Show Menu

NetworkManager Cheat Sheet by

networkmanager

Instal­lation

RedHat
yum install Networ­­kM­a­nager
yum install Networ­­kM­a­n­ag­­er-­tui
Archlinux
pacman -S networ­kma­nager
Debian
apt-get install networ­k-m­anager

Networ­kMa­nager Initia­liz­ation

Systemd
systemctl start Networ­kMa­nager
systemctl enable Networ­kMa­nager
systemctl status Networ­kMa­nager

General Commands

nmcli general status
Show overall status of Networ­kMa­nager
nmcli general hostname [hostname]
Get and change system hostname
nmcli general permis­sions
Show the permis­sions
nmcli general logging [level level] [domains domain­s...]
Get and change Networ­kMa­nager logging level and domains

Activity Monitor

nmcli monitor
Observe Networ­kMa­nager activity

Networking Control Commands

nmcli networking [on | off]
Enable or disable networking control by Networ­kMa­nager
nmcli networking connec­tivity [check]
connec­tivity [check]

Radio Transm­ission Control Commands

nmcli radio wifi [on | off]
Show or set status of Wi-Fi
nmcli radio wifi wwan [on | off]
Show or set status of WWAN
nmcli radio wifi all [on | off]
Show or set all previously mentioned radio switches at the same time

Secret Agent

nmcli agent {secret | polkit | all}
Run nmcli as a Networ­kMa­nager secret agent, or polkit agent

Examples

Listing available Wi-Fi APs
nmcli device wifi list
Showing general inform­ation and properties for a Wi-Fi interface
nmcli -p -f genera­l,w­ifi­-pr­ope­rties device show wlan0
Listing Networ­kMa­nager polkit permis­sions
nmcli general permis­sions
Listing Networ­kMa­nager log level and domains
nmcli general logging
Changing Networ­kMa­nager logging
nmcli g log level DEBUG domains CORE,E­THER,IP
nmcli g log level INFO domains DEFAULT
Activating a VPN connection profile requiring intera­ctive password input
nmcli --ask con up my-vpn-con
Adding a bonding master and two slave connection profiles
nmcli con add type bond ifname mybond0 mode active­-backup
nmcli con add type ethernet ifname eth1 master mybond0
nmcli con add type ethernet ifname eth2 master mybond0
Adding a team master and two slave connection profiles
nmcli con add type team con-name Team1 ifname Team1 config team1-­mas­ter­-js­on.conf
nmcli con add type ethernet con-name Team1-­slave1 ifname em1 master Team1
nmcli con add type ethernet con-name Team1-­slave2 ifname em2 master Team1
nmcli con add type ethernet con-name Team1-­slave2 ifname em2 master Team1
nmcli con up Team1-­slave1
nmcli con up Team1-­slave2
Adding a bridge and two slave profiles
nmcli con add type bridge con-name TowerB­ridge ifname TowerB­ridge
nmcli con add type ethernet con-name br-slave-1 ifname ens3 master TowerB­ridge
nmcli con add type ethernet con-name br-slave-2 ifname ens4 master TowerB­ridge
nmcli con modify TowerB­ridge bridge.stp no
Adding an ethernet connection profile with manual IP config­uration
nmcli con add con-name my-con-em1 ifname em1 type ethernet ip4 192.16­8.1­00.1­00/24 gw4 192.16­8.100.1 ip4 1.2.3.4 ip6 abbe::cafe
nmcli con mod my-con-em1 ipv4.dns "­8.8.8.8 8.8.4.4­"
nmcli con mod my-con-em1 +ipv4.dns 1.2.3.4
nmcli con mod my-con-em1 ipv6.dns "­200­1:4­860­:48­60:­:8888 2001:4­860­:48­60:­:88­44"
nmcli -p con show my-con-em1
Convenient field values retrieval for scripting
nmcli -g ip4.ad­dress connection show my-con­-eth0
nmcli -g ip4.ad­dre­ss,­ip4.dns connection show my-con­-eth0
nmcli -g ip4 connection show my-con­-eth0
Adding an Ethernet connection and config­uring SR-IOV VFs
nmcli con add type ethernet con-name EthernetPF ifname em1
nmcli con modify EthernetPF sriov.t­ot­al-vfs 3 sriov.a­ut­opr­obe­-dr­ivers false
nmcli con modify EthernetPF sriov.vfs '0 mac=00­:11­:22­:33­:44:55 vlans=10, 1 trust=true spoof-­che­ck=­false'
nmcli con modify EthernetPF +sriov.vfs '2 max-tx­-ra­te=20'
Escaping colon characters in tabular mode
nmcli -t -f general -e yes -m tab dev show eth0
Adding an ethernet connection profile in intera­ctive editor
nmcli connection edit type ethernet
print
goto ethernet
goto ipv4.a­ddr­esses
set ipv4.g­ateway 192.16­8.1.1
verify
print
set ipv4.dns 8.8.8.8 8.8.4.4
print
verify
save
quit
 

Running Networ­kMa­nager

--version | -V
Print Networ­kMa­nager software version
--help | -h
Print Networ­kMa­nager options
--no-d­aemon | -n
Do not daemonize
--debug | -d
Print output to STDOUT
--pid-file | -p
Specify location of PID file
--stat­e-file
Specify file for storing state
--config
Specifiy config­uration file
--log-­level
Set Networ­kMa­nager logging
--log-­domain
List operations to log
--prin­t-c­onfig
Print Networ­kmanger config­uration

Connection Management Commands

nmcli connection show [--active] [--order [+-]ca­teg­ory­:...]
List all profiles
nmcli connection show [--active] [id | uuid | path | apath] ID...
Show details for specified connec­tions
nmcli connection up [id | uuid | path] ID [ifname ifname] [ap BSSID] [passw­d-file file]
Activate a connection
nmcli connection down [id | uuid | path | apath] ID...
Deactivate a connection
nmcli connection modify [--tem­porary] [ id | uuid | path ] ID {option value | [+|-]s­ett­ing.pr­operty value} ...
Add, modify or remove properties
nmcli connection add [save {yes | no}] {option value | [+|-]s­ett­ing.pr­operty value} ...
Create a new connection
nmcli connection edit {[id | uuid | path] ID | [type type] [con-name name]}
Edit an existing connection or add a new one, using an intera­ctive editor
nmcli connection clone [--tem­porary] [id | uuid | path] ID new_name
Clone a connection
nmcli connection delete [id | uuid | path] ID...
Delete a configured connection
nmcli connection monitor [id | uuid | path] ID...
Monitor connection profile activity
nmcli connection reload
Reload all connection files from disk
nmcli connection load filena­me...
Load/r­eload one or more connection files from disk
nmcli connection import [--tem­porary] type type file file
Import an extern­al/­foreign config­uration
nmcli connection export [id | uuid | path] ID [file]
Export a connection
 

Config­uring Networ­kMa­nager

plugins
Lists plugin separated by ','
auth-p­olkit
Whether to use PolicyKit for author­ization
dhcp
Sets up DHCP client
dns
Set DNS processing mode e.g. dnsmasq, system­d-r­eso­lved, unbound, none.
level
Set log level e.g. OFF,ER­R,W­ARN­,IN­FO,­DEB­UG,­TRACE
domains
Set log domain e.g. NONE,A­LL,­DEF­AUL­T,D­HCP,IP.
backend
Set logging backend e.g. syslog, journal

Device Management Commands

nmcli device status
Print status of devices
nmcli device show [ifname]
Show detailed inform­ation about devices
nmcli device set [ifname] ifname [autoc­onnect {yes |no}] [managed {yes | no}]
Set device properties
nmcli device connect ifname
Connect the device
nmcli device reapply ifname
Attempt to update device
nmcli device modify ifname {option value | [+|-]s­ett­ing.pr­operty value} ...
Modify the settings
nmcli device disconnect ifname...
Disconnect a device
nmcli device delete ifname...
Delete a device
nmclie device monitor [ifnam­e...]
Monitor device activity
nmcli device wifi [list [--rescan | auto | no | yes] [ifname ifname] [bssid BSSID]]
List available Wi-Fi access points
nmcli device wifi connect (B)SSID [password password] [wep-k­ey-type {key | phrase}] [ifname ifname] [bssid BSSID] [name name] [private {yes | no}] [hidden {yes | no}]
Connect to a Wi-Fi network
nmcli device wifi hotspot [ifname ifname] [con-name name] [ssid SSID] [ band {a | bg} ] [channel channel] [password password]
Create a Wi-Fi hotspot
nmcli device wifi rescan [ifname ifname] [ssid SSID...]
Re-scan for available access points
nmcli device lldp [list [ifname ifname]]
Display inform­ation about neighb­oring devices

Dispatcher Scripts

Script should be owned by root
chown root:root /etc/N­etw­ork­Man­age­r/d­isp­atc­her.d/­10-­scr­ipt.sh
Must not be writable by group or other
chmod 755 /etc/N­etw­ork­Man­age­r/d­isp­atc­her.d/­10-­scr­ipt.sh
Each script receives two arguments
The first argument is the interface name
The second argument is the network action e.g. up, down, etc.

Download the NetworkManager Cheat Sheet

4 Pages
//media.cheatography.com/storage/thumb/misterrabinhalder_networkmanager.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by misterrabinhalder