Stackvora.tech

Configure DHCP Failover

Detailed guide on configuring DHCP failover on Windows Server, covering Hot Standby and Load Balance modes, shared secrets, MCLT, and common troubleshooting tips.

Ensuring high availability for critical infrastructure services is paramount. DHCP, responsible for IP address assignment, is no exception. A failure in a standalone DHCP server can lead to network disruptions as new clients can't obtain addresses and existing leases might not be renewed. Windows Server's DHCP failover feature, introduced in Windows Server 2012, addresses this by allowing two DHCP servers to share lease information and synchronize state, providing resilience against server failures.

This article details the configuration process for DHCP failover on Windows Server, covering both Hot Standby and Load Balance modes, essential parameters like Maximum Client Lead Time (MCLT), and best practices for deployment.

Prerequisites and Setup Considerations

Before configuring DHCP failover, ensure the following conditions are met:

  • Two Windows Server instances: Both servers must be running a supported Windows Server version (2012, 2012 R2, 2016, 2019, or 2022) with the DHCP Server role installed and authorized in Active Directory (if applicable).
  • Network Connectivity: The two DHCP servers must have reliable network connectivity to each other, preferably on the same subnet or accessible via routing. No specific firewall ports need to be opened beyond the standard DHCP ports (UDP 67/68 for client-server communication) for the failover replication itself, as it uses RPC over dynamic ports, typically within the 49152-65535 range. Ensure no restrictive firewall rules are blocking RPC traffic between the servers.
  • Active Directory Integration (Recommended): While not strictly mandatory for failover itself, having both servers authorized in Active Directory simplifies management and security.
  • IP Addresses: Both DHCP servers should have static IP addresses configured.
  • Time Synchronization: Critical for failover to function correctly. Ensure both servers are synchronized to the same time source, ideally via NTP or Active Directory's time services.

Initiating DHCP Failover Configuration

The configuration process is initiated from the DHCP management console on one of the servers. Open Server Manager, navigate to Tools > DHCP. Expand your server, right-click on 'IPv4', and select 'Configure Failover...'.

Selecting Scopes for Failover

The first step in the wizard is to select the scopes you wish to include in the failover relationship. You can choose to replicate all existing scopes on the primary server or select specific ones. If you have a large number of scopes and only a few require high availability, select 'Selected scopes' and move them from 'Available scopes' to 'Selected scopes'. For most deployments, selecting 'All scopes' is simpler if all IP ranges need failover protection.

Specifying the Partner Server

Next, you'll need to specify the partner server that will participate in the failover relationship. You can either browse for another DHCP server on your network or manually enter its hostname or IP address. The wizard will attempt to connect to the specified server to verify its availability and DHCP role status. Ensure the partner server is also authorized in Active Directory if your environment uses it.

Choosing a Failover Mode

Windows DHCP failover offers two primary modes, each suited for different scenarios:

Hot Standby Mode

In Hot Standby mode, one server acts as the active server (primary), responsible for leasing IP addresses, and the other acts as the standby server (secondary). The standby server monitors the primary and takes over if the primary becomes unavailable. The standby server does not actively issue leases unless the primary fails or is placed into a 'Partner Down' state. This mode is ideal for environments where you have a primary site and a disaster recovery site, or simply want a dedicated backup server.

  • Role: Primary and Secondary. The primary server handles 100% of the lease requests.
  • Reserved IP Percentage: You must allocate a percentage of the IP address range for the standby server to use during a 'Partner Down' state. A common recommendation is 5% or 10%. This prevents the standby from exhausting the pool quickly if the primary is down for an extended period. For instance, if a scope has 200 IPs, and 5% is reserved, the secondary can issue 10 IPs when the primary is offline.
  • MCLT (Maximum Client Lead Time): This is a crucial setting. It defines the maximum time a DHCP lease can be extended by a DHCP server without contacting its partner. It also dictates how long a server will wait before taking over a scope from a partner in a 'Partner Down' state. The default is 1 hour. A shorter MCLT means faster failover but increased replication traffic. A longer MCLT reduces replication but extends the recovery time. For most scenarios, 1-2 hours is sufficient.

Load Balance Mode

In Load Balance mode, both DHCP servers are active and share the responsibility of leasing IP addresses to clients. This provides true high availability and can distribute the processing load. Clients randomly contact either server, and the servers coordinate to ensure no duplicate IP assignments occur. This is suitable for environments where you want to maximize resource utilization and have both servers actively participate in lease distribution.

  • Role: Both servers are active.
  • Load Balance Percentage: You configure how the lease requests are distributed between the two servers. The default is 50/50. You can adjust this if one server has more capacity or is preferred for other reasons (e.g., closer to a specific client segment). For instance, a 70/30 split means 70% of requests go to the first server and 30% to the second.
  • MCLT (Maximum Client Lead Time): Same as in Hot Standby, typically 1-2 hours.

Shared Secret and State Synchronization

After selecting the failover mode, you'll configure the shared secret. This passphrase is used to authenticate communication between the two DHCP servers during replication and state synchronization. It's crucial for security. Choose a strong, complex passphrase and ensure it's recorded securely.

The 'State Synchronization Interval' specifies how often lease information is replicated between the servers. The default is 1 minute, which is generally acceptable. You can reduce this for faster synchronization, but it increases network traffic. Conversely, increasing it reduces traffic but lengthens the time it takes for lease changes to propagate.

Review and Completion

The wizard will present a summary of your configuration choices. Review them carefully before clicking 'Finish'. The DHCP service on both servers will restart during this process, which may temporarily interrupt DHCP services. The synchronization process will begin, replicating existing leases and scope configurations to the partner server.

# Example: Manual DHCP Failover configuration using PowerShell
# This assumes DHCP role is installed and authorized on both servers

# Define server details
$PrimaryDHCPServer = "DHCP-Server-01.contoso.com"
$SecondaryDHCPServer = "DHCP-Server-02.contoso.com"
$SharedSecret = "YourStrongSharedSecret!"
$MCLT = "01:00:00" # 1 hour
$ScopeIDs = (Get-DhcpServerv4Scope -ComputerName $PrimaryDHCPServer).ScopeId # Get all scopes

# --- Hot Standby Configuration Example ---
# Add-DhcpServerv4Failover -ComputerName $PrimaryDHCPServer `
# -PartnerServer $SecondaryDHCPServer `
# -Name "DHCP-Failover-HotStandby-Main" `
# -Mode HotStandby `
# -MaxClientLeadTime $MCLT `
# -AutoStateTransition `
# -LoadBalancePercentage 0 ` # 0% for secondary in Hot Standby
# -ReservePercent 5 ` # 5% reserved for secondary when primary is down
# -SharedSecret $SharedSecret `
# -ScopeId $ScopeIDs

# --- Load Balance Configuration Example ---
Add-DhcpServerv4Failover -ComputerName $PrimaryDHCPServer `
 -PartnerServer $SecondaryDHCPServer `
 -Name "DHCP-Failover-LoadBalance-Main" `
 -Mode LoadBalance `
 -MaxClientLeadTime $MCLT `
 -AutoStateTransition `
 -LoadBalancePercentage 50 ` # 50% distribution
 -SharedSecret $SharedSecret `
 -ScopeId $ScopeIDs

Write-Host "DHCP Failover relationship created successfully between $PrimaryDHCPServer and $SecondaryDHCPServer."

Common Pitfalls and Troubleshooting

  • Firewall Issues: RPC ports for replication can sometimes be blocked. Ensure dynamic port ranges (49152-65535 by default) are open between the DHCP servers, or configure static RPC ports if necessary (advanced scenario). Use Test-NetConnection -ComputerName <PartnerServer> -Port <PortNumber> to check connectivity.
  • Time Synchronization Problems: Discrepancies in time between the two servers can cause replication failures and prevent proper failover state transitions. Verify time synchronization using w32tm /query /source and w32tm /query /status.
  • Shared Secret Mismatch: An incorrect shared secret will prevent the failover relationship from establishing. Double-check the passphrase during configuration.
  • Authorization in Active Directory: Both DHCP servers must be authorized in AD. Check the event logs for 'DHCP Server' under 'Applications and Services Logs' for authorization errors (Event ID 1046, 1044).
  • Insufficient Permissions: The account used to configure failover needs appropriate administrative permissions on both DHCP servers.
  • Replication Errors: Monitor the DHCP server event logs for replication-related errors (Event IDs 200xx range, e.g., 20261 for replication failure). Use the 'Failover Relationship' node in the DHCP console to view the status.
  • Incorrect MCLT: If MCLT is set too high in Hot Standby, the standby server might take too long to assume control after a primary failure. If set too low in Load Balance, it could lead to increased replication overhead.
  • DNS Registration: Ensure both DHCP servers can correctly register DNS records for clients if dynamic DNS updates are enabled on your scopes.

Back to the knowledge base · Ask the AI assistant