Dynamic Host Configuration Protocol
Network hosts and devices can have their IP addresses assigned statically, this requires that you access each host, and manually configure an IP address. This can be cumbersome, and tedious.
Dynamic Host configuration protocol, DHCP assign IP addresses dynamically once a request is received. This address is assigned and valid for a length of time or duration called a lease.
DHCP removes the pain of manually assigning IP addresses, think of a task where you have to go around 5 buildings in a campus manually adding IP addresses.
There is a 4 way transaction which needs to take place, before a host get an IP address assigned…. I remember it as DORA.
Demo LAB
In this simple lab, we have a router requesting an IP from a DHCP server. We will run a wireshark capture to validate each step of DORA process.
Discovery
Hosts sends broadcast as UDP port 67 to discover a DHCP server. Request from 0.0.0.0:68, since has no IP address yet.
Offer
Server responds with an offer to destination 255.255.255.255.
Address 10.1.1.2, lease and renewal time are also inserted here.
Request
Hosts makes a formal request, essentially accepting what was offered. Note, IP address is still 0.0.0.0 !
Acknowledge
DHCP server ends the transaction acknowledging 10.1.1.2 is assigned to the host.
DHCP relay
When a host sending DHCP discoveries is on the same LAN as the server, broadcast will reach the server. However, what happens when there is a router or more between the host and DHCP server ? Routers will drop any broadcast by default, so how can a DHCP server receives discover packets ?
A router can act as a DHCP relay, this way forwarding discover packets to a configured IP address. This traffic will be routed all the way to the DHCP server, for this an ip helper command must be added under the receiving router’s interface.
Router(config-if)#ip helper-address 20.1.1.1″