vim /etc/sysconfig/network-scripts/ifcfg-ens33
将ONBOOT=no改为yes,将BOOTPROTO=dhcp改为BOOTPROTO=static,并在后面增加几行内容:
IPADDR=192.168.127.128
NETMASK=255.255.255.0
GATEWAY=192.168.127.2
DNS1=119.29.29.29
#重启网络
systemctl restart network.service
参考博客:https://blog.csdn.net/akipa11/article/details/81414875