Skip to main content
1 of 4
grawity_u1686
  • 465.3k
  • 66
  • 977
  • 1.1k

DHCP is a protocol at the application layer, so it must depend on the IP protocol in the network layer. But the IP protocol requires assignment of IP addresses to network interfaces, which is the job of DHCP. Do DHCP and IP depend on each other, and therefore require the existence of each other in advance? How does this cyclic dependency work?

It's not a hard dependency; hosts can have their IP address configured manually or in any other ways without DHCP, which only gained popularity many years later. (Some link types have their own configuration mechanisms: anything that uses PPP – like PPPoE or PPTP or SSTP or dial-up – will use PPP-integrated configuration instead of DHCP; mobile networks also do their own thing.)

But DHCP on IPv4 works in a somewhat unusual way – unlike other (normal) UDP-based protocols, a DHCP client is allowed to send packets from the "zero" address 0.0.0.0 while the host doesn't yet have a valid IP address.

The DHCP client software achieves this by using "raw sockets" where it directly sends whole IP packets instead of letting the OS add the usual lower-layer processing. So although technically the protocol is transported inside UDP/IP, it does not actually depend on the operating system's IP stack working at all.

(On IPv6 the situation is different as every IPv6-capable interface automatically has a "link-local" IP address which can be used to send DHCPv6 packets – or ICMPv6 Router Advertisements, or anything else needed for configuration.)

grawity_u1686
  • 465.3k
  • 66
  • 977
  • 1.1k