Client

Test suite to validate DHCP client functionality.

This test suite verifies that the DHCP client can: - Obtain IP addresses automatically from a DHCP server - Renew existing DHCP leases - Maintain network connectivity through DHCP operations

Test DHCP Client Lease

Description

This test verifies that the DHCP client can obtain an IP address automatically from the DHCP server and that the lease is properly registered in both the client and server.

Scenario

Step 1: Set the following configuration in DUT1 :

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

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 172.16.0.100/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping the IP address 172.16.0.5 from DUT0:

admin@DUT0$ ping 172.16.0.5 count 1 size 56 timeout 1
Show output
PING 172.16.0.5 (172.16.0.5) 56(84) bytes of data.
64 bytes from 172.16.0.5: icmp_seq=1 ttl=64 time=0.219 ms

--- 172.16.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.219/0.219/0.219/0.000 ms

Step 4: Run the command service dhcp-client show leases on DUT1 and expect the following output:

Show output
Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    172.16.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   172.16.0.100
Lease time:    43200
Expiry date:   Wed May 20 05:11:54 2026
Reason:        BOUND


Interface:     br0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE

Test DHCP Client Renew

Description

This test verifies that the DHCP client can successfully renew its existing lease, ensuring continuous network connectivity without losing the assigned IP address.

Scenario

Step 1: Set the following configuration in DUT1 :

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

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 172.16.0.100/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping the IP address 172.16.0.5 from DUT0:

admin@DUT0$ ping 172.16.0.5 count 1 size 56 timeout 1
Show output
PING 172.16.0.5 (172.16.0.5) 56(84) bytes of data.
64 bytes from 172.16.0.5: icmp_seq=1 ttl=64 time=0.396 ms

--- 172.16.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.396/0.396/0.396/0.000 ms

Step 4: Run the command service dhcp-client show leases on DUT1 and check whether the output contains the following tokens:

172.16.0.5
Show output
Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    172.16.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   172.16.0.100
Lease time:    43200
Expiry date:   Wed May 20 05:12:12 2026
Reason:        BOUND


Interface:     br0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE

Step 5: Run the command service dhcp-server show leases on DUT0 and check whether the output contains the following tokens:

172.16.0.5
Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
172.16.0.5  de:ad:be:ef:6c:10  2026/05/19 17:12:12  2026/05/20 05:12:12  2026/05/19 17:12:12

Step 6: Run the command service dhcp-client renew interface eth0.100 on DUT1 and expect the following output:

Show output
Renewing DHCP lease on interface eth0.100...

Step 7: Ping the IP address 172.16.0.5 from DUT0:

admin@DUT0$ ping 172.16.0.5 count 1 size 56 timeout 1
Show output
PING 172.16.0.5 (172.16.0.5) 56(84) bytes of data.
64 bytes from 172.16.0.5: icmp_seq=1 ttl=64 time=0.525 ms

--- 172.16.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.525/0.525/0.525/0.000 ms

Step 8: Run the command service dhcp-client show leases on DUT1 and check whether the output contains the following tokens:

172.16.0.5
Show output
Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    172.16.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   172.16.0.100
Lease time:    43199
Expiry date:   Wed May 20 05:12:12 2026
Reason:        REBOOT


Interface:     br0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE