How do i manage networkmanager using the cli on redhat?
-
Managing the NetworkManager using the cli is done via the nmcli command. It is preferred that one of the NetworkManager method is used to make changes instead of going into the files to make changes to the network configuration.
nmcli man page: http://bit.ly/2qKTLSc
Display information on all interfaces.
$ nmcli
Display nmcli help.
# nmcli help Usage: nmcli [OPTIONS] OBJECT { COMMAND | help } OPTIONS -t[erse] terse output -p[retty] pretty output -m[ode] tabular|multiline output mode -c[olors] auto|yes|no whether to use colors in output -f[ields] <field1,field2,...>|all|common specify fields to output -e[scape] yes|no escape columns separators in values -a[sk] ask for missing parameters -s[how-secrets] allow displaying passwords -w[ait] <seconds> set timeout waiting for finishing operations -v[ersion] show program version -h[elp] print this help OBJECT g[eneral] NetworkManager's general status and operations n[etworking] overall networking control r[adio] NetworkManager radio switches c[onnection] NetworkManager's connections d[evice] devices managed by NetworkManager a[gent] NetworkManager secret agent or polkit agent m[onitor] monitor NetworkManager changes
The help above shows the different sections (OBJECTS) that nmcli can be used for, the object can be abbreviated by using the first letter
For example, to abbreviated general.
$ nmcli g status
To obtain help on the objects.
# nmcli g help Usage: nmcli general { COMMAND | help } COMMAND := { status | hostname | permissions | logging } status hostname [<hostname>] permissions logging [level <log level>] [domains <log domains>]
The help for connection object. The connection object has many sub-commands. A lot can be done with this sub-command.
# nmcli c help Usage: nmcli connection { COMMAND | help } COMMAND := { show | up | down | add | modify | clone | edit | delete | monitor | reload | load | import | export } show [--active] [--order <order spec>] show [--active] [id | uuid | path | apath] <ID> ... up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [passwd-file <file with passwords>] down [id | uuid | path | apath] <ID> ... add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]<setting>.<property> <value>)+] modify [--temporary] [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+ clone [--temporary] [id | uuid | path ] <ID> <new name> edit [id | uuid | path] <ID> edit [type <new_con_type>] [con-name <new_con_name>] delete [id | uuid | path] <ID> monitor [id | uuid | path] <ID> ... reload load <filename> [ <filename>... ] import [--temporary] type <type> file <file to import> export [id | uuid | path] <ID> [<output file>]
Show connections. c for connections
$ nmcli c NAME UUID TYPE DEVICE eth0 4c567f95-a3b9-44c3-9fbd-da8fb60e2350 802-3-ethernet eth0 virbr0 ebdcd14b-c3ca-4f7c-b012-172845db0e32 bridge virbr0 vnet0 ac66314a-6436-4477-b681-ff1afd2d234a tun vnet0
Get more specific information on interfaces. d for devices.
$ nmcli d show virbr0 GENERAL.DEVICE: virbr0 GENERAL.TYPE: bridge GENERAL.HWADDR: 52:65:00:A9:x9:A1 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: virbr0 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 IP4.ADDRESS[1]: 192.168.1220.1/24 IP4.GATEWAY: IP6.GATEWAY:
© Lightnetics 2024