Most host devices that use DHCP client will use their MAC address as the client ID. Cisco IOS however uses one of their own formats, this can be a problem if you need to get an IP address from the DHCP server based on your MAC address. For example, some cable providers check the MAC address of a client before handing out an IP address.
Of course we can change this behavior on Cisco IOS to make it use the MAC address when it requests an IP address. Let’s take a look at the default behavior and how we can change it.
First of all, here’s the MAC address of R1:
R1#show interfaces FastEthernet 0/0 | incl bia
Hardware is MV96340 Ethernet, address is 001d.a18b.36d0 (bia 001d.a18b.36d0)
Before I enable DHCP client on this interface, let’s enable a debug. This will allow us to see the client ID:
R1#debug dhcp detail
DHCP client activity debugging is on (detailed)
Great, now let’s enable DHCP client:
R1(config)#interface FastEthernet 0/0
R1(config-if)#ip address dhcp
Within the DHCP request you will see the Client ID:
DHCP: SRequest attempt # 1 for entry:
Temp IP addr: 192.168.12.8 for peer on Interface: FastEthernet0/0
Temp sub net mask: 255.255.255.0
DHCP Lease server: 192.168.12.2, state: 4 Requesting
DHCP transaction id: 16F3
Lease: 86400 secs, Renewal: 0 secs, Rebind: 0 secs
Next timer fires after: 00:00:03
Retry count: 1 Client-ID: cisco-001d.a18b.36d0-Fa0/0
Client-ID hex dump: 636973636F2D303031642E613138622E
333664302D4661302F30
Hostname: R1
The Client ID starts with cisco, has the MAC address in the middle and ends with the interface number. Now let’s change it so it only uses the MAC address:
R1(config)#interface FastEthernet 0/0
R1(config-if)#ip address dhcp client-id FastEthernet 0/0
The command above tells the router to use the MAC address on the FastEthernet 0/0 interface as the client ID. You could use the MAC address of another interface if you want. Here’s what the DHCP request looks like now:
DHCP: SRequest attempt # 1 for entry:
Temp IP addr: 192.168.12.7 for peer on Interface: FastEthernet0/0
Temp sub net mask: 255.255.255.0
DHCP Lease server: 192.168.12.2, state: 4 Requesting
DHCP transaction id: 95
Lease: 86400 secs, Renewal: 0 secs, Rebind: 0 secs
Next timer fires after: 00:00:03
Retry count: 1 Client-ID: 001d.a18b.36d0
Client-ID hex dump: 001DA18B36D0
Hostname: R1
This is looking better, the client ID is now only the MAC address. That should solve the problem. I hope this lesson has been useful, if you have any questions feel free to leave a comment in our forum.
Hi Rene,
... Continue reading in our forumI tried this on WAN interface because my ISP uses DHCP, but didn’t make any difference to client-id.
Hmm that’s weird. I tried this on a 1841 router. What IOS is your 2900 running?
Hi Rene,
I am running c2900-universalk9-mz.SPA.154-3.M2.bin.
You could try another IOS, see if it makes a difference. It’s strange though and there is no other command that influences this.
Hello, everyone!
I’ve a few questions about the client ID.
If I had a router connected to the ISP and I issued the ip address dhcp command on that interface, there is a possibility that it wouldn’t receive an IP address just be
... Continue reading in our forum