网络配置
1.如何使用nmcli命令配置网络
一个网络接口可有多个连接配置,但同时只有一个连接配置生效
nmcli命令必须依赖于NetworkManagger ,若NetworkManagger 关闭,则nmcli命令不可用
在用nmcli命令配置网络之前,先确认NetworkManager开启
nmcli device status ##列出所有设备状态
nmcli device show ##显示某个网卡设备的信息
nmcli connection
- 添加网络
nmcli connection add ##添加网络
实验1:添加静态网络172.25.254.122/24
nmcli connection add con-name westos type ethernet ifname eth0 ip4 172.25.254.122/24
显示连接
nmcli connection show
con-name ##网络名称
type ##网络类型
ifname ##网络接口名称
autoconnection ##是否自动连接
ip4 ##ip配置
实验2:添加动态网络
nmcli connection add con-name westos type ethernet ifname eth0 ip4 autoconnect yes
(未完待续。。。。。。。。。。。)