0

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?

7
  • You can 100% create a network without DHCP. DHCP can help set up a network but it is not mandatory.
    – Mokubai
    Commented Feb 24 at 14:03
  • Not really related to your question, but perhaps consider that IPv4 (or even IPv6) isn’t the only network layer protocol that exists, though it probably is the most widely used nowadays.
    – Daniel B
    Commented Feb 24 at 14:03
  • Wikipedia is the right address for such questions.
    – harrymc
    Commented Feb 24 at 14:12
  • @harrymc i can't open wikipedia unless someone helps me climb over GFW
    – Tim
    Commented Feb 24 at 14:28
  • There are very many sources on the internet for finding out how DHCP really works,
    – harrymc
    Commented Feb 24 at 14:32

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .