If you are ready this you probably have a Cisco 800 series IOS router and use Unotelly to watch NetFlix around the world.
However everytime your IP address changes you have to update Unotelly. This event manager applet automates the task.
Before you start, make sure your router can perform DNS resolution and can talk to the outside world.
#ping ipv4.google.com Translating "ipv4.google.com"...domain server (x.x.x.x) Translating "ipv4.google.com"...domain server (x.x.x.x) [OK] Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to x.x.x.x, timeout is 2 seconds: !!!!!
The next step is to establish a tracking object each time your main interface gets an IP address and comes up. In this example, the outside interface is FastEthernet4.10. Yours might be Dialer0, or something else.
track 10 interface FastEthernet4.10 ip routing
Read this next bit carefully. You can not enter ? on the IOS command line. The URL we need to retrieve has a ? in it. To get around this route have to type CTRL-V and then ?. So you can copy and paste everything in up to the question mark, and then do a CTRL-V ?, and then copy and paste in everything after the question mark. You also need to get the hash for your account from the Unotelly web site (click on "Update IP", and then it appears in the "IP Update Link", and replace the xxxx below with it.
DO NOT TRY AND COPY AND PASTE THE ENTIRE BLOCK. IT WILL FAIL.
ip sla 10 http raw http://api.unotelly.com http-raw-request GET /api/v1/network/update_by_hash_api?user_hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HTTP/1.1\r\n Host: api.unotelly.com\r\n User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n \r\n exit ip sla schedule 10 life 1 start-time now
Lets check the above worked. You should see lots of things reporting how long bits took to run. The number of success should be "1". What you don't want to see is the word "error" any where, or for the failure counter to be 1 (or more). Do not proceed until you have this correct.
home#show ip sla statistics 10 IPSLAs Latest Operation Statistics IPSLA operation id: 10 Latest RTT: 10509 milliseconds Latest operation start time: 21:08:36 NZDT Mon Jan 11 2016 Latest operation return code: Over threshold Latest DNS RTT: 8 ms Latest TCP Connection RTT: 4 ms Latest HTTP Transaction RTT: 10497 ms Number of successes: 1 Number of failures: 0 Operation time to live: 0
Now we can tie everything together with an event manager applet. The applet triggers on the tracking object coming up (so we just got an IP address on our interface). We then wait 5 more seconds to let everything settle and come online. Then we go into "enable" mode, and then "config" mode. We then delete the existing IP sla schedule and add it straight back. The schedule causes it to run just once.
event manager applet unotelly event track 10 state up action 1.0 wait 5 action 1.1 cli command "enable" action 1.2 cli command "config terminal" action 1.3 cli command "no ip sla schedule 10" action 1.4 cli command "ip sla schedule 10 start-time now life 1"
You can now test your router by forcing it to get a new IP address by doing a shut/no shut on the outside interface. Wait a short time, and then see if the event manager shows it ran the app.
# show event manager history events No. Job Id Proc Status Time of Event Event Type Name 1 1 Actv success Mon Jan11 20:12:03 2016 track applet: unotelly
You can also execute the command "show ip sla statistics 10" to make sure it has run again.
All going well, every time your router changes its IP address it will get updated at Unotelly automatically.