通过 nmcli 命令修改IP信息

思路:查询---设置---启动

一、使用nmcli connection show命令来查询网络名称和UUID等信息。

二、设置IP网络参数:

nmcli connection modify "System eth0" ipv4.method manual connection.autoconnect yes ipv4.addresses "172.25.0.22/24" ipv4.gateway 172.25.0.254 ipv4.dns 172.25.254.254

● System eth0 为设备名称

● manual 为静态,connection.autoconnect yes 为设置开机自动启动

● 172.25.0.22/24 为IP和子网掩码

● 172.25.0.254 为网关

● 172.25.254.254 为DNS

三、启用:nmcli connection up "System eth0"

四、查看:ip a