cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2461
Views
5
Helpful
3
Replies

EEM to admin down a loopback

Hi everyone,

BLUF: I need some assistance on an EEM script.  Script will reside on a switch and simply needs to shut down a loopback interface when a port goes down.

 

Background:  I have a 16-port EtherSwitch module in a 4331 Router, with several mirrored systems with A/B routers plugged into the EtherSwitch.  On the router, I have VRF with vasi interfaces working properly, and NAT, and everything is working great from the perspective of the router.  Except, when router A on EtherSwitch port 0/1/3/5/7 goes down.  When A goes down, the router should swap over to the B side, but because the A/B side is on the EtherSwitch module, the router never knows when it occurs because it cannot sense the interface going down in the switch module.  Distant end router cannot respond to ping and I cannot make changes to that device, so i cannot IPSLA to the router itself.  My proposition, use IPSLA on the router programmed with the primary route, and program the secondary, side B, with a higher AD.  The IPSLA will watch the IP address of a loopback programmed on the switch module.  From the switch module's perspective, the EEM script will monitor when route A goes down (is disconnected), and then send a shutdown command to the loopback. Thusly, port goes down due to distant router going down, EEM turns off the loopback, router senses the loopback not working, and routes to the second route.  Just need help on the commands to get this working correctly as CCNA doesn't cover this.  Thanks a bunch!

Dan

 

3 Replies 3

Francesco Molino
VIP Alumni
VIP Alumni
Hi

Let's assume physical interface is g1/0/24 and your loopback interface to shutdown is loopback99.

Config to track the interface status:
track 100 interface GigabitEthernet1/0/24 line-protocol

EEM to shutdown the loopback and log a syslog message:

event manager applet SHUTLOOPBACK
event syslog pattern "TRACK-6-STATE: 100 interface Gi1/0/24 line-protocol Up -> Down"
action a001 cli command "enable"
action a002 cli command "conf t"
action a003 cli command "interface loopback99"
action a003 cli command "shutdown"
action z009 cli command "end"
action z010 cli command "wr"
action z999 syslog msg "Loopback has been shutdown"

Now the EEM to bring the loopback up when interface is back up with a syslog message as well:

event manager applet NOSHUTLOOPBACK
event syslog pattern "TRACK-6-STATE: 100 interface Gi1/0/24 line-protocol Down -> Up"
action a001 cli command "enable"
action a002 cli command "conf t"
action a003 cli command "interface loopback99"
action a003 cli command "no shutdown"
action z009 cli command "end"
action z010 cli command "wr"
action z999 syslog msg "Loopback has been unshut"

PS: test it and sorry for any typos, doing it through my phone.

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Thanks, that works great! 

You're welcome

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Review Cisco Networking for a $25 gift card