DHCP: Dynamic Host Configuration Protocol is used for automatically assigning IP Configuration to one or more hosts. Imagine a scenario where your company has purchased 100 desktops for official use and wants you to assign IP addresses and other information on it. Now, going to all the desktops and assigning information one by one is a time taking process. Solution to this problem is a DHCP Server. There could be a specific server that provides Dynamic Host Configuration Protocol Services or we can make a router work as a DHCP Server.
So how exactly DHCP works? It work on DORA Process. DORA means DISCOVER, OFFER, REQUEST and ACKNOWLEDGEMENT. Process is as follows,
- First, a client (Host Machine) sends a DISCOVER message.
- If any (or more) DHCP Server is present in the network, it will OFFER its’ services to the client. It will send the information that are available on server like IP Address, Subnet Mask, DNS Server and other.
- Client will select the best one that fits the need. It will then REQUEST for the desired Configuration.
- Finally, DHCP server will ACKNOWLEDGE the request and send the configuration to Hosts.
Note that there could be more than one servers in a network and client can choose which one they want to get services from.
Following terms should be kept in mind before configuring Dynamic Host Configuration Protocol Services,
- SCOPE: It is a range of IP Addresses that can be given to clients in a subnet.
- Excluded Range: If some IP addresses are reserved for future use, they can not be assigned to any Client.
- Address Pool: IP addresses that are assignable to clients.
- Pool Name: Name of the pool from which IP Addresses can be assigned.
- Lease Time: For how long an assigned IP Address can be used by a client.
- DHCP Reservation: It is used to bind particular IP Address to a particular client.
How to Configure DHCP in Cisco Packet Tracer?
So how to configure it? First let’s take a look at configuration in the server. Create a topology like shown in figure and click on server. Go to Services tab and click DHCP. Here assign the parameters as per your need and click save.
Next, go to desktop tab and click on IP Configuration tab. Now assign an IP address to the Server. This IP address will be used as default gateway for hosts. We have already discussed about Default Gateways here.
Once everything is configured, just click on hosts and go to IP Configuration tab. There, Click on DHCP and your host will automatically get an IP Address.
As you can see, we have successfully configured DHCP Server. Now what if I want to do it on a Cisco Router.
Watch the following video for router configuration.
So, that is how you can configure Dynamic Host Configuration Protocol on a router and a server.
What if DHCP Fails?
Whenever Dynamic Host Configuration Protocol fails to give IP Information to client, APIPA is used. APIPA is Automatic Private IP Addressing. This is one of the most important question asked in various interviews. APIPA assigns a class B IP address from 169.254.0.0 to 169.254.255.255 to the client when a DHCP server is either permanently or temporarily unavailable.
As you can see APIPA is giving an IP Address to Clients and communication is still successful. That is how complete Dynamic Host Configuration Protocol works. For more detailed information click here.