
{{ $('Map tags to IDs').item.json.title }}
How to Configure Network with nmcli
nmcli is a command-line interface used to manage NetworkManager, a tool for configuring and managing network connections in Linux. It provides a powerful way to control network settings without exiting the terminal. This tutorial will guide you through using nmcli for network configuration and management.
1. Understanding nmcli
The nmcli command allows you to interact with NetworkManager to manage network connections, view statuses, and configure networking settings.
2. Checking Network Connection Status
To view the status of all network connections on your system, run:
nmcli connection show
This command displays a list of all connections along with their current state (connected, disconnected, etc.).
3. Connecting to a Wi-Fi Network
To connect to a Wi-Fi network, use the following command:
nmcli device wifi connect 'SSID' password 'your_password'
Replace SSID
with the name of your Wi-Fi network and your_password
with the required password. If the connection is successful, you will see confirmation in the terminal.
4. Creating a New Ethernet Connection
If you want to create a new Ethernet connection, you can use:
nmcli connection add type ethernet con-name new-connection ifname eth0
Replace new-connection
with your desired connection name and eth0
with your Ethernet interface name. You can also set an IP address as you create the connection:
nmcli connection modify new-connection ipv4.addresses 192.168.1.10/24
This will assign the specified IP address to your connection.
5. Modifying Connection Settings
To change existing connection settings, use:
nmcli connection modify connection-name property value
For example, to set the DNS servers for a connection:
nmcli connection modify connection-name ipv4.dns "8.8.8.8,8.8.4.4"
6. Disconnecting and Deleting Connections
To disconnect from a network, run:
nmcli connection down connection-name
To permanently delete a connection:
nmcli connection delete connection-name
7. Conclusion
By following this tutorial, you have learned how to configure and manage network connections in Linux using nmcli. Whether connecting to Wi-Fi, setting up Ethernet, or modifying connection settings, nmcli provides a robust command-line interface for network management. Continue to explore advanced features and commands in nmcli to optimize your Linux networking experiences!