Step-by-Step DHCP Load Balance Cluster on Windows Server 2012 R2

Overview

In large environments a single DHCP server may become overwhelmed by the amount of client DHCP lease requests it receives. Load balancing your Windows DHCP server allows you to improve performance and availability by spreading the load across multiple servers.

When a load balance cluster is created, a partnership between two servers is defined. Each server is able to read and write to the DHCP scope’s database. Any changes are then replicated to the other partner to insure consistency.

Clustering is done at the scope level, allowing us to use one server, for example, as a cluster partner with multiple remote servers.  We can selectively choose to cluster all scopes available on a server or a selection of scopes.

This step-by-step tutorial will guide you through configuring a DHCP load balance cluster on Windows Server 2012 R2.

Requirements

  • An existing Active Directory Domain.
  • Two Windows Server 2012 R2 servers that are domain members.

Install the DHCP Server Role

The DHCP server role must be installed on both servers before the cluster can be created.

  1. Log onto the first server with an account that has administrative rights.
  2. Launch the Server Manager console.
  3. In the top-right corner, click Manage.

    Click the Manage link in Server Manager
    FIG1Click the Manage link in Server Manager
  4. Click Add Roles and Features.
  5. On the Before You Begin page, click Next.
  6. On the Select installation type screen, ensure Role-based or feature-based installation is selected, and then click Next.
  7. On the Select destination server screen, ensure Select a server from the server pool is selected, select the local server in the Server Pool list, and then click Next.
  8. On the Select server roles screen, ensure DHCP Server is checked. A dialog box called Add Roles and Features Wizard will appear, if dependencies exist. Click Add Feature to ensure all dependent roles or features are installed in addition to the DHCP server role.
  9. Click Next.
  10. On the Select features screen, click Next.
  11. On the DHCP Server screen, click Next.
  12. On the Confirmation screen, click Install.
  13. After the installation process completes, there should be a link named Complete DHCP Configuration. Click it to start the DHCP Server Active Directory authorization process. A DHCP server must be authorized before it can assign DHCP leases.
  14. On the Description screen of the DHCP Post-Install Configuration wizard, click Next.
  15. On the Authorization screen of the DHCP Post-Install Configuration wizard, select the appropriate option for selecting a user with domain admin rights. This is required to authorize the server. When done, click Commit.
  16. On the Summary screen, review the output to ensure the authorization was successful. Click Close.
  17. On the Results screen of the Add Roles and Features Wizard, click Close.
  18. Log onto the second server and repeat steps 2 through 17.

Create a DHCP Scope

The cluster cannot be created unless a DHCP scope exists. Let’s create a simple scope to start.

  1. Log onto the first DHCP server.
  2. Launch the Server Manager console.
  3. On the top-right, click Tools.
  4. Select DHCP from the Tools drop-down menu.
  5. From the DHCP tree on the left of the console, expand the node named after the server.
  6. Select the IPv4 node by clicking it.
  7. Right-click the IPv4 node and then select New Scope.
  8. Go through the New Scope Wizard to create the new scope.

 Create the Load Balance Cluster

  1. From within the DHCP console, right-click the IPv4 node of the DHCP server tree on the left-side.

    Windows Server 2012 R2 DHCP Console
    FIG2Windows Server 2012 R2 DHCP Console
  2. Click Configure Failover from the IPv4 context menu.
  3. When the Configure Failover dialog box appears, select from the available scopes that you wish to have in the cluster. If you want to include all of them, check the Select All box.
    DHCP Configure Cluster Dialog Box
    FIG3DHCP Configure Cluster Dialog Box
    You can create multiple partner relationships with other DHCP servers. This allows you to create clusters between all of your remote site DHCP servers and a central head office server.
  4. Click Next.
  5. Click Add Server to add the DHCP partner server. Alternatively, you can enter its IP address or fully-qualified domain name into the text field.
  6. Click Next.
  7. On the Create a new failover relationship screen, give the cluster relationship a name.

    Configure Cluster - DHCP Load Balance
    FIG4Configure Cluster – DHCP Load Balance
  8. Set the Maximum Client Lead Time value using hours and minutes.
    This sets the maximum amount of time a partner DHCP server can extend a lease to a client after the owner of the scope fails. This also sets how long the partner DHCP will wait for the failed owner before taking full control of the scope.
  9. From the Mode drop-down menu, select Load balance.
  10. Adjust the Load Balance Percentage values of the two DHCP servers. The default creates a 50/50 balance between both nodes.
  11. Ensure Enable Message Authentication is checked.
  12. In the Shared Secret text field, enter a complex password that will be used by the servers. This ensures that only servers who know the password can communicate in the cluster.
  13. Click Next.
  14. Verify your settings, and then click Finish.
  15. Log onto the second DHCP server.
  16. Launch the DHCP console and verify that the scope we created on the first DHCP server has been replicated to the second server.

Creating a DHCP Failover Cluster using PowerShell

We can accomplish the same task above using PowerShell. This is very useful when administering the servers remotely from a client computer.

  1. Launch PowerShell.
  2. Use the Add-DhcpServerv4Failover cmdlet. The example below creates a partnership (cluster) called Toronto-Loadbalance using servers WS12-DHCP01 and WS12-DHCP02.
    Add-DhcpServerv4Failover -ComputerName ws12-dhcp01.serverlab.intra -Name Toronto-Loadbalance -PartnerServer ws12-dhcp02.serverlab.intra -ScopeId 172.30.0.0 -LoadBalancePercent 50 -MaxClientLeadTime 2:00:00
  3. Verify the cluster’s configuration using the Get-DhcpServerv4Failover cmdlet.
    Name                : Toronto-Loadbalance
    PartnerServer       : ws12-dhcp02.corp.serverlab.intra
    Mode                : LoadBalance
    LoadBalancePercent  : 50
    ServerRole          :
    ReservePercent      :
    MaxClientLeadTime   : 02:00:00
    StateSwitchInterval :
    State               : Normal
    ScopeId             :
    AutoStateTransition : False
    EnableAuth          : True