1.网络设置选择桥接模式
设置-网络-桥接模式
2.系统分配ip地址
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=etho
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=dhcp
保存后 重启网卡
service network restart
systemctl restart network
然后使用 ifconfig 查看ip系统分配的ip地址(ip addr))
假设为192.168.1.101
vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
#(与本机ip地址在同一网段)
IPADDR=192.168.1.101
NETMASK=255.255.255.0
#(与ip地址同一网段)
GATEWAY=192.168.1.1
DNS1= 8.8.8.8
DNS2=8.8.8.4