Skip to content

The interface MAC address can be set with the link.address option of an interface. If the option is not set, the interface's MAC address will be configured to a default value. For physical interfaces this is their permanent MAC address. For virtual interfaces ifstate derives a reproducible MAC address.

Reproducible MAC Addresses

The reproducible MAC addresses are based on the output of the SHAKE256 extendable-output function. The input for SHAKE256 for each interface is build by concatinating the following values depending on the ifstate config:

EBNF for SHAKE256 input string

No implicit link.address config will be enforced if:

  • the interface does not support ethernet addressing (ipip, sit, vti, …) or
  • the mac_seed option for the current netns is set to null

Examples for a host with the machine-id of c5826ec0bb89fe5ca3af4e183d51e636:

  • a VLAN subinterface vl42 in a netns with the mac_seed set to ha-service01 will use the digest of the following string: SHAKE256("link\000\000ha-service01\000vl42")ee:65:a3:17:74:99
  • a VLAN subinterface vl42 in the root netns will use the digest of the following string: SHAKE256("link\000c5826ec0bb89fe5ca3af4e183d51e636\000\000vl42")9e:12:25:18:4e:31
  • a VLAN subinterface vl42 in the netns foo will use the digest of the following string: SHAKE256("link\000c5826ec0bb89fe5ca3af4e183d51e636\000foo\000vl42")0a:13:9b:fc:bc:6d