To communicate on the network, each device needs an IP address.
This IP address will allow the device, whether a computer, a server, or a printer, to be visible to other devices in the network.
There are two ways to assign an IP address to a device; manually and dynamically.
You can assign an IP address manually if you have a few devices on your network, less than 10. More than that, it becomes challenging to do it manually.
Some organizations may have hundreds or thousands of devices in their network. In this case, a DHCP server would be of great help.
A DHCP server is a network management protocol that assigns IP addresses to devices that request it.
The acronym DHCP stands for Dynamic Host Configuration Protocol.
A DHCP server operates based on the client-server model.
When a device (the client) is first connected to the network, it broadcasts a request to all devices present on the network, asking if there is a DHCP server.
If a DHCP server exists, it will reply to the client by offering him an IP address.
The client, then, will request the IP address from the DHCP server.
Finally, the DHCP server assigns the client the IP address.
The four steps we just described are often abbreviated as DORA; Discovery, Offer, Request, and Acknowledge.
This guide will show you how to configure a DHCP server in Windows Server.
Install DHCP Role
It’s best practice you install a DHCP server on a dedicated server.
It is common for small companies to install the DHCP role on the domain controller server because of a lack of resources or convenience.
Installing additional roles on your domain controller increases the attack surface and can lead to performance issues.
Avoid this as you can.
To add the DHCP role using the PowerShell, open PowerShell with administrator privileges and type the following:
Install-WindowsFeature DHCP -IncludeManagementTools
Once the role is added, you need to complete the DHCP configuration. This creates the security groups you need to manage the DHCP server.
NB: Without authorizing the DHCP server on the active directory, domain-joined computers may not receive IPs from that DHCP server.
To do that, go to the Server Manager, click on the notification flag, then click on “Complete DHCP configuration“
Use an administrator account to authorize the DHCP server in Active Directory.
The DHCP server is now configured and ready for use.
Create DHCP Scope
Now that your DHCP server is ready for use, the next step is to create the DHCP scope.
The DHCP scope is a range of IP addresses the DHCP server can lease out to DHCP clients.
But before starting building your scope, it’s critical to do some planning.
Devices, such as servers, printers, and routers, have static IP addresses. You must identify these addresses to exclude them from the DHCP pool.
let’s take a simple example design:
- Local network: 192.168.1.0/24 (192.168.1.1 to 192.168.1.254)
- Static IP addresses (servers, printers, routers…etc.): 192.168.1.1 to 192.168.1.30. Be sure to leave room for additional devices.
- Dynamic IP addresses: 192.168.1.31 to 192.168.1.254
Configure and Activate the Scope
Click on “Tools” in the server manager, then click on “DHCP” to open the DHCP manager.
Right-click on IPv4 under the server node in the DHCP manager, then click on “New Scope“.
Type the name of the scope;
Enter the scope’s start and end IP address, and ensure that the subnet mask is correct.
If you need to reserve some IPs in the range for a specific use or other devices (Ex: mobile devices), you can exclude them on this page.
The lease duration specifies how long a client can use an IP address from this scope. The default value is 8 days.
At this step, you have to configure the most common DHCP options, such as the default gateway and DNS servers. Click “Yes, I want to configure these options now” and continue.
Enter the IP of the default gateway.
Specify the domain name the client computers on your network will use for DNS name resolution. If the server on which you installed the DHCP role is domain joined, it will populate the domain name in the “Parent domain” filed.
Next, add the DNS server IPs the DHCP clients use for domain name resolution.
WINS is a Microsoft proprietary protocol that resolves NetBIOS names of computers and servers to IP addresses. Nowadays, WINS servers are less used and are replaced by DNS servers. You can skip this step and click next.
Finally, you have to activate this scope.
Note that clients can obtain address leases only if a scope is activated.
The new scope is created and active.
Congratulations, you can now use your DHCP server to assign IPs to devices in your network.