]> git.proxmox.com Git - systemd.git/blame - man/systemd.network.5
Imported Upstream version 220
[systemd.git] / man / systemd.network.5
CommitLineData
60f067b4 1'\" t
e3bff60a 2.TH "SYSTEMD\&.NETWORK" "5" "" "systemd 220" "systemd.network"
60f067b4
JS
3.\" -----------------------------------------------------------------
4.\" * Define some portability stuff
5.\" -----------------------------------------------------------------
6.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7.\" http://bugs.debian.org/507673
8.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10.ie \n(.g .ds Aq \(aq
11.el .ds Aq '
12.\" -----------------------------------------------------------------
13.\" * set default formatting
14.\" -----------------------------------------------------------------
15.\" disable hyphenation
16.nh
17.\" disable justification (adjust text to left margin only)
18.ad l
19.\" -----------------------------------------------------------------
20.\" * MAIN CONTENT STARTS HERE *
21.\" -----------------------------------------------------------------
22.SH "NAME"
23systemd.network \- Network configuration
24.SH "SYNOPSIS"
25.PP
26\fInetwork\fR\&.network
27.SH "DESCRIPTION"
28.PP
29Network setup is performed by
30\fBsystemd-networkd\fR(8)\&.
31.PP
32Network files must have the extension
33\&.network; other extensions are ignored\&. Networks are applied to links whenever the links appear\&.
34.PP
35The
36\&.network
37files are read from the files located in the system network directory
38/usr/lib/systemd/network, the volatile runtime network directory
39/run/systemd/network
40and the local administration network directory
41/etc/systemd/network\&. All configuration 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
42/etc
43have the highest priority, files in
44/run
45take precedence over files with the same name in
46/usr/lib\&. This can be used to override a system\-supplied configuration file with a local file if needed; a symlink in
47/etc
48with the same name as a configuration file in
49/usr/lib, pointing to
50/dev/null, disables the configuration file entirely\&.
e842803a 51.SH "[MATCH] SECTION OPTIONS"
60f067b4
JS
52.PP
53The network file contains a
54"[Match]"
55section, which determines if a given network file may be applied to a given device; and a
56"[Network]"
e3bff60a 57section specifying how the device should be configured\&. The first (in lexical order) of the network files that matches a given device is applied, all later files are ignored, even if they match as well\&.
60f067b4
JS
58.PP
59A network file is said to match a device if each of the entries in the
60"[Match]"
61section matches, or if the section is empty\&. The following keys are accepted:
62.PP
63\fIMACAddress=\fR
64.RS 4
65The hardware address\&.
66.RE
67.PP
68\fIPath=\fR
69.RS 4
e735f4d4
MP
70A whitespace\-separated list of shell\-style globs matching the persistent path, as exposed by the udev property
71"ID_PATH"\&.
60f067b4
JS
72.RE
73.PP
74\fIDriver=\fR
75.RS 4
e735f4d4 76A whitespace\-separated list of shell\-style globs matching the driver currently bound to the device, as exposed by the udev property
60f067b4
JS
77"DRIVER"
78of its parent device, or if that is not set the driver as exposed by
79"ethtool \-i"
80of the device itself\&.
81.RE
82.PP
83\fIType=\fR
84.RS 4
e735f4d4 85A whitespace\-separated list of shell\-style globs matching the device type, as exposed by the udev property
60f067b4
JS
86"DEVTYPE"\&.
87.RE
88.PP
89\fIName=\fR
90.RS 4
e735f4d4
MP
91A whitespace\-separated list of shell\-style globs matching the device name, as exposed by the udev property
92"INTERFACE"\&.
60f067b4
JS
93.RE
94.PP
95\fIHost=\fR
96.RS 4
97Matches against the hostname or machine ID of the host\&. See
98"ConditionHost="
99in
100\fBsystemd.unit\fR(5)
101for details\&.
102.RE
103.PP
104\fIVirtualization=\fR
105.RS 4
106Checks whether the system is executed in a virtualized environment and optionally test whether it is a specific implementation\&. See
107"ConditionVirtualization="
108in
109\fBsystemd.unit\fR(5)
110for details\&.
111.RE
112.PP
113\fIKernelCommandLine=\fR
114.RS 4
115Checks whether a specific kernel command line option is set (or if prefixed with the exclamation mark unset)\&. See
116"ConditionKernelCommandLine="
117in
118\fBsystemd.unit\fR(5)
119for details\&.
120.RE
121.PP
122\fIArchitecture=\fR
123.RS 4
124Checks whether the system is running on a specific architecture\&. See
125"ConditionArchitecture="
126in
127\fBsystemd.unit\fR(5)
128for details\&.
129.RE
f47781d8
MP
130.SH "[LINK] SECTION OPTIONS"
131.PP
132The
133"[Link]"
134section accepts the following keys:
135.PP
136\fIMACAddress=\fR
137.RS 4
138The hardware address\&.
139.RE
140.PP
141\fIMTUBytes=\fR
142.RS 4
143The maximum transmission unit in bytes to set for the device\&. The usual suffixes K, M, G, are supported and are understood to the base of 1024\&.
144.RE
e842803a 145.SH "[NETWORK] SECTION OPTIONS"
60f067b4
JS
146.PP
147The
148"[Network]"
149section accepts the following keys:
150.PP
151\fIDescription=\fR
152.RS 4
153A description of the device\&. This is only used for presentation purposes\&.
154.RE
155.PP
156\fIDHCP=\fR
157.RS 4
e842803a 158Enables DHCPv4 and/or DHCPv6 support\&. Accepts
e735f4d4
MP
159"yes",
160"no",
161"ipv4", or
162"ipv6"\&.
e3bff60a
MP
163.sp
164Please note that by default the domain name specified through DHCP is not used for name resolution\&. See option
165\fBUseDomains=\fR
166below\&.
e842803a
MB
167.RE
168.PP
169\fIDHCPServer=\fR
170.RS 4
171A boolean\&. Enables a basic DHCPv4 server on the device\&. Mostly useful for handing out leases to container instances\&.
60f067b4
JS
172.RE
173.PP
e735f4d4 174\fILinkLocalAddressing=\fR
60f067b4 175.RS 4
e735f4d4
MP
176Enables link\-local address autoconfiguration\&. Accepts
177"yes",
178"no",
179"ipv4", or
180"ipv6"\&. Defaults to
181"ipv6"\&.
5eef597e
MP
182.RE
183.PP
184\fIIPv4LLRoute=\fR
185.RS 4
186A boolean\&. When true, sets up the route needed for non\-IPv4LL hosts to communicate with IPv4LL\-only hosts\&. Defaults to false\&.
187.RE
188.PP
e735f4d4
MP
189\fIIPv6Token=\fR
190.RS 4
191An IPv6 address with the top 64 bits unset\&. When set, indicates the 64 bits interface part of SLAAC IPv6 addresses for this link\&. By default it is autogenerated\&.
192.RE
193.PP
5eef597e
MP
194\fILLMNR=\fR
195.RS 4
196A boolean or
197"resolve"\&. When true, enables Link\-Local Multicast Name Resolution on the link, when set to
198"resolve"
199only resolution is enabled, but not announcement\&. Defaults to true\&.
60f067b4
JS
200.RE
201.PP
e735f4d4
MP
202\fILLDP=\fR
203.RS 4
204A boolean\&. When true, enables LLDP link receive support\&.
205.RE
206.PP
e3bff60a
MP
207\fIBindCarrier=\fR
208.RS 4
209A port or a list of ports\&. When set, controls the behaviour of the current interface\&. When all ports in the list are in an operational down state, the current interface is brought down\&. When at least one port has carrier, the current interface is brought up\&.
210.RE
211.PP
60f067b4
JS
212\fIAddress=\fR
213.RS 4
214A static IPv4 or IPv6 address and its prefix length, separated by a
215"/"
216character\&. Specify this key more than once to configure several addresses\&. The format of the address must be as described in
217\fBinet_pton\fR(3)\&. This is a short\-hand for an [Address] section only containing an Address key (see below)\&. This option may be specified more than once\&.
e842803a
MB
218.sp
219If the specified address is 0\&.0\&.0\&.0 (for IPv4) or [::] (for IPv6), a new address range of the requested size is automatically allocated from a system\-wide pool of unused ranges\&. The allocated range is checked against all current network interfaces and all known network configuration files to avoid address range conflicts\&. The default system\-wide pool consists of 192\&.168\&.0\&.0/16, 172\&.16\&.0\&.0/12 and 10\&.0\&.0\&.0/8 for IPv4, and fc00::/7 for IPv6\&. This functionality is useful to manage a large number of dynamically created network interfaces with the same network configuration and automatic address range assignment\&.
60f067b4
JS
220.RE
221.PP
222\fIGateway=\fR
223.RS 4
224The gateway address, which must be in the format described in
225\fBinet_pton\fR(3)\&. This is a short\-hand for a [Route] section only containing a Gateway key\&. This option may be specified more than once\&.
226.RE
227.PP
228\fIDNS=\fR
229.RS 4
230A DNS server address, which must be in the format described in
231\fBinet_pton\fR(3)\&. This option may be specified more than once\&.
232.RE
233.PP
5eef597e
MP
234\fIDomains=\fR
235.RS 4
236The domains used for DNS resolution over this link\&.
237.RE
238.PP
239\fINTP=\fR
240.RS 4
241An NTP server address\&. This option may be specified more than once\&.
242.RE
243.PP
e735f4d4
MP
244\fIIPForward=\fR
245.RS 4
246Configures IP forwarding for the network interface\&. If enabled incoming packets on the network interface will be forwarded to other interfaces according to the routing table\&. Takes either a boolean argument, or the values
247"ipv4"
248or
e3bff60a
MP
249"ipv6", which only enables IP forwarding for the specified address family\&. This controls the
250net\&.ipv4\&.conf\&.<interface>\&.forwarding
251and
252net\&.ipv6\&.conf\&.<interface>\&.forwarding
253sysctl options of the network interface (see
254\m[blue]\fBip\-sysctl\&.txt\fR\m[]\&\s-2\u[1]\d\s+2
255for details about sysctl options)\&. Defaults to
256"no"\&.
257.sp
258Note: unless this option is turned on, no IP forwarding is done on this interface, even if this is globally turned on in the kernel, with the
259net\&.ipv4\&.ip_forward
260and
261net\&.ipv4\&.ip_forward
262sysctl options\&.
e735f4d4
MP
263.RE
264.PP
265\fIIPMasquerade=\fR
266.RS 4
267Configures IP masquerading for the network interface\&. If enabled packets forwarded from the network interface will be appear as coming from the local host\&. Takes a boolean argument\&. Implies
e3bff60a
MP
268\fIIPForward=ipv4\fR\&. Defaults to
269"no"\&.
e735f4d4
MP
270.RE
271.PP
60f067b4
JS
272\fIBridge=\fR
273.RS 4
274The name of the bridge to add the link to\&.
275.RE
276.PP
277\fIBond=\fR
278.RS 4
279The name of the bond to add the link to\&.
280.RE
281.PP
282\fIVLAN=\fR
283.RS 4
284The name of a VLAN to create on the link\&. This option may be specified more than once\&.
285.RE
286.PP
287\fIMACVLAN=\fR
288.RS 4
289The name of a MACVLAN to create on the link\&. This option may be specified more than once\&.
290.RE
291.PP
e842803a
MB
292\fIVXLAN=\fR
293.RS 4
294The name of a VXLAN to create on the link\&. This option may be specified more than once\&.
295.RE
296.PP
297\fITunnel=\fR
298.RS 4
299The name of a Tunnel to create on the link\&. This option may be specified more than once\&.
300.RE
301.SH "[ADDRESS] SECTION OPTIONS"
302.PP
60f067b4
JS
303An
304"[Address]"
305section accepts the following keys\&. Specify several
306"[Address]"
307sections to configure several addresses\&.
308.PP
309\fIAddress=\fR
310.RS 4
311As in the
312"[Network]"
313section\&. This key is mandatory\&.
314.RE
315.PP
5eef597e
MP
316\fIPeer=\fR
317.RS 4
318The peer address in a point\-to\-point connection\&. Accepts the same format as the
319"Address"
320key\&.
321.RE
322.PP
60f067b4
JS
323\fIBroadcast=\fR
324.RS 4
325The broadcast address, which must be in the format described in
326\fBinet_pton\fR(3)\&. This key only applies to IPv4 addresses\&. If it is not given, it is derived from the
327"Address"
328key\&.
329.RE
330.PP
331\fILabel=\fR
332.RS 4
333An address label\&.
334.RE
e842803a 335.SH "[ROUTE] SECTION OPTIONS"
60f067b4
JS
336.PP
337The
338"[Route]"
339section accepts the following keys\&. Specify several
340"[Route]"
341sections to configure several routes\&.
342.PP
343\fIGateway=\fR
344.RS 4
345As in the
346"[Network]"
f47781d8 347section\&.
60f067b4
JS
348.RE
349.PP
350\fIDestination=\fR
351.RS 4
5eef597e
MP
352The destination prefix of the route\&. Possibly followed by a slash and the prefixlength\&. If omitted, a full\-length host route is assumed\&.
353.RE
354.PP
f47781d8
MP
355\fISource=\fR
356.RS 4
357The source prefix of the route\&. Possibly followed by a slash and the prefixlength\&. If omitted, a full\-length host route is assumed\&.
358.RE
359.PP
5eef597e
MP
360\fIMetric=\fR
361.RS 4
362The metric of the route\&. An unsigned integer
60f067b4 363.RE
e735f4d4
MP
364.PP
365\fIScope=\fR
366.RS 4
367The scope of the route\&. One of the values
368"global",
369"link"
370or
371"host"\&. Defaults to
372"global"\&.
373.RE
e842803a 374.SH "[DHCP] SECTION OPTIONS"
60f067b4
JS
375.PP
376The
e842803a 377"[DHCP]"
60f067b4
JS
378section accepts the following keys:
379.PP
380\fIUseDNS=\fR
381.RS 4
382When true (the default), the DNS servers received from the DHCP server will be used and take precedence over any statically configured ones\&.
e3bff60a
MP
383.sp
384This corresponds to the
385\fBnameserver\fR
386option in
387\fBresolv.conf\fR(5)\&.
388.RE
389.PP
390\fIUseNTP=\fR
391.RS 4
392When true (the default), the NTP servers received from the DHCP server will be used by systemd\-timesyncd and take precedence over any statically configured ones\&.
60f067b4
JS
393.RE
394.PP
395\fIUseMTU=\fR
396.RS 4
397When true, the interface maximum transmission unit from the DHCP server will be used on the current link\&. Defaults to false\&.
398.RE
399.PP
e842803a
MB
400\fISendHostname=\fR
401.RS 4
402When true (the default), the machine\*(Aqs hostname will be sent to the DHCP server
403.RE
404.PP
60f067b4
JS
405\fIUseHostname=\fR
406.RS 4
407When true (the default), the hostname received from the DHCP server will be used as the transient hostname\&.
408.RE
409.PP
5eef597e
MP
410\fIUseDomains=\fR
411.RS 4
e3bff60a
MP
412When true (not the default), the domain name received from the DHCP server will be used for DNS resolution over this link\&. When a name cannot be resolved as specified, the domain name will be used a suffix and name resolution of that will be attempted\&.
413.sp
414This corresponds to the
415\fBdomain\fR
416option in
417\fBresolv.conf\fR(5)
418and should not be enabled on untrusted networks\&.
5eef597e
MP
419.RE
420.PP
e842803a
MB
421\fIUseRoutes=\fR
422.RS 4
423When true (the default), the static routes will be requested from the DHCP server and added to the routing table with metric of 1024\&.
424.RE
425.PP
60f067b4
JS
426\fICriticalConnection=\fR
427.RS 4
428When true, the connection will never be torn down even if the DHCP lease expires\&. This is contrary to the DHCP specification, but may be the best choice if, say, the root filesystem relies on this connection\&. Defaults to false\&.
429.RE
5eef597e 430.PP
e3bff60a
MP
431\fIClientIdentifier=\fR
432.RS 4
433DHCP client identifier to use\&. Either
434"mac"
435to use the MAC address of the link or
436"duid"
437(the default) to use a RFC4361\-compliant Client ID\&.
438.RE
439.PP
5eef597e
MP
440\fIVendorClassIdentifier=\fR
441.RS 4
442The vendor class identifier used to identify vendor type and configuration\&.
443.RE
444.PP
445\fIRequestBroadcast=\fR
446.RS 4
447Request the server to use broadcast messages before the IP address has been configured\&. This is necessary for devices that cannot receive RAW packets, or that cannot receive packets at all before an IP address has been configured\&. On the other hand, this must not be enabled on networks where broadcasts are filtered out\&.
448.RE
449.PP
450\fIRouteMetric=\fR
451.RS 4
452Set the routing metric for routes specified by the DHCP server\&.
453.RE
f47781d8
MP
454.SH "[BRIDGE] SECTION OPTIONS"
455.PP
456The
457"[Bridge]"
458section accepts the following keys\&.
459.PP
460\fICost=\fR
461.RS 4
462Each port in a bridge may have different speed\&. Cost is used to decide which link to use\&. Faster interfaces should have lower costs
463.RE
e735f4d4
MP
464.SH "[BRIDGEFDB] SECTION OPTIONS"
465.PP
466The
467"[BridgeFDB]"
468section manages the forwarding database table of a port and accepts the following keys\&. Specify several
469"[BridgeFDB]"
470sections to configure several static MAC table entries\&.
471.PP
472\fIMACAddress=\fR
473.RS 4
474As in the
475"[Network]"
476section\&. This key is mandatory\&.
477.RE
478.PP
479\fIVLANId=\fR
480.RS 4
481The VLAN Id for the new static MAC table entry\&. If omitted, no VLAN Id info is appended to the new static MAC table entry\&.
482.RE
60f067b4
JS
483.SH "EXAMPLE"
484.PP
485\fBExample\ \&1.\ \&/etc/systemd/network/50-static.network\fR
486.sp
487.if n \{\
488.RS 4
489.\}
490.nf
491[Match]
492Name=enp2s0
493
494[Network]
495Address=192\&.168\&.0\&.15/24
496Gateway=192\&.168\&.0\&.1
497.fi
498.if n \{\
499.RE
500.\}
501.PP
502\fBExample\ \&2.\ \&/etc/systemd/network/80-dhcp.network\fR
503.sp
504.if n \{\
505.RS 4
506.\}
507.nf
508[Match]
509Name=en*
510
511[Network]
e3bff60a 512DHCP=yes
60f067b4
JS
513.fi
514.if n \{\
515.RE
516.\}
517.PP
518\fBExample\ \&3.\ \&/etc/systemd/network/bridge-static.network\fR
519.sp
520.if n \{\
521.RS 4
522.\}
523.nf
524[Match]
525Name=bridge0
526
527[Network]
528Address=192\&.168\&.0\&.15/24
529Gateway=192\&.168\&.0\&.1
530DNS=192\&.168\&.0\&.1
531.fi
532.if n \{\
533.RE
534.\}
535.PP
536\fBExample\ \&4.\ \&/etc/systemd/network/bridge-slave-interface.network\fR
537.sp
538.if n \{\
539.RS 4
540.\}
541.nf
542[Match]
543Name=enp2s0
544
545[Network]
546Bridge=bridge0
547.fi
548.if n \{\
549.RE
550.\}
e842803a
MB
551.PP
552\fBExample\ \&5.\ \&/etc/systemd/network/ipip.network\fR
553.sp
554.if n \{\
555.RS 4
556.\}
557.nf
558[Match]
559Name=em1
560
561[Network]
562Tunnel=ipip\-tun
563.fi
564.if n \{\
565.RE
566.\}
567.PP
568\fBExample\ \&6.\ \&/etc/systemd/network/sit.network\fR
569.sp
570.if n \{\
571.RS 4
572.\}
573.nf
574[Match]
575Name=em1
576
577[Network]
578Tunnel=sit\-tun
579.fi
580.if n \{\
581.RE
582.\}
583.PP
584\fBExample\ \&7.\ \&/etc/systemd/network/gre.network\fR
585.sp
586.if n \{\
587.RS 4
588.\}
589.nf
590[Match]
591Name=em1
592
593[Network]
594Tunnel=gre\-tun
595.fi
596.if n \{\
597.RE
598.\}
599.PP
600\fBExample\ \&8.\ \&/etc/systemd/network/vti.network\fR
601.sp
602.if n \{\
603.RS 4
604.\}
605.nf
606[Match]
607Name=em1
608
609[Network]
610Tunnel=vti\-tun
611.fi
612.if n \{\
613.RE
614.\}
60f067b4
JS
615.SH "SEE ALSO"
616.PP
617\fBsystemd\fR(1),
618\fBsystemd-networkd\fR(8),
e735f4d4 619\fBsystemd.link\fR(5),
60f067b4 620\fBsystemd.netdev\fR(5)
e3bff60a
MP
621.SH "NOTES"
622.IP " 1." 4
623ip-sysctl.txt
624.RS 4
625\%https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
626.RE