nmcli - notes
Contents
Show connections
nmcli con show
Show active connections
nmcli con show --active
Show connection configuration settings
Example:
nmcli con show "<device name>"
Show device status
nmcli dev show
Or:
nmcli dev status
Connections can be modified or changed with nmcli con mod
Create new connection
nmcli con add
- Con-name “
(connection name) - Ifname “
(an existing device) - Type ethernet
- Ipv4 or ipv6 < ip address / cidr)
- Gw4
example:
nmcli con add con-name "static-eth0" ifname eth0 type ethernet ip4 192.168.1.119/32 gw4 192.168.1.1
Nmcli con mod
- Name
- Field + value
nmcli con mod static-eth0 ipv4.dns <ipaddress>
Activate connection
nmcli con up <name>
Disable autoconnect
Nic teaming
define team interface
nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}'
What it means:
- Nmcli add connection
- Connection type team
- Connection name
- Interface name
- Configuration settings in json format
Give team0 an ip address
nmcli con mod team0 ipv4.addresses '<someip>'
nmcli con mod team0 ipv4.method manual
What it means:
- Nmcli modify existing connection
- Connection name is team0
- Setting is ipv4.address
- Method is manual
Create team ports using connection type team slave
nmcli con add type team-slave con-name team0-port1 ifname eno1 master team0
What it means:
- Nmcli add new connection
- Con type is team-slave
- Con name is team0-port1
- Interface name is eno1
- Declare con master team0
check team state
teamdctl team0 state
If you found this useful please consider supporting the blog.
I use Fastmail to host my email for the blog. If you follow the link from this page you’ll get a 10% discount and I’ll get a little bit of break on my costs as well. It’s a win win.
Backblaze is a cloud backup solution for Mac and Windows desktops. I use it on my home computers, and if you sign up using the link on this page you get a free month of service through backblaze, and so do I. If you’re looking for a good backup solution give them a try!
Thanks!
Luke