DHCP is a network protocol that automatically assigns IP addresses and configuration settings to client devices through a structured discovery and negotiation process between clients and servers. This content covers the client-server relationship, the four-step DORA process, and key server configuration components including scopes, lease times, reservations, and options.
DHCP Review
The first thing to note is DHCP has both a client and a server. The client is the one that makes the request, and the server is the one that serves up the information, or serves up the services, to that client. So there's an interplay between two devices on here, a client and a server.
We're going to use this demo laptop as an example of the DHCP client, and then it's going to be making a request to a DHCP server, which could be the router, it could be a layer 3 switch, or it could be one of these Pis over here, or some other server that's on your network. So just realize that you have this demo laptop that is the client that's going to be requesting services from a server.
I thought I'd give you a quick little visual of what this looks like on a Windows machine. What I can do is I can go to the Windows menu and type in services to see what services are running on this machine, and as I look through these services I'm going to look for DHCP client. So there's the DHCP client — that is the service that's running that's going and asking for an IP address if this machine needs an IP address. So that's what's running on this side. If I were to go to a Windows server and take a look at the same thing, one that was running a DHCP server, I would see on that side a DHCP server, and it's listening for those requests. So a client's going to send a request, and then the server is going to be listening on those ports for that client's request so that it can respond to it.
To kick off this process, the DHCP client is going to send out a discovery. It's a DHCP discovery, and that is a broadcast that gets sent out on the layer 2 network. So it gets broadcasted out on the whole layer 2 network, so whatever DHCP servers are listening out there will receive that. You could actually have multiple servers reply to this DHCP discovery. So that's the discovery.
The next step — let's use this demo Pi as an example of something a DHCP server is running on. It's going to reply back and it's going to create an offer, and that's going to be a unicast, so it's going directly from this demo Pi and going directly to the demo laptop. It's destined for the MAC address of this demo laptop, and it's going to send that out with an IP address and some information on it that this demo laptop can use to get onto the network.
If there are multiple DHCP servers that are responding, then this demo laptop will choose the best one out of all of the offers, usually based off of the lease time, the longest lease time. And then it's going to respond back with a request: I'm going to request that what you have given, I'm requesting that now, I'm going to request that IP address. That also is sent as a broadcast, so if there were other DHCP servers that had responded, they'll see that request being sent back out and realize they can return those IP addresses to the pool. And just the one — in this case the demo Pi — will then realize that this is the machine that's actually getting the IP that I had made an offer for.
Then next what it does is it sends back — and this is also unicast, so it's directly going from the demo Pi to the demo laptop — an acknowledgment. So it's a DHCP acknowledgment that gets sent back to this demo laptop, so the demo laptop then can say, I now have this IP address, I've gone through this process, and now I can get onto the network knowing that I'm the only one on this network.
There are some different components that you should probably understand when it comes to DHCP, some terminology, some aspects to this.
First of all is the scope, or the pool. The scope or the pool is the range of addresses that can be handed out.
Then you have the lease time. The lease time is how long a client can hold on to that IP address for. So if you set it for 24 hours, then this laptop should release that IP address within 24 hours — although I have had to troubleshoot times when a client doesn't release that IP address properly. Usually it's on like a Mac or Apple machine, although I imagine that those are not as big of an issue nowadays. And what a machine will try to do is, when it's at the halfway point, it will request a renewal, so that way it doesn't get too close to that time.
Then you have reservations. A reservation is if I wanted a specific IP address on a specific machine, but I still want it to act as a DHCP client — then I can make a reservation on the server for that machine specifically. Let me just give you an example of this. Let's say I take this demo laptop and I go from network to network with it, and I don't want to sit there and assign a static IP address to it. So when I connect into this network I want a specific IP address, but I don't want to have to manually go in there and set an IP address for this machine. Also, when I'm on this network I only can do my admin duties when I'm in a certain range or with a certain IP address. So in that scenario I want to get a specific IP address, so I create a reservation for that machine, so that machine will get the same IP address every time it connects.
Then I have different options that I set. This could be things like a DNS server — most likely you're going to set a DNS server. The gateway — most likely you're going to set a gateway. A domain — many times we set a domain. And there are several other options that we can set on our DHCP server, so that this is information that gets handed out to the machine when it connects, so that way it can dynamically get some of this information.
We covered that client-server relationship. We got a little bit into the process and how it sends this discovery and offer and the request and the acknowledgment, so it sends this back and forth to confirm that the machine gets an IP address that's unique in the network. And then we talked about some of the components, like the scope and the lease time, that go into configuring DHCP.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →