DHCP Static Binding on Cisco IOS

Cisco IOS devices can be configured as DHCP servers and it’s also possible to configure a static binding for certain hosts. This might sound easy but there’s a catch to it…in this lesson I’ll show you how to configure this for a Cisco router and Windows 7 and Linux host. This is the topology I’ll be using:

DHCP Binding Demo Topology

The router called “DHCP” will be the DHCP server, R1 and the two computers will be DHCP clients. Everything is connected to a switch and we’ll use the 192.168.1.0 /24 subnet. The idea is to create a DHCP pool and use static bindings for the two computers and R1:

  • R1: 192.168.1.100
  • Windows 7: 192.168.1.110
  • Linux: 192.168.1.120

First we will create a new DHCP pool for the 192.168.1.0 /24 subnet:

DHCP(config)#ip dhcp pool MYPOOL
DHCP(dhcp-config)#network 192.168.1.0 255.255.255.0

Whenever a DHCP client sends a DHCP discover it will send its client identifier or MAC address. We can see this if we enable a debug on the DHCP server:

DHCP#debug ip dhcp server packet

Cisco Router DHCP Client

Now we’ll configure R1 to request an IP address:

R1(config)#interface fastEthernet 0/0
R1(config-if)#no shutdown
R1(config-if)#ip address dhcp

In a few seconds you will see the following message on the DHCP server:

DHCP#
DHCPD: DHCPDISCOVER received from client 0063.6973.636f.2d63.3230.382e.3135.6430.2e30.3030.302d.4661.302f.30 on interface FastEthernet0/0.

When a Cisco router sends a DHCP Discover message it will include a client identifier to uniquely identify the device. We can use this value to configure a static binding, here’s what it looks like:

DHCP(config)#ip dhcp pool R1-STATIC
DHCP(dhcp-config)#host 192.168.1.100 255.255.255.0
DHCP(dhcp-config)#client-identifier 0063.6973.636f.2d63.3230.382e.3135.6430.2e30.3030.302d.4661.302f.30

We create a new pool called “R1-STATIC” with the IP address we want to use for R1 and its client identifier. We’ll renew the IP address on R1 to see what happens:

R1#renew dhcp fastEthernet 0/0

Use the renew dhcp command or do a ‘shut’ and ‘no shut’ on the interface of R1 and you’ll see this on the DHCP server:

DHCP#
DHCPD: Sending DHCPOFFER to client 0063.6973.636f.2d63.3230.332e.3065.3232.2e30.3030.302d.4661.302f.30 (192.168.1.100).

As you can see above the DHCP server uses the client identifier for the static binding and assigns IP address 192.168.1.100 to R1. If you don’t like these long numbers you can also configure R1 to use the MAC address as the client identifier instead:

R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address dhcp client-id fastEthernet 0/0 

This tells the router to use the MAC address of its FastEthernet 0/0 interface as the client identifier, you’ll see this change on the DHCP server:

DHCP#
DHCPRELEASE message received from client 0063.6973.636f.2d63.3230.382e.3135.6430.2e30.3030.302d.4661.302f.30 (192.168.1.100).
DHCPD: Finding a relay for client 0063.6973.636f.2d63.3230.382e.3135.6430.2e30.3030.302d.4661.302f.30 on interface FastEthernet0/0.
DHCPD: DHCPDISCOVER received from client 01c2.0815.d000.00 on interface FastEthernet0/0.

Of course now we have to change the binding on the DHCP server to match the MAC address:

DHCP(config)#ip dhcp pool R1-STATIC
DHCP(dhcp-config)#no client-identifier 0063.6973.636f.2d63.3230.382e.3135.6430.2e30.3030.302d.4661.302f.30
DHCP(dhcp-config)#client-identifier 01c2.0815.d000.00

Do another release on R1:

R1#renew dhcp fastEthernet 0/0

And you’ll see that R1 gets its correct IP address from the DHCP server and is being identified with its MAC address:

DHCP#
DHCPD: DHCPDISCOVER received from client 01c2.0815.d000.00 on interface FastEthernet0/0.
DHCPD: Sending DHCPOFFER to client 01c2.0815.d000.00 (192.168.1.100).

So that’s how the Cisco router requests an IP address. Let’s look at the Windows 7 host now to see if there’s a difference.

Windows 7 DHCP Client

C:UsersWindows7>ipconfig /release
C:UsersWindows7>ipconfig /renew

This is what you’ll find on the DHCP server:

DHCP#
DHCPD: DHCPDISCOVER received from client 0100.0c29.7e06.12 on interface FastEthernet0/0.

Windows 7 uses its MAC address as the client identifier. We can verify this by looking at ipconfig:

C:UsersWindows7>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : Windows7
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
   Physical Address. . . . . . . . . : 00-0C-29-7E-06-12

That’s easy enough, we’ll create another static binding on the DHCP server so that our Windows 7 computers receives IP address 192.168.1.110:

DHCP(config)#ip dhcp pool WIN7-STATIC
DHCP(dhcp-config)#host 192.168.1.110 255.255.255.0
DHCP(dhcp-config)#client-identifier 0100.0c29.7e06.12

Let’s verify our work:

C:UsersWindows7>ipconfig /release
C:UsersWindows7>ipconfig /renew

This is what the debug on the DHCP server will tell us:

DHCP#
DHCPD: DHCPRELEASE message received from client 0100.0c29.7e06.12 (192.168.1.3).
DHCPD: DHCPDISCOVER received from client 0100.0c29.7e06.12 on interface FastEthernet0/0.
DHCPD: Sending DHCPOFFER to client 0100.0c29.7e06.12 (192.168.1.110).

There you go, Windows 7 has received the correct IP address. Last but not least is our Linux computer which acts a little different.

Linux DHCP Client

Linux (Ubuntu) in my example acts a little different when it comes to DHCP client, let me show you:

# sudo dhclient eth0

The DHCP server shows this:

DHCP#
DHCPD: DHCPDISCOVER received from client 000c.29c9.4bb1 on interface FastEthernet0/0.
DHCPD: Sending DHCPOFFER to client 000c.29c9.4bb1 (192.168.1.4).

We see the MAC address of the linux server so we’ll create a static binding that matches this:

DHCP(config)#ip dhcp pool LINUX-STATIC
DHCP(dhcp-config)#host 192.168.1.120 255.255.255.0
DHCP(dhcp-config)#client-identifier 000c.29c9.4bb1

We’ll release the IP address on our Linux host:

# sudo dhclient eth0 -r
# sudo dhclient eth0

Now take a good look at the debug:

DHCP#
DHCPD: DHCPRELEASE message received from client 000c.29c9.4bb1 (192.168.1.4).
DHCPD: DHCPDISCOVER received from client 000c.29c9.4bb1 on interface FastEthernet0/0.
DHCPD: Sending DHCPOFFER to client 000c.29c9.4bb1 (192.168.1.4).

That’s not good, even though we configured the client identifier it’s not working. Let’s double check the MAC address:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 654 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

533 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags: ,


Forum Replies

  1. Hello Rene,

    Is the client-identifier configured on the dhcp server is not the mac address of the dhcp client? Is it a different value?(real world)

    I tried to configure the “ip address dhcp client-id fa0/0” on the dhcp client but it’s not getting the correct ip im expecting. I already have a dhcp pool for it on the dhcp server.:

    DHCP SERVER:

    R1#SHOW RUN | sec ip dhcp
    no ip dhcp use vrf connected
    ip dhcp pool DONDRUJA
       network 192.168.1.0 255.255.255.0
       default-router 192.168.1.1
       option 150 ip 192.168.1.1
       dns-server 8.8.8.8
       lease 2
    ip dhcp pool PC2
     
    ... Continue reading in our forum

  2. Hi Rene,

    For the DHCP client in cisco router, there’s option to put the hostname. What the purpose to put the hostname?

    R1(config)#interface fastEthernet 0/0
    R1(config-if)#ip address dhcp client-id fastEthernet 0/0 hostname R1
    

    Davis

  3. Can you configure multiple static bindings in the same pool?

10 more replies! Ask a question or join the discussion by visiting our Community Forum