Don’t forget to have at least one authoritative DHCP server in network

I would like to describe potential issues with network connection in your network if you will not have authoritative DHCP server in your network. Authoritative DHCP server is a server which always respond to DHCP request if no another DHCP server in network responds.

Imagine situation when you are providing to your laptops to their WiFi adapters IP addresses via DHCP with lease time 7 days. Your user will hibernate or turn off the computer and will come home where he don’t have their home router DHCP configured as authoritative (not usual for home routers, but it can happen in some hotels). Behavior of Windows without enabled APIPA is that this computer resumed/started at home will try to keep it’s IP address which has assigned from work DHCP server and is still valid (lease time 7 days). Normally it will not try to get new IP address and this will result that this computer will have no connectivity. Possible solution to this situation is to enable APIPA (automatic private IP addressing) where computer will assign self-generated IP and simultaneously will start new clean DHCP request.

Explanation how DHCP process works

1. Assign of new IP address

Process of assigning new IP address to client computer
Process of assigning new IP address to client computer
  1. DHCP DISCOVERY – client will send a DHCP DISCOVERY packet to destination address 255.255.255.255 (source address 0.0.0.0) which is trying to find DHCP server in the network and ask for an IP address. The request contains also MAC address of the client which is requesting the address. Address 255.255.255.255 is broadcast address and means that the packet is possibly intended for any other host in the network.
  2. DHCP OFFER – DHCP server will send the DHCP OFFER packet which contains offered IP address (and also other information like netmask, gateway, lease time, etc). Packet is sent to destination address 255.255.255.255 (source address is IP of DHCP server).
  3. DHCP REQUEST – client will send to the address 255.255.255.255 request with IP address which has DHCP server offered in DHCP OFFER.
  4. DHCP ACK – DHCP server will confirm assignment of IP address to the client.
  5. DHCP INFORM – client will inform all clients in the network (broadcast) that it has assigned the specified IP address.
Network sniff of the process
Network sniff of the process

2. Confirmation of address validity after computer was switched off

Process of renew non expired IP address
Process of renew non expired IP address
  1. DHCP REQUEST – After power on of the computer if it has valid (not-expired) IP address it will try to use it and will send the DHCP REQUEST with specified IP address to broadcast address 255.255.255.255.
  2. DHCP ACK – DHCP server will confirm assignment of IP address to the client.
Network sniff of the process
Network sniff of the process

Windows system behavior

1. Wakeup of computer in “new” zone without authoritative DHCP server, IP address non-expired

dhcp_2_1_sniff

User has after switch off moved to the hotel or to another branch, assigned IP address is non-expired. When he will turn on the computer in the new locality, computer is whole time trying to get his old (still valid) IP address. If in the network is no authoritative DHCP server present, all DHCP servers will ignore the request (it is not renewal request for the IP address which he has provided) and client will get into unstable state where it is infinitely requesting the IP address which it cannot get.

This is problematic situation causing troubles to user.

2. Wakeup of computer in “new” zone with authoritative DHCP server, IP address non-expired

dhcp_2_2_sniff

User has after switch off moved to the hotel, assigned IP address is non-expired. When he will turn on the computer in the new locality, computer is trying to get his old (still valid) IP address. If in the network is authoritative DHCP server it will respond with DHCP NAK message (refuse of use wanted IP address) which will cause client will throw away old IP and will start whole DISCOVERY process to obtain new IP address. As you can see user will get new IP address automatically in 3 seconds.

This is correct situation causing no troubles to user.

3. Wakeup of computer in “new” zone, IP address expired

dhcp_2_3_sniff

User has after switch off moved to the hotel, assigned IP address has expired during computer was off. When he will turn on the computer in the new locality computer knows that IP address has expired and will start whole DISCOVERY process to obtain new IP address. As you can see user will get new IP address automatically in 3 seconds.

This is correct situation causing no troubles to user.

4. Wakeup of computer in “new” zone without authoritative DHCP server, IP address non-expired, APIPA enabled

dhcp_2_4_sniff

On the network sniff you can see the same problematic situation as described above, but if APIPA is enabled, computer will in 30 seconds detect that it is in unstable state, it will assign itself APIPA address and will start whole DISCOVERY process to obtain new IP address.

APIPA (Automatic Private IP Addressing) is a built-in Windows feature which will assign to computer automatic private IP address from special reserved network subnet 169.254.0.0-169.254.255.255 when no DHCP server is available on the network. This is possibly to use at home or in small networks where administrator don’t need to care about assignment of IP addresses and all clients will configure itself automatically. In our big corporate network is not important the part that computer will configure automatic private IP address, because our network infrastructure will not route clients with private address.

For our issue is interesting feature that when computer will assign itself APIPA address it will also start to do the DHCP DISCOVERY process in regular intervals until it will get the address from DHCP.

APIPA is in Windows by default enabled.

This is problematic situation but it will be solved automatically in 30 seconds. During connecting to WiFi user will get the message “connecting takes longer than usual”…