Cisco Routing & Switching

Setting Up a DHCP Server

Configuring a DHCP Server on a Cisco router is a very common task on SOHO enviroments. In small companies with a small number of hosts, there is no need of a separate DHCP Server, taking advantage of the DHCP Service avaliable on routers.

Verify the service is running:

This service is enabled by the default, but can be disabled for security or if we are leveraging on a third device. We can check the service is running using this command:

R1#sh udp
Proto    Remote      Port      Local       Port  In Out Stat TTY OutputIF
 17             0          67   0   0 2211   0

As we can see, the router is listening at DHCP Server’s port UDP 67.

Disabling the service:

R1(config)#no service dhcp
R1(config)#do sh udp
Proto    Remote      Port      Local       Port  In Out Stat TTY OutputIF

Procedure for configuring DHCP:

We are going to use R4 as DHCP server and R5 as DHCP client:

First step is specify the pool, together with the excluded addresses:

R4(config)#ip dhcp excluded-address
R4(config)#ip dhcp pool LAN

For our example, I have excluded the first 4 addresses, to avoid duplicated address issues with R1 and R4.

 Verify the correct function:

Check that R5 gets an ip:

R5(config)#int fa0/0
R5(config-if)#ip add dhcp
R5(config-if)#do sh ip
*Mar  1 00:02:17.651: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address, mask, hostname R5

See the corresponding binding at R4:

R4(config)#do sh ip dhcp bind
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name          0063.6973.636f.2d63.    Mar 02 2002 12:02 AM    Automatic
R4#sh ip dhcp server stat
Memory usage         23799
Address pools        1
Database agents      0
Automatic bindings   1
Manual bindings      0
Expired bindings     0
Malformed messages   0
Secure arp entries   0
Message              Received
BOOTREQUEST          0
DHCPREQUEST          1
DHCPDECLINE          0
DHCPRELEASE          0
DHCPINFORM           0
Message              Sent
BOOTREPLY            0
DHCPOFFER            1
DHCPACK              1
DHCPNAK              0
R4#sh ip dhcp pool
Pool LAN :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 254
 Leased addresses               : 1
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses        -      1


Related Posts

No Comments

Leave a Reply