Edit

Share via


Manage DHCP failover relationships in Windows Server

Failover relationships are settings used by two DHCP servers to share one or more failover-enabled DHCP scopes.

In this article, follow the steps to create, view, edit, and delete DHCP failover relationships in Windows Server.

Prerequisites

  • At least Windows Server 2012

  • The DHCP server role is installed

  • Understand how failover relationships work. For more information about DHCP failover relationships, see DHCP failover overview.

  • Two network-connected DHCP servers that can communicate with each other

  • At least one IPv4 DHCP scope is configured on the primary DHCP server.

Configure failover relationships

To create a failover relationship on a DHCP server, you can use PowerShell, or you can use the DHCP console. Follow the steps for the method of your choice.

Some notes to consider about creating a failover relationship:

  • The default DHCP failover mode is load balance with 50% of leases assigned by the local server and 50% assigned by the partner server.
  • Authentication is enabled by default, but this setting isn't required. If authentication is enabled, you must also provide a shared secret.
  • The scope ID provided must correspond to a scope configured on the local server that isn't already failover-enabled, and doesn't already exist on the partner server.
  • If DHCP failover is being configured remotely, the local server refers to the server specified on the command line or added to the management console.
  • You can't enable DHCP failover on a DHCP scope if the scope already exists on both DHCP servers in a failover relationship, as might occur in a split scope configuration.
  • If a DHCP scope exists on the partner DHCP server, it must be deleted prior to configuring DHCP failover.

To configure a failover relationship using PowerShell, complete the following steps:

  1. On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.

  2. Right-click Windows PowerShell and select Run as Administrator.

  3. Use the PowerShell cmdlet Add-DhcpServerv4Failover to add an IPv4 failover relationship on the DHCP server service. Run the following command to create a load balance failover relationship:

Add-DhcpServerv4Failover -ComputerName "dhcp1.contoso.com" -Name "dc1-dhcp1" -PartnerServer "dhcp2.contoso.com" -ScopeId 10.10.10.0,10.20.20.0 -SharedSecret "sEcReT"

This command creates a load balance failover relationship between dhcp1.contoso.com and dhcp2.contoso.com. The failover has scopes 10.10.10.0, and 10.20.20.0 present on dhcp1.contoso.com. These scopes are created on the partner DHCP server service that runs on the computer named dhcp2.contoso.com as part of the failover relationship creation. Message authentication is enabled for the server-to-server message exchange with the specified shared secret.

To create a hot standby failover relationship, use the command:

Add-DhcpServerv4Failover -ComputerName "dhcp1.contoso.com" -Name "dc1-dhcp1" -PartnerServer "dhcp2.contoso.com" -ServerRole Standby -ScopeId 10.10.10.0,10.20.20.0

dhcpserver.contoso.com is the standby DHCP server service, and dhcpserver2.contoso.com is the active DHCP server service in the failover relationship.

View failover relationships

You can view failover relationships on a DHCP server using either Windows PowerShell, or the DHCP console.

To view failover relationships on a DHCP server, you can use the cmdlet Get-DhcpServerv4Failover in an elevated Windows PowerShell prompt.

  1. On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.

  2. Right-click Windows PowerShell and select Run as Administrator.

  3. Run the following command:

Get-DhcpServerv4Failover
    Name                : dc1.contoso.com-192.168.0.254
    PartnerServer       : 192.168.0.254
    Mode                : HotStandby
    LoadBalancePercent  :
    ServerRole          : Active
    ReservePercent      : 5
    MaxClientLeadTime   : 01:00:00
    StateSwitchInterval :
    State               : Normal
    ScopeId             : {192.168.50.0, 192.168.0.0}
    AutoStateTransition : False
    EnableAuth          : False
    
    Name                : dhcp1-dc1 load balance
    PartnerServer       : dhcp1.contoso.com
    Mode                : LoadBalance
    LoadBalancePercent  : 50
    ServerRole          :
    ReservePercent      :
    MaxClientLeadTime   : 01:00:00
    StateSwitchInterval :
    State               : Normal
    ScopeId             :
    AutoStateTransition : False
    EnableAuth          : False

An advantage to using Windows PowerShell to view failover relationships is that you can view more properties of the DHCP failover relationship than you can see in the DHCP console.

Edit failover relationships

To edit failover relationships on a DHCP server, you can either use PowerShell or the DHCP console.

To edit failover relationships on a DHCP server, you can use the cmdlet Set-DhcpServerv4Failover.

  1. On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.

  2. Right-click Windows PowerShell and select Run as Administrator.

  3. Run the following command:

Set-DhcpServerv4Failover –Name "dhcp1-dc1" –LoadBalancePercent 70

This command changes the failover relationship dhcp1-dc1 to take 70% of the client requests served by the DHCP server.

Delete failover relationships

To delete a failover relationship on a DHCP server, you can either use PowerShell or the DHCP console.

To edit failover relationships on a DHCP server, you can use the cmdlet Remove-DhcpServerv4Failover.

  1. On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.

  2. Right-click Windows PowerShell and select Run as Administrator.

  3. Run the following command:

Remove-DhcpServerv4Failover –Name dhcp1.contoso.com-dhcp2-dns1.contoso.com

DHCP Failover overview