linux的网络配置相关命令除了常用的ifconfig 命令,也可以用nmcli 命令进行配置。
命令:nmcli
nmcli device show 显示全部接口及属性
nmcli device show eth0 显示eth0设备信息
停止eth0接口
开启eth0接口
nmcli connection show 显示所有链接
nmcli connection show 显示所有链接
nmcli connection down westos 启动链接
nmcli connection up westos 关闭链接
nmcli connection add type ethernet con-name westos ifname eth0 添加一个静态ip地址的以太网链接
nmcli connection add type ethernet con-name westos ifname eth0 type ethernet ip4 172.25.254.177/24 添加网卡链接名为为westos并设定ip
nmcle connection delete westos
删除westos的网络配置文件