1. Display the status of all network devices:
nmcli device status
2. View network card configuration file information
nmcli connection show
3. View the detailed information of the specified interface
nmcli connection show [网卡名]
4. View details of all network devices
nmcli device show
5. View detailed information of a specified network device
nmcli device show [网卡名]
6. Add network card configuration file
nmcli con add con-name [自定义连接名] ifname [硬件设备名称] type [网络类型]
7. Modify the network card configuration file
nmcli con modify [网卡名] ipv4.addresses 192.168.1.1/24 ipv4.gateway 192.168.1.254 ipv4.dns 223.5.5.5 connection.autoconnect yes
# connection.autoconnect yes 网卡随系统启动自动连接
8. Restart the network card
nmcli con down [网卡名]
nmcli con up [网卡名]
9.Add multiple ip addresses
nmcli con modify [网卡名] +ipv4.addresses 192.168.1.2/24 +ipv4.dns 223.5.5.5 connection.autoconnect yes
10. Delete address
nmcli con modify [网卡名] -ipv4.addresses 192.168.1.2/24 -ipv4.dns 223.5.5.5 connection.autoconnect yes
11. Set up automatic acquisition and manual configuration
# dhcp自动获取
nmcli con modify [网卡名] ipv4.method auto
# 手动配置
nmcli con modify [网卡名] ipv4.method method