The link files are read from the files located in the system network directory /usr/lib/systemd/network, the volatile runtime network directory /run/systemd/network, and the local administration network directory /etc/systemd/network. Link files must have the extension .link; other extensions are ignored. All link files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same name in /usr/lib. This can be used to override a system-supplied link file with a local file if needed. As a special case, an empty file (file size 0) or symlink with the same name pointing to /dev/null disables the configuration file entirely (it is "masked").
The link file contains a [Match] section, which determines if a given link file may be applied to a given device, as well as a [Link] section specifying how the device should be configured. The first (in lexical order) of the link files that matches a given device is applied. Note that a default file 99-default.link is shipped by the system. Any user-supplied .link should hence have a lexically earlier name to be considered at all.
See udevadm(8) for diagnosing problems with .link files.
MACAddress=01:23:45:67:89:ab 00-11-22-33-44-55 AABB.CCDD.EEFF
Note that specifying a name that the kernel might use for another interface (for example "eth0") is dangerous because the name assignment done by udev will race with the assignment done by the kernel, and only one interface may use the name. Depending on the order of operations, either udev or the kernel will win, making the naming unpredictable. It is best to use some different prefix, for example "internal0"/"external0" or "lan0"/"lan1"/"lan3".
Note that if autonegotiation is enabled, speed and duplex settings are read-only. If autonegotation is disabled, speed and duplex settings are writable if the driver supports multiple link modes.
Defaults to off.
Table 1. Supported advertise values
|Advertise||Speed (Mbps)||Duplex Mode|
By default this is unset, i.e. all possible modes will be
advertised. This option may be specified more than once, in which case all
specified speeds and modes are advertised. If the empty string is assigned
to this option, the list is reset, and all prior assignments have no effect.
The link file 99-default.link that is shipped with systemd defines the default naming policy for links.
[Link] NamePolicy=kernel database onboard slot path MACAddressPolicy=persistent
Example 2. /etc/systemd/network/10-dmz.link
This example assigns the fixed name "dmz0" to the interface with the MAC address 00:a0:de:63:7a:e6:
[Match] MACAddress=00:a0:de:63:7a:e6 [Link] Name=dmz0
Example 3. /etc/systemd/network/10-internet.link
This example assigns the fixed name "internet0" to the interface with the device path "pci-0000:00:1a.0-*":
[Match] Path=pci-0000:00:1a.0-* [Link] Name=internet0
Example 4. /etc/systemd/network/25-wireless.link
Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.
[Match] MACAddress=12:34:56:78:9a:bc Driver=brcmsmac Path=pci-0000:02:00.0-* Type=wlan Virtualization=no Host=my-laptop Architecture=x86-64 [Link] Name=wireless0 MTUBytes=1450 BitsPerSecond=10M WakeOnLan=magic MACAddress=cb:a9:87:65:43:21