Lease-Timers

These scenarios check DHCP lease timer functionality. DHCP leases have time-based behavior as defined in RFC 2131: - T1 (Renewal Time): Client attempts to renew at 50% of lease time - T2 (Rebinding Time): Client attempts to rebind at 87.5% of lease time - Lease Expiration: After lease expires, client must release the IP

This test suite verifies temporal behavior of DHCP leases.

Test Lease Renewal at T1

Description

This scenario checks that the DHCP client automatically renews its lease at T1 (50% of lease time). With a 60-second lease, the client should attempt renewal around 30 seconds. We verify the client still has the IP after T1 time passes, confirming automatic renewal occurred.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network medium-lease subnet 10.0.0.0/24 options lease 60
set service dhcp-server shared-network medium-lease subnet 10.0.0.0/24 options max-lease 120
set service dhcp-server shared-network medium-lease subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 4: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 5: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 6: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

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

10.0.0.5
Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
 10.0.0.5   de:ad:be:ef:6c:10  2025/12/11 18:57:37  2025/12/11 18:59:37  2025/12/11 18:57:37

Test Server Disable and Re-enable

Description

This scenario checks DHCP server disable/enable functionality. When the server is disabled, clients cannot obtain or renew leases. When re-enabled, clients can successfully obtain leases again. This tests the server’s ability to handle service interruption and recovery. According to RFC 2131, clients continue attempting to renew expired leases, so when the server comes back online, the client will successfully obtain a new lease, resulting in active lease statistics.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network short-lease subnet 10.0.0.0/24 options lease 30
set service dhcp-server shared-network short-lease subnet 10.0.0.0/24 options max-lease 60
set service dhcp-server shared-network short-lease subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 4: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 5: Run command service dhcp-server show stats at DUT0 and expect this output:

Show output
-------------------------------------------------------
Instance  Total leases  Active leases  Available leases
-------------------------------------------------------
  main         1              1               0

Step 6: Modify the following configuration lines in DUT0 :

set service dhcp-server disable

Step 7: Run command service dhcp-server show stats at DUT0 and expect this output:

Show output
DHCP-Server is not running

Step 8: Modify the following configuration lines in DUT0 :

delete service dhcp-server disable

Step 9: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 10: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 11: Run command service dhcp-server show stats at DUT0 and expect this output:

Show output
-------------------------------------------------------
Instance  Total leases  Active leases  Available leases
-------------------------------------------------------
  main         1              1               0

Test Very Short Lease Time

Description

This scenario checks DHCP behavior with very short lease times (10 seconds). This is an edge case that tests rapid renewal cycles. The client should successfully maintain connectivity despite frequent renewal requirements.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network very-short subnet 10.0.0.0/24 options lease 10
set service dhcp-server shared-network very-short subnet 10.0.0.0/24 options max-lease 20
set service dhcp-server shared-network very-short subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 4: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 5: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64

Step 6: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.0.0.5/24                   up     up
      fe80::dcad:beff:feef:6c10/64