Assigning server IP addresses with DHCP

Using DHCP to assign server IP addresses is usually not a wise decision. To start with, you have to define static DHCP mappings, which rely on client-id attribute in the DHCP request (usually the MAC address of the client). For me, the easiest way to find the correct client ID is as follows:

  • Use DHCP to assign the IP address to the server
  • Note the newly assigned IP address
  • Use the show ip dhcp bindings | include ip-address command to display the client-id to IP address binding.
  • Create a static DHCP mapping (for example, by configuring a host DHCP pool on the router) and release/renew IP address on the server

Of course, if the Ethernet adapter in the server is replaced, the static mapping stops working. The only reliable workaround I've found so far is to assign a locally-administered MAC address to the server's LAN adapter (if anyone has figured out a way to assign ASCII client-ID to a Windows server, let me know). To do it on Windows XP, use the Advanced properties in the adapter configuration window.

Remember: locally administered MAC addresses on Ethernet networks start with 02xx. More precisely, second bit in first byte must be set, thus 02 in the previous sentence. AA00-0000-0001 is also a locally administered MAC address.

After you've configured MAC address on the server, prepend 01 to it and insert a dot after every fourth character to get the client-ID you need to enter on the DHCP server. For example, the MAC address 0200.1000.1234 becomes client-id 0102.0010.0012.34, and the static DHCP pool on a router is configured as follows:

ip dhcp pool Server_static
host 10.0.0.10 255.255.255.0
client-identifier 0102.0010.0012.34

8 comments:

  1. Whats the meaning of the prepending 01 anyway? if I do a 'show ip dhcp binding' i see some mac's with the usual xxxx.xxxx.xxxx and some with the prepending 01, making them 01xx.xxxx.xxxx.xx. Thanks. :)
  2. The DHCP RFCs recommend that the hardware type should be prepended to the MAC address in client identifier to ensure that two MAC addresses would not accidentally end up as the same client identifier due to little/big endian bit ordering.

    The DHCP Options RFC says in section 9.12: It is expected that this field will typically contain a hardware type and hardware address, but this is not required. So, the more strictly conformant DHCP client implementations will prepend 01 to the MAC address, others might choose not to do so.

    The hardware type is defined in Assigned Numbers RFC, well hidden in the ARP Parameters section.
  3. Some HP network printers/printservers (ethernet!) prepend 00 instead of 01. Some don't prepend anything so only hardware-address is working with them.
  4. Hm. One of the limitations/issues I've run with the IOS DHCP server and setting up a reservation is that it only accepts on "client-identifier" per pool.

    Picture this: AP to switch. router on same VLAN. Notebook with wireless and wired cards. You want for the notebook to get the same IP address no matter if the connection is wired or wireless. Tough luck - just one "client-identifier" per pool.

    The use of a locally administered MAC address could solve my problem - if I used the same MAC for both the wired _and_ the wireless interface. Have to try and see what Vista thinks of it ;)
  5. to set the client id on XP go to a command line and use ipconfig /setclassid "adaptername" asciisgtring

    where adaptername is the name of the adapter in your network interfaces and asciistring is the string you want.

    no idea if it works with cisco dhcp yet. have not tried it.
  6. anonymous wrote:

    One of the limitations/issues I've run with the IOS DHCP server and setting up a reservation is that it only accepts on "client-identifier" per pool.

    Now I have a hp2300n and i want to make a reservation in dhcp. Nothing is working hardware-address, client-identifier, no prepend, 01 prepend, 00 prepend

    Who can help me?
  7. For old HP printer/Jetdirect, use "hardware-address" with no prepend.
  8. If you use a locally-administered MAC address as per this article, is it still unwise to use DHCP to assign layer-3 addresses to a server?
Add comment
Sidebar