List all available connections:
sudo nmcli connection show
View detailed connection information:
sudo nmcli connection show <connection_name>
Enable or disable a connection:
sudo nmcli connection up <connection_name>
sudo nmcli connection down <connection_name>
Create a new connection:
sudo nmcli connection add type <connection_type> ifname <interface_name> con-name <connection_name>
Delete a connection:
sudo nmcli connection delete <connection_name>
Modify connection properties (e.g., MTU, DNS search domains):
sudo nmcli connection modify <connection_name> <property_name> <value>
Set or change IP addressing:
sudo nmcli connection modify <connection_name> ipv4.method manual
sudo nmcli connection modify <connection_name> ipv4.addresses <static_ip>/<subnet_mask>
Set the gateway:
sudo nmcli connection modify <connection_name> ipv4.gateway <gateway_ip>
Set DNS servers:
sudo nmcli connection modify <connection_name> ipv4.dns <dns_server1> <dns_server2>
To change the name of “Wired connection 1″ to something else, eg.”LinuxPi.ca”
sudo nmcli connection modify "Wired connection 1" connection.id "LinuxPi.ca"
These are just some of the tasks you can perform with NMCLI. It offers many more options for managing network connections, and you can explore additional features and options in the NMCLI manual or by using nmcli --help
to see the available commands and options.