Dynamic Host Configuration Protocol


  1. DHCP Overview
  2. DHCP Process
  3. DHCP Components
    1. DHCP Server
    2. DHCP Scope
    3. DHCP Exclusion
    4. DHCP Reservation
    5. DHCP Relay Agent
    6. APIPA
    7. Rogue DHCP Server
  4. DHCP Port

DHCP Overview

DHCP (Dynamic host configuration protocol) is a protocol which is used to assign IP addresses to computers configured to obtain an automatic IP address. DHCP only works in LAN but not on WAN or Internet where static IP addresses are required.

DHCP works on UDP port 67 and 68. It is platform independent and can work in Windows, Linux, Routers and firewalls. Any network which is running DHCP service must have at least 2 components.

  1. DHCP Server: This is a node where the main service of DHCP operates. The range of IP addresses also known as DHCP scope to be assigned to client computers resides on this server. DHCP server can be a computer or router.
  2. DHCP Client: A node on the network which requests for IP address assignment from the DHCP server. These nodes are higher in number and do not require any sort of configurations.

DHCP is a successor to BOOTP and uses broadcast as a mode of communication. All the nodes which require an IP address from the DHCP server sends a broadcast request to the server which is replied back again in the form of broadcast.

An IP address assigned by a DHCP server is a dynamic IP address and is subjected to change in future. The duration of a dynamically assigned IP address depends upon DHCP Lease Time.

External Links:

DHCP Process

Whenever any node wants to acquire an IP address from DHCP server then it must follow a proper procedure or process before that IP address is assigned to it. This process is inbuilt into DHCP protocol and is supported by all the platform supporting DHCP.

The entire process is generally termed as DORA or Discover, Offer, Request and Acknowledgement. Here is the complete step by step process of how a dynamic IP address is assigned to a client computer by DHCP server.

  1. Discover: First of all, the client sends a broadcast UDP packet known as Discover packet on the network. It is called Discover packet because this packet is used to discover all the DHCP servers on a network segment.
  2. Offer: When any DHCP server receives a Discover packet it sends back a range of IP addresses from the DHCP scope which are left unassigned on the network. If the client is unable to receive any offer from the DHCP server, the client can then take any of the below defined steps.
    1. APIPA: A node can assign itself any IP address in the range of 169.254.0.1 to 169.254.255.254 which is reserved for APIPA range.
    2. Alternate Static: In windows operating systems, a special option is reserved when configuring a computer to receive automatic IP addresses and that is to auto-configure the LAN card to assign itself a static IP address. This type of configuration is better for those computers which receive IP address using DHCP reservation.
    3. No configuration: If a node is neither APIPA nor Alternate static IP compliant then it would keep discovering DHCP server within specific time intervals.
  3. Request: After successfully receiving a list of IP addresses from the DHCP server the client then requests the server to assign it any randomly chosen IP address.
  4. Acknowledgment: After receiving the request from the client computer, the DHCP server rechecks the requested IP address for any collision before assigning it to the client.

When a client computer receives an acknowledgment message from the DHCP server. It configures its TCP/IP properties with the assigned IP address, thus ending the complete DHCP IP address assigning process.

DHCP Components

DHCP Server

DHCP Server is a machine either a computer, router or any other networking device which runs the DHCP service used to assign IP addresses to Client Computers.

DHCP Server can either be Windows or Linux machine, it can also be a Router or ADSL modem. DHCP Server is a term which is basically used for all devices running the DHCP service, like a router running DHCP is generally called DHCP server rather then DHCP Router.

The DHCP server must have a Static IP address and also a DHCP Software installed. This software is responsible for assigning IP addresses to client computers. As you know that DHCP Protocol uses UDP broadcasts as one of its communication medium, the DHCP Server must be placed in a location which does not restricts the server to communicate with other nodes using UDP broadcasts.

DHCP Scope

DHCP scope is the range of IP addresses which are assigned by a DHCP server to clients on a network. This scope contains only those IP addresses which have not been assigned statically to any node on the network. When any node requires an automatic IP address it sends a query to DHCP server. This server then looks for all the unassigned IP addresses in its scope and later on assigns one of the IP address to the client. A DHCP scope can contain many components like DHCP reservation, DHCP lease, DHCP exclusion and DHCP options. Multiple DHCP scopes can themselves be contained inside another DHCP scope known as superscope.

DHCP Exclusion

All the IP addresses which are excluded from a DHCP scope are those which are actually defined in the range of IP addresses but must not be assigned by the DHCP server due to any reason. Instead of creating a new DHCP scope without the excluded IP addresses, these IP addresses are just listed in the DHCP server exclusion range and they are then never assigned.

DHCP Reservation

Some nodes may need a static IP address. This type of IP address can be assigned without the need DHCP server but sometimes due to a company policy, administrators are forced to assign a static IP address via DHCP server. This is done by a process called reservation in which an IP address assigned by DHCP server is bind with the MAC address of a computer. Now whenever this computer will request for an IP address, it will always be given the same IP address until the MAC address is the same. (which can change only if the LAN card is replaced)

DHCP Relay Agent

DHCP relay agent is a routing component that helps in forwarding broadcast packets of DHCP as unicast packets through router to the DHCP server. DHCP relay agent is not a component of DHCP protocol rather it is a feature inbuilt into Microsoft Windows RRAS Service.

Most of the DHCP server and client communication is UDP based which means that there are a lot of broadcasts in the network. But if the network is divided into different subnets and those subnets are connected to each other using routers then the whole communication of DHCP will fail. This is due to the fact that routers stop broadcast in one network segment creating multiple broadcast domains.

So if you want network nodes to get IP addresses from DHCP server then either you must setup different DHCP servers with different DHCP scopes on different subnets or you may setup any of the following networks:

  1. Use a RFC 1542 compliant router which connects both the subnets.
  2. If RFC 1542 compliant router is unavailable then configure DHCP relay agent on a Windows RRAS machine on the segment of network which does not has a DHCP server. Configure this RRAS machine to forward DHCP broadcast packets as unicast packets to the router. The router will then relay request between both DHCP relay agent and DHCP server, thus eliminating the need of sending broadcasts across networks.

Always be sure that the work of RFC 1542 router is different then a DHCP relay agent. If you have a RFC 1542 compliant router then you do not need DHCP relay agent and vice versa.

APIPA (Automatic Private IP addressing)

Automatic Private IP address is a type of IP address which is assigned automatically to a computer’s network adapter. This IP address is used for temporary communication when DHCP server is unavailable.

Basically an IP address is assigned either manually or automatically using DHCP server. If the client computer is unable to communicate with the DHCP server then it assigns itself an IP address in the range of 169.254.0.1 to 169.254.254.255 with a subnet mask of 255.255.0.0 – This IP address is selected randomly from this pool.

Autoconfiguration IP address are built into Operating System core and almost all operating systems have them. These types of IP addressing is also called APIPA or Automatic Private IP Addressing or Link-Local addressing. The Techniques running behind this type of IP addressing is called Zero Configuration Networking.

This APIPA addressing is only used in Intranet or LAN. On WAN or Internet this type of IP addressing must be disabled because it can cause Routers and Servers to function improperly.

Automatic IP addressing is used as default type of addressing by IPv6 IP addresses. IPv4 address do not use this type of IP configuration by default but only as an alternate method to assign IP address.

Rogue DHCP Server

Rogue DHCP servers are those DHCP servers which are not authorized to assign an IP address in a network. You can find these DHCP servers as any device on a network which has its own DHCP server service and switched on without any permission from the administrator.

Mainly Routers, firewall and third party software contribute to the list of Rogue DHCP servers. Sometimes devices have an inbuilt DHCP server of their own which if is enabled by anyone, will start assigning IP addresses to other nodes without the knowledge of system administrator. These types of DHCP servers are often detected when assigning of similar IP addresses happens on the network or when an IP address is assigned without the knowledge of the authorized DHCP server.

An authorized DHCP server is basically a term used in Microsoft Windows Active Directory. In order to point out the authorized DHCP server in an AD network it is listed manually by a system administrator as an authorized DHCP server in the Active Directory database.

External Links:

DHCP Port

DHCP works on UDP Port Number 67 for Server 68 for Client.

Comments are closed.