Managing Networking Status with nmcli networking (with examples)
NetworkManager is a powerful tool for managing network connections on Linux systems. One of the commands available with NetworkManager is nmcli networking
, which allows users to manage the networking status of NetworkManager. In this article, we will explore different use cases of the nmcli networking
command and provide code examples for each use case.
1. Show the networking status of NetworkManager
To show the networking status of NetworkManager, you can use the following command:
nmcli networking
Motivation: This command is useful to quickly check whether networking is enabled or disabled on your system.
Explanation: The nmcli networking
command provides the current networking status of NetworkManager. It will display either “enabled” or “disabled” depending on whether networking is currently enabled or disabled.
Example output:
enabled
2. Enable or disable networking and all interfaces managed by NetworkManager
To enable or disable networking and all interfaces managed by NetworkManager, you can use the following command:
nmcli networking on|off
Motivation: This command is useful when you want to enable or disable networking on your system. Disabling networking can be helpful when troubleshooting network-related issues or when you want to disconnect from the network temporarily.
Explanation: The nmcli networking
command with the arguments “on” or “off” allows you to enable or disable networking respectively. When you use “on”, it will enable networking, and when you use “off”, it will disable networking.
Example output:
NetworkManager is now enabled.
3. Show the last known connectivity state
To show the last known connectivity state, you can use the following command:
nmcli networking connectivity
Motivation: This command is useful to check the last known connectivity state of your network.
Explanation: The nmcli networking connectivity
command displays the last known connectivity state of your network. It will show one of the following states:
- “full” - if the network connectivity is fully operational.
- “limited” - if the network connectivity is limited or restricted.
- “none” - if there is no network connectivity.
Example output:
full
4. Show the current connectivity state
To show the current connectivity state, you can use the following command:
nmcli networking connectivity check
Motivation: This command is helpful in determining the current connectivity status of your network.
Explanation: The nmcli networking connectivity check
command checks the current connectivity state of your network. It will display one of the following states:
- “full” - if the network connectivity is fully operational.
- “limited” - if the network connectivity is limited or restricted.
- “none” - if there is no network connectivity.
Example output:
limited
In conclusion, the nmcli networking
command provides users with the ability to manage and monitor the networking status of NetworkManager. Whether you want to check the networking status, enable/disable networking, or view the connectivity state, this command has you covered. By utilizing these different use cases, you can efficiently manage your network connections on Linux systems.