What is DHCP and Why is It Useful?
In this lecture, we are going to discuss DHCP, basically what it is, and why it is useful, and why you need to understand what it is.
So, DHCP stands for Dynamic Host Configuration Protocol.
It’s a Network Service that provides automatic IP Address configurations to your DHCP Clients, which could be a Laptop, could be a mobile phone, tablet, anything that connects to your network, Desktop or Server. Generally, Servers don’t use DHCP but they could in theory. So, any network device that is configured to use DHCP would be a DHCP Client.
Now, DHCP could be installed on a server, it could be installed on a Network Device you think of as your Home Router, almost all Home Routers act as a DHCP Server.
Now, Why Is It Useful?
It simplifies and automates the mass configuration of your network clients.
Imagine this scenario where you have 200 Laptops on the same network, and imagine that they are constantly moved between one network to another, let’s say you have an office and those employees are bringing their Laptops from office A to office B in separate networks, maybe they are separate subnets, you would have to configure the Static IP Address on those Laptops every time they are moved from one network through another, and it would be a big pain because you have to make sure you don’t hand-out and IP Address that’s already in use because you will create an IP conflict, and it just would be a lot of work.
Well, DHCP automates the entire process, all you have to do is plug in your Laptops or connect to the Wi-Fi, and it will automatically find and obtain an IP Address that is available.
So, when it comes to DHCP there’s a couple of key terms that you need to be familiar with.
The first is the Scope. This is the range of the IP Addresses that you want to use. A Scope would be something like 192.168.1.100 through 192.168.1.200, that would be your Scope.
Exclusions could be any kind of range that you would imagine that falls within a Scope. Let’s say within that Scope 192.168.1.100 through to 192.168.1.200 we don’t want to include 192.168.1.105 through 192.168.1.110. There could be reasons for this like maybe we are using Static IP Addresses within that range, whatever the case might be you can choose to exclude a certain number of IP Addresses within a Scope.
The next is Reservations. So, Reservations are based on MAC Addresses, and you can make a Reservation for any kind of device, for example, if we want to reserve 192.168.1.10 we can do that just by specifying the MAC Address for that computer, and so when that computer comes to the network and it requests an IP Address from our DHCP server it will find that we have created a reservation for that computer to have the 192.168.1.10 address.
As a side note, it might sound a lot like a Static IP Address but it is not really the same because if a computer came only and couldn’t contact the DHCP server, let’s say for example the DHCP server crashed it wouldn’t be able to obtain that IP Address. If it had that IP Address previously once the lease expired then that computer would revert to what is called a Private IP which the address typically starts with 169.254.X.X and it is basically the IP Addresses that are handed to your computers that are configured to use DHCP but cannot contact a DHCP server.
So, the easiest way for you to understand exactly how DHCP works is through the Hotel metaphor.
Here we have our Hotel and say you showed up and you go onto the Front Desk and you say: “Hey, I would like a room”. Well, how is the Front Desk going to handle this? First, they will find out what rooms are available right?
So, in this case, we have the top 4 here and these rooms are off-limits, it could be maybe they are being upgraded, maybe remodeling them, but this would be an example of a DHCP exclusion, we are saying we don’t want to hand out any of these rooms to any guests.
So the guest here would be the DHCP Client and the Front Desk the DHCP Server.
Next, they might want to see if there are any Reservations. Maybe someone called in ahead and reserved a couple of rooms, so, 101, 102, and 103 are not available because these are reserved.
And, 104, 105, and 201 are currently in use because there are guests living in that room.
But, the Hotel Clerk of the Front Desk can see that we can give them room 202, so, they give us that room, we go on there, and we take it.
And, the Front Desk will update that room and say “hey, now 202 is no longer available because it has been used”.
DHCP works in the same way. The client connects to the server and it says, “hey, what IP Address can you give me”?
The server goes back and it looks and says, “OK, we have some excursions, don’t give them those IP Addresses in Red, we have some Reservations in Blue so don’t give them those, and these in Green are in use so don’t give them those, and it will find one that’s available.
And, it will hand it to the DHCP Client.
OK, so quick recap.
DHCP stands out for Dynamic Host Configuration Protocol.
We have the Scope which could be ranges of IP Addresses that you want to hand out.
We have Exclusions which would be, let’s take the Scope from .100 - .200 but don’t hand out the IP Addresses from .50 - .55 inside that range.
We have Reservations which is where we would take a MAC Address and we will assign a reservation for that MAC Address, so if we have a specific laptop that we always want to use a certain IP Address we could do that.
And then we have, there’s no DHCP server that will assign then your computer will return the Private IP Address which starts with 169.254.X.X.
OK, so that’s all we need to talk about in this lecture.