网络配置

1.如何使用nmcli命令配置网络
一个网络接口可有多个连接配置,但同时只有一个连接配置生效
nmcli命令必须依赖于NetworkManagger ,若NetworkManagger 关闭,则nmcli命令不可用
在用nmcli命令配置网络之前,先确认NetworkManager开启在这里插入图片描述

nmcli device status ##列出所有设备状态
在这里插入图片描述

nmcli device show ##显示某个网卡设备的信息

在这里插入图片描述

nmcli connection

  1. 添加网络
    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 (未完待续。。。。。。。。。。。)