Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Dynamic IPv4 with DMVPN hub

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. 

 

Everyone's tags (5)
2 ACCEPTED SOLUTIONS

Accepted Solutions
Cisco Employee

What about this: event

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

Cisco Employee

Ah, I get the logic now. In

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

5 REPLIES
Cisco Employee

What about this: event

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

New Member

@Joseph ClarkeYOU ARE A

@Joseph Clarke

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

 

Cisco Employee

To go to 45 seconds, just

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.

New Member

Hi,  Sorry for the Late

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 ?

Cisco Employee

Ah, I get the logic now. In

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

346
Views
0
Helpful
5
Replies
CreatePlease to create content