01-29-2020 06:19 AM
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
Solved! Go to Solution.
01-29-2020 08:21 AM
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”
01-29-2020 07:34 AM
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”
01-29-2020 07:44 AM - edited 01-29-2020 07:45 AM
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.
01-29-2020 08:03 AM
01-29-2020 08:21 AM
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”
01-29-2020 08:32 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide