查看是否为动态ip
使用命令 ip addr show
inet <静态IP地址>/<子网掩码> brd <广播地址> scope global <网络接口名称>
如果网络接口已配置为动态IP地址,则在输出中会看到以下内容:
inet <动态IP地址>/<子网掩码> brd <广播地址> scope global dynamic <网络接口名称>
设置静态ip
打开虚拟网络编辑器
vi /etc/sysconfig/network-scripts/ifcfg-ens33
修改前:
修改后
重启网络
systemctl restart network
最后使用ip addr show复查一次
如果出现Job for network.service failed because the control process exited with error code.
请查看这篇文章