Windows Server 2012 DHCP Clustering

Getting Started with Windows DHCP on Server Core

At work, we currently switched from a Linux dhcpd server to a Windows 2012 R2 DHCP cluster. Here’s how I built the cluster.

What to Know:

  • Windows DHCP Clustering does not require Microsoft Failover Clustering (MSCS).
  • Windows DHCP Clustering will synchronize leases, but it will not synchronize scope options or reservations. To do that, you’ll have to use PowerShell.

The Basics

  1. Install and Authorize the DHCP role on two nodes.
  2. Create a scope.
  3. Create a failover partnership.
  4. Synchronize scope options with PowerShell.

Step-By-Step

Install and Authorize the DHCP servers.

Login to each server (preferably with PS Remoting) and run the following command in PowerShell.

Install-WindowsFeature DHCP –IncludeManagementTools
#Authorize
Add-DhcpServerInDC

Configure the DHCP servers.

Login to one of the servers, and run the following code after modifying it for your needs.

#add some scopes!
Add-DhcpServerv4Scope -Name "Network 1" -StartRange 10.10.10.1 -EndRange 10.10.10.254 -SubnetMask 255.255.255.0
Add-DhcpServerv4Scope -Name "Network 2" -StartRange 10.10.20.1 -EndRange 10.10.20.254 -SubnetMask 255.255.255.0

#configure failover for the scopes
Add-DhcpServerv4Failover -ComputerName <dhcpServer1-FQDN> -PartnerServer <dhcpServer2-FQDN> -Name "server1-server2" -ScopeId <Scope – ex: 10.10.10.0,10.10.11.0> -SharedSecret "Password"

#configure some DHCP options on one of the servers (note: does not auto-replicate).
Set-DhcpServerv4OptionValue -DnsDomain <option-15-domain-name> -DnsServer <option-5-dns-servers> [-optionId <ID#> -Value <"IdValue">]
Set-DhcpServerv4OptionValue –ScopeID <10.10.10.0> –Router <10.10.10.1> [-optionId <ID#> -Value <"IdValue">]

References

Sync DHCP Options

You will soon notice that DHCP options are not automatically synchronized. Here’s a microsoft blog article about the issue.

What to know about the Microsoft DHCP Sync Tool:

  • It launches at startup via task manager and then runs in the background.
  • The tool should be installed on one DHCP server only.
  • Any changes to DHCP should be done on the server where the DHCP Sync Tool is installed.
  • The DHCP Sync Tool will not delete scope options.
  • The DHCP Sync Tool will not synchronize server-level options.
  • If new scopes are created after the sync tool is launched, the tool will not synchronize changes to the new scopes until the tool is restarted.

It’s not a perfect tool, but it works well for what it does (scope synchronization). I’m planning on double-checking changes I make anyway.

  1. Download the DHCP Config Automatic Sync Tool from Microsoft.
  2. Extract the zip file to your desired destination folder (ex: C:\scripts\dhcpSync).
  3. Open powershell and navigate to the extracted tool folder.
  4. Run .\install.ps1.
  5. Open Task Manager, navigate to Microsoft -> DHCP Server.
  6. Right-click the newly created task and choose ‘Run’.

You’re now sync’ing. Grats!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s