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
Jul 17 17:57:16.438786 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 17 17:57:16.519120 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main".
Jul 17 17:57:16.520779 osdx cfgd[1240]: [418134]Completed change to active configuration
Jul 17 17:57:16.521778 osdx dhcpd[418525]: Wrote 0 leases to leases file.
Jul 17 17:57:16.523200 osdx OSDxCLI[418134]: User 'admin' committed the configuration.
Jul 17 17:57:16.545435 osdx OSDxCLI[418134]: User 'admin' left the configuration menu.
Jul 17 17:57:16.570996 osdx dhcpd[418525]: Server starting service.
Jul 17 17:57:16.664270 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:16.783293 osdx zebra[1205]: [RZ3YY-GPH41][EC 100663310] snmp[warning]: Warning: Failed to connect to the agentx master agent ([NIL]):
Jul 17 17:57:17.472797 osdx dhcpd[418525]: 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
Jul 17 17:57:18.313123 osdx systemd-journald[93647]: Runtime Journal (/run/log/journal/7135572a45764d02b8df631348eed5fb) is 2.1M, max 15.3M, 13.2M free.
Jul 17 17:57:18.314852 osdx systemd-journald[93647]: Received client request to rotate journal, rotating.
Jul 17 17:57:18.314904 osdx systemd-journald[93647]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7135572a45764d02b8df631348eed5fb.
Jul 17 17:57:18.325516 osdx OSDxCLI[418134]: 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
Jul 17 17:57:18.313123 osdx systemd-journald[93647]: Runtime Journal (/run/log/journal/7135572a45764d02b8df631348eed5fb) is 2.1M, max 15.3M, 13.2M free.
Jul 17 17:57:18.314852 osdx systemd-journald[93647]: Received client request to rotate journal, rotating.
Jul 17 17:57:18.314904 osdx systemd-journald[93647]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7135572a45764d02b8df631348eed5fb.
Jul 17 17:57:18.325516 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal clear'.
Jul 17 17:57:18.386792 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:18.484352 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:18.504658 osdx dhcpd[418568]: 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)
Jul 17 17:57:19.540713 osdx dhcpd[418568]: 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: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/07/17 17:57:21  2024/07/18 05:57:21  2024/07/17 17:57:21

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
Jul 17 17:57:27.707973 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 17 17:57:27.747979 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 17 17:57:27.820480 osdx systemd[1]: Started dhcpd@VRF0.service - "DHCP Server Service instance VRF0".
Jul 17 17:57:27.822298 osdx cfgd[1240]: [418134]Completed change to active configuration
Jul 17 17:57:27.824335 osdx dhcpd[418831]: Wrote 0 leases to leases file.
Jul 17 17:57:27.824385 osdx OSDxCLI[418134]: User 'admin' committed the configuration.
Jul 17 17:57:27.878752 osdx OSDxCLI[418134]: User 'admin' left the configuration menu.
Jul 17 17:57:27.916195 osdx dhcpd[418831]: Server starting service.
Jul 17 17:57:28.014106 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:28.273665 osdx dhcpd[418831]: 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
Jul 17 17:57:29.724424 osdx systemd-journald[93647]: Runtime Journal (/run/log/journal/7135572a45764d02b8df631348eed5fb) is 2.2M, max 15.3M, 13.1M free.
Jul 17 17:57:29.727989 osdx systemd-journald[93647]: Received client request to rotate journal, rotating.
Jul 17 17:57:29.728053 osdx systemd-journald[93647]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7135572a45764d02b8df631348eed5fb.
Jul 17 17:57:29.736448 osdx OSDxCLI[418134]: 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
Jul 17 17:57:29.724424 osdx systemd-journald[93647]: Runtime Journal (/run/log/journal/7135572a45764d02b8df631348eed5fb) is 2.2M, max 15.3M, 13.1M free.
Jul 17 17:57:29.727989 osdx systemd-journald[93647]: Received client request to rotate journal, rotating.
Jul 17 17:57:29.728053 osdx systemd-journald[93647]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7135572a45764d02b8df631348eed5fb.
Jul 17 17:57:29.736448 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal clear'.
Jul 17 17:57:29.812333 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:29.888524 osdx OSDxCLI[418134]: User 'admin' executed a new command: 'system journal show | tail'.
Jul 17 17:57:30.345539 osdx dhcpd[418874]: 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: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/07/17 17:57:33  2024/07/18 05:57:33  2024/07/17 17:57:33