DHCP (Dynamic Host configuration protocol) provides a mechanism for automatically allocating IP (IPv4) addresses to network devices e.g. computers..
It consists of two components.
- A DHCP client
- A DHCP server
DHCP Client
All modern operating systems come equipped with a DHCP client and by default, they are all configured to use DHCP.
A DHCP client is responsible for requesting an address and assigning it to the computer.
Client Configuration
If you go to you adaptor settings page (see this tutorial for windows 10) you will see a page similar to the one below:
You can see that the DHCP client is configured to obtain an IP address, and also a DNS server address.
DHCP Server
A DHCP server is responsible for allocating IP address and other information to requesting clients.
The DHCP server is configured with a range of IP addresses that it can assign and also with other settings like DNS servers, default gateway addresses etc.
IP addresses from a DHCP server are normally leased, and must be renewed periodically.
This renewal process happens in the background, and doesn’t require any user intervention.
DHCP Server Location
On home networks the ISP router or hub generally provides the DHCP server.
However you can use another computer e.g raspberry pi to provide DHCP, but it is generally not done.
Configuring The DHCP Server
On home networks there is generally nothing to be configured.
If you go the admin page on your home router you will see configuration options similar to the screen shot below.
There are limited options on most ISP provided home routers and it is very rare to need to change them.
You should note that the allocation range on my home router is 192.168.1.64-192.168.1.253.
The home router itself uses address 192.168.1.254 and so it leaves me 192.168.1.1-.192.168.1.63 for allocating to static clients if needed.
Only assigning static addresses in this range will help avoid IP address conflicts.
You should also start at address 192..168.1.1 or 192..168.1.2 and work up in case you need to increase the address range at a later date.
Note: Some networks use 192..168.1.1 for the default gateway address.
Assigning Static Addresses Using DHCP
Although you can manually assign a static address to a client it is not really the best way as it is very inflexible.
A better way is to use the DHCP server to assign the address on a permanent basis and almost all home routers have this ability.
This is usually known as address reservation and the screen shot below shows my tplink router settings.
It works by using the MAC address of the client,which is fixed, to fix the IP address to that client.
Troubleshooting DHCP
You will need to look at the clients and the router.
The main client trouble shooting tool is the command line tool ipconfig (windows) and ifconfig (Linux).
This tool will show you the IP addresses assigned to your device.
What you are looking for when using this tool is that your computer has a valid IP address,Gateway address, and DNS server address.
If your client has an IP address beginning with 169 or an address of 0.0.0.0 then something is wrong, and it can’t locate a DHCP server.
In the screen shot above you can see that the client is configured for DHCP and that the IP address has been leased.
Router Checks – You will also need to logon to your home router and check that DHCP has been enabled.
If you have many clients on the network then you may also need to adjust the address range.
If you do adjust the address range then make sure that you haven’t already assigned static addresses in this range.
Common Questions and Answers
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 on the client configuration.
Q- My IP address doesn’t appear to change does this mean that I have a static IP address?
A- No not necessarily as when a DHCP client renews its IP address it asks for the same address and will normally be allowed to keep it.
Q- Can I have more than one DHCP server on a network?
A- Yes and No. You might find multiple DHCP servers on large corporate networks. Setup is tricky and they must be configured so as not to assign the same IP addresses from the same address range. On Home networks you should only have one.
Q- Does DHCP provide ipv6 addresses?
A- Currently NO as IPv6 addresses on home networks are auto assigned by the client and don’t need DHCP.
Terms and Acronyms
Static Address – An IP address that is assigned manually.
Dynamic Address – An IP address assigned automatically and can change from time to time.
IP Address Conflict – When Two computers(devices) are configured to use the same IP address.
Default Gateway — The IP address of the device that provides access to the Internet i.e. your home router.
Resources and Related tutorials
Useful Ipconfig commands
ipconfig /all -This command will show IP and DNS settings
ipconfig /release -This command will release the IP address from DHCP
ipconfig /renew -This command will renew the IP address using DHCP
Useful Rapberry Pi /Linux commands
ifconfig – Shows basic address details for all Interfaces.
dhclient lets you renew and release IP addresses:
to release use:
dhclient -r
to renew use:
dhclient
to target a particular interface (e.g eth0) use
dhclient -r eth0
to enable more details use the -v (verbose) switch
dhclient -r -v eth0
- Setting Up A Static IP Address on Windows 10
- Home Network Addressing
- Setting Up and building a Home Network
- How to Setup and Configure your Home Router
- Name Resolution on Home Networks
- DHCP specification RFC 2131 for IPv4
Very good and easy to read/understand. However, the following information needs to be edited.
ipconfig ./all -This command will show IP and DNS settings
ipconfig ./release -This command will release the IP address from DHCP
ipconfig ./renew -This command will renew the IP address using DHCP
Just FYI you don’t use a period before the switch. Thank you for your time.
Rob
Tks for spotting that and telling me.
Rgds
Steve