nmcli

Address configuration tool

Supplementary instructions

nmcli command is NetworkManager client network management client.

grammar

nmcli [OPTIONS] OBJECT { COMMAND | help }

Options

OPTIONS
   -t[erse] # terse output concise output
   -p[retty] # pretty output pretty output
   -m[ode] tabular|multiline # output mode output mode
   -f[ields] <field1,field2,...>|all|common # specify fields to output Specify the fields to output
   -e[scape] yes|no # escape columns separators in values Escape column separators in values
   -n[ocheck] # Do not check nmcli and NetworkManager versions
   -a[sk] # Require missing parameters
   -w[ait] <seconds> # Set timeout to wait for sorting operation
   -v[version] # Display program version
   -h[elp] # Print this help

OBJECT
   g[eneral] General status and operation of NetworkManager
   n[networking] overall networking control
   r[adio] NetworkManager switch
   c[onnection] NetworkManager connection
   d[evice] Device managed by NetworkManager
   a[gent] NetworkManager secret agent or polkit agent

Example

nmcli connection show # View current connection status
nmcli connection reload # Restart service
nmcli connection show -active # Display active connections
nmcli connection show "lan eth0" # Display the specified network connection configuration
nmcli device status # Display device status
nmcli device show eno16777736 # Display the specified interface attributes
nmcli device show # Display all interface attributes
nmcli con up static # Enable static connection configuration
nmcli con up default # Enable default connection configuration
nmcli con add help # View help

Create a network session

nmcli connection add con-name company ifname ens33 autoconnect no type ethernet ip4 192.168.1.2/24 gw4 192.168.1.1
# con-name specifies the session name,
# ifname specifies the local network card
# autoconnect no Whether to connect automatically
#ethernet specifies the network card type
#ip4/ip6
#gw4/gw5