Difference between revisions of "Nmcli"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<code>nmcli</code> is [[NetworkManager]]'s built-in command-line interface added in 2010<ref>https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=c2ec07f17d69a590b45797de5c8a0f26a4c45eaa</ref>, it is used at least in [[Red Hat Enterprise Linux|RHEL]]. nmcli allows easy display of NetworkManager's current status, manage at least [[Ethernet]] and [[WiFi]] connections and devices, monitor connections.
+
{{lowercase}}
 +
<code>nmcli</code> is [[NetworkManager]]'s built-in command-line interface added in 2010<ref>https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=c2ec07f17d69a590b45797de5c8a0f26a4c45eaa</ref>, it is used at least in [[Red Hat Enterprise Linux|RHEL]]. <code>nmcli</code> allows easy display of NetworkManager's current status, manage at least [[Ethernet]] and [[WiFi]] connections and devices, monitor connections.
  
  
Line 5: Line 6:
 
See RHEL 8.0 official documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_networking/index
 
See RHEL 8.0 official documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_networking/index
 
* Show  network connections:
 
* Show  network connections:
<pre>nmcli connection show
+
[[nmcli connection show]]
  NAME      UUID                                  TYPE      DEVICE
+
  NAME      UUID                                  TYPE      DEVICE
Profile 1  db1060e9-c164-476f-b2b5-caec62dc1b05  ethernet    ens3
+
Profile 1  db1060e9-c164-476f-b2b5-caec62dc1b05  ethernet    ens3
bond0      aaf6eb56-73e5-4746-9037-eed42caa8a65  ethernet    --
+
bond0      aaf6eb56-73e5-4746-9037-eed42caa8a65  ethernet    --
</pre>
+
 
* <code>nmcli connection show --active</code>
+
nmcli connection show
* <code>nmcli device status</code>
+
NAME                UUID                                  TYPE      DEVICE
<pre>
+
System eth0        5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0
DEVICE  TYPE      STATE      CONNECTION
+
System eth1        9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04  ethernet  eth1
ens3   ethernet  connected  Profile 1
+
Wired connection 1  c40205e6-e5f8-37ba-a85b-ef94a15aad79  ethernet  --
ens4    ethernet  disconnected  --
+
 
lo      loopback  unmanaged  --
+
<code>nmcli connection show --active</code>
</pre>
+
 
* <code>nmcli device show</code> (Includes link or carrier status). See also: <code>[[ethtool]]</code>
+
[[nmcli device]] status
<pre>
+
DEVICE  TYPE      STATE      CONNECTION
GENERAL.DEVICE:                        ens33
+
[[ens]]3   ethernet  connected  Profile 1
GENERAL.TYPE:                          ethernet
+
ens4    ethernet  disconnected  --
GENERAL.HWADDR:                        00:0C:29:54:F7:20
+
lo      loopback  unmanaged  --
GENERAL.MTU:                            1500
+
 
GENERAL.STATE:                          100 (connected)
+
nmcli device status
GENERAL.CONNECTION:                    ens33
+
DEVICE  TYPE      STATE      CONNECTION
GENERAL.CON-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/5
+
eth0    ethernet  connected  System eth0
WIRED-PROPERTIES.CARRIER:              on
+
eth1    ethernet  connected  System eth1
IP4.ADDRESS[1]:                        192.168.219.150/24
+
lo      loopback  unmanaged  --
IP4.GATEWAY:                            192.168.219.2
+
 
IP4.DNS[1]:                            192.168.219.2
+
 
IP4.DOMAIN[1]:                          localdomain
+
<code>[[nmcli device show]]</code> (Includes link or carrier status). See also: <code>[[ethtool]]</code>
IP6.ADDRESS[1]:                        fe80::3442:365:1982:aa4b/64
 
IP6.GATEWAY:     
 
</pre>
 
  
 
== Configure commands ==
 
== Configure commands ==
* Configure DNS: <code>nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"</code>
+
* Configure [[DNS]]: <code>[[nmcli con]] mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"</code>
* Activate Ethernet connection: <code>nmcli con up test-lab ifname ens9</code>
+
* Activate Ethernet connection: <code>[[nmcli con up]] test-lab ifname ens9</code>
 
* View details: <code>nmcli -p con show test-lab</code>
 
* View details: <code>nmcli -p con show test-lab</code>
 
* Configure IP in eth0:
 
* Configure IP in eth0:
<pre>
+
 
nmcli c add type ethernet ifname eth0 con-name "My_New_Connection" ip4 192.168.1.166/24 gw4 192.168.1.1
+
[[nmcli c add]] type ethernet ifname eth0 con-name "My_New_Connection" ip4 192.168.1.166/24 gw4 192.168.1.1
Connection "My_New_Connection"  (xxxxxxx-sdafasfsdf-adfasdfaf-adsfads) suceessfully added.
+
Connection "My_New_Connection"  (xxxxxxx-sdafasfsdf-adfasdfaf-adsfads) suceessfully added.
</pre>
+
 
 +
* <code>[[nmcli --help]]</code>
  
 
== Activities ==
 
== Activities ==
Line 50: Line 49:
  
 
== See also ==
 
== See also ==
 +
* {{nmcli}}
 
* {{Netplan}}
 
* {{Netplan}}
 
* {{NetworkManager}}
 
* {{NetworkManager}}

Latest revision as of 16:25, 11 November 2021

nmcli is NetworkManager's built-in command-line interface added in 2010[1], it is used at least in RHEL. nmcli allows easy display of NetworkManager's current status, manage at least Ethernet and WiFi connections and devices, monitor connections.


Basic Commands[edit]

See RHEL 8.0 official documentation: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_networking/index

  • Show network connections:
nmcli connection show
  NAME       UUID                                  TYPE      DEVICE
Profile 1  db1060e9-c164-476f-b2b5-caec62dc1b05  ethernet    ens3
bond0       aaf6eb56-73e5-4746-9037-eed42caa8a65  ethernet    --
nmcli connection show
NAME                UUID                                  TYPE      DEVICE
System eth0         5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  eth0
System eth1         9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04  ethernet  eth1
Wired connection 1  c40205e6-e5f8-37ba-a85b-ef94a15aad79  ethernet  --

nmcli connection show --active

nmcli device status
DEVICE  TYPE      STATE      CONNECTION
ens3    ethernet  connected  Profile 1
ens4    ethernet  disconnected  --
lo      loopback  unmanaged  --
nmcli device status
DEVICE  TYPE      STATE      CONNECTION
eth0    ethernet  connected  System eth0
eth1    ethernet  connected  System eth1
lo      loopback  unmanaged  --


nmcli device show (Includes link or carrier status). See also: ethtool

Configure commands[edit]

  • Configure DNS: nmcli con mod test-lab ipv4.dns "8.8.8.8 8.8.4.4"
  • Activate Ethernet connection: nmcli con up test-lab ifname ens9
  • View details: nmcli -p con show test-lab
  • Configure IP in eth0:
nmcli c add type ethernet ifname eth0 con-name "My_New_Connection" ip4 192.168.1.166/24 gw4 192.168.1.1
Connection "My_New_Connection"  (xxxxxxx-sdafasfsdf-adfasdfaf-adsfads) suceessfully added.

Activities[edit]

  1. Configure network bonding using nmcli: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_and_managing_networking/index#configuring-network-bonding-using-nmcli_Configuring-Networking-with-nmcli

See also[edit]

  • https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=c2ec07f17d69a590b45797de5c8a0f26a4c45eaa
  • Advertising: