Check-Mac-Address

These scenarios show how the feature check-mac-address works for DHCP server

../../../_images/check-mac-address.svg

Test Check MAC Address

Description

The check-mac-address option filters packets if there are differences between the MAC address found at the ethernet header and the MAC address found in the DHCP packet. To check this option, you should send packets with these differences and enable this option and see if there are warnings in your logs. Also, this test check the server’s behaviour in regular conditions.

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 dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5

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

DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Show output
Jun 12 22:17:13.260375 osdx OSDxCLI[16691]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5'.
Jun 12 22:17:13.446856 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 12 22:17:13.506660 osdx systemd[1]: Started "DHCP Server Service instance main".
Jun 12 22:17:13.509297 osdx cfgd[1122]: [16691]Completed change to active configuration
Jun 12 22:17:13.513329 osdx OSDxCLI[16691]: User 'admin' committed the configuration.
Jun 12 22:17:13.516249 osdx dhcpd[21313]: Wrote 0 leases to leases file.
Jun 12 22:17:13.566255 osdx OSDxCLI[16691]: User 'admin' left the configuration menu.
Jun 12 22:17:13.603170 osdx dhcpd[21313]: Server starting service.
Jun 12 22:17:13.734107 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:14.383827 osdx dhcpd[21313]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0

Step 3: Set the following configuration in DUT0:

set service dhcp-server check-mac-address

Step 4: Run command system journal clear at DUT0.

Step 5: Run command system journal show | tail at DUT0 and check if output does not contain the following tokens:

DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Show output
-- Logs begin at Wed 2024-06-12 22:17:15 UTC, end at Wed 2024-06-12 22:17:15 UTC. --
Jun 12 22:17:15.502293 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 2.0M, max 16.0M, 14.0M free.
Jun 12 22:17:15.525857 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal clear'.

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

MAC received in DHCP packet (10:00:00:00:00:02) is different than source MAC in ethernet header (10:00:00:00:00:01)
Show output
-- Logs begin at Wed 2024-06-12 22:17:15 UTC, end at Wed 2024-06-12 22:17:16 UTC. --
Jun 12 22:17:15.502293 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 2.0M, max 16.0M, 14.0M free.
Jun 12 22:17:15.525857 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal clear'.
Jun 12 22:17:15.613567 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:15.717058 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:16.471832 osdx dhcpd[21355]: MAC received in DHCP packet (10:00:00:00:00:02) is different than source MAC in ethernet header (10:00:00:00:00:01)

Step 7: Set the following configuration in DUT1:

set interfaces eth0 mac 10:00:00:00:00:05

Step 8: Set the following configuration in DUT1:

set interfaces eth0 address dhcp

Step 9: 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 10: 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:05
Show output
10.0.0.5   10:00:00:00:00:05  2024/06/12 22:17:19  2024/06/13 10:17:19  2024/06/12 22:17:19

Test Check MAC Address VRF

Description

This scenario configures a DHCP server with VRF instead of regular interfaces and checks the option check-mac-address. To check this option you will need to send packets with differences in Source MAC for link layer and the client MAC from the application layer.

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 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 system vrf VRF0

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

DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Show output
Jun 12 22:17:27.717455 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 12 22:17:27.749483 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 12 22:17:27.801245 osdx systemd[1]: Started "DHCP Server Service instance VRF0".
Jun 12 22:17:27.805132 osdx cfgd[1122]: [16691]Completed change to active configuration
Jun 12 22:17:27.807130 osdx dhcpd[21641]: Wrote 0 leases to leases file.
Jun 12 22:17:27.809114 osdx OSDxCLI[16691]: User 'admin' committed the configuration.
Jun 12 22:17:27.843787 osdx OSDxCLI[16691]: User 'admin' left the configuration menu.
Jun 12 22:17:27.865826 osdx dhcpd[21641]: Server starting service.
Jun 12 22:17:28.007598 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:28.286268 osdx dhcpd[21641]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0

Step 3: Set the following configuration in DUT0:

set service dhcp-server check-mac-address

Step 4: Run command system journal clear at DUT0.

Step 5: Run command system journal show | tail at DUT0 and check if output does not contain the following tokens:

DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Show output
-- Logs begin at Wed 2024-06-12 22:17:29 UTC, end at Wed 2024-06-12 22:17:29 UTC. --
Jun 12 22:17:29.777275 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 2.0M, max 16.0M, 14.0M free.
Jun 12 22:17:29.806464 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal clear'.

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

MAC received in DHCP packet (10:00:00:00:00:02) is different than source MAC in ethernet header (10:00:00:00:00:01)
Show output
-- Logs begin at Wed 2024-06-12 22:17:29 UTC, end at Wed 2024-06-12 22:17:30 UTC. --
Jun 12 22:17:29.777275 osdx systemd-journald[1508]: Runtime journal (/run/log/journal/f8d19df27e8d4f24a0b0e24ed9aec425) is 2.0M, max 16.0M, 14.0M free.
Jun 12 22:17:29.806464 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal clear'.
Jun 12 22:17:29.896102 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:30.004635 osdx OSDxCLI[16691]: User 'admin' executed a new command: 'system journal show | tail'.
Jun 12 22:17:30.370221 osdx dhcpd[21683]: MAC received in DHCP packet (10:00:00:00:00:02) is different than source MAC in ethernet header (10:00:00:00:00:01)

Step 7: Set the following configuration in DUT1:

set interfaces eth0 mac 10:00:00:00:00:05

Step 8: Set the following configuration in DUT1:

set interfaces eth0 address dhcp

Step 9: 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 10: 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:05
Show output
10.0.0.5   10:00:00:00:00:05  2024/06/12 22:17:33  2024/06/13 10:17:33  2024/06/12 22:17:33