1SYSTEMD.LINK(5) systemd.link SYSTEMD.LINK(5)
2
3
4
6 systemd.link - Network device configuration
7
9 link.link
10
12 Network link configuration is performed by the net_setup_link udev
13 builtin.
14
15 The link files are read from the files located in the system network
16 directory /usr/lib/systemd/network, the volatile runtime network
17 directory /run/systemd/network, and the local administration network
18 directory /etc/systemd/network. Link files must have the extension
19 .link; other extensions are ignored. All link files are collectively
20 sorted and processed in lexical order, regardless of the directories in
21 which they live. However, files with identical filenames replace each
22 other. Files in /etc have the highest priority, files in /run take
23 precedence over files with the same name in /usr/lib. This can be used
24 to override a system-supplied link file with a local file if needed; a
25 symlink in /etc with the same name as a link file in /usr/lib, pointing
26 to /dev/null, disables the link file entirely.
27
28 The link file contains a "[Match]" section, which determines if a given
29 link file may be applied to a given device, as well as a "[Link]"
30 section specifying how the device should be configured. The first (in
31 lexical order) of the link files that matches a given device is
32 applied. Note that a default file 99-default.link is shipped by the
33 system, any user-supplied .link should hence have a lexically earlier
34 name to be considered at all.
35
37 A link file is said to match a device if each of the entries in the
38 "[Match]" section matches, or if the section is empty. The following
39 keys are accepted:
40
41 MACAddress=
42 The hardware address.
43
44 OriginalName=
45 A whitespace-separated list of shell-style globs matching the
46 device name, as exposed by the udev property "INTERFACE". This can
47 not be used to match on names that have already been changed from
48 userspace. Caution is advised when matching on kernel-assigned
49 names, as they are known to be unstable between reboots.
50
51 Path=
52 A whitespace-separated list of shell-style globs matching the
53 persistent path, as exposed by the udev property "ID_PATH".
54
55 Driver=
56 A whitespace-separated list of shell-style globs matching the
57 driver currently bound to the device, as exposed by the udev
58 property "DRIVER" of its parent device, or if that is not set, the
59 driver as exposed by "ethtool -i" of the device itself.
60
61 Type=
62 A whitespace-separated list of shell-style globs matching the
63 device type, as exposed by the udev property "DEVTYPE".
64
65 Host=
66 Matches against the hostname or machine ID of the host. See
67 "ConditionHost=" in systemd.unit(5) for details.
68
69 Virtualization=
70 Checks whether the system is executed in a virtualized environment
71 and optionally test whether it is a specific implementation. See
72 "ConditionVirtualization=" in systemd.unit(5) for details.
73
74 KernelCommandLine=
75 Checks whether a specific kernel command line option is set (or if
76 prefixed with the exclamation mark unset). See
77 "ConditionKernelCommandLine=" in systemd.unit(5) for details.
78
79 Architecture=
80 Checks whether the system is running on a specific architecture.
81 See "ConditionArchitecture=" in systemd.unit(5) for details.
82
84 The "[Link]" section accepts the following keys:
85
86 Description=
87 A description of the device.
88
89 Alias=
90 The "ifalias" is set to this value.
91
92 MACAddressPolicy=
93 The policy by which the MAC address should be set. The available
94 policies are:
95
96 "persistent"
97 If the hardware has a persistent MAC address, as most hardware
98 should, and if it is used by the kernel, nothing is done.
99 Otherwise, a new MAC address is generated which is guaranteed
100 to be the same on every boot for the given machine and the
101 given device, but which is otherwise random. This feature
102 depends on ID_NET_NAME_* properties existing for the link, on
103 hardware where these properties are not set the generation of a
104 persistent MAC address will fail.
105
106 "random"
107 If the kernel is using a random MAC address, nothing is done.
108 Otherwise, a new address is randomly generated each time the
109 device appears, typically at boot.
110
111 MACAddress=
112 The MAC address to use, if no "MACAddressPolicy=" is specified.
113
114 NamePolicy=
115 An ordered, space-separated list of policies by which the interface
116 name should be set. "NamePolicy" may be disabled by specifying
117 "net.ifnames=0" on the kernel command line. Each of the policies
118 may fail, and the first successful one is used. The name is not set
119 directly, but is exported to udev as the property "ID_NET_NAME",
120 which is, by default, used by a udev rule to set "NAME". If the
121 name has already been set by userspace, no renaming is performed.
122 The available policies are:
123
124 "kernel"
125 If the kernel claims that the name it has set for a device is
126 predictable, then no renaming is performed.
127
128 "database"
129 The name is set based on entries in the udev's Hardware
130 Database with the key "ID_NET_NAME_FROM_DATABASE".
131
132 "onboard"
133 The name is set based on information given by the firmware for
134 on-board devices, as exported by the udev property
135 "ID_NET_NAME_ONBOARD".
136
137 "slot"
138 The name is set based on information given by the firmware for
139 hot-plug devices, as exported by the udev property
140 "ID_NET_NAME_SLOT".
141
142 "path"
143 The name is set based on the device's physical location, as
144 exported by the udev property "ID_NET_NAME_PATH".
145
146 "mac"
147 The name is set based on the device's persistent MAC address,
148 as exported by the udev property "ID_NET_NAME_MAC".
149
150 Name=
151 The interface name to use in case all the policies specified in
152 NamePolicy= fail, or in case NamePolicy= is missing or disabled.
153
154 MTUBytes=
155 The maximum transmission unit in bytes to set for the device. The
156 usual suffixes K, M, G, are supported and are understood to the
157 base of 1024.
158
159 BitsPerSecond=
160 The speed to set for the device, the value is rounded down to the
161 nearest Mbps. The usual suffixes K, M, G, are supported and are
162 understood to the base of 1000.
163
164 Duplex=
165 The duplex mode to set for the device. The accepted values are
166 "half" and "full".
167
168 WakeOnLan=
169 The Wake-on-LAN policy to set for the device. The supported values
170 are:
171
172 "phy"
173 Wake on PHY activity.
174
175 "magic"
176 Wake on receipt of a magic packet.
177
178 "off"
179 Never wake.
180
182 Example 1. /etc/systemd/network/wireless.link
183
184 [Match]
185 MACAddress=12:34:56:78:9a:bc
186 Driver=brcmsmac
187 Path=pci-0000:02:00.0-*
188 Type=wlan
189 Virtualization=no
190 Host=my-laptop
191 Architecture=x86-64
192
193 [Link]
194 Name=wireless0
195 MTUBytes=1450
196 BitsPerSecond=10M
197 WakeOnLan=magic
198 MACAddress=cb:a9:87:65:43:21
199
201 systemd-udevd.service(8), udevadm(8), systemd.netdev(5),
202 systemd.network(5)
203
204
205
206systemd 219 SYSTEMD.LINK(5)