Windows Server 2019 – DHCP versus static addressing

Initial Configurations of Windows server 2019

IP addresses on your network are sort of like home addresses on your street. When you want to send a package to someone, you write their address on the front of the package and set it in the mailbox. In the same way, when your computer wants to send data to a server or another device on a network, each of those devices has an IP address that is used for the delivery of those packets. We know that DNS is responsible for telling the machines which name resolves to which IP address, but how do those IP addresses get put into place on the servers and computers in the first place?

Static addressing is simply the process of configuring IP addresses on your system manually, using your own hands as the configuration tool in order to plug all of your IP address information into the NIC settings on that device. While this is a quick and easy way to get network traffic flowing between a few endpoints, by giving them each an IP address, it is not scalable. We do often statically address our servers as a way of making sure that those IP addresses are not subject to change, but what about on the client and device side? Even in a small company with 10 employees, each person may have a desktop and a laptop, there are likely going to be print servers on the network also needing IP addresses, and you may have a wireless network where employees or even guests can connect phones and other devices in order to gain internet access. Are you going to assign IP addresses by hand to all of these devices? Certainly not.

Our answer to this problem is the Dynamic Host Configuration Protocol (DHCP). This is a protocol that is designed to solve our exact problem by providing the ability for machines and devices to be plugged into your network and automatically obtain IP addressing information. Almost any user on any device in the entire world uses DHCP every day without even realizing it. When you connect your laptop or smartphone to a Wi-Fi router to gain internet access, a DHCP server has given you the ability to route traffic on that Wi-Fi network by assigning you IP addressing information. Often, in the case of a public Wi-Fi, your DHCP server is actually running on the router itself, but in our businesses where Windows Server rules the datacenter, our DHCP services are most often hosted on one or more servers across the network.

The DHCP scope

In the new Windows Server 2019 lab environment I have been building, so far I have been statically assigning IP addresses to all of the servers that are being built. This is starting to get old, and hard to keep track of. When the first Domain Controller was configured, I actually installed the DHCP role onto it, but haven’t told it to start doing anything yet. What does a DHCP server need in order to start handing out IP addresses? It needs to know what IP addresses, subnet mask, default gateway, and DNS server addresses are within your network so that it can package that up and start handing the information out to the computers who request it. This package of information inside the DHCP server is called a DHCP scope. Once we define our scope, the DHCP server will start handing out IP addresses from that scope to our new servers and computers which do not already have static addresses defined.

Once again, we need to launch a management tool on our Windows Server 2019, and once again, the easiest way to launch that is by using the Tools menu inside Server Manager. Go ahead and launch the DHCP console. Inside, you will see the name of your server where the DHCP server is running. Expand that, and you have options for both IPv4 and IPv6. Yes, this means that you can use this DHCP server to hand out both IPv4 addresses, as well as IPv6 addresses for those of you who are testing out IPv6, or have plans to in the future. For now, we are sticking with good old IPv4, and so I can right-click on IPv4 and choose to create a New Scope. This launches a New Scope Wizard that walks you through the few pieces of information that the DHCP server needs in order to create a scope that is ready to start handing out IP addresses inside your network. I am setting my new scope to hand out IP addresses from 10.10.10.100 through 10.10.10.150:

As soon as you finish creating your scope, it is immediately active and any computer in your network whose NIC is configured to grab an address automatically from a DHCP server will start doing so against this new DHCP server.

Now that our new scope has been created, you can expand the scope inside the DHCP console and see some additional information about this scope. By clicking on the Address Leases folder, you can see all of the DHCP addresses that have been handed out by this DHCP server. As you can see in the following screenshot, I have a Windows 10 client computer on the network, which does not have a static address, and so it has grabbed a DHCP address from my DHCP server. It has been given the first IP address that I defined in my scope, 10.10.10.100. The next machine that reaches in to grab an IP address from this DHCP server will receive 10.10.10.101, and so on from there:

DHCP reservations

Assigning IP addresses from a big pool of available ones is great, but these address leases are subject to expiry and change. This means that a computer that has 10.10.10.100 today might receive 10.10.10.125 tomorrow. Typically, this is fine from a desktop computer perspective, as they don’t generally care what IP address they have. Client computers are usually reaching outward on the network, but other devices are rarely trying to find and contact them. What if you have a more permanent fixture in your network, like a Windows Server, but you don’t want to have to deal with statically addressing this server? This is where DHCP reservations come into play. A reservation is the act of taking a single IP address within your DHCP scope, and reserving it to a particular device. This device will receive the same IP address every time it connects through the DHCP server, and this particular IP address will not be handed out to any other device on your network. By using reservations inside DHCP, you can allow the DHCP server to handle the assigning of IP addresses even to your permanent servers, so that you do not have to manually configure the NICs of those servers, yet still maintain permanent IP addresses on those machines.

You can see the folder called Reservations in the DHCP console. Currently, there is nothing listed here, but by right-clicking on Reservations and choosing New Reservation… we will create one for ourselves. Let’s work once again with that web1 server. Right now, I have a static IP address assigned to web1, but I will instead create a reservation for it on the IP address 10.10.10.150:

Whoa, whoa, whoa … back the train up. Most of the information on this screen makes sense—a quick description of the server name and the IP address itself—but how did I come up with that MAC address? A MAC address is a network card’s physical address on the network. When your networking equipment tries to send information to a certain IP address, or, in this case, when the DHCP server needs to hand a certain IP address to a particular NIC on a server, it needs a physical identifier for that network card. So, this MAC address is something that is unique to the NIC on my web1 server. By logging into my web1 server, I can run ipconfig /all and see the MAC address listed for my NIC right in that output, that goofy looking combination of letters and numbers shown as Physical Address. That is where I got this information. This is how DHCP decides when to invoke reservations. If a network interface asks it for a DHCP address, and that device’s MAC address is listed here in the reservations, then the DHCP server will hand the reserved address back to the device, rather than one from the general pool:

Now that our DHCP reservation has been created, I will head into the NIC settings on my web1 server, and get rid of all the static IP addressing information by choosing the option to  Obtain an IP address automatically:

After doing that, web1 will reach over to the DHCP server and ask for an address, and you can see that I have now been assigned the reserved address of 10.10.10.150. This will always be the IP address of the web1 server from this point forward, unless I change my DHCP Reservation or somehow change the MAC address of web1. This could possibly happen if I were to install a new NIC into web1:

You can also create DHCP Reservations for objects other than Windows devices in your network. Since all you need is the MAC address of the device (and every device with a network adapter has a MAC address), it is easy to create reservations for devices such as print servers, copy machines, security alarm systems, and more.

Comments are closed.