===== nmcli (NetworkManager CLI) =====
==== Quick Commands ====
View current connections:
nmcli connection show
View device information from all devices:
nmcli device show
==== Add new interface with static IP ====
First get the name of the interface:
ip a
Then add a new connection:
nmcli connection add con-name ifname type ethernet
This //can// then look like this:
''nmcli connection add con-name Connection2 ifname ens19 type ethernet''
Enable auto connection:
nmcli connection modify connection.autoconnect yes
Set IP:
nmcli connection modify ipv4.addresses
This //can// then look like this:
''nmcli connection modify Connection1 ipv4.addresses 192.168.0.2/24''
Set method to static:
nmcli connection modify ipv4.method static
Set default gateway:
nmcli connection modify ipv4.gateway
Set DNS server:
nmcli connection modify ipv4.dns ""
Then verify everything was saved correctly:
nmcli device show
If everything is correct, start the new connection:
nmcli connection up