WRITELOOP

NETWORKMANAGER TIPS

2018 November 27

nmcli cheatsheet

WiFi management

  • List all available wifi connections nearby: $ nmcli device wifi list
  • Activate an wifi connection: $ nmcli connection up tiagoprn
  • Deactivate an wifi connection: $ nmcli connection down tiagoprn

Connect to a WiFi network for the first time:

Add the connection to the connection list:

$ nmcli connection add type wifi con-name AWifiNetworkFromSomewhere ssid AWifiNetworkFromSomewhere ifname wlp1s0

Set the wifi password:

$ nmcli connection modify AWifiNetworkFromSomewhere wifi-sec.key-mgmt wpa-psk $ nmcli connection modify AWifiNetworkFromSomewhere wifi-sec.psk TheWifiNetworkFromSomewherePasswordHere

Activate the WiFi connection:

$ nmcli connection up AWifiNetworkFromSomewhere

Get information

  • Show network status: $ nmcli general status
  • Show status per device: $ nmcli device status
  • Show all connections: $ nmcli connection show
  • Show details on specific connection (DNS servers e.g.): $ nmcli connection show tiagoprn

Manage connections DNS

  • Modify dns servers on a connection: $ nmcli connection modify tiagoprn ipv4.dns "8.8.8.8 8.8.4.4" (then you must deactivate and activate the connection again)
  • Add dns servers to a connection: $ nmcli connection add tiagoprn ip4.dns "8.8.8.8 8.8.4.4"

Fix wifi stopping working after some time:

$ vim /etc/NetworkManager/conf.d/wifi-always-working.conf
[device]
wifi.scan-rand-mac-address=no