dhclient - Obtaining IP address dynamically

Whenever you want to obtain a dynamic IP address for your Linux/Unix machine from a DHCP server, you should use dhclient utility.

Both DHCP request and responses are UDP requests. If you use a sniffer to identify the pattern of the request responses, the following is what you might see. The following was taken from dhclient running in FreeBSD 6.1.

Len SrcIP SrcMACAddr DestIP DestMACAddr Protocol
342 0.0.0.0 00:0c:29:c1:13:81 255.255.255.255 ff:ff:ff:ff:ff:ff UDP

62 192.168.49.254 00:50:56:ef:75:a8 192.168.49.128 ff:ff:ff:ff:ff:ff ICMP ping request
342 192.168.49.254 00:50:56:ef:75:a8 192.168.49.128 00:0c:29:c1:13:81 UDP
60 192.168.49.128 00:0c:29:c1:13:81 ff:ff:ff:ff:ff:ff ARP request


If you observe the source and destination (IP, MACAddr) patterns, it is easy to appreciate what happens. Here is what happens:

  1. A DHCP request is sent on the network. Both destination MACAddr and IPAddr are broadcast addresses.
  2. The DHCP server chooses and IP address to offer and confirms if the IP address it is not used anywhere else in the network.
  3. DHCP server offers the IP address to the requester.
  4. The requester sends an ARP request to register its MAC address and IP address in interested hosts in the network.
DHCP is an application layer protocol. Thats an important thing to keep in mind.

Comments

Anonymous said…
Excusez, non Г  ce paragraphe..... cialis en ligne le cialis [url=http://runfr.com]achat cialis en ligne[/url]

Popular posts from this blog

The mysterious ORA-03111 error

Note on allocationSize parameter of @SequenceGenerator while using JPA

xVM's vboxmanage.exe command