LinuxCommandLibrary

networkctl

Control and inspect network interfaces

TLDR

List existing links with their status

$ networkctl list
copy

Show an overall network status
$ networkctl status
copy

Bring network devices up
$ networkctl up [interface1 interface2 ...]
copy

Bring network devices down
$ networkctl down [interface1 interface2 ...]
copy

Renew dynamic configurations (e.g. IP addresses received from a DHCP server)
$ networkctl renew [interface1 interface2 ...]
copy

Reload configuration files (.netdev and .network)
$ networkctl reload
copy

Reconfigure network interfaces (if you edited the config, you need to call networkctl reload first)
$ networkctl reconfigure [interface1 interface2 ...]
copy

SYNOPSIS

networkctl [OPTIONS...] {COMMAND} [LINK...]

PARAMETERS

-a, --all
    Show all network links, including inactive ones.

-s, --stats
    Show network link statistics, such as packet counts and errors.

-l LINES, --lines=LINES
    Control the number of lines to show for property lists.

-o FORMAT, --output=FORMAT
    Set the output format. Common formats include 'json', 'json-pretty', 'short', 'plain'.

--no-pager
    Do not pipe output into a pager.

--no-legend
    Do not print the header line of tables.

-h, --help
    Show a short help text and exit.

--version
    Show a short version string and exit.

DESCRIPTION

networkctl is a powerful command-line utility for inspecting and controlling network interfaces managed by systemd-networkd.

It provides a comprehensive overview of network link states, including operational status, IP addresses, routes, and DNS configurations. Beyond inspection, networkctl enables management actions such as enabling or disabling specific links, bringing them up or down, and reconfiguring network settings. It simplifies network administration by tightly integrating with the systemd ecosystem, offering a unified interface for network configuration and troubleshooting, especially in environments where systemd-networkd is the primary network management daemon. It's an essential tool for system administrators to monitor and manipulate network connectivity on Linux systems.

CAVEATS

networkctl primarily interacts with the systemd-networkd daemon. Therefore, it will only display and manage network interfaces that are configured and controlled by systemd-networkd.

Interfaces managed by other network management services (e.g., NetworkManager, ifupdown) may not be fully visible or controllable via networkctl.

COMMON COMMANDS

list: List all discovered network links and their states.

status [LINK]: Show detailed status information for all links, or a specific link if LINK is provided.

up LINK: Bring a network link up and make it operational.

down LINK: Bring a network link down, making it inoperable.

reconfigure [LINK]: Reconfigure a network link, applying current configuration changes.

reload: Reload systemd-networkd's configuration files without restarting the daemon.

restart: Restart the systemd-networkd daemon.

USAGE EXAMPLE

To list all network interfaces with their status:

networkctl list

To view detailed status of a specific interface, e.g., 'eth0':

networkctl status eth0

To bring an interface 'eth0' down:

networkctl down eth0

HISTORY

networkctl is an integral part of the systemd project, designed to provide a modern, unified interface for network configuration and status alongside systemd-networkd. It was introduced as part of the ongoing effort to centralize and standardize system management utilities under the systemd umbrella, aiming to replace older, more fragmented network tools for systems running systemd.

SEE ALSO

ip(8), ss(8), systemd-networkd(8), networkd.conf(5), resolvectl(1)

Copied to clipboard