How to use Cisco Router as DHCP Server?
About Dynamic Host Configuration Protocol (DHCP) and how to use Cisco Router as DHCP Server
An upgrade of BOOTSTRAP PROTOCOL created by IETF (Internet Engineering Task Force). It is a client-server protocol whose main objective is to assign IP-Address to the client asking for it, however DHCP also provides some more information than just IP-address. It reduces need of administrator to give IP-Address to all the devices statically and human errors can also be reduced with DHCP in a large network.
What is DHCP?
It is an application layer protocol which provides IP-address, subnet-mask, default-gateway, DNS server IP-Address automatically. it uses UDP port no 67 and 68 as an information of transport layer of OSI.
How DHCP works?
DHCP works on DORA process
- DISCOVER
- OFFER
- REQUEST
- ACKNOWLEDGEMENT
When client boots up it sends a broadcast looking for DHCP server and asking for IP-Address.
When server respond on discover message it sends an offer message this message is unicasted on the same IP-address which is been offered by the server from the pool of a IP-address stored in server. Note: Cisco router as a DHCP server may do broadcast in this case.
Client requests for the IP-address after checking it for IP conflicts. It is again a broadcast message from client to server, requesting for the same IP offered in the offer message.
It is a message sent by a server to the client as an acknowledgement that one IP--address is been assigned to client from the pool of IP-addresses. It is a uni-cast message.
Note: Cisco router as a DHCP server may do broadcast in this case.
These messages are all unicasted by DHCP helping agent when DHCP server is not in same broadcast domain.
We can make different devices as a DHCP server. Devices like Routers, Layer3 switches, Access-Points, modem, etc.
DHCP configuration on Cisco Router used as a DHCP server and client as a PC.
IP-Address pool =172.20.10.0/28
Subnet mask = 255.255.255.240
Default-gateway = 172.20.10.1
DNS server = 172.20.10.1
On R1
After assigning IP-Address on interface fastethernet 0/0 statically
DHCP as a router
Syntax:
R1(config)#ip dhcp excluded-address 172.20.10.1
With this command we exclude that IP-Address or range of IP-Addresses which are not to be provided to client via DHCP.
R1(config)#ip dhcp pool Network Bulls
With this we created dhcp pool and named it Network Bulls.
R1(dhcp-config)#network 172.20.10.0 255.255.255.240
This command is of dhcp mode in which we declare the IP subnet from where server will assign IP-Address.
R1(dhcp-config)#default-router 172.20.10.1
This command is telling about the default-gateway IP-Address.
R1(dhcp-config)#dns-server 172.20.10.1 This command is telling about the dns-server’s IP-Address.
On PC
Open command prompt check IP-Address.
Syntax:
>ipconfig
One can also refer to RFC 2131 for DHCP
RFC 2131 was updated in 2014
Vishwajeet Rathore
Sr. Trainer - Cisco R&S and Security
Network Bulls
- RECOMMENDED POSTS
What about DHCP option 82. Kindly explain details about option 82.