Packet flow in DHCP

Packet flow in DHCP

Packet flow in DHCP relay

 Here, we will use a diagram to explain the flow of packets in exchanges between the DHCP client and DHCP server when DHCP relay is performed.

The communication between DHCP client and server in DHCP relay is performed as shown in the figure below.

UDP number 67 is used from the client to the DHCP server, and number 68 is used from the DHCP server to the client.

DHCPDISCOVER packet flow

DHCPOFFER packet flow

DHCPREQUEST packet flow

DHCPACK packet flow

DHCP (segment identification)

 If you use the router's DHCP relay function, you can receive an IP address from the DHCP server beyond the router. Here, I will explain why the DHCP client can receive the IP address of the network to which it belongs.

 By using the DHCP relay function, you can build a network as shown in the figure below. By consolidating DHCP servers, it becomes possible to manage the allocation of IP addresses with a single DHCP server.

On the DHCP server, a scope is set for each segment (network) as shown below.

 1F・・・10.1.0.0/16
 2F・・・10.2.0.0/16
 3F・・・10.3.0.0/16
 4F・・・10.4.0.0/16
 5F・・・10.5.0.0/16

 So why does the DHCP server identify which segment (network) a DHCP client belongs to and assign different configuration information to each segment?

 This is because the IP address of "GIADDR" in the DHCP message identifies which subnet the IP address is assigned to and assigns the IP address. If there is no value in "GIADDR", it is recognized as the same segment.

● DHCP message format

information nameexplanation
CIADDRClient IP address, used when client is in BOUND, RENEW or REBINDING state.
YIADDRThe IP address of the client assigned by the DHCP server (your IP address)
SIADDRDHCP server IP address
GIADDRIP address of the DHCP relay agent. The DHCP server identifies the subnet to which the client belongs by looking at GIADDR.
CHADDRClient's MAC address

 Before forwarding a DHCP packet to a DHCP server, a router configured with DHCP relay stores the IP address of the router for that segment (the IP address of the incoming interface of the DHCP packet) in the GIADDR field of the packet.

When a DHCP client obtains an IP address, that IP address becomes the gateway address for the client.