How DHCP Works

DHCP (Dynamic Host Configuration Protocol) simplifies the management of IP address configuration by automating address configuration for network clients. All computers that participate on TCP/IP networks or the Internet need to have IP addresses assigned to them and have other IP information configured. IP addresses allow computers and other network hosts to communicate with other computers or hosts on the network.

Some of the additional information needed by network clients may include a subnet mask, default gateway and DNS server information. This information is needed in order for the computer to do things such as send data outside the network and resolve host names to IP addresses. Rather than manually inputting all of this information on each client, DHCP can do this for you automatically once its setup on the DHCP server.

In order for DHCP to work you need to have a device acting as a DCHP server. This device can be a computer, router or other type of network device. The DHCP server is configured with a range or ranges of IP addresses that can be used to give to clients that request one. It can also be configured with other network parameters as stated earlier.

For a client to be able to obtain information from a DHCP server it must be DHCP enabled. When it is configured this way then it will look for a DHCP server when it starts up. This process will vary depending on what implementation of DHCP is in use. For example in the Microsoft implementation of DHCP works as follows:

  • The client sends out a DHCPDiscover packet the first time the client attempts to log onto the network.
  • Then the DHCP server that receives the DHCPDiscover packet responds with a DHCPOffer packet which contains an un-leased IP address and any additional TCP/IP configuration information.
  • When a DHCP client receives a DHCPOffer packet, it then responds by broadcasting a DHCPRequest packet that contains the offered IP address, and shows acceptance of the offered IP address.
  • The selected DHCP server acknowledges the client DHCPRequest for the IP address by sending a DHCPAck packet and then the client can access the network.
  • DHCP clients try to renew their lease when 50 percent of the lease time has expired by sending a DHCPRequest message to the DHCP server. They also send this message when they restart to try and get the same IP configuration back.

The amount of time a client keeps its lease on its IP address varies depending on how it is setup. The default Microsoft duration is 8 days.

Windows DHCP console

DHCP Console

If the client computer is setup to use DHCP to obtain its IP address and cannot find a DHCP server then it will most likely use an APIPA (Automatic Private IP Addressing) address instead. When using APIPA, DHCP clients can automatically self configure an IP address and subnet mask for themselves when a DHCP server is not available. The IP address range used by APIPA is 169.254.0.1 through 169.254.255.254 with a class B subnet mask of 255.255.0.0. The client will use this self configured IP address until a DHCP server becomes available. So if you are trying to configure your new DSL router at home and notice your IP address is 169.254.x.x when running the ipconfig command then its most likely because it can’t get an IP address from the router.

Related Posts

© 2024 Online Computer Tips
Website by Anvil Zephyr