Dynamic Host Configuration Protocol

Introduction

System for automatically assigning IP addresses and other network settings to devices in a network.

Without it, you would have to manually configure IP addresses, subnet masks, default gateways and DNS servers for each device on the network.

When a device connects to a network, it sends a DHCP request to a DHCP server. The server then assigns the IP address and other network settings to the device.

Benefits of DHCP

How does it work?

DHCP Discover

When a device connects to a network for the first time (i.e. it doesn't have an IP address assigned in the network) it sends a broadcast message on the network "asking" to be assigned an address.

DHCP Offer

The DHCP server listens for "DHCP Discover" message.

In response, the DHCP Offer message is sent with IP address and other network settings. It is possible for there to be multiple DHCP servers to exist in the same network and to respond with DHCP Offer messages.

DHCP Request

It falls on the device to choose one of the offered IP addresses and network data. It will then respond with a DHCP Request to the server that offered the IP saying that it will assume this address now.

DHCP Acknowledgement

The chosen DHCP server receives the "DHCP Request" and sends back a "DHCP Acknowledgement" message. This message confirms the lease of the IP address and provides the device with all the necessary network configuration details, such as:

Lease Time

IP address is not given to device permanently, and is "leased" for a specific period. When lease time is about to expire, the device will contact the DHCP server to renew the lease.

If device is no longer on the network, the lease expires, and the IP address goes back into the pool of available addresses for the DHCP server to assign to other devices.