NETWORKCTL(1)

๐ŸŽ€ NAME ๐ŸŽ€

networkctl โ€” query or modify the status of network links ๐Ÿฆ‹

okay so this is the networkctl(1) manual page, and we are getting through it together, bestie. no cap.


โœจ SYNOPSIS โœจ

networkctl [OPTIONS...] COMMAND [LINK...]

๐ŸŒˆ DESCRIPTION ๐ŸŒˆ

networkctl is the girl you call when you wanna query or modify the state of the network links as seen by systemd-networkd. that's the whole vibe. ๐Ÿ’…

and if you need the actual intro โ€” the basic concepts, the functionality, the configuration syntax โ€” go read systemd-networkd.service(8). it's giving prerequisite reading, iykyk. ๐Ÿ“š


๐Ÿ‘‘ COMMANDS ๐Ÿ‘‘

the following commands are understood. all of them. every single one. we're not skipping, periodt. ๐Ÿ’–

๐Ÿ“‹ list [PATTERN...]

shows you a list of the existing links and their status, like a little roster. ๐Ÿซถ if one or more *PATTERN*s get specified, only links matching one of them are shown. if no further arguments are specified it shows all links, otherwise just the specified links.

produces output similar to:

IDX LINK         TYPE     OPERATIONAL SETUP
  1 lo           loopback carrier     unmanaged
  2 eth0         ether    routable    configured
  3 virbr0       ether    no-carrier  unmanaged
  4 virbr0-nic   ether    off         unmanaged

4 links listed.

the operational status is one of the following:

  • missing โ€” the device is missing. just... not there. gone. ๐Ÿ’€ Added in version 245.
  • off โ€” the device is powered down. Added in version 240.
  • no-carrier โ€” the device is powered up, but it does not yet have a carrier. Added in version 240.
  • dormant โ€” the device has a carrier, but it is not yet ready for normal traffic. Added in version 240.
  • degraded-carrier โ€” one of the bonding or bridge slave network interfaces is in off, no-carrier, or dormant state, and the master interface has no address. Added in version 242.
  • carrier โ€” the link has carrier, or, for a bond or bridge master, all bonding or bridge slave network interfaces are enslaved to the master. Added in version 240.
  • degraded โ€” the link has carrier and addresses valid on the local link configured. for a bond or bridge master this means that not all slave network interfaces have carrier but at least one does. Added in version 240.
  • enslaved โ€” the link has carrier and is enslaved to a bond or bridge master network interface. Added in version 242.
  • routable โ€” the link has carrier and a routable address configured. for a bond or bridge master it is not necessary for all slave network interfaces to have carrier, but at least one must. Added in version 240.

and the setup status is one of the following:

  • pending โ€” systemd-udevd(8) is still processing the link, we do not yet know if we will manage it. Added in version 240.
  • initialized โ€” systemd-udevd(8) has processed the link, but we do not yet know if we will manage it. Added in version 251.
  • configuring โ€” configuration for the link is being retrieved, or the link is being configured. Added in version 240.
  • configured โ€” link has been configured successfully. slay. Added in version 240.
  • unmanaged โ€” systemd-networkd is not handling the link. not her problem, not her business. Added in version 240.
  • failed โ€” systemd-networkd failed to configure the link. ๐Ÿ˜ญ Added in version 240.
  • linger โ€” the link is gone, but it has not yet been dropped by systemd-networkd. it's lingering, bestie. Added in version 240.

Added in version 219.

๐Ÿ” status [PATTERN...]

shows you info about the specified links: type, state, kernel module driver, hardware and IP address, configured DNS servers, etc. etc. if one or more *PATTERN*s are specified, only links matching one of them are shown. โœจ

when no links are specified, an overall network status is shown. also see the option --all.

produces output similar to:

โ—        State: routable
  Online state: online
       Address: 10.193.76.5 on eth0
                192.168.122.1 on virbr0
                169.254.190.105 on eth0
                fe80::5054:aa:bbbb:cccc on eth0
       Gateway: 10.193.11.1 (CISCO SYSTEMS, INC.) on eth0
           DNS: 8.8.8.8
                8.8.4.4

in that overall network status, the online state depends on the individual online state of all required links. managed links are required for online by default. in that case, the online state is one of the following:

  • unknown โ€” all links have unknown online status (i.e. there are no required links). Added in version 249.
  • offline โ€” all required links are offline. Added in version 249.
  • partial โ€” some, but not all, required links are online. it's giving half-there. Added in version 249.
  • online โ€” all required links are online. ๐ŸŽ‰ Added in version 249.

Added in version 219.

๐Ÿงพ dhcp-lease INTERFACE [CODE[:FORMAT]] ...

shows the DHCP message of the acquired lease (i.e. the received DHCPACK message). takes an interface name and optional DHCP option codes. if no option code is specified, both the DHCP message header and all options are shown. if one or more option codes are specified, only the specified options are shown. ๐Ÿ™ˆ

when called with the --json= option, the entire DHCP message is shown in JSON format. in that case, any specified option codes are ignored. ok noted.

by default, each option is displayed in a human-readable format, depending on the option. for example, DNS server addresses are shown as a list of IP addresses (e.g. "192.0.2.1"), and the lease time is shown as a human-readable duration (e.g. "8h").

each option code may optionally be followed by a formatter, separated by a colon (e.g. "42:address"). this can be useful if the default formatting is not appropriate. ๐Ÿ’…

the following formatters are supported:

  • auto โ€” use the default formatting.
  • hex โ€” show the raw bytes in hexadecimal, separated by colons.
  • flag โ€” treat the option as having zero-length data and display "yes".
  • bool โ€” treat the option as a 1-byte boolean and display "yes" or "no".
  • uint8 โ€” treat the option as a 1-byte unsigned integer.
  • uint16 โ€” treat the option as a 2-byte unsigned integer.
  • time โ€” treat the option as a 4-byte time value in seconds and display it as a human-readable duration.
  • string โ€” treat the option as a string.
  • address โ€” treat the option as one or more IPv4 addresses and display them in human-readable form.

produces output similar to:

$ networkctl dhcp-lease eth0
Header:
              KEY VALUE
   Hardware Type: ETHER
Hardware Address: 41:42:43:31:32:33
  Client Address: 192.0.2.123
  Server Address: 192.0.2.1

Options:
CODE NAME               DATA
   1 subnet mask        255.255.255.0
   3 router             192.0.2.1
   6 domain name server 192.0.2.1
  12 hostname           test-node
  15 domain name        lan
  28 broadcast address  192.0.2.255
  42 NTP server         192.0.2.11
                        192.0.2.12
  51 lease time         1d
  53 message type       5
  54 server identifier  192.0.2.1
  58 renewal time       11h 5min 38s
  59 rebinding time     20h 5min 38s
 119 domain search      hoge.example.com
                        foo.example.com

Added in version 261.

๐Ÿ›ฐ๏ธ lldp [PATTERN...]

shows discovered LLDP (Link Layer Discovery Protocol) neighbors โ€” like, who's around you on the network. ๐ŸŒ if one or more *PATTERN*s are specified, only neighbors on those interfaces are shown. otherwise, it shows discovered neighbors on all interfaces. note that for this feature to work, LLDP= must be turned on for the specific interface, see systemd.network(5) for details. fr fr, it won't just happen on its own.

produces output similar to:

LINK    SYSTEM-NAME SYSTEM-DESCRIPTION CHASSIS-ID        PORT-ID PORT-DESCRIPTION CAPS
enp0s25 GS1900      -                  00:e0:4c:00:00:00 2       Port #2           ..b........

Capability Flags:
o - Other; p - Repeater;  b - Bridge; w - WLAN Access Point; r - Router;
t - Telephone; d - DOCSIS cable device; a - Station; c - Customer VLAN;
s - Service VLAN, m - Two-port MAC Relay (TPMR)

1 neighbor(s) listed.

Added in version 219.

๐Ÿท๏ธ label

shows numerical address labels that can be used for address selection. this is the same information that ip-addrlabel(8) shows. see RFC 3484[1] for a discussion of address labels. iykyk. ๐Ÿ’œ

produces output similar to:

Prefix/Prefixlen                          Label
        ::/0                                  1
    fc00::/7                                  5
    fec0::/10                                11
    2002::/16                                 2
    3ffe::/16                                12
  2001:10::/28                                 7
    2001::/32                                 6
::ffff:0.0.0.0/96                             4
        ::/96                                 3
       ::1/128                                0

Added in version 234.

๐Ÿ—‘๏ธ delete DEVICE...

deletes virtual netdevs. takes an interface name or index number. bye bestie ๐Ÿ‘‹

Added in version 243.

โฌ†๏ธ up DEVICE...

brings devices up. takes an interface name or index number. wake up queen. ๐Ÿ‘‘

Added in version 246.

โฌ‡๏ธ down DEVICE...

brings devices down. takes an interface name or index number.

Added in version 246.

๐Ÿ”„ renew DEVICE...

renews dynamic configurations, e.g. addresses received from a DHCP server. takes an interface name or index number. glow-up time. โœจ

Added in version 244.

๐Ÿ’ฅ forcerenew DEVICE...

sends a FORCERENEW message to all connected clients, triggering DHCP reconfiguration. takes an interface name or index number. it's giving aggressive but polite. ๐Ÿ˜Œ

Added in version 246.

reconfigure DEVICE...

Reconfigure network interfaces ๐Ÿ’ซ โ€” hand it an interface name or an index number, either one works, bestie.

But the tea โ˜•: this does not reload the .netdev or .network files for the interface you named. So if you've been editing config files, you have to call networkctl reload first to actually apply the new settings. No skipping that step, fr fr.

Added in version 244.

reload

Reloads .netdev and .network files. Iconic behavior.

If a new or modified .netdev file is found, the corresponding netdev is created or updated, respectively โœจ. But lowkey important โ€” if the corresponding interface already exists, then some of the new settings may not be applied. E.g., a VLAN ID cannot be changed after the interface was created, so changing [VLAN] Id= will not take effect if the matching VLAN interface already exists ๐Ÿ˜ญ. To apply settings like that, the interfaces need to be removed manually before reload. Also note: even if a .netdev file is removed, systemd-networkd(8) does not remove the existing netdev corresponding to the file. Not me warning you twice ๐Ÿ’€.

If a new, modified, or removed .network file is found, then all interfaces that matched the file are reconfigured. You can skip this reconfiguration step by passing --no-reconfigure, in which case only config files are reloaded from disk without reconfiguring any network interfaces. Use networkctl reconfigure afterwards to selectively apply config changes per interface ๐Ÿซถ.

Added in version 244.

edit FILE|@DEVICE...

Edit network configuration files โ€” that means .network, .netdev, and .link files ๐ŸŽ€.

If no network config file matching the given name is found, a new one will be created under /etc/ or /run/, depending on whether --runtime is specified. And here's the cute part: if the name is prefixed by "@", it gets treated as a network interface, and the editing happens on the network config files associated with it. You can also suffix the interface name with :network (the default), :link, or :netdev to pick which type of network config you're operating on ๐Ÿ’….

If --drop-in= is specified, edit the drop-in file instead of the main configuration file. Unless --no-reload is specified, systemd-networkd(8) will be reloaded after the edit of the .network or .netdev files finishes. Same deal for .link files and systemd-udevd(8) ๐ŸŒธ. Note that the changed link settings are not automatically applied after reloading โ€” to make that happen, trigger uevents for the corresponding interface. Refer to systemd.link(5) for more info.

If --stdin is specified, the new content will be read from standard input. In this mode, the old content of the file is discarded ๐Ÿ‘‹.

Added in version 254.

cat [FILE|@DEVICE...]

Show network configuration files ๐Ÿฆ‹. This command honors the "@" prefix in a similar way as edit, with support for an additional suffix :all for showing all types of configuration files associated with the interface at once. And when no argument is specified, networkd.conf(5) and its drop-in files will be shown. Sneaky useful, ngl.

Added in version 254.

mask FILE...

Mask network configuration files โ€” the .network, .netdev, and .link ones ๐ŸŒˆ. A symlink of the given name will be created under /etc/ or /run/, depending on whether --runtime is specified, that points to /dev/null.

Careful bestie ๐Ÿšจ: if a non-empty config file with the specified name exists under the target directory or a directory with higher priority (e.g. --runtime is used while an existing config resides in /etc/), the operation is aborted. No masking over real content, periodt.

This command honors --no-reload in the same way as edit.

Added in version 256.

unmask FILE...

Unmask network configuration files โ€” i.e. reverting the effect of mask ๐Ÿ™ˆ. Note that this command operates regardless of the scope of the directory, i.e. --runtime is of no effect. She does not care about your directory vibes.

This command honors --no-reload in the same way as edit and mask.

Added in version 256.

persistent-storage BOOL

Notify systemd-networkd.service(8) that the persistent storage for the service is ready ๐Ÿซก. This is called by systemd-networkd-persistent-storage.service. Usually, this command should not be called manually by users or administrators โ€” it's giving backstage pass only, iykyk.

Added in version 256.


โœจ OPTIONS โœจ

The following options are understood ๐Ÿ’–:

  • -a, --all โ€” Show all links with status. Everybody, on stage now.

Added in version 219.

  • -s, --stats โ€” Show link statistics with status. Numbers, we love her ๐Ÿ“Š.

Added in version 243.

  • -l, --full โ€” Do not ellipsize the output. No โ€ฆ erasure around here, we show the whole thing.

Added in version 245.

  • -n, --lines= โ€” When used with status, controls the number of journal lines to show, counting from the most recent ones. Takes a positive integer argument. Defaults to 10.

Added in version 245.

  • *--drop-in=NAME* โ€” When used with edit, edit the drop-in file NAME instead of the main configuration file.

Added in version 254.

Added in version 254.

  • --no-reconfigure โ€” When used with reload, only reload config files from disk without reconfiguring any network interfaces. This may be useful to avoid reconfiguring multiple interfaces simultaneously when multiple .network files are updated, or when an updated .network file is applied to multiple interfaces. Use networkctl reconfigure afterwards to apply changes selectively per interface ๐ŸŽฏ.

Added in version 262.

  • --runtime โ€” When used with edit or mask, operate on the file under /run/ instead of /etc/. Temporary queen behavior โœจ.

Added in version 256.

  • --stdin โ€” When used with edit, the contents of the file will be read from standard input and the editor will not be launched. In this mode, the old contents of the file are automatically replaced. This is useful to "edit" configuration from scripts, especially so that drop-in directories are created and populated in one go ๐Ÿ”ฅ.

Multiple drop-ins may be "edited" in this mode with --drop-in=, and the same contents will be written to all of them. Otherwise, exactly one main configuration file is expected.

Added in version 257.

  • --no-ask-password โ€” Do not query the user for authentication for privileged operations. No pop quiz for you ๐Ÿ™….
  • *--json=MODE* โ€” Shows output formatted as JSON. Expects one of "short" (for the shortest possible output without any redundant whitespace or line breaks), "pretty" (for a pretty version of the same, with indentation and line breaks) or "off" (to turn off JSON output, the default). Pick your aesthetic ๐Ÿ’œ.
  • -h, --help โ€” Print a short help text and exit. Bye bestie ๐Ÿ‘‹.
  • --version โ€” Print a short version string and exit.
  • --no-legend โ€” Do not print the legend, i.e. column headers and the footer with hints. Minimalism core.
  • --no-pager โ€” Do not pipe output into a pager. Straight to the terminal, no middleman.

๐Ÿšฆ EXIT STATUS

On success, 0 is returned, a non-zero failure code otherwise. Simple as that ๐Ÿ’….


๐Ÿ‘€ SEE ALSO

systemd-networkd.service(8), systemd.network(5), systemd.netdev(5), ip(8)


๐Ÿ“ NOTES

  1. RFC 3484 https://tools.ietf.org/html/rfc3484

and that's the whole page, bestie ๐ŸŽ€ this one was served up by systemd 262.1, filed under NETWORKCTL(1) โ€” go forth and network responsibly, you absolute icon ๐Ÿ‘‘๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms