cd /etc/sysconfig/network-scripts/
vim ifcfg-enp0s3
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static # dhcp修改为static
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=enp0s31f6
UUID=14a87b5c-b458-43be-b608-4e03e7b46ed7
DEVICE=enp0s31f6
ONBOOT=yes
PREFIX=24
IPADDR=192.168.1.117 # 添加ip地址
GATEWAY=192.168.1.1 # 添加网关
NETMASK=255.255.255.0 # 添加子网掩码
DNS=114.114.114.114 # 可选择的,添加DNS