Static DHCP assignment for clients without client-id

A while ago I've installed Fedora Linux on one of my workstations and spent enormous amount of time trying to give it a static IP address from the Cisco IOS DHCP server. I though I was the only one dumb enough to have this problem, so I didn’t document my solution, but then one of the readers made a comment to the Assigning server IP addresses with DHCP post describing almost identical symptoms:

I have a hp2300n and I want to make a static IP assignment with DHCP. Nothing is working: hardware-address, client-identifier, no prepend, 01 prepend, 00 prepend.

In my case, the Fedora DHCP client did not send any DHCP client-ID in the DHCPREQUEST message. One would think that the IOS DHCP server would use the MAC address as the client-ID, but that's not the case. You have to configure the hardware-address parameter in the host DHCP pool to match the MAC address of the DHCP client with the pool and the static IP address:

ip dhcp pool fedi
host 192.168.200.206 255.255.255.240
hardware-address 000f.fe83.bca9
dns-server 208.67.220.220 208.67.222.222

This article is part of You've asked for it series.

12 comments:

  1. For most of the modern linux distributions, you can use /etc/dhcp3/dhclient.conf to send whatever client-id you want to the dhcp server. This way you do not have to change the configuration when you replace your server's or desktop's network card.

    I added the following line to the conf file;
    send dhcp-client-identifier 01:xx:xx:xx:xx:xx:xx (Replace xx with the mac address you want to use)

    ReplyDelete
  2. My preffered way to solve this problem is define dynamic DHCP pool then look into
    show ip dhcp server bindings
    to know how the client was recognized.

    ReplyDelete
  3. @selcuk: this is what I've tried to do, but for whatever reason, my dhclient.conf file worked while the machine was running but got ignored/overwritten (I don't remember which one any more) during the boot process. After a few hours, I gave up and found an IOS solution (after all, I'm a router-, not a Linux person :)

    @anonymous: that's exactly what I'm doing, but if you see just the MAC address without the 01. prefix in the bindings, you don't know whether it's a host with broken Client-ID calculation (that happens as well) in which case you copy the value in client-id parameter, or a host not using the Client-ID at all forcing you to use hardware-address parameter.

    ReplyDelete
  4. instead of using hardware-address you can use client-identifier in the DHCP pool options. To see what client-identifier your machines have do a show ip dhcp bind *, and you can use that parameter in the pool's configuration

    ReplyDelete
  5. I wanted to be absolutely sure, so I started Wireshark and captured DHCP packets generated by Linux and Cisco IOS (or Windows XP). The results are here: by default Linux does not include Client identifier in DHCP packets, so Cisco IOS cannot match it with the pool configuration; you have to use mac-address.

    ReplyDelete
  6. Maybe a lot of time passed, but I have still this issue unsolved.
    I placed PXE files on router's flash to have ability to boot-up (and repair using linux tools) any PC which normally has its statically assigned IP address. My requirement is: any particular PC should have the same address inside Windows and when using embedded PXE boot agent. This is still the same PC! Unfortunately Win uses client-id, PXE uses hw mac... and unfortunately man cannot set both: client-id and mac address inside single lease :(
    What can I do if I wont have separate static IP sets: for normal operation and for PXE?

    ReplyDelete
  7. This was very helpful,
    I had one linux client, and I couldn't figure out why the DHCP reservation wasn't working like Windows.

    ReplyDelete
  8. thanks so much! The Cisco documentation on this is JUST PLAIN WRONG; as they say that you should use #hardware-address for bootp processes, and #client-identifier for mac address reservations. That just didn't work, but your solution worked just fine. Irritating. >:o

    ReplyDelete
  9. I refer to http://www.cisco.com/en/US/docs/ios/12_2/ip/configuration/guide/1cfdhcp.html#wp1001108

    ReplyDelete
  10. So... Ummm... If a device dual-boots a Linux distro and Windows, is there a way to deal with that? It looks like entering a "hardware-address" wipes out the "client-identifier" and vice versa.

    Also, if you've got half a dozen static entries, can they be all in one pool? It looks to me like only one entry can be made per pool, which means a heck of a lot of extra pools if you've got a few devices you want static.

    ReplyDelete
    Replies
    1. Recent IOS release can deal with multiple static clients per pool (methinks). No idea about the other problem though :(

      Delete
  11. This is perfect, I was wondering why my Linux Mint installation wasn't getting the static ID I had defined for the same machine when running Windows 8.

    Why don't Linux clients supply client identifiers?

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.