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的網絡配置文件