An often overlooked, but very powerful tool in the Cisco IOS, the DHCP service provides a full DHCP implementation on your router. In this 3 part post, I’m going to cover the basics of simple DHCP services as well as advanced configuration.
To get started let’s do a quick review of DHCP functionality.
When a new host connects to the network, the first IP related action it takes (assuming DHCP here folks) is to request an address from the server. It does this by sending an unaddressed broadcast IP packet out to the network (DHCPDISCOVER). The packet still has the system’s MAC address attached to it, so the server knows which device is making the request. In most cases, the server (or servers) see this request and respond with an assigned IP address (DHCPOFFER).
At this point the DHCP client will choose one of the offers that it received and send out another broadcast (DHCPREQUEST) which notifies all DHCP servers that an offer has been accepted. Any offer that was not accepted is invalidated on the server. The server that sent the accepted offer will then send out an aknowledgement to the client (DHCPACK).
All DHCP packets are sent via UDP with a port number of 68 on the client and 67 on the server.
So, how do we setup a simple DHCP server on IOS?
ip dhcp pool MYNETWORK
 network 192.168.1.0 /24
The name of the DHCP pool can be whatever you want, you just need to make sure it’s unique.
And that’s it! Pretty worthless though without a default router or dns…
Let’s add that in
 default-router 192.168.1.1
 dns-server 192.168.1.10 192.168.1.11
At this point we have a fairly usable DHCP scope.
Lets say that we want to reserve the first 10 addresses in the scope for servers, routers, switches, etc.
We can do so like this
ip dhcp excluded-address 192.168.1.1 192.168.1.10
If you only wanted to exclude one address, you would enter the one address in twice like this
ip dhcp excluded-address 192.168.1.10 192.168.1.10
There are a few other commands that should be configured for basic DHCP. First is the domain name.
 domain-name mydomain.com
This command should be entered inside the ip dhcp pool block, so if you left dhcp pool configuration you’ll need to reenter that command.
This assigns a domain name to your clients. Usage of this domain name is application specific. One example would be for DNS queries though. If your software is only given a hostname it may assume that the fully qualified name of the host is host.(dhcp assigned domain)
The other command actually activates the DHCP server, without it the router will not respond to DHCP messages.
service dhcp
Some may argue that this is a default command… Most of the time you’d be correct, but I’ve worked on some devices where this is not the case. So remember to enter this command if for some unknown reason your router doesn’t appear to be accepting DHCP packets.
That about wraps it up for basic DHCP. I’ll be following up with two other posts for Advanced DHCP Settings and DHCP Tuning