cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1071
Views
0
Helpful
5
Replies

EEM help

patoberli
VIP Alumni
VIP Alumni

Hi all

I need to toggle two interfaces in a router depending if the link tw1/0/1 is up or down. 

From information I found online, I built the following script, but the 'event track 10...' line doesn't work.

How can I solve this? Router is running IOS 16.11.1 and has stackwise-virtual active. 

The script:

track 10 interface tw1/0/1 line-protocol !primary link
delay up 2
delay down 2
!
event manager applet PRIMARY_LINK_OK
event track 10 state up !this one doesn't work, how can I track the interface for this even?
action 1.0 syslog msg “Switch to primary link”
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw2/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw1/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”
!
event manager applet PRIMARY_LINK_FAILURE
event track 10 state down
action 1.0 syslog msg “Switch to backup link”
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw1/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw2/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”
!

Thanks for suggestions

Patrick

 

1 Accepted Solution

Accepted Solutions

Hello,

 

add a 'wait' as the first action, this will delay all subsequent actions by 2 seconds:

 

event manager applet PRIMARY_LINK_OK
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to up"
action 1.0 syslog msg “Switch to primary link”

action 1.1 wait 2
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw2/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw1/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”
!
event manager applet PRIMARY_LINK_FAILURE
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to down"
action 1.0 syslog msg “Switch to backup link”

action 1.1 wait 2
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw1/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw2/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”

 

View solution in original post

5 Replies 5

Hello,

 

is the line protocol actually going down? Is there a syslog message generated ? You could use that syslog message to trigger your EEM instead:

 

event manager applet PRIMARY_LINK_OK
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to up"
action 1.0 syslog msg “Switch to primary link”
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw2/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw1/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”
!
event manager applet PRIMARY_LINK_FAILURE
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to down"
action 1.0 syslog msg “Switch to backup link”
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw1/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw2/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”

Thanks for your help. That probably means I can delete my track commands. 

 

To be honest, this is the redundancy "hack" in case I reload one of the two SWV nodes (software upgrade) or power outage or similar. All other cases I don't catch with this, but it's currently the only way I've found.
Flexlink+ is sadly not supported (yet) on the 9500 high-performance models, and my peers can't do OSPF. Attached is a layer 2 mpls-vpls which doesn't support spanning-tree. So I need to shutdown one of the interfaces to not make a loop.

One more thing. Do you know if it's possible to somehow add a little delay of ~2 seconds, so that the script doesn't start to flap?


Hello,

 

add a 'wait' as the first action, this will delay all subsequent actions by 2 seconds:

 

event manager applet PRIMARY_LINK_OK
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to up"
action 1.0 syslog msg “Switch to primary link”

action 1.1 wait 2
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw2/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw1/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”
!
event manager applet PRIMARY_LINK_FAILURE
event syslog pattern "Line protocol on Interface TwoGigabitEthernet2/0/1, changed state to down"
action 1.0 syslog msg “Switch to backup link”

action 1.1 wait 2
action 1.5 cli command “enable”
action 2.0 cli command “conf t”
action 2.5 cli command “int tw1/0/1”
action 2.6 cli command "shut"
action 3.0 cli command "no ip address 10.0.0.21 255.255.255.0"
action 3.4 cli command “int tw2/0/1”
action 3.5 cli command "ip address 10.0.0.21 255.255.255.0"
action 3.9 cli command "no shut"
action 4.0 cli command “end”

 

Great, thanks! :)