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 SHAKE256 input for an interface is build by concatenating the following values, depending on the configuration:

EBNF for SHAKE256 input string

No implicit link.address setting 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

Configurable MAC Address Defaults

For some interface kinds it is possible to change how IfState determines the default MAC address. This allows you to adopt IfState to your use cases and might help to get around with physical TCAM resource limits found in some switchdev hardware:

parameters:
  link_address_default:
    # use reproducible instead of parent interface addresses
    macsec: generated
    # use reproducible instead of permanent addresses
    physical: generated
    # use parent interface instead of reproducible addresses
    vlan: inherited

interfaces: …