Nmcli: Difference between revisions

From DikapediaV2
Jump to: navigation, search
No edit summary
No edit summary
 
Line 33: Line 33:
----
----
Turn on:
Turn on:
  # nmcli connection modify ens192 connection.autoconnect yes
  # nmcli connection modify ens192 connection.autoconnect "yes"


Turn of:
Turn of:
  # nmcli connection modify ens192 connection.autoconnect no
  # nmcli connection modify ens192 connection.autoconnect "no"


 
For changes to take effect, turn the interface down and up (in some cases, this works better than restarting NetworkManager):
Or you can do the typical way of editing:
  # nmcli con down ens192
  # vi /etc/sysconfig/network-scripts/ifcfg-ens192
  # nmcli con up ens192
  .
.
.
ONBOOT=<yes/no>

Latest revision as of 18:36, 6 May 2025

Network Manager Command Line - is used for controlling NetworkManager and reporting network status.


Check connection status of interfaces


nmcli dev status

# nmcli dev status

DEVICE      TYPE      STATE         CONNECTION 
docker0     bridge    connected     docker0    
virbr0      bridge    connected     virbr0     
enp0s3      ethernet  connected     enp0s3     
virbr0-nic  ethernet  disconnected  --         
lo          loopback  unmanaged     --   

Turn Connection Up or Down


nmcli connection down <interface> or nmcli connection up <interface>

# nmcli connection down ens192
Connection 'ens192' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
# nmcli connection up ens192
Connection 'ens192' successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)


Turn Networking Up or Down


nmcli networking off
nmcli networking on


Turn Autoconnect On/Off


Turn on:

# nmcli connection modify ens192 connection.autoconnect "yes"

Turn of:

# nmcli connection modify ens192 connection.autoconnect "no"

For changes to take effect, turn the interface down and up (in some cases, this works better than restarting NetworkManager):

# nmcli con down ens192
# nmcli con up ens192