cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

142
Views
0
Helpful
2
Replies
Participant

Can I open or shut an interface based on an ipv4 route in a vrf?

hi out there

I have a setup vhere I need to open og close a vasi interface based on the occurence of a route in a vrf - can I track a route and then use a script to shut or no shut a particular interface if this route shows up?

1 ACCEPTED SOLUTION

Accepted Solutions
Enthusiast

Hey,

Hey,

Can you please try something like this? 

This will track the route 2.2.2.0/24 and shutdown the lo interface if the route available and unshut the interface if the route is not available.


track 1 ip route 2.2.2.0 255.255.255.0 reachability

event manager applet Run-If-Route-Available
event track 1 state up
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "int lo0"
action 1.4 cli command "sh"
action 1.4 cli command "end"
action 1.6 syslog msg "Interface lo0 is admin DOWN now"

event manager applet Run-If-Route-Not-Available
event track 1 state down
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "int lo0"
action 1.4 cli command "no sh"
action 1.4 cli command "end"
action 1.6 syslog msg "Interface lo0 is UP now"

CF

View solution in original post

2 REPLIES 2
Enthusiast

Hey,

Hey,

Can you please try something like this? 

This will track the route 2.2.2.0/24 and shutdown the lo interface if the route available and unshut the interface if the route is not available.


track 1 ip route 2.2.2.0 255.255.255.0 reachability

event manager applet Run-If-Route-Available
event track 1 state up
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "int lo0"
action 1.4 cli command "sh"
action 1.4 cli command "end"
action 1.6 syslog msg "Interface lo0 is admin DOWN now"

event manager applet Run-If-Route-Not-Available
event track 1 state down
action 1.1 cli command "enable"
action 1.2 cli command "conf t"
action 1.3 cli command "int lo0"
action 1.4 cli command "no sh"
action 1.4 cli command "end"
action 1.6 syslog msg "Interface lo0 is UP now"

CF

View solution in original post

Highlighted
Participant

hi Again

hi Again

yep - this looks like something which i was thinking of - the only little problem is - can it be made depending on a route in a given vrf? my problem is that it is a ivrf from a cryptomap ipsec where I have to activate a vrf for nat'ing the Networks in case of a failover

So I have the ivrf - if the route suddenly show up because of a failover - injected trough RRI - i need to open a vasi interface which will be a simple nat inside

The only little tweak needed is that if this track can track a route in a given vrf...

And - if I look here this should be possibly:

http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipapp/configuration/12-4/iap-12-4-book/iap-eot.html#GUID-FDCACD5E-0F4C-43C8-8770-93CC8883D0A6

CreatePlease to create content
Content for Community-Ad