DHCP like DNS is a network service that is vital to networking and the internet.
But What exactly is DHCP, and What does it do?
The key to understanding DHCP is to understand that all network devices on a network and the Internet need an IP address to operate.
There are two ways that the device can acquire an address. They are
- Manual Address assignment
- Automatic assignment using DHCP
Almost all networks use automatic assignment using DHCP (Dynamic host configuration protocol) as it is easier and more reliable.
In order to have automatic assignment on your network you need to have a DHCP server on that network.
All network devices (PCs,Tablets,Smart phones) come equipped with a DHCP client, and when they boot up they contact the DHCP server, and request an IP address.
You don’t need to tell the client the IP address of the DHCP server as the client uses a broadcast mechanism to locate it.
This means that the DHCP server must be located on the same broadcast networks as the client. -Not a problem with home networks. See the basic networking tutorial.
Provided everything is working OK they get an IP address, and usually they also get the address of the DNS servers so that they can resolve domain names.
IP addresses from a DHCP server are normally leased, and must be renewed periodically.
The renewal process happens in the background, and doesn’t require any user intervention.
The screen shot below shows the IP address, DNS address and lease duration of my IP address.
You can find your own details by using the ipconfig /all command.
On large networks an administrator must set up and manage the DHCP server, but on home networks it is built into the router, and doesn’t normally need any manual intervention.
Although on home networks you don’t need to configure the DHCP server you do need to tell the clients (computers) to use a DHCP for IP addresses.
DHCP Address Ranges
When configuring a DHCP server you will need to assign address ranges for the IP addresses.
When a client requests an IP address the DHCP server will assign the client an IP address from the address range.
On Home networks the home router is usually pre-configured to assign IP addresses in the 192.168. address range.
Below is a screen shot of my home router default DHCP settings:
Notice that the hub/router is using a static IP address (192.168.1.254)and this address range is outside the address range that the dhcp server is configured to allocate 192.168.1.64 -192.168.1.253.
It is also important to note that the addresses 192.168.1.1 -192.168.1.63 are not part of the allocated range.
You can use addresses in this range to assign to devices that require a static IP address.
Missing DHCP Server
If the client cannot find a DHCP server then It may auto assign an IP address from a reserved range 169.254.0.0-169.254.255.255 or simply have an IP address of 0.0.0.0.
Note: Different versions of windows use different default IP addresses
In either case it is unlikely to work correctly.
You can find out whether or not your client (windows) has an IP address by using the ipconfig command at a command prompt.
ipconfig ./all -This command will show IP and DNS settings
ipconfig ./release -This command will release the IP address
ipconfig ./renew -This command will renew the IP address
Common Questions and Answers
Q- Does DHCP work with the hosts file?
A- No it doesn’t.
Q- Can I assign static IP addresses and still use DHCP?
A- Yes most DHCP servers (even on home networks) allow you to exclude IP addresses and address ranges.
Q- Can I assign DNS servers manually even though I’m using DHCP?
A- Yes there is a separate setting for that.
Related Articles and Resources
- Understanding IP Addresses
- Understanding DNS
- Internet and Networking Components– Internet and Networking Components for connecting to the Internet.
- DHCP specification RFC 2131 for IPv4