How to Set Up DHCP Server on Windows Server 2016
A DHCP (Dynamic Host Configuration Protocol) server automatically assigns IP addresses, subnet masks, default gateways, DNS server addresses, and other configuration parameters to clients on the network. Windows Server 2016 includes a full-featured DHCP Server role. This guide covers installing the DHCP Server role, creating and activating scopes, configuring exclusions and reservations, authorizing the server in Active Directory, and managing leases.
Prerequisites
The server running the DHCP role must itself have a static IP address. Ensure the DNS Server role or a reachable DNS server is available. If the server is part of an Active Directory domain, you will need Domain Admin or Enterprise Admin credentials to authorize the DHCP server in Active Directory — an unauthorized DHCP server on a domain will not hand out leases to domain clients.
Step 1: Install the DHCP Server Role
# Install DHCP Server role with management tools
Install-WindowsFeature -Name DHCP -IncludeManagementTools
# Verify installation
Get-WindowsFeature -Name DHCP | Select-Object Name, InstallState
Step 2: Authorize the DHCP Server in Active Directory
On a domain, DHCP servers must be authorized before they can serve leases. Unauthorized servers are blocked by domain controllers:
# Authorize the DHCP server (requires Domain Admin credentials)
Add-DhcpServerInDC -DnsName "WS2016-SRV01.corp.example.com" -IPAddress 192.168.1.10
# Verify the server is authorized
Get-DhcpServerInDC
For a standalone workgroup server, authorization in AD is not required. The DHCP service will start and begin serving leases immediately.
Step 3: Create a DHCP Scope
A scope defines the range of IP addresses that the DHCP server can assign to clients. Create a scope for your subnet:
# Create a new DHCP scope
Add-DhcpServerv4Scope `
-Name "Office LAN" `
-StartRange 192.168.1.100 `
-EndRange 192.168.1.200 `
-SubnetMask 255.255.255.0 `
-Description "DHCP scope for the office LAN" `
-State Active `
-LeaseDuration (New-TimeSpan -Days 8)
# Verify the scope was created
Get-DhcpServerv4Scope
Step 4: Set Scope Options (Gateway, DNS, Domain)
Configure scope options to provide clients with the default gateway, DNS servers, and domain name:
# Set default gateway for the scope
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -OptionId 3 -Value 192.168.1.1
# Set DNS server addresses
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -OptionId 6 -Value @("192.168.1.10","8.8.8.8")
# Set DNS domain name
Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -OptionId 15 -Value "corp.example.com"
# Verify scope options
Get-DhcpServerv4OptionValue -ScopeId 192.168.1.0
Step 5: Add Exclusion Ranges
Exclude IP addresses from the scope that are already assigned statically to servers, printers, or network equipment:
# Exclude a range of addresses (e.g., for static devices)
Add-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0 -StartRange 192.168.1.100 -EndRange 192.168.1.119
# Verify exclusion ranges
Get-DhcpServerv4ExclusionRange -ScopeId 192.168.1.0
Step 6: Create DHCP Reservations
Reservations bind a specific MAC address to a specific IP address, ensuring a device always receives the same IP while still being managed by DHCP:
# Create a DHCP reservation
Add-DhcpServerv4Reservation `
-ScopeId 192.168.1.0 `
-IPAddress 192.168.1.120 `
-ClientId "AA-BB-CC-DD-EE-FF" `
-Description "Network Printer HP LaserJet" `
-Name "printer01"
# List all reservations in the scope
Get-DhcpServerv4Reservation -ScopeId 192.168.1.0
Step 7: View and Manage Active Leases
# View all active leases
Get-DhcpServerv4Lease -ScopeId 192.168.1.0
# Find a lease by hostname
Get-DhcpServerv4Lease -ScopeId 192.168.1.0 | Where-Object { $_.HostName -like "*desktop01*" }
# Remove a specific lease
Remove-DhcpServerv4Lease -ScopeId 192.168.1.0 -ClientId "AA-BB-CC-DD-EE-FF"
# View DHCP lease statistics
Get-DhcpServerv4ScopeStatistics -ScopeId 192.168.1.0
Step 8: Configure DHCP Failover (High Availability)
DHCP failover allows two DHCP servers to share the same scope for high availability. If one server fails, the other continues to serve leases. This requires a second DHCP server:
# Configure DHCP failover with a partner server
Add-DhcpServerv4Failover `
-Name "LAN-Failover" `
-PartnerServer "WS2016-SRV02.corp.example.com" `
-ScopeId 192.168.1.0 `
-Mode HotStandby `
-ServerRole Active `
-ReservePercent 20 `
-MaxClientLeadTime (New-TimeSpan -Hours 1) `
-AutoStateTransition $true
# View failover configuration
Get-DhcpServerv4Failover
Step 9: Enable DHCP Audit Logging
# Check if audit logging is enabled
Get-DhcpServerAuditLog
# Enable audit logging
Set-DhcpServerAuditLog -Enable $true -Path "C:WindowsSystem32dhcp"
# View the DHCP audit log (today's log)
$today = (Get-Date).DayOfWeek.ToString().Substring(0,3)
Get-Content "C:WindowsSystem32dhcpDhcpSrvLog-$today.log" | Select-Object -Last 50
Step 10: Verify DHCP Server Operation
# Check DHCP service status
Get-Service -Name DHCPServer | Select-Object Status, StartType
# View DHCP server statistics
Get-DhcpServerv4Statistics
# List all scopes with their statistics
Get-DhcpServerv4Scope | ForEach-Object {
$stats = Get-DhcpServerv4ScopeStatistics -ScopeId $_.ScopeId
[PSCustomObject]@{
ScopeId = $_.ScopeId
Name = $_.Name
AddressesFree = $stats.AddressesFree
AddressesInUse = $stats.AddressesInUse
}
}
The DHCP Server is now fully configured on Windows Server 2016. Clients on the network will receive IP addresses, gateway information, and DNS configuration automatically. Reservations ensure that critical devices always receive the same address, and the optional failover configuration provides high availability in the event of a server failure.