Skip to main content
4 of 4
added 83 characters in body
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; DHCP is there just for user convenience, and IP(v4) has existed for a long time before DHCP (or BOOTP, or RARP). Hosts can have their IP address configured manually or in any other ways1 without DHCP.

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.

(Install Wireshark or some other packet capture tool to see this.)

The DHCP client software achieves this by using "raw sockets" where it manually builds whole IP packets (adding the UDP header and the IP header) instead of letting the OS add the usual lower-layer processing. So although the protocol looks like it 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" IPv6 address (the fe80:… address), so the host can just use that to send and receive its DHCPv6 packets – or ICMPv6 Router Solicitations, or anything else needed for configuration.


1 Some link types have their own configuration mechanisms: for example, anything that uses PPP – like PPPoE for ADSL, or PPTP VPNs, or oldschool dial-up – will use PPP-integrated configuration instead of DHCP. Mobile networks also do their own thing. And typically all such mechanisms are only used for "user-facing" connections, whereas "core" connections between routers almost always use manually configured IP addresses.

grawity_u1686
  • 465.3k
  • 66
  • 977
  • 1.1k