Appearance
nmcli使用命令
查看网卡
bash
nmcli device status
查看网络连接
bash
nmcli connection show
查看网络连接详情
bash
nmcli connection show "Wired connection 2"
删除网络连接
bash
nmcli connection delete "Wired connection 2"
添加网络连接(基本不用)
bash
nmcli connection add type ethernet con-name eth0 ifname eth0 ip4 192.168.1.1/24 gw4 192.168.1.1
修改dns
bash
nmcli connection mod eth0 ipv4.dns "114.114.114.114"
修改dhcp
bash
nmcli connection mod eth0 ipv4.method manual
nmcli connection mod eth0 ipv4.method auto
修改IP地址
bash
nmcli connection modify eth0 ipv4.addresses "192.168.1.1/24"
修改网关
bash
nmcli connection modify eth0 ipv4.gateway "192.168.1.1"
激活网卡
bash
nmcli con up eth0
添加静态路由(基本不用)
bash
nmcli connection modify enp3s0 +ipv4.routes "192.168.122.0/24 10.10.10.1"
添加IP地址
bash
nmcli connection modify "Wired connection 2" +ipv4.addresses "172.16.1.1/24"