Cisco IOS routers and layer 3 switches can be configured as DHCP server. It’s quite easy to do this and in this short lesson I want to explain to you how to do this and how to verify your configuration. If you are a little fuzzy how DHCP works, take a look at my introduction to DHCP first.
Let’s use the following topology:
Above we have a router that I will call ‘DHCP’. The router and computer are connected to each other using a simple switch and in the same VLAN. We will use the 192.168.12.0 /24 subnet for this demonstration. Let’s prepare the interface first:
DHCP(config)#interface fastEthernet 0/0
DHCP(config-if)#no shutdown
DHCP(config-if)#ip address 192.168.12.1 255.255.255.0
Now let’s configure DHCP server:
DHCP(config)#ip dhcp pool MYPOOL
DHCP(dhcp-config)#network 192.168.12.0 255.255.255.0
Use the ip dhcp pool command to create a DHCP pool and give it a name. This DHCP pool will use network 192.168.12.0 /24. Basically this is all you have to do to get DHCP server going, there is no need to start a service or something. We can verify that we have DHCP clients using the following command:
DHCP#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
192.168.12.2 0063.6973.636f.2d63. Mar 02 2002 12:24 AM Automatic
6330.372e.3132.3265.
2e30.3030.302d.4661.
302f.30
Above you can see that we have a DHCP client and it received IP address 192.168.12.2. In production networks we will also use DHCP to hand out some other useful things like a default gateway, DNS server and more. Let’s see how we can do this:
DHCP(config)#ip dhcp pool MYPOOL
DHCP(dhcp-config)#default-router 192.168.12.1
DHCP(dhcp-config)#dns-server 208.67.222.222
Above I configured IP address 192.168.12.1 as the default gateway for the DHCP clients with the default-router command. The dns-server commands lets us specify a DNS server.
Something else you might want to do is exclude a number of IP addresses. With the configuration so far our DHCP server will hand out IP address .2,3,4,5,6 etc. Here’s how to do it:
How i can configure a fast-Ethernet interface to act as a DHCP client? and, is there any configuration we need to do apart from the configuration you have shown in DHCP server for that?
Do you mean how to configure DHCP to use the same IP address for some hosts?
http://networklessons.com/network-services/dhcp-static-binding-on-cisco-ios/
Hi Hussein,
When you have two DHCP servers in the same subnet then the host will receive an IP address from whoever answers first. This can be dangerous btw, take a look here:
https://networklessons.com/security/dhcp-snooping/
The 2950 or 2960 switches support DHCP server I believe but I would probably not use them for this as you can configure only one IP address on them (for management).
Rene
Hi Rene
How about reserving certain IP addresses and having the Dhcp allocate them automatically to specific hosts on the LAN
Thanks
Andrew
Hi,
I think you there is conflict between the diagram and the configuration, in the diagram it is written “.254” as the default gateway, but the config states “.1” as the default router !