Failover

These scenarios shows how to configure the failover feature in DHCP. This functionality provides more availability in case the connection to the main server is lost.

Test DHCP Failover

Description

Test scenario to check DHCP Failover feature. The configuration for this feature has 2 peers, the principal server and the secondary. The principal server will give the leases and the secondary will act if the principal fails. So in case there was any failure in the main server, the secondary will help. This scenario will check everything is configured right, so it will check peer to peer his state and his partner state are normal.

Scenario

Step 1: Set the following configuration in DUT0:

set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover local-address 10.0.0.1
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover name failover-test
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover peer-address 10.0.0.2
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover status primary
set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.0.0.2/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover local-address 10.0.0.2
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover name failover-test
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover peer-address 10.0.0.1
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover status secondary
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5

Step 3: Run command service dhcp-server show failover at DUT0 and check if output contains the following tokens:

primary
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 4: Run command service dhcp-server show failover at DUT0 and check if output matches the following regular expressions:

Local state\s+normal
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 5: Run command service dhcp-server show failover at DUT0 and check if output matches the following regular expressions:

Partner state\s+normal
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 6: Run command service dhcp-server show failover at DUT1 and check if output contains the following tokens:

secondary
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal

Step 7: Run command service dhcp-server show failover at DUT1 and check if output matches the following regular expressions:

Local state\s+normal
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal

Step 8: Run command service dhcp-server show failover at DUT1 and check if output matches the following regular expressions:

Partner state\s+normal
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal

Test DHCP Failover Disable

Description

This scenario set a configuration with the DHCP server service disable. This means that the DHCP service is stopped. So, the CLI will send a message telling that the server is not running. Then we restart this service and check everything works properly.

Scenario

Step 1: Set the following configuration in DUT0:

set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover local-address 10.0.0.1
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover name failover-test
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover peer-address 10.0.0.2
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover status primary
set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set service dhcp-server disable

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.0.0.2/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover local-address 10.0.0.2
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover name failover-test
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover peer-address 10.0.0.1
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 failover status secondary
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5

Step 3: Run command service dhcp-server show failover at DUT0 and check if output contains the following tokens:

Main instance of DHCP-server is not running
Show output
Main instance of DHCP-server is not running

Step 4: Set the following configuration in DUT0:

delete service dhcp-server disable

Step 5: Run command service dhcp-server show failover at DUT0 and check if output contains the following tokens:

primary
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 6: Run command service dhcp-server show failover at DUT0 and check if output matches the following regular expressions:

Local state\s+normal
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 7: Run command service dhcp-server show failover at DUT0 and check if output matches the following regular expressions:

Partner state\s+normal
Show output
------------------------------------
DHCP Failover failover-test
------------------------------------
Server role                  primary
Local state                  normal
Partner state                normal

Step 8: Run command service dhcp-server show failover at DUT1 and check if output contains the following tokens:

secondary
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal

Step 9: Run command service dhcp-server show failover at DUT1 and check if output matches the following regular expressions:

Local state\s+normal
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal

Step 10: Run command service dhcp-server show failover at DUT1 and check if output matches the following regular expressions:

Partner state\s+normal
Show output
--------------------------------------
DHCP Failover failover-test
--------------------------------------
Server role                  secondary
Local state                  normal
Partner state                normal