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 -->
5
6<refentry id="networkctl" conditional='ENABLE_NETWORKD'
7          xmlns:xi="http://www.w3.org/2001/XInclude">
8
9  <refentryinfo>
10    <title>networkctl</title>
11    <productname>systemd</productname>
12  </refentryinfo>
13
14  <refmeta>
15    <refentrytitle>networkctl</refentrytitle>
16    <manvolnum>1</manvolnum>
17  </refmeta>
18
19  <refnamediv>
20    <refname>networkctl</refname>
21    <refpurpose>Query the status of network links</refpurpose>
22  </refnamediv>
23
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>
32
33  <refsect1>
34    <title>Description</title>
35
36    <para><command>networkctl</command> may be used to introspect 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>
43
44  <refsect1>
45    <title>Commands</title>
46
47    <para>The following commands are understood:</para>
48
49    <variablelist>
50      <varlistentry>
51        <term>
52          <command>list</command>
53          <optional><replaceable>PATTERN…</replaceable></optional>
54        </term>
55
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:
61
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
67
684 links listed.</programlisting></para>
69
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>
76                </listitem>
77              </varlistentry>
78              <varlistentry>
79                <term>off</term>
80                <listitem>
81                  <para>the device is powered down</para>
82                </listitem>
83              </varlistentry>
84              <varlistentry>
85                <term>no-carrier</term>
86                <listitem>
87                  <para>the device is powered up, but it does not yet have a carrier</para>
88                </listitem>
89              </varlistentry>
90              <varlistentry>
91                <term>dormant</term>
92                <listitem>
93                  <para>the device has a carrier, but is not yet ready for normal traffic</para>
94                </listitem>
95              </varlistentry>
96              <varlistentry>
97                <term>degraded-carrier</term>
98                <listitem>
99                  <para>for bond or bridge master, one of the bonding or bridge slave network interfaces is
100                  in off, no-carrier, or dormant state</para>
101                </listitem>
102              </varlistentry>
103              <varlistentry>
104                <term>carrier</term>
105                <listitem>
106                  <para>the link has a carrier, or for bond or bridge master, all bonding or bridge slave
107                  network interfaces are enslaved to the master</para>
108                </listitem>
109              </varlistentry>
110              <varlistentry>
111                <term>degraded</term>
112                <listitem>
113                  <para>the link has carrier and addresses valid on the local link configured</para>
114                </listitem>
115              </varlistentry>
116              <varlistentry>
117                <term>enslaved</term>
118                <listitem>
119                  <para>the link has carrier and is enslaved to bond or bridge master network interface</para>
120                </listitem>
121              </varlistentry>
122              <varlistentry>
123                <term>routable</term>
124                <listitem>
125                  <para>the link has carrier and routable address configured</para>
126                </listitem>
127              </varlistentry>
128            </variablelist>
129        </para>
130
131        <para>The setup status is one of the following:
132            <variablelist>
133              <varlistentry>
134                <term>pending</term>
135                <listitem>
136                  <para>udev is still processing the link, we don't yet know if we will manage it</para>
137                </listitem>
138              </varlistentry>
139              <varlistentry>
140                <term>initialized</term>
141                <listitem>
142                  <para>udev has processed the link, but we don't yet know if we will manage it</para>
143                </listitem>
144              </varlistentry>
145              <varlistentry>
146                <term>configuring</term>
147                <listitem>
148                  <para>in the process of retrieving configuration or configuring the link</para>
149                </listitem>
150              </varlistentry>
151              <varlistentry>
152                <term>configured</term>
153                <listitem>
154                  <para>link configured successfully</para>
155                </listitem>
156              </varlistentry>
157              <varlistentry>
158                <term>unmanaged</term>
159                <listitem>
160                  <para>networkd is not handling the link</para>
161                </listitem>
162              </varlistentry>
163              <varlistentry>
164                <term>failed</term>
165                <listitem>
166                  <para>networkd failed to manage the link</para>
167                </listitem>
168              </varlistentry>
169              <varlistentry>
170                <term>linger</term>
171                <listitem>
172                  <para>the link is gone, but has not yet been dropped by networkd</para>
173                </listitem>
174              </varlistentry>
175            </variablelist>
176        </para>
177        </listitem>
178      </varlistentry>
179
180      <varlistentry>
181        <term>
182          <command>status</command>
183          <optional><replaceable>PATTERN…</replaceable></optional>
184        </term>
185
186        <listitem>
187          <para>Show information about the specified links: type, state, kernel module driver, hardware and
188          IP address, configured DNS servers, etc. If one or more <replaceable>PATTERN</replaceable>s are
189          specified, only links matching one of them are shown.</para>
190
191          <para>When no links are specified, an overall network status is shown. Also see the option
192          <option>--all</option>.</para>
193
194          <para>Produces output similar to:
195          <programlisting>
196●        State: routable
197  Online state: online
198       Address: 10.193.76.5 on eth0
199                192.168.122.1 on virbr0
200                169.254.190.105 on eth0
201                fe80::5054:aa:bbbb:cccc on eth0
202       Gateway: 10.193.11.1 (CISCO SYSTEMS, INC.) on eth0
203           DNS: 8.8.8.8
204                8.8.4.4</programlisting></para>
205
206          <para>In the overall network status, the online state depends on the individual online state of all
207          required links. Managed links are required for online by default. In this case, the online state is
208          one of the following:
209          <variablelist>
210            <varlistentry>
211              <term>unknown</term>
212              <listitem>
213                <para>all links have unknown online status (i.e. there are no required links)</para>
214              </listitem>
215            </varlistentry>
216            <varlistentry>
217              <term>offline</term>
218              <listitem>
219                <para>all required links are offline</para>
220              </listitem>
221            </varlistentry>
222            <varlistentry>
223              <term>partial</term>
224              <listitem>
225                <para>some, but not all, required links are online</para>
226              </listitem>
227            </varlistentry>
228            <varlistentry>
229              <term>online</term>
230              <listitem>
231                <para>all required links are online</para>
232              </listitem>
233            </varlistentry>
234          </variablelist>
235          </para>
236        </listitem>
237
238      </varlistentry>
239
240      <varlistentry>
241        <term>
242          <command>lldp</command>
243          <optional><replaceable>PATTERN…</replaceable></optional>
244        </term>
245
246        <listitem>
247          <para>Show discovered LLDP (Link Layer Discovery Protocol) neighbors. If one or more
248          <replaceable>PATTERN</replaceable>s are specified only neighbors on those interfaces are shown.
249          Otherwise shows discovered neighbors on all interfaces. Note that for this feature to work,
250          <varname>LLDP=</varname> must be turned on for the specific interface, see
251          <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
252          details.</para>
253
254          <para>Produces output similar to:
255          <programlisting>LINK             CHASSIS ID        SYSTEM NAME      CAPS        PORT ID           PORT DESCRIPTION
256enp0s25          00:e0:4c:00:00:00 GS1900           ..b........ 2                 Port #2
257
258Capability Flags:
259o - Other; p - Repeater;  b - Bridge; w - WLAN Access Point; r - Router;
260t - Telephone; d - DOCSIS cable device; a - Station; c - Customer VLAN;
261s - Service VLAN, m - Two-port MAC Relay (TPMR)
262
2631 neighbors listed.</programlisting></para>
264        </listitem>
265      </varlistentry>
266
267      <varlistentry>
268        <term>
269          <command>label</command>
270        </term>
271
272        <listitem><para>Show numerical address labels that can be used for address selection.
273        This is the same information that
274        <citerefentry project='die-net'><refentrytitle>ip-addrlabel</refentrytitle><manvolnum>8</manvolnum></citerefentry>
275        shows. See <ulink url="https://tools.ietf.org/html/rfc3484">RFC 3484</ulink>
276        for a discussion of address labels.</para>
277
278        <para>Produces output similar to:
279        <programlisting>Prefix/Prefixlen                          Label
280        ::/0                                  1
281    fc00::/7                                  5
282    fec0::/10                                11
283    2002::/16                                 2
284    3ffe::/16                                12
285 2001:10::/28                                 7
286    2001::/32                                 6
287::ffff:0.0.0.0/96                             4
288        ::/96                                 3
289       ::1/128                                0</programlisting></para>
290        </listitem>
291      </varlistentry>
292
293       <varlistentry>
294        <term>
295          <command>delete</command>
296          <replaceable>DEVICE…</replaceable>
297        </term>
298        <listitem><para>Deletes virtual netdevs. Takes interface name or index number.</para></listitem>
299      </varlistentry>
300
301       <varlistentry>
302        <term>
303          <command>up</command>
304          <replaceable>DEVICE…</replaceable>
305        </term>
306        <listitem><para>Bring devices up. Takes interface name or index number.</para></listitem>
307      </varlistentry>
308
309       <varlistentry>
310        <term>
311          <command>down</command>
312          <replaceable>DEVICE…</replaceable>
313        </term>
314        <listitem><para>Bring devices down. Takes interface name or index number.</para></listitem>
315      </varlistentry>
316
317       <varlistentry>
318        <term>
319          <command>renew</command>
320          <replaceable>DEVICE…</replaceable>
321        </term>
322        <listitem><para>Renew dynamic configurations e.g. addresses received from DHCP server.
323        Takes interface name or index number.</para></listitem>
324      </varlistentry>
325
326      <varlistentry>
327        <term>
328          <command>forcerenew</command>
329          <replaceable>DEVICE…</replaceable>
330        </term>
331        <listitem><para>Send a FORCERENEW message to all connected clients, triggering DHCP reconfiguration.
332        Takes interface name or index number.</para></listitem>
333      </varlistentry>
334
335      <varlistentry>
336        <term>
337          <command>reconfigure</command>
338          <replaceable>DEVICE…</replaceable>
339        </term>
340        <listitem><para>Reconfigure network interfaces. Takes interface name or index number. Note that
341        this does not reload <filename>.netdev</filename> or <filename>.network</filename>
342        corresponding to the specified interface. So, if you edit config files, it is necessary to call
343        <command>networkctl reload</command> first to apply new settings.</para></listitem>
344      </varlistentry>
345
346      <varlistentry>
347        <term>
348          <command>reload</command>
349        </term>
350        <listitem><para>Reload <filename>.netdev</filename> and <filename>.network</filename> files.
351        If a new <filename>.netdev</filename> file is found, then the corresponding netdev is created.
352        Note that even if an existing <filename>.netdev</filename> is modified or removed,
353        <command>systemd-networkd</command> does not update or remove the netdev.
354        If a new, modified or removed <filename>.network</filename> file is found, then all interfaces
355        which match the file are reconfigured.</para></listitem>
356      </varlistentry>
357
358    </variablelist>
359  </refsect1>
360
361  <refsect1>
362    <title>Options</title>
363
364    <para>The following options are understood:</para>
365
366    <variablelist>
367      <varlistentry>
368        <term>
369          <option>-a</option>
370          <option>--all</option>
371        </term>
372
373        <listitem>
374          <para>Show all links with <command>status</command>.</para>
375        </listitem>
376      </varlistentry>
377
378      <varlistentry>
379        <term>
380          <option>-s</option>
381          <option>--stats</option>
382        </term>
383
384        <listitem>
385          <para>Show link statistics with <command>status</command>.</para>
386        </listitem>
387      </varlistentry>
388
389      <varlistentry>
390        <term><option>-l</option></term>
391        <term><option>--full</option></term>
392
393        <listitem>
394          <para>Do not ellipsize the output.</para>
395        </listitem>
396      </varlistentry>
397
398      <varlistentry>
399        <term><option>-n</option></term>
400        <term><option>--lines=</option></term>
401
402        <listitem>
403          <para>When used with <command>status</command>, controls the number of journal lines to show,
404          counting from the most recent ones. Takes a positive integer argument. Defaults to 10.</para>
405        </listitem>
406      </varlistentry>
407
408      <xi:include href="standard-options.xml" xpointer="json" />
409      <xi:include href="standard-options.xml" xpointer="help" />
410      <xi:include href="standard-options.xml" xpointer="version" />
411      <xi:include href="standard-options.xml" xpointer="no-legend" />
412      <xi:include href="standard-options.xml" xpointer="no-pager" />
413
414    </variablelist>
415  </refsect1>
416
417  <refsect1>
418    <title>Exit status</title>
419
420    <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
421  </refsect1>
422
423  <refsect1>
424    <title>See Also</title>
425    <para>
426      <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
427      <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
428      <citerefentry><refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
429      <citerefentry project='die-net'><refentrytitle>ip</refentrytitle><manvolnum>8</manvolnum></citerefentry>
430    </para>
431  </refsect1>
432</refentry>
433