How to Configure a DHCP Server on Windows Server 2012 R2

The Dynamic Host Configuration Protocol (DHCP) automates the assignment of IP addresses, subnet masks, default gateways, DNS servers, and other network configuration parameters to clients on a network. Without DHCP, every device would require manual static IP configuration — an unmanageable burden in environments with more than a handful of machines. Windows Server 2012 R2 includes a full-featured DHCP Server role with support for IPv4, IPv6, failover pairs, policies, and Active Directory authorization.

This guide covers installing DHCP, creating scopes, configuring options, authorising the server in Active Directory, setting up DHCP failover, and performing routine management tasks using both Server Manager and PowerShell.

Prerequisites

  • Windows Server 2012 R2 with a static IP address on each network interface that will serve DHCP.
  • Domain Administrator credentials (for AD authorisation).
  • IP address ranges planned — know which ranges to exclude for static assignments.
  • Default gateway and DNS server IP addresses for each scope.

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

# Add the DHCP administrators security groups (created automatically on install)
netsh dhcp add securitygroups

# Restart the DHCP service to register the security groups
Restart-Service -Name DHCPServer

Step 2: Authorize the DHCP Server in Active Directory

In Active Directory domains, DHCP servers must be explicitly authorised before they will start leasing addresses. This prevents rogue DHCP servers from disrupting the network.

# Authorize the DHCP server in Active Directory
Add-DhcpServerInDC -DnsName "dc01.corp.example.com" -IPAddress 192.168.1.10

# Verify that the server is authorized
Get-DhcpServerInDC

# If the server is not domain-joined, authorize by IP only
Add-DhcpServerInDC -IPAddress 192.168.1.10

Step 3: Create an IPv4 Scope

A scope defines the pool of IP addresses the DHCP server can assign for a particular subnet.

# Create a scope for the 192.168.1.0/24 subnet
Add-DhcpServerv4Scope `
    -Name "Corporate LAN - Building A" `
    -Description "Main office floor 1 and 2 clients" `
    -StartRange 192.168.1.100 `
    -EndRange 192.168.1.250 `
    -SubnetMask 255.255.255.0 `
    -State Active `
    -LeaseDuration "8.00:00:00"

# Add an exclusion range within the scope (for printers, servers, etc.)
Add-DhcpServerv4ExclusionRange `
    -ScopeId 192.168.1.0 `
    -StartRange 192.168.1.200 `
    -EndRange 192.168.1.220

# List all scopes
Get-DhcpServerv4Scope | Select-Object ScopeId, Name, StartRange, EndRange, State

Step 4: Configure Scope Options

Scope options are the extra parameters (gateway, DNS, domain name) sent to clients along with their IP address.

# Set default gateway (option 3) for the scope
Set-DhcpServerv4OptionValue `
    -ScopeId 192.168.1.0 `
    -OptionId 3 `
    -Value "192.168.1.1"

# Set DNS servers (option 6)
Set-DhcpServerv4OptionValue `
    -ScopeId 192.168.1.0 `
    -OptionId 6 `
    -Value "192.168.1.10","192.168.1.11"

# Set DNS domain name (option 15)
Set-DhcpServerv4OptionValue `
    -ScopeId 192.168.1.0 `
    -OptionId 15 `
    -Value "corp.example.com"

# Set NTP server (option 42)
Set-DhcpServerv4OptionValue `
    -ScopeId 192.168.1.0 `
    -OptionId 42 `
    -Value "192.168.1.10"

# Configure server-level options (apply to all scopes)
Set-DhcpServerv4OptionValue `
    -OptionId 6 `
    -Value "192.168.1.10","192.168.1.11"

# View all options for a scope
Get-DhcpServerv4OptionValue -ScopeId 192.168.1.0

Step 5: Create DHCP Reservations

Reservations guarantee a specific IP address to a device based on its MAC address. Use these for servers, printers, and other devices that need a predictable IP but where you still want the convenience of DHCP management.

# Add a reservation
Add-DhcpServerv4Reservation `
    -ScopeId 192.168.1.0 `
    -IPAddress 192.168.1.150 `
    -ClientId "00-1A-2B-3C-4D-5E" `
    -Description "Network Printer - Floor 1" `
    -Name "printer-floor1"

# List all reservations in a scope
Get-DhcpServerv4Reservation -ScopeId 192.168.1.0 | 
    Select-Object IPAddress, ClientId, Description

# Remove a reservation
Remove-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.150

Step 6: Configure DHCP Failover

DHCP failover, introduced in Windows Server 2012, allows two DHCP servers to share responsibility for a scope. If one server goes offline, the other continues to serve leases. This is the recommended high-availability configuration — it replaces the old split-scope method.

# Configure DHCP failover in Load Balance mode (both servers active)
Add-DhcpServerv4Failover `
    -Name "DHCP-Failover-Corp" `
    -PartnerServer "dhcp02.corp.example.com" `
    -ScopeId 192.168.1.0 `
    -LoadBalancePercent 50 `
    -SharedSecret "Sup3rS3cr3t!" `
    -AutoStateTransition $true `
    -MaxClientLeadTime "01:00:00"

# Configure failover in Hot Standby mode (one server standby)
Add-DhcpServerv4Failover `
    -Name "DHCP-Failover-Corp-Standby" `
    -PartnerServer "dhcp02.corp.example.com" `
    -ScopeId 192.168.2.0 `
    -Mode HotStandby `
    -ServerRole Active `
    -ReservePercent 5 `
    -SharedSecret "Sup3rS3cr3t!"

# View failover configuration
Get-DhcpServerv4Failover

Step 7: Enable DNS Dynamic Update Integration

DHCP can automatically create and update DNS records when clients get leases, keeping DNS in sync with DHCP assignments.

# Configure DNS update settings for all scopes
Set-DhcpServerv4DnsSetting `
    -DynamicUpdates "Always" `
    -DeleteDnsRROnLeaseExpiry $true `
    -UpdateDnsRRForOlderClients $true

# Configure DNS updates for a specific scope
Set-DhcpServerv4DnsSetting `
    -ScopeId 192.168.1.0 `
    -DynamicUpdates "OnClientRequest" `
    -DeleteDnsRROnLeaseExpiry $true

# View DNS settings
Get-DhcpServerv4DnsSetting

Monitoring and Troubleshooting

# List all active leases in a scope
Get-DhcpServerv4Lease -ScopeId 192.168.1.0 | 
    Select-Object IPAddress, HostName, ClientId, LeaseExpiryTime | Sort-Object IPAddress

# Get DHCP server statistics
Get-DhcpServerv4Statistics

# Get scope utilisation
Get-DhcpServerv4ScopeStatistics -ScopeId 192.168.1.0

# Check the DHCP server audit log
Get-Content "C:WindowsSystem32DhcpDhcpSrvLog-Mon.log" -Tail 30

# Reconcile scope (fix database inconsistencies)
Invoke-DhcpServerv4DbReconcile -ScopeId 192.168.1.0

Summary

A well-configured DHCP server on Windows Server 2012 R2 is the silent workhorse of your network, handling IP assignment for every workstation, laptop, and network device. The essential steps are: install the DHCP role, authorise it in Active Directory, create scopes with appropriate ranges and exclusions, set scope options for gateway and DNS, create reservations for devices needing stable addresses, and deploy DHCP failover for resilience. Always pair DHCP with DNS dynamic updates so your name resolution stays current as leases are assigned and expire. PowerShell’s DhcpServer module makes the entire lifecycle — from initial configuration to daily monitoring — fully scriptable and automatable.