04-26-2014 08:12 PM
Hi,
Is there a way to use event manager to replace tunnel destination ip each time it changes ?
1. Resolve the hostname
2. Set it as a variable
3. Use the variable to replace the IP
int tunnel 0
tunnel destination <a>
Mostly like a reverse dynamic dns.
Solved! Go to Solution.
04-26-2014 10:58 PM
What about this:
event manager environment saved_ip 0.0.0.0
!
event manager applet change-tunnel
event timer watchdog time 60
action 001 cli command "enable"
action 002 cli command "ping ip hostname repeat 1"
action 003 regexp "Echos to ([0-9\.]+)" $_cli_result match ip
action 004 if $ip ne $saved_ip
action 005 cli command "config t"
action 006 cli command "int tun0"
action 007 cli command "tunnel destination $ip"
action 008 cli command "event manager environment saved_ip $ip"
action 009 cli command "end"
action 010 end
05-03-2014 11:20 PM
Ah, I get the logic now.
In that case, insert the following actions and push everything else down.
action 008 regexp "!!" $_cli_result
action 009 if $_regexp_result eq 1
action 010 exit 0
action 011 end
04-26-2014 10:58 PM
What about this:
event manager environment saved_ip 0.0.0.0
!
event manager applet change-tunnel
event timer watchdog time 60
action 001 cli command "enable"
action 002 cli command "ping ip hostname repeat 1"
action 003 regexp "Echos to ([0-9\.]+)" $_cli_result match ip
action 004 if $ip ne $saved_ip
action 005 cli command "config t"
action 006 cli command "int tun0"
action 007 cli command "tunnel destination $ip"
action 008 cli command "event manager environment saved_ip $ip"
action 009 cli command "end"
action 010 end
04-27-2014 10:01 AM
YOU ARE A GENIUS! It works perfectly.
I have been looking for a solution to this problem for quite a while now.
Could we make each 45 seconds
>ping ip 10.255.255.1 repeat 2
If "!" stop
If ".." run the script below ?
here's what i'm using and it really works!
event manager environment saved_ip 0.0.0.0
event manager applet change-tunnel
event timer watchdog time 60
action 001 cli command "enable"
action 002 cli command "config t"
action 003 cli command "int tunnel 40"
action 004 cli command "no ip nhrp map multicast $ip"
action 005 cli command "end"
action 006 cli command "ping ip rtr1.noip.me repeat 1"
action 007 regexp "Echos to ([0-9\.]+)" "$_cli_result" match ip
action 008 if $ip ne $saved_ip
action 009 cli command "config t"
action 010 cli command "int tunnel 40"
action 011 cli command "ip nhrp map multicast $ip"
action 012 cli command "ip nhrp map 10.255.255.1 $ip"
action 013 cli command "event manager environment saved_ip $ip"
action 014 cli command "end"
action 015 end
!
end
04-27-2014 02:15 PM
To go to 45 seconds, just change the 60 second watchdog timer to 45. As for the ping test, why would you want to update the tunnel if the ping fails? I would think you'd want the opposite.
05-03-2014 04:33 PM
Hi,
Sorry for the Late response.
The goal of updating the tunnel is to update it only when the ping fails.
From a dmvpn spoke perspective, if I can't reach my hub anymore, it means that the Hub changed of IP.
There is no need to re-update the Hub address as it's not changing. We only want to update it if it changes.
Does that makes more sens ?
05-03-2014 11:20 PM
Ah, I get the logic now.
In that case, insert the following actions and push everything else down.
action 008 regexp "!!" $_cli_result
action 009 if $_regexp_result eq 1
action 010 exit 0
action 011 end
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