Custom-Mac

Test suite to validate DHCP client with custom MAC address configuration.

This test suite verifies that custom MAC addresses are correctly applied to interfaces before starting the DHCP client, ensuring that: - VLAN interfaces inherit parent MAC correctly - VLAN interfaces with own MAC work correctly - Physical interfaces with custom MAC work correctly - Bridge interfaces with custom MAC work correctly - Runtime MAC changes restart DHCP client properly - Removing MAC configuration works correctly - Default MAC operation is not affected

Test VLAN Inherits Parent MAC on Boot

Description

This test verifies that a VLAN interface correctly inherits and applies the custom MAC configured on its parent interface during boot.

When a parent interface has a custom MAC, VLAN sub-interfaces should inherit that MAC address and use it for DHCP operations.

Configuration: - set interfaces ethernet eth0 mac ‘10:00:00:00:00:10’ - set interfaces ethernet eth0 vif 100 address dhcp

Expected behavior: - eth0.100 uses MAC 10:00:00:00:00:10 (inherited from parent) - DHCP client starts with correct MAC - DHCP server receives requests with custom MAC - Client obtains IP successfully - Packet capture confirms MAC in DHCP packets

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

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

Step 3: Run command interfaces ethernet eth0 vif 100 show at DUT1 and check if output contains the following tokens:

172.16.0.
Show output
-----------------------------------------------------------------
  Name           IP Address         Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0.100  172.16.0.5/24             up     up
          fe80::1200:ff:fe00:10/64

Step 4: Run command interfaces show detailed at DUT1 and expect this output:

Show output
--------------------------------------------------------------------------------------------------------------------
  Name    Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
--------------------------------------------------------------------------------------------------------------------
    eth0  2    fe80::dcad:beff:feef:6c10/64  up     up    up    1500                     ethernet  10:00:00:00:00:10
eth0.100  713  172.16.0.5/24                 up     up    up    1500              eth0   ethernet  10:00:00:00:00:10
               fe80::1200:ff:fe00:10/64
    eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:11
    eth2  4                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:12
    eth3  5                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:13

Step 5: Run command service dhcp-server show leases at DUT0 and expect this output:

Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
172.16.0.5  10:00:00:00:00:10  2026/03/05 21:02:30  2026/03/06 09:02:30  2026/03/05 21:02:30

Step 6: Run command traffic dump monitor detail interface eth0 filter "port 67 or port 68" packets 10 at DUT0.

Step 7: Run command service dhcp-client renew interface eth0.100 at DUT1 and expect this output:

Show output
Renewing DHCP lease on interface eth0.100...

Test Physical Interface MAC on Boot

Description

This test verifies that a physical interface with custom MAC correctly applies the MAC before starting DHCP client.

Configuration: - set interfaces ethernet eth0 mac ‘10:00:00:00:00:30’ - set interfaces ethernet eth0 address dhcp

Expected behavior: - eth0 boots with custom MAC 10:00:00:00:00:30 - DHCP client starts with correct MAC - Client obtains IP successfully - Packet capture confirms MAC in DHCP packets

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

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

Step 3: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

172.16.0.
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  172.16.0.5/24                 up     up
      fe80::dcad:beff:feef:6c10/64

Step 4: Run command interfaces show detailed at DUT1 and expect this output:

Show output
----------------------------------------------------------------------------------------------------------------
Name  Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
----------------------------------------------------------------------------------------------------------------
eth0  2    172.16.0.5/24                 up     up    up    1500                     ethernet  10:00:00:00:00:30
           fe80::dcad:beff:feef:6c10/64
eth1  3                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:11
eth2  4                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:12
eth3  5                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:13

Step 5: Run command service dhcp-server show leases at DUT0 and expect this output:

Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
172.16.0.5  10:00:00:00:00:30  2026/03/05 21:02:43  2026/03/06 09:02:43  2026/03/05 21:02:43

Step 6: Run command traffic dump monitor detail interface eth0 filter "port 67 or port 68" packets 10 at DUT0.

Step 7: Run command service dhcp-client renew interface eth0 at DUT1 and expect this output:

Show output
Renewing DHCP lease on interface eth0...

Test Bridge Interface MAC on Boot

Description

This test verifies that a bridge interface with custom MAC correctly applies the MAC before starting DHCP client.

A bridge interface can have an explicit MAC address configured, which should be applied before the DHCP client starts, ensuring that DHCP requests are sent with the correct MAC address.

Configuration: - set interfaces ethernet eth1 bridge-group bridge br0 - set interfaces bridge br0 mac ‘10:00:00:00:00:40’ - set interfaces bridge br0 address dhcp

Expected behavior: - br0 boots with custom MAC 10:00:00:00:00:40 - DHCP client starts with correct MAC - DHCP server receives requests with custom MAC - Client obtains IP successfully - Packet capture confirms MAC in DHCP packets

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces bridge br0 address dhcp
set interfaces bridge br0 mac '10:00:00:00:00:40'
set interfaces ethernet eth1 bridge-group bridge br0
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces bridge show detailed at DUT1 and check if output contains the following tokens:

172.16.0.
Show output
--------------------------------------------------------------------------------------------------------------
Name  Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower   Type       Phys addr
--------------------------------------------------------------------------------------------------------------
 br0  714  172.16.0.5/24                 up     up    up    1500                     bridge  10:00:00:00:00:40
           fe80::80d4:a0ff:febc:830c/64

Step 4: Run command interfaces show detailed at DUT1 and expect this output:

Show output
----------------------------------------------------------------------------------------------------------------
Name  Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower    Type        Phys addr
----------------------------------------------------------------------------------------------------------------
 br0  714  172.16.0.5/24                 up     up    up    1500                     bridge    10:00:00:00:00:40
           fe80::80d4:a0ff:febc:830c/64
eth0  2                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:10
eth1  3    fe80::dcad:beff:feef:6c11/64  up     up    up    1500       br0           ethernet  de:ad:be:ef:6c:11
eth2  4                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:12
eth3  5                                  down   down  down  1500                     ethernet  de:ad:be:ef:6c:13

Step 5: Run command service dhcp-server show leases at DUT0 and expect this output:

Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
172.16.0.5  10:00:00:00:00:40  2026/03/05 21:02:57  2026/03/06 09:02:57  2026/03/05 21:02:57

Step 6: Run command traffic dump monitor detail interface eth0 filter "port 67 or port 68" packets 10 at DUT0.

Step 7: Run command service dhcp-client renew interface br0 at DUT1 and expect this output:

Show output
Renewing DHCP lease on interface br0...