Bring down an interface when IP SLA fails
From Internetworkpro
eltrboricv We want f0/0 to be down when there is SLA failure:
The idea is to use backup interfaces in a way that when one interface is up, the other will be up, and once the interface is down the other will be also down. To do this we will use 3 interface: Tunnel interface Loopback interface and the f0/0 interface. The backup of the tunnel will be the loopback, and the backup of the loopback will be the tunnel. so when the tunnel is down the loopback is up, but when the loopback ip up, f0/0 is down because its the backup interface of the loopback.
Lets configure this:
interface Tunnel99 no ip address tunnel source Loopback98 tunnel destination 1.1.1.1 backup interface lo 99 ! interface Loopback98 no ip address ! interface Loopback99 no ip address backup interface FastEthernet0/0
What this got to do with SLA? The idea here is to bring the tunnel interface down when the sla is down. Tunnel interface will be down when the tunnel destination is unreachable. Tunnel destination is unreachable when there is no route to the destination. We can use a static route to the tunnel destination. That static route will be tracking SLA.
SLA configuration:
ip sla monitor 1 type echo protocol ipIcmpEcho 1.2.3.4 frequency 10 ip sla monitor schedule 1 life forever start-time now track 1 rtr 1 reachability
route configuration:
ip route 1.1.1.1 255.255.255.255 Loopback98 track 1
To test this configure lo 98 interface with ip address of 1.2.3.4, which is the tracking address:
interface Loopback98 ip address 1.2.3.4 255.255.255.255
Now the SLA should be able to ping.. :
R2#sh ip int br Interface IP-Address OK? Method Status Protocol FastEthernet0/0 1.1.56.2 YES NVRAM up up Loopback98 1.2.3.4 YES manual up up Loopback99 unassigned YES unset standby mode down Tunnel99 2.2.2.2 YES manual up up
Now lets change the ip address from lo98, which will result in SLA failure:
R2(config)#int lo 98
R2(config-if)#ip addr 9.2.2.2 255.255.255.255
R2(config-if)#do sh track
Track 1
Response Time Reporter 1 reachability
Reachability is Down
5 changes, last change 00:00:06
Latest operation return code: Timeout
Tracked by:
STATIC-IP-ROUTING 0
R2(config-if)#d
*Mar 6 10:51:29.679: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel99, changed state to downo
*Mar 6 10:51:35.687: %LINK-3-UPDOWN: Interface Loopback99, changed state to up
*Mar 6 10:51:36.687: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback99, changed state to up
*Mar 6 10:51:38.703: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to standby mode
*Mar 6 10:51:39.703: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
Notice that Interface f0/0 is down.
HTH

