###1.查看主机ip地址及网关###
# ifconfig
###2.修改配置###
在虚拟机中找到/etc/sysconfig/network-scripts/ifcfg-enp0s3文件并编辑
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INI=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=xxxxxxx
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.xx.xx (和宿主主机同一网段)
PREFIX=24
GATEWAY=192.168.xx.xx
DNS1=114.114.114.114
DNS2=8.8.8.8
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
3.重启服务
# service network restart
查看ip地址命令:# ip add