Network Manager command line nmcli detailed introduction

Networker Manager is a network management service on Linux with powerful functions. It has its own independent UI interface nm-applet and its own command line. This article mainly introduces NM's related command line-nmcli. nmcli is a command line tool used to control NetworkManager and report network status. It can replace nm-applet or other graphical clients. nmcli is used to create, display, edit, delete, activate and deactivate network connections and control and display the status of network devices.

1, general order

Use this command to display the status and permissions of NetworkManager. You can also get and change the system host name and NetworkManager logging level and domain.

nmcli general {
    
    status | hostname | permissions | logging} [ARGUMENTS...]

1.1 View the current network status

nmcli general status  

Insert picture description here
1.2 View or modify the host name

查看:nmcli general hostname 
修改:nmcli general hostname NewHostname

Insert picture description here
1.3 View permissions

nmcli general permissions

Insert picture description here

2. Control commands

Query the current network link status, view and control the current network switch.

nmcli networking {
    
    on | off | connectivity} [ARGUMENTS...]

2.1 View the current network enable state

nmcli networking

Insert picture description here
2.2 Switch network

nmcli networking on
nmcli networking off

Insert picture description here
2.3 View network connection status

nmcli networking connectivity

Insert picture description here

All connection status values ​​are as follows:

none : the host is not connected to any network.

portal : the host is behind a captive portal and cannot reach the full Internet.

limited : the host is connected to a network, but it has no access to the Internet.

full : the host is connected to a network and has full access to the Internet.

unknown : the connectivity status cannot be found out.

3. Wireless transmission control commands

Show radio switches status, or enable and disable the switches.
nmcli radio {
    
    all | wifi | wwan} [ARGUMENTS...] 

nmcli radio :显示当前radio信息
nmcli radio wifi : 显示WiFi开关状态
nmcli radio wifi on : 设置WiFi开启
nmcli radio wifi off :设置WiFi关闭
nmcli radio wwan :查看WWAN(移动宽带)的状态
nmcli radio wwan on :设置WWAN 开启
nmcli radio wwan off :设置WWAN 关闭
nmcli radio all on :设置所有开关开启
nmcli radio all off : 设置所有开关关闭

4. Connection management commands (core)

nmcli connection {
    
    show | up | down | modify | add | edit | clone | delete | monitor | reload | load | import | export} [ARGUMENTS...]

4.1 View connection information

nmcli connection show
等价于: nmcli con show

Insert picture description here
Parameter introduction:

NAME: 连接名称,虚拟名称,无线连接一般为连接的ssid名称
UUID: 唯一标识
TYPE: 连接类型,ethernet代表网线连接(也称以太连接),wireless代表无线(WiFi)
DEVICE: 设备名称

4.2 View the detailed information of a connection

nmcli connection show [connection name 或 UUID]

4.3 Activate or deactivate the connection

nmcli connection up [connection name]
nmcli connection down [connection name]

Insert picture description here
4.4 Delete the current connection

nmcli connection delete [connection name]
nmcli connection delete [cvonnection name]

5. Device management commands (core)

nmcli device {
    
    status | show | set | connect | reapply | modify | disconnect | delete | monitor | wifi | lldp} [ARGUMENTS...]

5.1 Printing device status

nmcli device status

Insert picture description here

5.2 View device details

nmcli device show : 显示所有设备的信息
nmcli device show [device name] : 显示指定设备的信息,设备名称,如上图中的enp0s8

Insert picture description here
(To be continued...)

Guess you like

Origin blog.csdn.net/PRML_MAN/article/details/113878415