1:255.16-alt1
[systemd_ALT.git] / man / networkctl.xml
blob68b1d97f09cf6d4e692c504a8c0c3a1cad8509f8
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="networkctl" conditional='ENABLE_NETWORKD'
7           xmlns:xi="http://www.w3.org/2001/XInclude">
9   <refentryinfo>
10     <title>networkctl</title>
11     <productname>systemd</productname>
12   </refentryinfo>
14   <refmeta>
15     <refentrytitle>networkctl</refentrytitle>
16     <manvolnum>1</manvolnum>
17   </refmeta>
19   <refnamediv>
20     <refname>networkctl</refname>
21     <refpurpose>Query or modify the status of network links</refpurpose>
22   </refnamediv>
24   <refsynopsisdiv>
25     <cmdsynopsis>
26       <command>networkctl</command>
27       <arg choice="opt" rep="repeat">OPTIONS</arg>
28       <arg choice="plain">COMMAND</arg>
29       <arg choice="opt" rep="repeat">LINK</arg>
30     </cmdsynopsis>
31   </refsynopsisdiv>
33   <refsect1>
34     <title>Description</title>
36     <para><command>networkctl</command> may be used to query or modify the
37     state of the network links as seen by
38     <command>systemd-networkd</command>.  Please refer to
39     <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
40     for an introduction to the basic concepts, functionality, and
41     configuration syntax.</para>
42   </refsect1>
44   <refsect1>
45     <title>Commands</title>
47     <para>The following commands are understood:</para>
49     <variablelist>
50       <varlistentry>
51         <term>
52           <command>list</command>
53           <optional><replaceable>PATTERN…</replaceable></optional>
54         </term>
56         <listitem>
57           <para>Show a list of existing links and their status. If one or more
58           <replaceable>PATTERN</replaceable>s are specified, only links matching one of them are shown.
59           If no further arguments are specified shows all links,
60           otherwise just the specified links. Produces output similar to:
62           <programlisting>IDX LINK         TYPE     OPERATIONAL SETUP
63   1 lo           loopback carrier     unmanaged
64   2 eth0         ether    routable    configured
65   3 virbr0       ether    no-carrier  unmanaged
66   4 virbr0-nic   ether    off         unmanaged
68 4 links listed.</programlisting></para>
70         <para>The operational status is one of the following:
71             <variablelist>
72               <varlistentry>
73                 <term>missing</term>
74                 <listitem>
75                     <para>The device is missing.</para>
77                     <xi:include href="version-info.xml" xpointer="v245"/>
78                 </listitem>
79               </varlistentry>
80               <varlistentry>
81                 <term>off</term>
82                 <listitem>
83                   <para>The device is powered down.</para>
85                   <xi:include href="version-info.xml" xpointer="v240"/>
86                 </listitem>
87               </varlistentry>
88               <varlistentry>
89                 <term>no-carrier</term>
90                 <listitem>
91                   <para>The device is powered up, but does not yet have a carrier.</para>
93                   <xi:include href="version-info.xml" xpointer="v240"/>
94                 </listitem>
95               </varlistentry>
96               <varlistentry>
97                 <term>dormant</term>
98                 <listitem>
99                   <para>The device has a carrier, but is not yet ready for normal traffic.</para>
101                   <xi:include href="version-info.xml" xpointer="v240"/>
102                 </listitem>
103               </varlistentry>
104               <varlistentry>
105                 <term>degraded-carrier</term>
106                 <listitem>
107                   <para>One of the bonding or bridge slave network interfaces is in off, no-carrier, or
108                   dormant state, and the master interface has no address.</para>
110                   <xi:include href="version-info.xml" xpointer="v242"/>
111                 </listitem>
112               </varlistentry>
113               <varlistentry>
114                 <term>carrier</term>
115                 <listitem>
116                   <para>The link has carrier, or for bond or bridge master, all bonding or bridge slave
117                   network interfaces are enslaved to the master.</para>
119                   <xi:include href="version-info.xml" xpointer="v240"/>
120                 </listitem>
121               </varlistentry>
122               <varlistentry>
123                 <term>degraded</term>
124                 <listitem>
125                   <para>The link has carrier and addresses valid on the local link configured. For bond or
126                   bridge master this means that not all slave network interfaces have carrier but at least
127                   one does.</para>
129                   <xi:include href="version-info.xml" xpointer="v240"/>
130                 </listitem>
131               </varlistentry>
132               <varlistentry>
133                 <term>enslaved</term>
134                 <listitem>
135                   <para>The link has carrier and is enslaved to bond or bridge master network interface.
136                   </para>
138                   <xi:include href="version-info.xml" xpointer="v242"/>
139                 </listitem>
140               </varlistentry>
141               <varlistentry>
142                 <term>routable</term>
143                 <listitem>
144                   <para>The link has carrier and routable address configured. For bond or bridge master it is
145                   not necessary for all slave network interfaces to have carrier, but at least one must.</para>
147                   <xi:include href="version-info.xml" xpointer="v240"/>
148                 </listitem>
149               </varlistentry>
150             </variablelist>
151         </para>
153         <para>The setup status is one of the following:
154             <variablelist>
155               <varlistentry>
156                 <term>pending</term>
157                 <listitem>
158                   <para><citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
159                   is still processing the link, we don't yet know if we will manage it.</para>
161                   <xi:include href="version-info.xml" xpointer="v240"/>
162                 </listitem>
163               </varlistentry>
164               <varlistentry>
165                 <term>initialized</term>
166                 <listitem>
167                   <para><citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
168                   has processed the link, but we don't yet know if we will manage it.</para>
170                   <xi:include href="version-info.xml" xpointer="v251"/>
171                 </listitem>
172               </varlistentry>
173               <varlistentry>
174                 <term>configuring</term>
175                 <listitem>
176                   <para>Configuration for the link is being retrieved or the link is being configured.</para>
178                   <xi:include href="version-info.xml" xpointer="v240"/>
179                 </listitem>
180               </varlistentry>
181               <varlistentry>
182                 <term>configured</term>
183                 <listitem>
184                   <para>Link has been configured successfully.</para>
186                   <xi:include href="version-info.xml" xpointer="v240"/>
187                 </listitem>
188               </varlistentry>
189               <varlistentry>
190                 <term>unmanaged</term>
191                 <listitem>
192                   <para><command>systemd-networkd</command> is not handling the link.</para>
194                   <xi:include href="version-info.xml" xpointer="v240"/>
195                 </listitem>
196               </varlistentry>
197               <varlistentry>
198                 <term>failed</term>
199                 <listitem>
200                   <para><command>systemd-networkd</command> failed to configure the link.</para>
202                   <xi:include href="version-info.xml" xpointer="v240"/>
203                 </listitem>
204               </varlistentry>
205               <varlistentry>
206                 <term>linger</term>
207                 <listitem>
208                   <para>The link is gone, but has not yet been dropped by <command>systemd-networkd</command>.</para>
210                   <xi:include href="version-info.xml" xpointer="v240"/>
211                 </listitem>
212               </varlistentry>
213             </variablelist>
214         </para>
216         <xi:include href="version-info.xml" xpointer="v219"/>
217         </listitem>
218       </varlistentry>
220       <varlistentry>
221         <term>
222           <command>status</command>
223           <optional><replaceable>PATTERN…</replaceable></optional>
224         </term>
226         <listitem>
227           <para>Show information about the specified links: type, state, kernel module driver, hardware and
228           IP address, configured DNS servers, etc. If one or more <replaceable>PATTERN</replaceable>s are
229           specified, only links matching one of them are shown.</para>
231           <para>When no links are specified, an overall network status is shown. Also see the option
232           <option>--all</option>.</para>
234           <para>Produces output similar to:
235           <programlisting>
236 ●        State: routable
237   Online state: online
238        Address: 10.193.76.5 on eth0
239                 192.168.122.1 on virbr0
240                 169.254.190.105 on eth0
241                 fe80::5054:aa:bbbb:cccc on eth0
242        Gateway: 10.193.11.1 (CISCO SYSTEMS, INC.) on eth0
243            DNS: 8.8.8.8
244                 8.8.4.4</programlisting></para>
246           <para>In the overall network status, the online state depends on the individual online state of all
247           required links. Managed links are required for online by default. In this case, the online state is
248           one of the following:
249           <variablelist>
250             <varlistentry>
251               <term>unknown</term>
252               <listitem>
253                 <para>All links have unknown online status (i.e. there are no required links).</para>
255                 <xi:include href="version-info.xml" xpointer="v249"/>
256               </listitem>
257             </varlistentry>
258             <varlistentry>
259               <term>offline</term>
260               <listitem>
261                 <para>All required links are offline.</para>
263                 <xi:include href="version-info.xml" xpointer="v249"/>
264               </listitem>
265             </varlistentry>
266             <varlistentry>
267               <term>partial</term>
268               <listitem>
269                 <para>Some, but not all, required links are online.</para>
271                 <xi:include href="version-info.xml" xpointer="v249"/>
272               </listitem>
273             </varlistentry>
274             <varlistentry>
275               <term>online</term>
276               <listitem>
277                 <para>All required links are online.</para>
279                 <xi:include href="version-info.xml" xpointer="v249"/>
280               </listitem>
281             </varlistentry>
282           </variablelist>
283           </para>
285           <xi:include href="version-info.xml" xpointer="v219"/>
286         </listitem>
288       </varlistentry>
290       <varlistentry>
291         <term>
292           <command>lldp</command>
293           <optional><replaceable>PATTERN…</replaceable></optional>
294         </term>
296         <listitem>
297           <para>Show discovered LLDP (Link Layer Discovery Protocol) neighbors. If one or more
298           <replaceable>PATTERN</replaceable>s are specified only neighbors on those interfaces are shown.
299           Otherwise shows discovered neighbors on all interfaces. Note that for this feature to work,
300           <varname>LLDP=</varname> must be turned on for the specific interface, see
301           <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
302           details.</para>
304           <para>Produces output similar to:
305           <programlisting>LINK             CHASSIS ID        SYSTEM NAME      CAPS        PORT ID           PORT DESCRIPTION
306 enp0s25          00:e0:4c:00:00:00 GS1900           ..b........ 2                 Port #2
308 Capability Flags:
309 o - Other; p - Repeater;  b - Bridge; w - WLAN Access Point; r - Router;
310 t - Telephone; d - DOCSIS cable device; a - Station; c - Customer VLAN;
311 s - Service VLAN, m - Two-port MAC Relay (TPMR)
313 1 neighbors listed.</programlisting></para>
315           <xi:include href="version-info.xml" xpointer="v219"/>
316         </listitem>
317       </varlistentry>
319       <varlistentry>
320         <term>
321           <command>label</command>
322         </term>
324         <listitem><para>Show numerical address labels that can be used for address selection.
325         This is the same information that
326         <citerefentry project='die-net'><refentrytitle>ip-addrlabel</refentrytitle><manvolnum>8</manvolnum></citerefentry>
327         shows. See <ulink url="https://tools.ietf.org/html/rfc3484">RFC 3484</ulink>
328         for a discussion of address labels.</para>
330         <para>Produces output similar to:
331         <programlisting>Prefix/Prefixlen                          Label
332         ::/0                                  1
333     fc00::/7                                  5
334     fec0::/10                                11
335     2002::/16                                 2
336     3ffe::/16                                12
337  2001:10::/28                                 7
338     2001::/32                                 6
339 ::ffff:0.0.0.0/96                             4
340         ::/96                                 3
341        ::1/128                                0</programlisting></para>
343         <xi:include href="version-info.xml" xpointer="v234"/>
344         </listitem>
345       </varlistentry>
347        <varlistentry>
348         <term>
349           <command>delete</command>
350           <replaceable>DEVICE…</replaceable>
351         </term>
352         <listitem><para>Deletes virtual netdevs. Takes interface name or index number.</para>
354         <xi:include href="version-info.xml" xpointer="v243"/></listitem>
355       </varlistentry>
357        <varlistentry>
358         <term>
359           <command>up</command>
360           <replaceable>DEVICE…</replaceable>
361         </term>
362         <listitem><para>Bring devices up. Takes interface name or index number.</para>
364         <xi:include href="version-info.xml" xpointer="v246"/></listitem>
365       </varlistentry>
367        <varlistentry>
368         <term>
369           <command>down</command>
370           <replaceable>DEVICE…</replaceable>
371         </term>
372         <listitem><para>Bring devices down. Takes interface name or index number.</para>
374         <xi:include href="version-info.xml" xpointer="v246"/></listitem>
375       </varlistentry>
377        <varlistentry>
378         <term>
379           <command>renew</command>
380           <replaceable>DEVICE…</replaceable>
381         </term>
382         <listitem><para>Renew dynamic configurations e.g. addresses received from DHCP server.
383         Takes interface name or index number.</para>
385         <xi:include href="version-info.xml" xpointer="v244"/></listitem>
386       </varlistentry>
388       <varlistentry>
389         <term>
390           <command>forcerenew</command>
391           <replaceable>DEVICE…</replaceable>
392         </term>
393         <listitem><para>Send a FORCERENEW message to all connected clients, triggering DHCP reconfiguration.
394         Takes interface name or index number.</para>
396         <xi:include href="version-info.xml" xpointer="v246"/></listitem>
397       </varlistentry>
399       <varlistentry>
400         <term>
401           <command>reconfigure</command>
402           <replaceable>DEVICE…</replaceable>
403         </term>
404         <listitem><para>Reconfigure network interfaces. Takes interface name or index number. Note that
405         this does not reload <filename>.netdev</filename> or <filename>.network</filename>
406         corresponding to the specified interface. So, if you edit config files, it is necessary to call
407         <command>networkctl reload</command> first to apply new settings.</para>
409         <xi:include href="version-info.xml" xpointer="v244"/></listitem>
410       </varlistentry>
412       <varlistentry>
413         <term>
414           <command>reload</command>
415         </term>
416         <listitem><para>Reload <filename>.netdev</filename> and <filename>.network</filename> files.
417         If a new <filename>.netdev</filename> file is found, then the corresponding netdev is created.
418         Note that even if an existing <filename>.netdev</filename> is modified or removed,
419         <command>systemd-networkd</command> does not update or remove the netdev.
420         If a new, modified or removed <filename>.network</filename> file is found, then all interfaces
421         which match the file are reconfigured.</para>
423         <xi:include href="version-info.xml" xpointer="v244"/></listitem>
424       </varlistentry>
426       <varlistentry>
427         <term>
428           <command>edit</command>
429           <replaceable>FILE</replaceable>|<replaceable>@DEVICE</replaceable>…
430         </term>
431         <listitem><para>Edit network configuration files, which include <filename>.network</filename>,
432         <filename>.netdev</filename>, and <filename>.link</filename> files. If no network config file
433         matching the given name is found, a new one will be created under <filename>/etc/</filename>.
434         Specially, if the name is prefixed by <literal>@</literal>, it will be treated as
435         a network interface, and editing will be performed on the network config files associated
436         with it. Additionally, the interface name can be suffixed with <literal>:network</literal> (default)
437         or <literal>:link</literal>, in order to choose the type of network config to operate on.</para>
439         <para>If <option>--drop-in=</option> is specified, edit the drop-in file instead of
440         the main configuration file. Unless <option>--no-reload</option> is specified,
441         <command>systemd-networkd</command> will be reloaded after the edit of the
442         <filename>.network</filename> or <filename>.netdev</filename> files finishes.
443         The same applies for <filename>.link</filename> files and
444         <citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
445         Note that the changed link settings are not automatically applied after reloading.
446         To achieve that, trigger uevents for the corresponding interface. Refer to
447         <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
448         for more information.</para>
450         <xi:include href="version-info.xml" xpointer="v254"/></listitem>
451       </varlistentry>
453       <varlistentry>
454         <term>
455           <command>cat</command>
456           <replaceable>FILE</replaceable>|<replaceable>@DEVICE</replaceable>…
457         </term>
458         <listitem><para>Show network configuration files. This command honors
459         the <literal>@</literal> prefix in the same way as <command>edit</command>.</para>
461         <xi:include href="version-info.xml" xpointer="v254"/></listitem>
462       </varlistentry>
463     </variablelist>
464   </refsect1>
466   <refsect1>
467     <title>Options</title>
469     <para>The following options are understood:</para>
471     <variablelist>
472       <varlistentry>
473         <term>
474           <option>-a</option>
475           <option>--all</option>
476         </term>
478         <listitem>
479           <para>Show all links with <command>status</command>.</para>
481           <xi:include href="version-info.xml" xpointer="v219"/>
482         </listitem>
483       </varlistentry>
485       <varlistentry>
486         <term>
487           <option>-s</option>
488           <option>--stats</option>
489         </term>
491         <listitem>
492           <para>Show link statistics with <command>status</command>.</para>
494           <xi:include href="version-info.xml" xpointer="v243"/>
495         </listitem>
496       </varlistentry>
498       <varlistentry>
499         <term><option>-l</option></term>
500         <term><option>--full</option></term>
502         <listitem>
503           <para>Do not ellipsize the output.</para>
505           <xi:include href="version-info.xml" xpointer="v245"/>
506         </listitem>
507       </varlistentry>
509       <varlistentry>
510         <term><option>-n</option></term>
511         <term><option>--lines=</option></term>
513         <listitem>
514           <para>When used with <command>status</command>, controls the number of journal lines to show,
515           counting from the most recent ones. Takes a positive integer argument. Defaults to 10.</para>
517           <xi:include href="version-info.xml" xpointer="v245"/>
518         </listitem>
519       </varlistentry>
521       <varlistentry>
522         <term><option>--drop-in=</option><replaceable>NAME</replaceable></term>
524         <listitem>
525           <para>When used with <command>edit</command>, edit the drop-in file <replaceable>NAME</replaceable>
526           instead of the main configuration file.</para>
528           <xi:include href="version-info.xml" xpointer="v254"/>
529         </listitem>
530       </varlistentry>
532       <varlistentry>
533         <term><option>--no-reload</option></term>
535         <listitem>
536           <para>When used with <command>edit</command>,
537           <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
538           or
539           <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
540           will not be reloaded after the editing finishes.</para>
542         <xi:include href="version-info.xml" xpointer="v254"/>
543         </listitem>
544       </varlistentry>
546       <xi:include href="standard-options.xml" xpointer="json" />
547       <xi:include href="standard-options.xml" xpointer="help" />
548       <xi:include href="standard-options.xml" xpointer="version" />
549       <xi:include href="standard-options.xml" xpointer="no-legend" />
550       <xi:include href="standard-options.xml" xpointer="no-pager" />
552     </variablelist>
553   </refsect1>
555   <refsect1>
556     <title>Exit status</title>
558     <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
559   </refsect1>
561   <refsect1>
562     <title>See Also</title>
563     <para>
564       <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
565       <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
566       <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
567       <citerefentry project='die-net'><refentrytitle>ip</refentrytitle><manvolnum>8</manvolnum></citerefentry>
568     </para>
569   </refsect1>
570 </refentry>