> On Jul 23, 2018, at 3:07 AM, Michael Knill 
> <michael.kn...@ipcsolutions.com.au> wrote:
> 
> Hi Group
>  
> Is there any way to configure a static route for the primary interface e.g. a 
> route which will not fail over to the secondary?
> I basically do not want to access my VoIP Provider on the secondary interface 
> e.g. it needs to be unreachable so it fails over to my backup trunk for 
> outgoing calls.


> I could put the SIP address in the Target IPv4 Hosts section but that would 
> be my last resort.

Yes, as long as you trust your SIP provider will always echo ICMP, that is not 
a bad solution.  And as a side-effect it will failover when your SIP provider 
is not reachable.

If you want a more general method, create a /mnt/kd/wan-failover.script ...

Failover Action Script
https://doc.astlinux-project.org/userdoc:tt_wan_failover#action_script_optional

**Untested example**

-- /mnt/kd/wan-failover.script --
#!/bin/sh

##
## wan-failover action script
##
## Automatically called after any WAN link change
##
state="$1"
primary_if="$2"
primary_gw="$3"
secondary_if="$4"
secondary_gw="$5"
secondary_gw_ipv6="$6"

primary_only_routes="1.2.3.4 1.2.3.5 1.2.4.0/24"

case $state in

SECONDARY)
  ## Switched to Failover using secondary WAN link
  for x in $primary_only_routes; do
    ip route add $x ${primary_gw:+via $primary_gw} dev $primary_if
  done
  ;;

PRIMARY)
  ## Switched back to normal using primary WAN link
  for x in $primary_only_routes; do
    ip route delete $x ${primary_gw:+via $primary_gw} dev $primary_if
  done
  ;;

esac

exit 0
--

This will add routes via the primary interface on failover you want 
unreachable, and remove them when back to normal to clean things up.


Lonnie




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Astlinux-users mailing list
Astlinux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
pay...@krisk.org.

Reply via email to