DHCP Logging in Cisco IOS Is a Nightmare

One of the readers sent me an interesting question: he’d like to know the IP address of his home router (to be able to connect to it from the office), but its IP address is assigned through DHCP and changes occasionally.

I wanted to solve the problem by hooking an EEM applet onto the DHCP-6-ADDRESS_ASSIGN syslog message. No good; as it turns out, Cisco IOS generates the logging message only when a DHCP-acquired IP address is assigned to an interface without one. If the IP address is changed via DHCP, the change is not logged.

One could understand the faulty programmers’ logic if the initial address assignment would be different from the address change, but DHCP is such a simple protocol that any change in client’s IP address requires the client to enter the INIT state, so acquiring a new IP address is no different from changing an existing one. I guess they had to take special precautions not to log the address change (and ensure we have another interesting challenge to chew on).

Fortunately, the IP routing table changes after every change in interface IP address, and you can catch that event with EEM.

6 comments:

  1. Why not using dynamic dns services, such as dyndns.org (free)?
  2. enable "debug ip address" and make your EEM applet match syslog ip_new_address
  3. I agree - I have been using editdns.net for just this service for a while. Works very but does take a very recent version of IOS to work I have found.

    ip ddns update method editdns
    HTTP
    add http://dyndns.editdns.net/api/dynLinux.php?p=PASSWORD&r=DNS_ENTRY
    interval maximum 10 0 0 0
    interval minimum 0 0 0 30
    !
    interface GigabitEthernet0/0
    ip ddns update hostname g0-0.a.gw.teb.example.com
    ip ddns update editdns host dyndns.editdns.net
    ip address dhcp client-id GigabitEthernet0/0
    !
  4. It look like re-inventing the wheel. :)
    http://www.cisco.com/en/US/docs/ios/ipaddr/command/reference/iad_dns1.html#wp1012430
  5. How about getting the "show ip int br" output from the router and sent to the user via email using EEM?
  6. Since the main task is to keep track of the ip address, with latest EEM you could monitor interface ip address with event cli/regexp (or snmp), compare it with the previous one and act accordingly.
Add comment
Sidebar