Nmcli

From DikapediaV2
Jump to: navigation, search

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


Or you can do the typical way of editing:

# vi /etc/sysconfig/network-scripts/ifcfg-ens192
.
.
.
ONBOOT=<yes/no>