修改网卡配置文件(操作前先备份一下该文件),/etc/sysconfig/network-scripts/ifcfg-enp0s3 ,如下:
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.111.152
NETMASK=255.255.255.0
NETWORK=192.168.111.0
DNS1=192.168.111.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=cdf87327-fdd7-427e-ac31-8b19f688c3fc
DEVICE=ens33
ONBOOT=yes
ZONE=public
默认该文件中还有其他配置,可以都删除或注释。
修改网关配置文件,/etc/sysconfig/network,如下:
# Created by anaconda NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain GATEWAY=192.168.111.2
重启服务
systemctl restart network