Misunderstanding of DHCP/DNS – What is the IP of a machine before DHCPOFFER/DHCPREQUEST

dhcp

From what little I understand, DHCP allows for dynamic assignment of IP addresses to client machines on a network from a DHCP server. The client transmits a DHCPDISCOVER packet, followed by a DHCPOFFER from the server back to the client, and that can be followed by a DHCPREQUEST and so on.

So if the IP address is formally "assigned" once the server receives the client's DHCPREQUEST packet, is there some generic rule for IP assignment before that point? Made by a router, switch, or network card?

I'm curious because I know I have quite a few misunderstandings about how networks work but also because I'm trying to use wireshark to look at some DHCPOFFER and DHCPREQUEST packets and wireshark of course lists the source and destination IP addresses, but I have no clue what that would be before this whole process finishes. All I know about is the client's MAC address, because /var/log/messages literally just says: DHCPDISCOVER from [MAC ADDRESS]

Best Answer

It has no IP before it has an IP.

An example DHCP Discover packet sets the source IP to 0.0.0.0 and the destination is 255.255.255.255 to broadcast to every host on the local net.

The reply from the server goes to the client's MAC address. When you say All I know about is the client's MAC address - that's all the DHCP server knows about as well, and that's enough.

However, there is a standard for hosts to assign themselves an IP, which usually happens if a DHCP request fails. These IPs are in the 169.254.0.0/16 range.

http://packetlife.net/blog/2008/sep/24/169-254-0-0-addresses-explained/

When a host fails to dynamically acquire an address, it can optionally assign itself a link-local IPv4 address in accordance with RFC 3927. Microsoft's term for this is Automatic Private Internet Protocol Addressing (APIPA).

So it's possible a host has a self-assigned link-local address if it has tried DHCP before and failed to get an address, and is now trying DHCP again.

(And this has nothing to do with DNS)