XpressLearn Home

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
DHCP Services on IOS

The are two separate options when it comes to configuring DHCP on IOS devices . So the first question you may have is: If there is more than one way to configure an IOS router for DHCP – How do I know which path to select?

The answer to that question depends on this secondary question: Will DHCP services be performed on a traditional server running DHCP or does it need to be handled solely by the network?

If the answer to the second question is: There will be a traditional server running DHCP (such as Windows DHCP services or the dhcpd demon on Unix), then the IOS router will be configured as a DHCP relay device.

If the answer to the second question is: DHCP needs to be handled completely by the network , then the IOS router will be configured as a DHCP server.

In either option, both require the following global configuration command (on by default):

Router(config)# service dhcp

Configuring DHCP relay:

The DHCP relay agent is configured on each Layer 3 interface that needs DHCP services.

Router(config)# int FastEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# ip helper-address  x.x.x.x

Where x.x.x.x is the DHCP Server. In this scenario, there isn’t a DHCP server on the 192.168.1.0/24 subnet – so the clients on this network have to get their dynamically assigned IP from a server somewhere else on the network. When the router receives a UDP broadcast (port 67), it examines the gateway IP address field (giaddr) in the DHCP message header. If the value of this field is 0.0.0.0, the DHCP agent replaces the all zero’s entry with the IP address of the interface on which the DHCP message arrived. In this example, the giaddr would be replaced with 192.168.1.1 and then forwarded to the DHCP server IP address that is defined in the helper-address statement on that interface.

When the DHCP server receives the DHCP request, it examines the value in the Gateway IP Address field to determine if the packet was relayed. Once it is determined that the packet was forwarded, it looks at the configured DHCP scopes for the network that would encompass the Gateway IP Address in the packet. If a match is found, an address is proposed out of the pool range for that scope and sent back to the relay agent for forwarding back to the original requesting client.

Configuring DHCP Server Service:

To configure the IOS device to act as a DHCP Server, first start by configuring a pool and assign it a name.

Router(config)# ip dhcp pool SubnetX

Where SubnetX is a meaningful name that describes the network pool. Next assign the network for this pool to handle, which in this example is 192.168.1.0/24.

Router(dhcp-config)#network 192.168.1.0 255.255.255.0

This tells the DHCP service that pool SubnetX is to be used for servicing requests on the 192.168.1.0 network. By default, the DHCP service will attempt to assign any address in the network. If you want to reserve the first twenty addresses, so that the first client will start for .21 – configure the following in global configuration mode:

Router(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.20

Other standard DHCP options to configure:

DNS Servers for the client to use for name resolution:

Router(dhcp-config)#dns-server 10.1.1.100 10.2.1.100

Default Gateway for clients to use on this subnet:

Router(dhcp-config)#default-router 192.168.1.1

Domain Name the client will be assigned:

Router(dhcp-config)#domain-name xpresslearn.com

Here is what the minimal DHCP Server configuration now looks like:

ip dhcp excluded-address 192.168.1.1 192.168.1.20
!
ip dhcp pool SubnetX
network 192.168.1.0 255.255.255.0
dns-server 10.1.1.100 10.2.1.100
domain-name xpresslearn.com
default-router 192.168.1.1

Some additional options available that can be very useful :

Configure lease times

Router(dhcp-config)#lease 5

Wins Server assignment

Router(dhcp-config)#netbios-name-server 10.1.1.100 10.2.1.100

Configure DHCP database location on a physical storage medium, this prevents the router from loosing all of it’s lease data after a reboot. By default, the router maintains the dhcp bindings in NVRAM.

Router(config)#ip dhcp database flash:router-dhcp write-delay 60 timeout 10

Author Info:

 
 
Scott's profession is a Senior Network Engineer at a Healthcare related company in Nashville, TN. When he is not trying to secure a network or come up with a design for a new project, he enjoys spending time with his family. You can find out more at: http://www.scottp.net

Similar Posts:

 

Leave a Reply