Skip to main content

DHCP Failover Configuration on Enterprise SONiC Switch

1 Commands

1.1 Configuration Commands

Operation
Command
Description
Enter DHCP Failover mode
Configure DHCP Failover name
-
Set local IP address
address A.B.C.D
Specify IP or loopback address
Set peer IP address
peer address A.B.C.D
-
Set role
role primary/secondary
Only the primary can set load split
Set load split
split 1-100
Percentage (e.g., 60 means primary 60%, secondary 40%)
Set max response delay (optional)
max-response-delay seconds
Default 60s
Set partner down timer (optional)
auto-partner-down seconds
Recommended for automatic failover

2 Example Deployment

2.1 Networking Requirements

DHCP-Failover-Network-Requirement-Illustration

In this network design, two DHCP servers are configured to handle half of the client requests each, providing both high availability and load balancing. Downstream DHCP clients can obtain IP addresses normally, and the failure of a single server or a single downstream link does not affect the overall network functionality.

Configuration Recommendation:
During the lease renewal process, clients typically send a renewal request at 37.5% of the lease time. To ensure uninterrupted service, it is recommended that the minimum DHCP server lease time be configured to more than three times the MCLT. This ensures that the client’s renewal request is sent before the DHCP server’s stay in the communications_interrupted state expires, allowing the client to renew successfully and preventing temporary network outages caused by failed renewals and forced reallocation of IP addresses.

2.2 Configuration Steps

2.2.1 Configure the DHCP Server

  • Configure interface information
Primary Server
Secondary Server
Configure physical interface
interface ethernet 1
dhcp select server
ip address 10.93.0.1/30
interface ethernet 1
dhcp select server
ip address 10.93.0.1/30
Configure loopback 0
interface loopback 0
ip address 172.16.1.165/32
interface loopback 0
ip address 172.16.1.165/32
  • Configure DHCP Failover
Primary Server
Secondary Server
dhcp failover test
address loopback 0
auto-partner-down 50
peer address 172.16.1.166
role primary
split 50
dhcp failover test
address loopback 0
auto-partner-down 50
peer address 172.16.1.165
role secondary
  • Configure DHCP Pool
Primary Server
Secondary Server
dhcp pool test
address-pool 10.20.1.10 10.20.1.254
dns 8.8.8.8
failover test
lease-time 12000 20000
network 10.20.1.1 255.255.255.0
routers 10.20.1.1
dhcp pool test
address-pool 10.20.1.10 10.20.1.254
dns 8.8.8.8
failover test
lease-time 12000 20000
network 10.20.1.1 255.255.255.0
routers 10.20.1.1
  • Configure routing
Primary Server
Secondary Server
ip route 172.16.1.155/32 10.92.0.2
ip route 172.16.1.166/32 10.92.0.2
ip route 172.16.1.155/32 10.92.1.2
ip route 172.16.1.162/32 10.92.1.2

2.2.2 Configure DHCP Relay

  • Configure interface information
Uplink Port
Downlink Port
Loopback 0
interface ethernet 1
ip address 10.93.0.2/30
!
interface ethernet 2
ip address 10.93.1.2/30
!
vlan 100
!
port-group ethernet 3-24
switchport access vlan 100
!
interface vlan 100
ip address 10.20.1.1/24
!
interface loopback 0
ip address 172.16.1.155/32
  • Configure DHCP Relay
dhcp-relay test v4
down_link interface vlan 100
server_ip 172.16.1.165
server_ip 172.16.1.166
up_link interface ethernet 23
up_link interface ethernet 24
  • Configure routing
ip route 172.16.1.165/32 10.92.0.1
ip route 172.16.1.166/32 10.92.1.1

3 Display and Maintenance

Operation
Command
Description
Display DHCP Failover related information
show dhcp failover
info Displays detailed information about the DHCP failover:
Failover-name: Name
Local-address: Local address
Peer-address: Peer address
Role: Role (primary/secondary)
Max_response_delay: Maximum response delay (60s by default)
Heartbeat_interval: Heartbeat detection interval (20s by default)
Auto_partner_down: Time to automatically mark the peer as down
Local-state: Local state (normal)
Peer-state: Peer state (normal)
Split: Traffic distribution ratio
Display DHCP Relay related information
show dhcp relay
config Displays the global configuration information of the DHCP relay