chiark / gitweb /
networkd: send hostname to dhcp server
[elogind.git] / man / systemd.netdev.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2013 Tom Gundersen
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.netdev" conditional='ENABLE_NETWORKD'>
25
26         <refentryinfo>
27                 <title>systemd.network</title>
28                 <productname>systemd</productname>
29
30                 <authorgroup>
31                         <author>
32                                 <contrib>Developer</contrib>
33                                 <firstname>Tom</firstname>
34                                 <surname>Gundersen</surname>
35                                 <email>teg@jklm.no</email>
36                         </author>
37                 </authorgroup>
38         </refentryinfo>
39
40         <refmeta>
41                 <refentrytitle>systemd.netdev</refentrytitle>
42                 <manvolnum>5</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>systemd.netdev</refname>
47                 <refpurpose>Virtual Network Device configuration</refpurpose>
48         </refnamediv>
49
50         <refsynopsisdiv>
51                 <para><filename><replaceable>netdev</replaceable>.netdev</filename></para>
52         </refsynopsisdiv>
53
54         <refsect1>
55                 <title>Description</title>
56
57                 <para>Network setup is performed by
58                 <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
59                 </para>
60
61                 <para>Virtual Network Device files must have the extension
62                 <filename>.netdev</filename>; other extensions are ignored. Virtual
63                 network devices are created as soon as networkd is started.</para>
64
65                 <para>The <filename>.netdev</filename> files are read from the files located in the
66                 system network directory <filename>/usr/lib/systemd/network</filename>,
67                 the volatile runtime network directory
68                 <filename>/run/systemd/network</filename> and the local administration
69                 network directory <filename>/etc/systemd/network</filename>.
70                 All configuration files are collectively sorted and processed in lexical order,
71                 regardless of the directories in which they live. However, files with
72                 identical filenames replace each other. Files in
73                 <filename>/etc</filename> have the highest priority, files in
74                 <filename>/run</filename> take precedence over files with the same
75                 name in <filename>/usr/lib</filename>. This can be used to override a
76                 system-supplied configuration file with a local file if needed; a symlink in
77                 <filename>/etc</filename> with the same name as a configuration file in
78                 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
79                 disables the configuration file entirely.</para>
80
81         </refsect1>
82
83         <refsect1>
84                 <title>[Match] Section Options</title>
85
86                 <para>A virtual network device is only created if the
87                 <literal>[Match]</literal> section matches the current
88                 environment, or if the section is empty. The following keys are accepted:</para>
89
90                         <variablelist class='network-directives'>
91                                 <varlistentry>
92                                         <term><varname>Host=</varname></term>
93                                         <listitem>
94                                                 <para>Matches against the hostname or machine ID of the
95                                                 host. See <literal>ConditionHost=</literal> in
96                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
97                                                 for details.
98                                                 </para>
99                                         </listitem>
100                                 </varlistentry>
101                                 <varlistentry>
102                                         <term><varname>Virtualization=</varname></term>
103                                         <listitem>
104                                                 <para>Checks whether the system is executed in a virtualized
105                                                 environment and optionally test whether it is a specific
106                                                 implementation. See <literal>ConditionVirtualization=</literal> in
107                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
108                                                 for details.
109                                                 </para>
110                                         </listitem>
111                                 </varlistentry>
112                                 <varlistentry>
113                                         <term><varname>KernelCommandLine=</varname></term>
114                                         <listitem>
115                                                 <para>Checks whether a specific kernel command line option is
116                                                 set (or if prefixed with the exclamation mark unset). See
117                                                 <literal>ConditionKernelCommandLine=</literal> in
118                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
119                                                 for details.
120                                                 </para>
121                                         </listitem>
122                                 </varlistentry>
123                                 <varlistentry>
124                                         <term><varname>Architecture=</varname></term>
125                                         <listitem>
126                                                 <para>Checks whether the system is running on a specific
127                                                 architecture. See <literal>ConditionArchitecture=</literal> in
128                                                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
129                                                 for details.
130                                                 </para>
131                                         </listitem>
132                                 </varlistentry>
133                         </variablelist>
134
135         </refsect1>
136
137         <refsect1>
138                 <title>[NetDev] Section Options</title>
139
140                         <para>The <literal>[NetDev]</literal> section accepts the following
141                         keys:</para>
142
143                         <variablelist class='network-directives'>
144                                 <varlistentry>
145                                         <term><varname>Description=</varname></term>
146                                         <listitem>
147                                                 <para>A free-form description of the netdev.
148                                                 </para>
149                                         </listitem>
150                                 </varlistentry>
151                                 <varlistentry>
152                                         <term><varname>Name=</varname></term>
153                                         <listitem>
154                                                 <para>The interface name used when creating the
155                                                 netdev. This option is compulsory.</para>
156                                         </listitem>
157                                 </varlistentry>
158                                 <varlistentry>
159                                         <term><varname>Kind=</varname></term>
160                                         <listitem>
161                                                 <para>The netdev kind. Currently, <literal>bridge</literal>,
162                                                 <literal>bond</literal>, <literal>vlan</literal>,
163                                                 <literal>macvlan</literal>, <literal>vxlan</literal>,
164                                                 <literal>ipip</literal>, <literal>gre</literal>,
165                                                 <literal>sit</literal>, <literal>vti</literal>,
166                                                 <literal>veth</literal> are supported. This option
167                                                 is compulsory.</para>
168                                         </listitem>
169                                 </varlistentry>
170                                 <varlistentry>
171                                         <term><varname>MTUBytes=</varname></term>
172                                         <listitem>
173                                                 <para>The maximum transmission unit in bytes to
174                                                 set for the device. The usual suffixes K, M, G,
175                                                 are supported and are understood to the base of
176                                                 1024.</para>
177                                         </listitem>
178                                 </varlistentry>
179                                 <varlistentry>
180                                         <term><varname>MACAddress=</varname></term>
181                                         <listitem>
182                                                 <para>The MAC address to use for the device.
183                                                 If none is given, one is generated based on
184                                                 the interface name and the
185                                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
186                                                 </para>
187                                         </listitem>
188                                 </varlistentry>
189                         </variablelist>
190         </refsect1>
191
192         <refsect1>
193                 <title>[VLAN] Section Options</title>
194
195                         <para>The <literal>[VLAN]</literal> section only applies for netdevs of kind <literal>vlan</literal>,
196                         and accepts the following key:</para>
197
198                         <variablelist class='network-directives'>
199                                 <varlistentry>
200                                         <term><varname>Id=</varname></term>
201                                         <listitem>
202                                                 <para>The VLAN ID to use. An integer in the range 0–4094.
203                                                 This option is compulsory.</para>
204                                         </listitem>
205                                 </varlistentry>
206                         </variablelist>
207
208         </refsect1>
209
210         <refsect1>
211                 <title>[MACVLAN] Section Options</title>
212
213                         <para>The <literal>[MACVLAN]</literal> section only applies for netdevs of kind
214                         <literal>macvlan</literal>, and accepts the following key:</para>
215
216                         <variablelist class='network-directives'>
217                                 <varlistentry>
218                                         <term><varname>Mode=</varname></term>
219                                         <listitem>
220                                                 <para>The MACVLAN mode to use. The supported options are
221                                                 <literal>private</literal>, <literal>vepa</literal>,
222                                                 <literal>bridge</literal> and <literal>passthru</literal>.
223                                                 </para>
224                                         </listitem>
225                                 </varlistentry>
226                         </variablelist>
227
228         </refsect1>
229         <refsect1>
230                 <title>[VXLAN] Section Options</title>
231                         <para>The <literal>[VXLAN]</literal> section only applies for netdevs of kind
232                         <literal>vxlan</literal>, and accepts the following key:</para>
233
234                         <variablelist class='network-directives'>
235                                 <varlistentry>
236                                         <term><varname>Id=</varname></term>
237                                         <listitem>
238                                                 <para>The VXLAN ID to use.</para>
239                                         </listitem>
240                                 </varlistentry>
241                                 <varlistentry>
242                                         <term><varname>Group=</varname></term>
243                                         <listitem>
244                                                 <para>An assigned multicast group IP address.</para>
245                                         </listitem>
246                                 </varlistentry>
247                                 <varlistentry>
248                                         <term><varname>TOS=</varname></term>
249                                         <listitem>
250                                                 <para>The Type Of Service byte value for a vxlan interface.</para>
251                                         </listitem>
252                                 </varlistentry>
253                                 <varlistentry>
254                                         <term><varname>TTL=</varname></term>
255                                         <listitem>
256                                                 <para>A fixed Time To Live N on Virtual eXtensible Local Area Network packets.
257                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
258                                                 inherit the TTL value.</para>
259                                         </listitem>
260                                 </varlistentry>
261                                 <varlistentry>
262                                         <term><varname>MacLearning=</varname></term>
263                                         <listitem>
264                                                 <para>A boolean. When true, enables dynamic MAC learning
265                                                 to discover remote MAC addresses.</para>
266                                         </listitem>
267                                 </varlistentry>
268                         </variablelist>
269         </refsect1>
270         <refsect1>
271                 <title>[Tunnel] Section Options</title>
272
273                         <para>The <literal>[Tunnel]</literal> section only applies for netdevs of kind
274                         <literal>ipip</literal>, <literal>sit</literal>, <literal>gre</literal> and
275                         <literal>vti</literal> and accepts the following keys:</para>
276
277                         <variablelist class='network-directives'>
278                                 <varlistentry>
279                                         <term><varname>Local=</varname></term>
280                                         <listitem>
281                                                 <para>A static local address for tunneled packets.
282                                                 It must be an address on another interface of this host.</para>
283                                         </listitem>
284                                 </varlistentry>
285                                 <varlistentry>
286                                         <term><varname>Remote=</varname></term>
287                                         <listitem>
288                                                 <para>The remote endpoint of the tunnel.</para>
289                                         </listitem>
290                                 </varlistentry>
291                                 <varlistentry>
292                                         <term><varname>TOS=</varname></term>
293                                         <listitem>
294                                                 <para>The Type Of Service byte value for a tunnel interface.
295                                                 For details about the TOS see the
296                                                 <ulink url="http://tools.ietf.org/html/rfc1349">
297                                                 Type of Service in the Internet Protocol Suite
298                                                 </ulink> document.
299                                                 </para>
300                                         </listitem>
301                                 </varlistentry>
302                                 <varlistentry>
303                                         <term><varname>TTL=</varname></term>
304                                         <listitem>
305                                                 <para>A fixed Time To Live N on tunneled packets.
306                                                 N is a number in the range 1-255. 0 is a special value meaning that packets
307                                                 inherit the TTL value. The default value for IPv4 tunnels is: inherit.
308                                                 The default value for IPv6 tunnels is: 64.</para>
309                                         </listitem>
310                                 </varlistentry>
311                                 <varlistentry>
312                                         <term><varname>DiscoverPathMTU=</varname></term>
313                                         <listitem>
314                                                 <para>A boolean. When true, enables Path MTU Discovery on the tunnel.</para>
315                                         </listitem>
316                                 </varlistentry>
317                         </variablelist>
318         </refsect1>
319         <refsect1>
320                 <title>[Peer] Section Options</title>
321
322                         <para>The <literal>[Peer]</literal> section only applies for netdevs of kind <literal>veth</literal>
323                         and accepts the following key:</para>
324
325                         <variablelist class='network-directives'>
326                                 <varlistentry>
327                                         <term><varname>Name=</varname></term>
328                                         <listitem>
329                                                 <para>The interface name used when creating the netdev.
330                                                 This option is compulsory.</para>
331                                         </listitem>
332                                 </varlistentry>
333                                 <varlistentry>
334                                         <term><varname>MACAddress=</varname></term>
335                                         <listitem>
336                                                 <para>The peer MACAddress, if not set it is generated in the same
337                                                 way as the MAC address of the main interface.</para>
338                                         </listitem>
339                                 </varlistentry>
340                         </variablelist>
341         </refsect1>
342         <refsect1>
343                 <title>Example</title>
344                 <example>
345                         <title>/etc/systemd/network/bridge.netdev</title>
346
347                         <programlisting>[NetDev]
348 Name=bridge0
349 Kind=bridge</programlisting>
350                 </example>
351
352                 <example>
353                         <title>/etc/systemd/network/vlan1.netdev</title>
354
355                         <programlisting>[Match]
356 Virtualization=no
357
358 [NetDev]
359 Name=vlan1
360 Kind=vlan
361
362 [VLAN]
363 Id=1</programlisting>
364                 </example>
365                 <example>
366                         <title>/etc/systemd/network/ipip.netdev</title>
367                         <programlisting>[NetDev]
368 Name=ipip-tun
369 Kind=ipip
370 MTUBytes=1480
371
372 [Tunnel]
373 Local=192.168.223.238
374 Remote=192.169.224.239
375 TTL=64</programlisting>
376                 </example>
377
378                 <example>
379                         <title>/etc/systemd/network/sit.netdev</title>
380                         <programlisting>[NetDev]
381 Name=sit-tun
382 Kind=sit
383 MTUBytes=1480
384
385 [Tunnel]
386 Local=10.65.223.238
387 Remote=10.65.223.239</programlisting>
388                 </example>
389
390                 <example>
391                         <title>/etc/systemd/network/gre.netdev</title>
392                         <programlisting>[NetDev]
393 Name=gre-tun
394 Kind=gre
395 MTUBytes=1480
396
397 [Tunnel]
398 Local=10.65.223.238
399 Remote=10.65.223.239</programlisting>
400                 </example>
401
402                 <example>
403                         <title>/etc/systemd/network/vti.netdev</title>
404
405                         <programlisting>[NetDev]
406 Name=vti-tun
407 Kind=vti
408 MTUBytes=1480
409
410 [Tunnel]
411 Local=10.65.223.238
412 Remote=10.65.223.239</programlisting>
413                 </example>
414
415                 <example>
416                         <title>/etc/systemd/network/veth.netdev</title>
417                         <programlisting>[NetDev]
418 Name=veth-test
419 Kind=veth
420
421 [Peer]
422 Name=veth-peer</programlisting>
423                 </example>
424
425         </refsect1>
426         <refsect1>
427                 <title>See Also</title>
428                 <para>
429                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
430                         <citerefentry><refentrytitle>systemd-networkd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
431                         <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
432                 </para>
433         </refsect1>
434
435 </refentry>