DHCP
Last updated
DHCP stands for Dynamic Host Configuration Protocol. It is a network protocol used to automatically assign and manage IP addresses and other network configuration information to devices on a TCP/IP network. DHCP eliminates the need for administrators to manually assign static IP addresses to each device on a network.
Here's a brief overview of how DHCP works:
Discover (D): The client (device seeking an IP address) sends a DHCP Discover message to discover available DHCP servers on the network.
Offer (O): DHCP servers respond to the Discover message with a DHCP Offer, providing an IP address and other configuration details that the client can use.
Request (R): The client selects one of the offered IP addresses and sends a DHCP Request message to request the allocation of the chosen address from the DHCP server.
Acknowledge (A): The DHCP server acknowledges the client's request with a DHCP Acknowledge message, finalizing the allocation of the IP address and providing additional network configuration information.
The DORA process represents the sequence of interactions between the DHCP client and server as the client seeks and obtains an IP address dynamically from the DHCP server on the network.
In this scenario, we are going to install DHCP on the server and then specify a scope in the range of 192.168.10.0/24. Then, we'll check the client and verify the configuration.
Things to check before you start:
Assign a static IP address to the server.
You must have administrative privilege to install a DHCP server role.
Let’s get started.
Step1: Install the DHCP Server Role in Windows Server
We should have sufficient permission to install the DHCP server role and to authorize the DHCP server.
1. Open Server Manager console to view the Server Manager Dashboard.
On the Server Manager dashboard, Click on Manage and select Add Roles and Features.
On the Before you begin window, click on “Next” at the lower right corner, this brings you to the next part of the process.
On the Select installation type window, select Role-based or feature based installation then click Next.
On the Select server roles console, select the DHCP Server role for installation.
As soon as you choose DHCP Server role, the new window will show you the features that will be added for the DHCP Server role. Click Add Features then click Next.
On the select features console, just click next because we do not require any extra features at the moment.
The next window shows you a brief description about the DHCP Service being added to the server as well as recommendations. You can click Next to continue.
On the Confirm installation selections window, click Install to start the installation process. This may take a few minutes.
Once the installation is done, click on the “Complete DHCP configuration” link to start the DHCP post-install wizard.
In case, if you close the console still you can start the “DHCP post-install wizard” by clicking on the yellow exclamation mark on the flag in server manager dashboard.
Step2: DHCP Post Install Configuration
The description window will show you what the DHCP post-install configuration will do next.
This will create two security groups for DHCP administration:
DHCP Administrators
DHCP Users
If the server where you are installing DHCP server role is a domain controller or member server, then this wizard is also going to register DHCP service in Active Directory as well. That is known as a DHCP authorization in Active Directory.
Click on Next to continue.
2. On the Authorization window, we will need to specify the user credential to register the DHCP service in Active Directory. We will be using the domain administrator account which has the right privilege to join our domain, for this case it will be “HARCHIT\Administrator”.
Click Commit to proceed.
Once the security group creation and DHCP authorization completes, you can click close to continue.
That’s it, we have successfully completed the installation of DHCP server role on machine.
A scope is a range of IP addresses on a particular subnet that a DHCP server has selected for allocation to clients when they make a DHCP request.
You can use the DHCP management console or PowerShell to create DHCP scope. In this tutorial we will create an IPv4 DHCP scope using the DHCP management console.
1. On the Server Manager console, Click on Tools and select DHCP to open the DHCP management tool.
On the DHCP console, expand your server name. In my case it is winserver.harchit.local.
3. Select IPv4. On the right pane you will see an overview about DHCP scope and how to create a scope.
4. Right click on IPv4 and select the “New Scope” option.
The New Scope wizard starts. Click Next.
On the Scope Name screen, type any name of your choice for the scope name, this will help you identify the DHCP Scope once it’s created. Adding a description is optional but it can help identify the scope better in the future by adding any relevant information in the field.
On the IP Address Range screen, provide an IP address range (Start IP address and End IP address). For this demo I am using 192.168.10.20 to 192.168.10.30 with subnet mask 255.255.255.0. Once you are done with all, click next to proceed.
Note: The defined Start and End IP Addresses will be the IP Addresses that will be Offered to our hosts requesting an IP Address. For this case, any Requesting hosts will be given an IP address between 192.168.10.20 - 192.168.10.30 with a subnet of /24 or 255.255.255.0.
On the Add Exclusions and Delay screen, leave it empty. Click on Next.
On the Lease Duration screen, the default lease time for an assigned IP Address will be 8 days (as shown below). I will change the default lease duration and set the new lease duration to 8 hours. You can adjust it as per your requirement. Click Next to continue.
On Configure DHCP Option, we can configure additional DHCP options such as our routers’ IP Address or the Default Gateway, DNS server address and WINS settings for the scope we are creating.
Select “Yes, I want to configure these options now” and click Next to continue.
On the Router (Default Gateway) page, add your gateway's IP address 192.168.10.1 then click on Add then click Next.
We have install the DHCP server role on our Domain Controller, so the wizard will automatically detect the DNS server’s address. If you wish to add another DNS server address you can but for this demo will use our local DNS address only. Click Next.
If you have any WINS server in your network, you can specify the address here. Since we don’t have any WINS server we can simply leave it blank and click Next.
On the Activate Scope window, select “Yes, I want to activate this scope now” then click Next.
On the next screen, click Finish to create a DHCP scope and close the wizard.
On the DHCP Console, Now you can see your newly created scope ready to distribute IP addresses to client computers.
To verify the DHCP server is working properly, we will be using a client PC which is connected to the same network where our DHCP Server is.
1. Go to Windows 10 client machine. Right click on start button and select “Network Connections”.
Under change your network settings, click on change adapter settings that will open Network connection console.
Select Ethernet adapter, Right click on it and select Properties.
Select TCP/IPv4 and click on Properties.
Make sure you choose Obtain an IP address automatically, same goes to Obtain DNS server address automatically. Click OK button.
Click on Close to close “Ethernet Properties” console.
Right click on Ethernet adapter again and select status.
Click on details option.
Here you can verify that our windows 10 client is getting IP address from DHCP Server that you just configured.
10. Even from the DHCP management console you can verify that clients are getting IP’s from the DHCP server.
After this we can safely say that our DHCP server is configured and ready to allocate TCP/IP settings to the DHCP clients.