networkctl – Query the Status of Network Links in Linux

networkctl is a command-line utility for viewing a summary of network devices and their connection status. It allows you to query and control the Linux networking subsystem.

It is one of the new commands in the latest release of systemd that displays the state of the network links as seen by the systemd-networkd service.

Note: Before running networkctl, ensure that systemd-networkd is running, otherwise you will get incomplete output indicated by the following error.
WARNING: systemd-networkd is not running, output will be incomplete.
WARNING: systemd-networkd is not running
WARNING: systemd-networkd is not running

You can check the status of systemd-networkd by running the following systemctl command.

sudo systemctl status systemd-networkd
Check systemd-networkd Status
Check systemd-networkd Status

If systemd-networkd is not running, you can start, enable it to start at boot time, and verify the status using the following commands.

sudo systemctl start systemd-networkd
sudo systemctl enable systemd-networkd
sudo systemctl status systemd-networkd

1. Listing Network Connections in Linux

To get the status information about your all network connections, run the following networkctl command without any argument.

networkctl

The above command will list all the network interfaces along with their statuses.

Check Network Connection Status
Check Network Connection Status

In the above output, you can see three network interfaces: lo (loopback), enp7s0 (Ethernet), and virbr0 (virtual network). Each interface has information about its index (IDX), name (LINK), type, operational status, and setup status.

2. Listing Active Network Connections in Linux

To display information about the specified links, such as type, state, kernel module driver, hardware and IP address, configured DNS, server, and more, use the status command. If you don’t specify any links, routable links are shown by default.

networkctl status 
Check All Network Connection Status
Check All Network Connection Status

To list various details of specific network interface called enp7s0, you can run the following command, which will list network configuration files, type, state, IP addresses (both IPv4 and IPv6), broadcast addresses, gateway, DNS servers, domain, routing information, maximum transmission unit (MTU), and queuing discipline (QDisc).

networkctl status enp7s0
Check Network Interface Status
Check Network Interface Status

Enable/Disable Network Interface in Linux

You can enable or disable a particular network interface in Linux using the following commands.

To enable (bring up) a network interface:

sudo networkctl up INTERFACE

To disable (bring down) a network interface:

sudo networkctl down INTERFACE

Replace INTERFACE with the name of the network interface.

To view its help message, use the -h flag or check out its man page for more information.

networkctl -h
OR
man networkctl 

You will also find the following Linux networking guides useful:

That’s all! In this article, we have explained how to use networkctl command for viewing a summary of network devices attached to a Linux system. Use the feedback form below to share your thoughts or ask any questions.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

1 Comment

Leave a Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.