Поделиться через


Configure DHCP Failover using the Command Line

 

Applies To: Windows Server 2012 R2, Windows Server 2012

Use the following procedures to configure DHCP failover using the command line. When you have completed the procedures in this topic, return to the parent checklist: Checklist: Deploy DHCP Failover.

Configuring DHCP failover with the command line uses Windows PowerShell. To configure DHCP failover using the Windows interface instead, see Configure DHCP Failover using the DHCP Console.

Additional considerations:

  • When you configure DHCP failover, you can accept default values for several parameters, or you can specify custom values. For more information about DHCP failover settings, see DHCP Failover Settings.

  • DHCP failover can be configured on a single DHCP scope, or you can configure multiple scopes simultaneously if they will all use the same failover relationship. The procedures below describe how to specify a new failover relationship for use with a single DHCP scope. Multiple scopes can be configured using the command line by providing a comma-delimited list of scope IDs after the ScopeID parameter.

  • In the following procedures, the Add-DhcpServerv4Failover cmdlet is used to create a new DHCP failover relationship. You can also add scopes to an existing DHCP failover relationship using the Add-DhcpServerv4FailoverScope cmdlet. For more information about Windows PowerShell cmdlets for configuring and managing DHCP failover relationships, scopes, and server settings, see DHCP Server Cmdlets in Windows PowerShell.

To configure DHCP failover, you must choose load balance or hot standby mode:

Configure DHCP failover in load balance mode using the command line

Membership in the Administrators group, or equivalent, is the minimum required to complete these procedures. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (https://go.microsoft.com/fwlink/?LinkId=83477).

To configure DHCP failover in load balance mode using the command line

  1. On a computer with the Windows PowerShell DHCP Server module installed, right-click Windows PowerShell and then click Run as Administrator.

  2. Type the following at the command line, and then press ENTER. Replace the example values with values used in your environment.

    Add-DhcpServerv4Failover –ComputerName dhcp1.contoso.com –PartnerServer dhcp2.contoso.com –Name dhcp1-dhcp2 –ScopeID 10.10.10.0 –LoadBalancePercent 70 –SharedSecret sEcReT -Force
    

In this example, the primary DHCP server is named dhcp1.contoso.com and the secondary DHCP server is named dhcp2.contoso.com. DHCP failover is enabled in load balancing mode with 70% of leases allocated to the primary DHCP server. The failover relationship name is dhcp1-dhcp2, the DHCP scope ID is 10.10.10.0, and the shared secret is sEcReT. A shared secret is optional. If specified, message digest authentication is turned on for the newly created failover relationship.

Tip

Windows PowerShell DHCP Server module can be installed using the Add Roles and Features Wizard under Features\Remote Server Administration Tools\Role Administration Tools\DHCP Server Tools. The DHCP Server module is also installed by default when you install the DHCP Server role service.

The following table provides a description of parameters used in this example.

Parameter

Description

ComputerName

The name of the primary DHCP server.

PartnerServer

The name of the secondary DHCP server.

Name

The name of the new DHCP failover relationship.

ScopeID

The ID of the DHCP scope on the primary DHCP server to be configured for failover.

LoadBalancePercent

The load balancing percentage assigned to the primary DHCP server.

SharedSecret

The shared secret for the failover relationship.

Configure DHCP failover in hot standby mode using the command line

Membership in the Administrators group, or equivalent, is the minimum required to complete these procedures. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (https://go.microsoft.com/fwlink/?LinkId=83477).

To configure DHCP failover in hot standby mode using the command line

  1. On a computer with the Windows PowerShell DHCP Server module installed, right-click Windows PowerShell and then click Run as Administrator.

  2. Type the following at the command line, and then press ENTER. Replace the example values with values used in your environment.

    Add-DhcpServerv4Failover –ComputerName dhcp1.contoso.com –PartnerServer dhcp2.contoso.com –Name dhcp1-dhcp2 –ScopeID 10.10.10.0 –ServerRole Active -SharedSecret sEcReT -Force
    

In this example, the primary DHCP server is named dhcp1.contoso.com and the secondary DHCP server is named dhcp2.contoso.com. DHCP failover is enabled in hot standby mode with the primary DHCP server assigned as the active server. The failover relationship name is dhcp1-dhcp2, the DHCP scope ID is 10.10.10.0, and the shared secret is sEcReT. A shared secret is optional. If specified, message digest authentication is turned on for the newly created failover relationship.

Tip

Windows PowerShell DHCP Server module can be installed using the Add Roles and Features Wizard under Features\Remote Server Administration Tools\Role Administration Tools\DHCP Server Tools. The DHCP Server module is also installed by default when you install the DHCP Server role service.

The following table provides a description of parameters used in this example.

Parameter

Description

ComputerName

The name of the primary DHCP server.

PartnerServer

The name of the secondary DHCP server.

Name

The name of the new DHCP failover relationship.

ScopeID

The ID of the DHCP scope on the primary DHCP server to be configured for failover.

ServerRole

Specifies the role of the target DHCP server in hot standby mode. Acceptable values are Active or Standby. The target computer is specified by the ComputerName parameter.

SharedSecret

The shared secret for the failover relationship.

See also

What is DHCP Failover?

Deploy DHCP Failover

Step-by-Step: Configure DHCP for Failover