Check-Mac-Address

These scenarios show how the check-mac-address feature works for the 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 to see if warnings appear in your logs. Also, this test checks how the server behaves under normal 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
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

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
Feb 03 11:08:01.501129 osdx INFO[45517]: FRR daemons did not change
Feb 03 11:08:01.526814 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Feb 03 11:08:01.759652 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main".
Feb 03 11:08:01.763310 osdx dhcpd[45583]: Wrote 0 leases to leases file.
Feb 03 11:08:01.765579 osdx cfgd[1636]: [39569]Completed change to active configuration
Feb 03 11:08:01.815494 osdx OSDxCLI[39569]: User 'admin' committed the configuration.
Feb 03 11:08:01.850934 osdx dhcpd[45583]: Server starting service.
Feb 03 11:08:01.878122 osdx OSDxCLI[39569]: User 'admin' left the configuration menu.
Feb 03 11:08:02.095905 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal show | tail'.
Feb 03 11:08:02.457913 osdx dhcpd[45583]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0

Step 3: Modify the following configuration lines 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
Feb 03 11:08:04.140318 osdx systemd-journald[1936]: Runtime Journal (/run/log/journal/0b455e05fd8849079cae205af04c9e16) is 2.0M, max 15.3M, 13.3M free.
Feb 03 11:08:04.142758 osdx systemd-journald[1936]: Received client request to rotate journal, rotating.
Feb 03 11:08:04.142841 osdx systemd-journald[1936]: Vacuuming done, freed 0B of archived journals from /run/log/journal/0b455e05fd8849079cae205af04c9e16.
Feb 03 11:08:04.157820 osdx OSDxCLI[39569]: 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
Feb 03 11:08:04.140318 osdx systemd-journald[1936]: Runtime Journal (/run/log/journal/0b455e05fd8849079cae205af04c9e16) is 2.0M, max 15.3M, 13.3M free.
Feb 03 11:08:04.142758 osdx systemd-journald[1936]: Received client request to rotate journal, rotating.
Feb 03 11:08:04.142841 osdx systemd-journald[1936]: Vacuuming done, freed 0B of archived journals from /run/log/journal/0b455e05fd8849079cae205af04c9e16.
Feb 03 11:08:04.157820 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal clear'.
Feb 03 11:08:04.260425 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal show | tail'.
Feb 03 11:08:04.385867 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal show | tail'.
Feb 03 11:08:04.565418 osdx dhcpd[45636]: 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 ethernet eth0 mac '10:00:00:00:00:05'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 8: Modify the following configuration lines in DUT1:

set interfaces ethernet 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  2025/02/03 11:08:08  2025/02/03 23:08:08  2025/02/03 11:08:08

Test Check MAC Address VRF

Description

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

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 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 login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
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
Feb 03 11:08:18.913952 osdx cfgd[1636]: [39569]Completed change to active configuration
Feb 03 11:08:18.914513 osdx dhcpd[45937]: Wrote 0 leases to leases file.
Feb 03 11:08:18.951163 osdx OSDxCLI[39569]: User 'admin' committed the configuration.
Feb 03 11:08:18.978640 osdx OSDxCLI[39569]: User 'admin' left the configuration menu.
Feb 03 11:08:18.991071 osdx dhcpd[45937]: Server starting service.
Feb 03 11:08:19.159187 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal show | tail'.
Feb 03 11:08:19.217291 osdx dhcpd[45937]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Feb 03 11:08:20.218119 osdx dhcpd[45937]: DHCPOFFER on 10.0.0.5 to 10:00:00:00:00:02 via eth0
Feb 03 11:08:20.261622 osdx dhcpd[45937]: DHCPDISCOVER from 10:00:00:00:00:02 via eth0
Feb 03 11:08:20.261648 osdx dhcpd[45937]: DHCPOFFER on 10.0.0.5 to 10:00:00:00:00:02 via eth0

Step 3: Modify the following configuration lines 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
Feb 03 11:08:21.231455 osdx systemd-journald[1936]: Runtime Journal (/run/log/journal/0b455e05fd8849079cae205af04c9e16) is 2.0M, max 15.3M, 13.3M free.
Feb 03 11:08:21.234923 osdx systemd-journald[1936]: Received client request to rotate journal, rotating.
Feb 03 11:08:21.235089 osdx systemd-journald[1936]: Vacuuming done, freed 0B of archived journals from /run/log/journal/0b455e05fd8849079cae205af04c9e16.
Feb 03 11:08:21.249776 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal clear'.
Feb 03 11:08:21.305390 osdx dhcpd[45987]: 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 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
Feb 03 11:08:21.231455 osdx systemd-journald[1936]: Runtime Journal (/run/log/journal/0b455e05fd8849079cae205af04c9e16) is 2.0M, max 15.3M, 13.3M free.
Feb 03 11:08:21.234923 osdx systemd-journald[1936]: Received client request to rotate journal, rotating.
Feb 03 11:08:21.235089 osdx systemd-journald[1936]: Vacuuming done, freed 0B of archived journals from /run/log/journal/0b455e05fd8849079cae205af04c9e16.
Feb 03 11:08:21.249776 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal clear'.
Feb 03 11:08:21.305390 osdx dhcpd[45987]: 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)
Feb 03 11:08:21.355696 osdx OSDxCLI[39569]: User 'admin' executed a new command: 'system journal show | tail'.

Step 7: Set the following configuration in DUT1:

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

Step 8: Modify the following configuration lines in DUT1:

set interfaces ethernet 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  2025/02/03 11:08:24  2025/02/03 23:08:24  2025/02/03 11:08:24