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
Dec 02 22:09:37.373439 osdx cfgd[1120]: [15982]Completed change to active configuration
Dec 02 22:09:37.378150 osdx OSDxCLI[15982]: User 'admin' committed the configuration.
Dec 02 22:09:37.380731 osdx dhcpd[4889]: Wrote 0 leases to leases file.
Dec 02 22:09:37.426175 osdx OSDxCLI[15982]: User 'admin' left the configuration menu.
Dec 02 22:09:37.508294 osdx dhcpd[4889]: Server starting service.
Dec 02 22:09:37.636039 osdx OSDxCLI[15982]: User 'admin' executed a new command: 'system journal show | tail'.
Dec 02 22:09:37.689178 osdx dhcpd[4889]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Dec 02 22:09:38.690427 osdx dhcpd[4889]: DHCPOFFER on 10.0.0.5 to 10:00:00:00:00:02 via eth0
Dec 02 22:09:38.738045 osdx dhcpd[4889]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Dec 02 22:09:38.738078 osdx dhcpd[4889]: DHCPOFFER on 10.0.0.5 to 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 Mon 2024-12-02 22:09:39 UTC, end at Mon 2024-12-02 22:09:39 UTC. --
Dec 02 22:09:39.624914 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 2.0M, max 16.0M, 14.0M free.
Dec 02 22:09:39.661748 osdx OSDxCLI[15982]: 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 Mon 2024-12-02 22:09:39 UTC, end at Mon 2024-12-02 22:09:39 UTC. --
Dec 02 22:09:39.624914 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 2.0M, max 16.0M, 14.0M free.
Dec 02 22:09:39.661748 osdx OSDxCLI[15982]: User 'admin' executed a new command: 'system journal clear'.
Dec 02 22:09:39.768986 osdx OSDxCLI[15982]: User 'admin' executed a new command: 'system journal show | tail'.
Dec 02 22:09:39.798110 osdx dhcpd[4931]: 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:6c10/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/12/02 22:09:42  2024/12/03 10:09:42  2024/12/02 22:09:42

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
Dec 02 22:09:53.907438 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Dec 02 22:09:53.997494 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Dec 02 22:09:54.027790 osdx zebra[1073]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Dec 02 22:09:54.089204 osdx systemd[1]: Started "DHCP Server Service instance VRF0".
Dec 02 22:09:54.097164 osdx cfgd[1120]: [15982]Completed change to active configuration
Dec 02 22:09:54.098952 osdx dhcpd[5238]: Wrote 0 leases to leases file.
Dec 02 22:09:54.105084 osdx OSDxCLI[15982]: User 'admin' committed the configuration.
Dec 02 22:09:54.152304 osdx OSDxCLI[15982]: User 'admin' left the configuration menu.
Dec 02 22:09:54.202646 osdx dhcpd[5238]: Server starting service.
Dec 02 22:09:54.257308 osdx dhcpd[5238]: 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 Mon 2024-12-02 22:09:55 UTC, end at Mon 2024-12-02 22:09:55 UTC. --
Dec 02 22:09:55.286704 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 2.0M, max 16.0M, 14.0M free.
Dec 02 22:09:55.310267 osdx dhcpd[5275]: 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)
Dec 02 22:09:55.322127 osdx OSDxCLI[15982]: 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 Mon 2024-12-02 22:09:55 UTC, end at Mon 2024-12-02 22:09:55 UTC. --
Dec 02 22:09:55.286704 osdx systemd-journald[31677]: Runtime journal (/run/log/journal/1d07d1333cb24d498692b025d3740112) is 2.0M, max 16.0M, 14.0M free.
Dec 02 22:09:55.310267 osdx dhcpd[5275]: 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)
Dec 02 22:09:55.322127 osdx OSDxCLI[15982]: User 'admin' executed a new command: 'system journal clear'.
Dec 02 22:09:55.459969 osdx OSDxCLI[15982]: User 'admin' executed a new command: 'system journal show | tail'.

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:6c10/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/12/02 22:09:58  2024/12/03 10:09:58  2024/12/02 22:09:58