Options

These scenarios check the functionality of different DHCP server options.

Test One Lease Per Client

Description

This scenario checks the one-lease-per-client option. In this scenario, you need two active leases at the same time. First, check those leases are active and then activate this option and check that no two leases belonging to the same client (same MAC address) are active at the same time.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces ethernet eth0 vif 100 address 10.0.0.1/24
set interfaces ethernet eth0 vif 200 address 10.0.0.2/24
set interfaces ethernet eth1 address 10.215.168.64/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options lease 4
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options max-lease 4
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.6
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 vif 100 mac '10:00:00:00:00:01'
set interfaces ethernet eth0 vif 200 mac '10:00:00:00:00:01'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Modify the following configuration lines in DUT1:

set interfaces ethernet eth0 vif 100 address dhcp
set interfaces ethernet eth0 vif 200 address dhcp

Warning

If you do not see changes after enabling the options, refresh all your interfaces

Step 4: Run command service dhcp-server show leases main | grep 10.0.0.5 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.5   10:00:00:00:00:01  2020/11/08 08:43:51

Step 5: Run command service dhcp-server show leases main | grep 10.0.0.6 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.6   10:00:00:00:00:01  2024/07/03 16:49:51  2024/07/03 16:49:55  2024/07/03 16:49:51

Step 6: Modify the following configuration lines in DUT0:

set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options one-lease-per-client

Step 7: Run command service dhcp-server show leases main | grep 10.0.0.5 at DUT0 and check if output does not contain the following tokens:

10:00:00:00:00:01

Step 8: Run command service dhcp-server show leases main | grep 10.0.0.6 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.6   10:00:00:00:00:01  2024/07/03 16:49:53  2024/07/03 16:49:57  2024/07/03 16:49:53

Step 9: Run command service dhcp-server clear main lease all at DUT0.

Step 10: Run command interfaces show detailed at DUT1 and check if output does not contain the following tokens:

10.0.0.5
Show output
--------------------------------------------------------------------------------------------------------------------
  Name    Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
--------------------------------------------------------------------------------------------------------------------
    eth0  2    fe80::dcad:beff:feef:6c20/64  up     up    up    1500                     ethernet  de:ad:be:ef:6c:20
eth0.100  249  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
eth0.200  250  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
    eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:21

Step 11: Run command interfaces show detailed at DUT1 and check if output contains the following tokens:

10.0.0.6
Show output
--------------------------------------------------------------------------------------------------------------------
  Name    Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
--------------------------------------------------------------------------------------------------------------------
    eth0  2    fe80::dcad:beff:feef:6c20/64  up     up    up    1500                     ethernet  de:ad:be:ef:6c:20
eth0.100  249  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
eth0.200  250  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
    eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:21

Test One Lease Per Client VRF

Description

This scenario checks the one-lease-per-client option for DHCP-server, but it is configured with VRF instead of regular interfaces. It first checks whether there are 2 simultaneous leases for the same client. When the option is enabled, it checks there are no two active leases for the same client at the same time.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces ethernet eth0 vif 100 address 10.0.0.1/24
set interfaces ethernet eth0 vif 100 vrf VRF0
set interfaces ethernet eth0 vif 200 address 10.0.0.2/24
set interfaces ethernet eth0 vif 200 vrf VRF0
set interfaces ethernet eth1 address 10.215.168.64/24
set service dhcp-server shared-network dhcp local-vrf VRF0
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options lease 4
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options max-lease 4
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.6
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system vrf VRF0

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 vif 100 mac '10:00:00:00:00:01'
set interfaces ethernet eth0 vif 200 mac '10:00:00:00:00:01'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Modify the following configuration lines in DUT1:

set interfaces ethernet eth0 vif 100 address dhcp
set interfaces ethernet eth0 vif 200 address dhcp

Warning

If you do not see changes after enabling the options, refresh all your interfaces

Step 4: Run command service dhcp-server show leases VRF0 | grep 10.0.0.5 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.5   10:00:00:00:00:01  2020/11/08 08:43:51

Step 5: Run command service dhcp-server show leases VRF0 | grep 10.0.0.6 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.6   10:00:00:00:00:01  2024/07/03 16:50:09  2024/07/03 16:50:13  2024/07/03 16:50:09

Step 6: Modify the following configuration lines in DUT0:

set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 options one-lease-per-client

Step 7: Run command service dhcp-server show leases VRF0 | grep 10.0.0.5 at DUT0 and check if output does not contain the following tokens:

10:00:00:00:00:01

Step 8: Run command service dhcp-server show leases VRF0 | grep 10.0.0.6 at DUT0 and check if output contains the following tokens:

10:00:00:00:00:01
Show output
10.0.0.6   10:00:00:00:00:01  2024/07/03 16:50:11  2024/07/03 16:50:15  2024/07/03 16:50:11

Step 9: Run command service dhcp-server clear VRF0 lease all at DUT0.

Step 10: Run command interfaces show detailed at DUT1 and check if output does not contain the following tokens:

10.0.0.5
Show output
--------------------------------------------------------------------------------------------------------------------
  Name    Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
--------------------------------------------------------------------------------------------------------------------
    eth0  2    fe80::dcad:beff:feef:6c20/64  up     up    up    1500                     ethernet  de:ad:be:ef:6c:20
eth0.100  251  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
eth0.200  252  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
    eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:21

Step 11: Run command interfaces show detailed at DUT1 and check if output contains the following tokens:

10.0.0.6
Show output
--------------------------------------------------------------------------------------------------------------------
  Name    Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
--------------------------------------------------------------------------------------------------------------------
    eth0  2    fe80::dcad:beff:feef:6c20/64  up     up    up    1500                     ethernet  de:ad:be:ef:6c:20
eth0.100  251  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
eth0.200  252  10.0.0.6/24                   up     up    up    1500              eth0   ethernet  10:00:00:00:00:01
               fe80::dcad:beff:feef:6c20/64
    eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:21

Test Authoritative

Description

This scenario checks the authoritative option. First, you need to configure a DHCP server without enabling the option and give a lease to the client. Then, change the configuration of the server for another subnet. The client will refresh his lease and see a problem: the new server is not in the same subnet and is not authorized to give a lease. Finally, if you enable the option and refresh the interface, you will see the server is authorized and can provide the lease to the client.

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 authoritative 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 mac '10:00:00:00:00:01'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Modify the following configuration lines in DUT1:

set interfaces ethernet eth0 address dhcp

Warning

If you do not see changes after enabling the options, refresh all your interfaces

Step 4: 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:6c20/64

Step 5: Modify the following configuration lines in DUT0:

delete interfaces
delete service

Step 6: Modify the following configuration lines in DUT0:

set interfaces ethernet eth0 address 11.0.0.1/24
set service dhcp-server shared-network authoritative subnet 11.0.0.0/24 start 11.0.0.5 stop 11.0.0.5

Step 7: 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:6c20/64

Step 8: Run command system journal show | tail at DUT0 and check if output contains the following tokens:

DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative)
Show output
Jul 03 16:50:22.491341 osdx OSDxCLI[350113]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network authoritative subnet 11.0.0.0/24 start 11.0.0.5 stop 11.0.0.5'.
Jul 03 16:50:22.550283 osdx OSDxCLI[350113]: User 'admin' added a new cfg line: 'show changes'.
Jul 03 16:50:22.687194 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 03 16:50:22.751660 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main".
Jul 03 16:50:22.753223 osdx cfgd[1440]: [350113]Completed change to active configuration
Jul 03 16:50:22.754071 osdx dhcpd[350542]: Wrote 0 leases to leases file.
Jul 03 16:50:22.755844 osdx OSDxCLI[350113]: User 'admin' committed the configuration.
Jul 03 16:50:22.772905 osdx OSDxCLI[350113]: User 'admin' left the configuration menu.
Jul 03 16:50:22.795302 osdx dhcpd[350542]: Server starting service.
Jul 03 16:50:23.111332 osdx dhcpd[350542]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative).

Step 9: Modify the following configuration lines in DUT0:

set service dhcp-server options authoritative

Step 10: Run command system journal show | tail at DUT0 and check if output contains the following tokens:

DHCPNAK on 10.0.0.5 to 10:00:00:00:00:01 via eth0
Show output
Jul 03 16:50:23.715647 osdx systemd[1]: dhcpd@main.service: Deactivated successfully.
Jul 03 16:50:23.715799 osdx systemd[1]: Stopped dhcpd@main.service - "DHCP Server Service instance main".
Jul 03 16:50:23.735749 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main".
Jul 03 16:50:23.737220 osdx cfgd[1440]: [350113]Completed change to active configuration
Jul 03 16:50:23.738673 osdx dhcpd[350580]: Wrote 0 leases to leases file.
Jul 03 16:50:23.739248 osdx OSDxCLI[350113]: User 'admin' committed the configuration.
Jul 03 16:50:23.754006 osdx OSDxCLI[350113]: User 'admin' left the configuration menu.
Jul 03 16:50:23.775402 osdx dhcpd[350580]: Server starting service.
Jul 03 16:50:24.091409 osdx dhcpd[350580]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: wrong network.
Jul 03 16:50:24.091439 osdx dhcpd[350580]: DHCPNAK on 10.0.0.5 to 10:00:00:00:00:01 via eth0

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

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

Test Authoritative VRF

Description

This scenario checks the authoritative option when the server is configured with VRF instead of regular interfaces. First, configure the server and give a lease to the client. Then, change the configuration of the server and put it on a different subnet. Refresh the interfaces and you will see the server cannot do it. Change the configuration again and add the authoritative option. With this change, the server will be able to give a lease to the client.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.0.0.1/24
set interfaces ethernet eth0 vrf VRF0
set service dhcp-server shared-network authoritative local-vrf VRF0
set service dhcp-server shared-network authoritative 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'
set system vrf VRF0

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 mac '10:00:00:00:00:01'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Modify the following configuration lines in DUT1:

set interfaces ethernet eth0 address dhcp

Warning

If you do not see changes after enabling the options, refresh all your interfaces

Step 4: 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:6c20/64

Step 5: Modify the following configuration lines in DUT0:

delete interfaces
delete service

Step 6: Modify the following configuration lines in DUT0:

set interfaces ethernet eth0 address 11.0.0.1/24
set interfaces ethernet eth0 vrf VRF0
set service dhcp-server shared-network authoritative local-vrf VRF0
set service dhcp-server shared-network authoritative subnet 11.0.0.0/24 start 11.0.0.5 stop 11.0.0.5

Step 7: 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:6c20/64

Step 8: Run command system journal show | tail at DUT0 and check if output contains the following tokens:

DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative)
Show output
Jul 03 16:50:36.194647 osdx OSDxCLI[350113]: User 'admin' added a new cfg line: 'show changes'.
Jul 03 16:50:36.325517 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 03 16:50:36.349511 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 03 16:50:36.438147 osdx systemd[1]: Started dhcpd@VRF0.service - "DHCP Server Service instance VRF0".
Jul 03 16:50:36.440221 osdx cfgd[1440]: [350113]Completed change to active configuration
Jul 03 16:50:36.441182 osdx dhcpd[350927]: Wrote 0 leases to leases file.
Jul 03 16:50:36.443086 osdx OSDxCLI[350113]: User 'admin' committed the configuration.
Jul 03 16:50:36.460903 osdx OSDxCLI[350113]: User 'admin' left the configuration menu.
Jul 03 16:50:36.485587 osdx dhcpd[350927]: Server starting service.
Jul 03 16:50:36.805816 osdx dhcpd[350927]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative).

Step 9: Modify the following configuration lines in DUT0:

set service dhcp-server options authoritative

Step 10: Run command system journal show | tail at DUT0 and check if output contains the following tokens:

DHCPNAK on 10.0.0.5 to 10:00:00:00:00:01 via eth0
Show output
Jul 03 16:50:37.365761 osdx systemd[1]: dhcpd@VRF0.service: Deactivated successfully.
Jul 03 16:50:37.365909 osdx systemd[1]: Stopped dhcpd@VRF0.service - "DHCP Server Service instance VRF0".
Jul 03 16:50:37.382045 osdx systemd[1]: Started dhcpd@VRF0.service - "DHCP Server Service instance VRF0".
Jul 03 16:50:37.383422 osdx cfgd[1440]: [350113]Completed change to active configuration
Jul 03 16:50:37.384710 osdx dhcpd[350965]: Wrote 0 leases to leases file.
Jul 03 16:50:37.385816 osdx OSDxCLI[350113]: User 'admin' committed the configuration.
Jul 03 16:50:37.408503 osdx OSDxCLI[350113]: User 'admin' left the configuration menu.
Jul 03 16:50:37.429580 osdx dhcpd[350965]: Server starting service.
Jul 03 16:50:37.729644 osdx dhcpd[350965]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: wrong network.
Jul 03 16:50:37.729666 osdx dhcpd[350965]: DHCPNAK on 10.0.0.5 to 10:00:00:00:00:01 via eth0

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

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