Options

These scenarios check the functionality of different options in DHCP server.

Test One Lease Per Client

Description

This scenario checks one-lease-per-client option. For this scenario you need two active leases at the same time. First you check that these leases are active and then, activate this option and check that there aren’t two leases at the same time for the same client (same MAC address).

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces eth1 address 10.215.168.64/24
set interfaces eth0.100 address 10.0.0.1/24
set interfaces eth0.200 address 10.0.0.2/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.6
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 options lease 4

Step 2: Set the following configuration in DUT1:

set interfaces eth0.100 mac 10:00:00:00:00:01
set interfaces eth0.200 mac 10:00:00:00:00:01

Step 3: Set the following configuration in DUT1:

set interfaces eth0.100 address dhcp
set interfaces eth0.200 address dhcp

Warning

If you do not see changes after enabling the options, you should renew 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        -1

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  2020/11/08 08:43:51        -1

Step 6: Set the following configuration 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/04/09 08:52:56  2024/04/09 08:53:00  2024/04/09 08:52:56

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  67   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  68   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
   tunl0  48                                 down   down  down  1480                     tunnel    0.0.0.0

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  67   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  68   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
   tunl0  48                                 down   down  down  1480                     tunnel    0.0.0.0

Test One Lease Per Client VRF

Description

This scenario checks one-lease-per-client option for DHCP-server but it is configured with VRF instead of regular interfaces. First this scenario checks there are 2 leases for the same client at the same time and then enable the option and check there are not two leases active at the same time for the same client.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces eth1 address 10.215.168.64/24
set interfaces eth0.100 address 10.0.0.1/24
set interfaces eth0.100 vrf VRF0
set interfaces eth0.200 address 10.0.0.2/24
set interfaces eth0.200 vrf VRF0
set service dhcp-server shared-network dhcp local-vrf VRF0
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.6
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 options lease 4
set system vrf VRF0

Step 2: Set the following configuration in DUT1:

set interfaces eth0.100 mac 10:00:00:00:00:01
set interfaces eth0.200 mac 10:00:00:00:00:01

Step 3: Set the following configuration in DUT1:

set interfaces eth0.100 address dhcp
set interfaces eth0.200 address dhcp

Warning

If you do not see changes after enabling the options, you should renew 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        -1

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  2020/11/08 08:43:51        -1

Step 6: Set the following configuration 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/04/09 08:53:20  2024/04/09 08:53:24  2024/04/09 08:53:20

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  69   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  70   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
   tunl0  48                                 down   down  down  1480                     tunnel    0.0.0.0

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  69   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  70   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
   tunl0  48                                 down   down  down  1480                     tunnel    0.0.0.0

Test Authoritative

Description

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

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces 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

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 mac 10:00:00:00:00:01

Step 3: Set the following configuration in DUT1:

set interfaces ethernet eth0 address dhcp

Warning

If you do not see changes after enabling the options, you should renew 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: Set the following configuration in DUT0:

delete service
delete interfaces

Step 6: Set the following configuration in DUT0:

set interfaces 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
Apr 09 08:53:33.716833 osdx OSDxCLI[7130]: User 'admin' added a new cfg line: 'set interfaces eth0 address 11.0.0.1/24'.
Apr 09 08:53:33.824968 osdx OSDxCLI[7130]: 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'.
Apr 09 08:53:33.983650 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Apr 09 08:53:34.045989 osdx systemd[1]: Started "DHCP Server Service instance main".
Apr 09 08:53:34.048669 osdx cfgd[1120]: [7130]Completed change to active configuration
Apr 09 08:53:34.052383 osdx OSDxCLI[7130]: User 'admin' committed the configuration.
Apr 09 08:53:34.059821 osdx dhcpd[7632]: Wrote 0 leases to leases file.
Apr 09 08:53:34.097601 osdx OSDxCLI[7130]: User 'admin' left the configuration menu.
Apr 09 08:53:34.127858 osdx dhcpd[7632]: Server starting service.
Apr 09 08:53:34.461381 osdx dhcpd[7632]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative).

Step 9: Set the following configuration 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
Apr 09 08:53:35.135879 osdx systemd[1]: dhcpd@main.service: Succeeded.
Apr 09 08:53:35.136159 osdx systemd[1]: Stopped "DHCP Server Service instance main".
Apr 09 08:53:35.137327 osdx systemd[1]: Started "DHCP Server Service instance main".
Apr 09 08:53:35.139493 osdx cfgd[1120]: [7130]Completed change to active configuration
Apr 09 08:53:35.143425 osdx OSDxCLI[7130]: User 'admin' committed the configuration.
Apr 09 08:53:35.148114 osdx dhcpd[7669]: Wrote 0 leases to leases file.
Apr 09 08:53:35.186476 osdx OSDxCLI[7130]: User 'admin' left the configuration menu.
Apr 09 08:53:35.223922 osdx dhcpd[7669]: Server starting service.
Apr 09 08:53:35.522303 osdx dhcpd[7669]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: wrong network.
Apr 09 08:53:35.522343 osdx dhcpd[7669]: 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 authoritative option but 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. In addition, renew the interfaces and you will see the server cannot. 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 eth0 address 10.0.0.1/24
set interfaces eth0 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 service dhcp-server shared-network authoritative local-vrf VRF0
set system vrf VRF0

Step 2: Set the following configuration in DUT1:

set interfaces ethernet eth0 mac 10:00:00:00:00:01

Step 3: Set the following configuration in DUT1:

set interfaces ethernet eth0 address dhcp

Warning

If you do not see changes after enabling the options, you should renew 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: Set the following configuration in DUT0:

delete service
delete interfaces

Step 6: Set the following configuration in DUT0:

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

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
Apr 09 08:53:50.780377 osdx OSDxCLI[7130]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network authoritative local-vrf VRF0'.
Apr 09 08:53:50.941100 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Apr 09 08:53:50.977100 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Apr 09 08:53:51.035352 osdx systemd[1]: Started "DHCP Server Service instance VRF0".
Apr 09 08:53:51.038604 osdx cfgd[1120]: [7130]Completed change to active configuration
Apr 09 08:53:51.042148 osdx OSDxCLI[7130]: User 'admin' committed the configuration.
Apr 09 08:53:51.046613 osdx dhcpd[8061]: Wrote 0 leases to leases file.
Apr 09 08:53:51.095547 osdx OSDxCLI[7130]: User 'admin' left the configuration menu.
Apr 09 08:53:51.121264 osdx dhcpd[8061]: Server starting service.
Apr 09 08:53:51.492929 osdx dhcpd[8061]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: ignored (not authoritative).

Step 9: Set the following configuration 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
Apr 09 08:53:52.253368 osdx systemd[1]: dhcpd@VRF0.service: Succeeded.
Apr 09 08:53:52.253722 osdx systemd[1]: Stopped "DHCP Server Service instance VRF0".
Apr 09 08:53:52.255753 osdx systemd[1]: Started "DHCP Server Service instance VRF0".
Apr 09 08:53:52.257945 osdx cfgd[1120]: [7130]Completed change to active configuration
Apr 09 08:53:52.261754 osdx OSDxCLI[7130]: User 'admin' committed the configuration.
Apr 09 08:53:52.265832 osdx dhcpd[8098]: Wrote 0 leases to leases file.
Apr 09 08:53:52.286625 osdx OSDxCLI[7130]: User 'admin' left the configuration menu.
Apr 09 08:53:52.349341 osdx dhcpd[8098]: Server starting service.
Apr 09 08:53:52.699112 osdx dhcpd[8098]: DHCPREQUEST for 10.0.0.5 from 10:00:00:00:00:01 via eth0: wrong network.
Apr 09 08:53:52.699321 osdx dhcpd[8098]: 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