Thanks Lonnie. I have now learned something else! Regards Michael Knill
On 24/7/18, 10:31 pm, "Lonnie Abelbeck" <li...@lonnie.abelbeck.com> wrote: > Actually I can just add this in my routing table startup script as this route will not go anywhere else. No, if your primary external interface is DHCP (client), you should use the /mnt/kd/wan-failover.script . If the DHCP (client) address changes the interface is flushed, which destroys any associated routes, but in that case wan-failover is automatically restarted to load the new IP and gateway address. Since this is wan-failover related, I would use /mnt/kd/wan-failover.script . Lonnie > On Jul 24, 2018, at 12:35 AM, Michael Knill <michael.kn...@ipcsolutions.com.au> wrote: > > Cool thanks Lonnie. Actually I can just add this in my routing table startup script as this route will not go anywhere else. > I thought there was something a little more tricky at work! > > Regards > Michael Knill > > On 24/7/18, 12:53 am, "Lonnie Abelbeck" <li...@lonnie.abelbeck.com> wrote: > > >> 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. > > > ------------------------------------------------------------------------------ > 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. ------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------ 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.