host-only模式
1、主机设置网络共享
2、虚拟机网络设置
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# ls ifcfg-enp0s3 ifdown-ppp ifup-ib ifup-Team ifcfg-lo ifdown-routes ifup-ippp ifup-TeamPort ifdown ifdown-sit ifup-ipv6 ifup-tunnel ifdown-bnep ifdown-Team ifup-isdn ifup-wireless ifdown-eth ifdown-TeamPort ifup-plip init.ipv6-global ifdown-ib ifdown-tunnel ifup-plusb network-functions ifdown-ippp ifup ifup-post network-functions-ipv6 ifdown-ipv6 ifup-aliases ifup-ppp ifdown-isdn ifup-bnep ifup-routes ifdown-post ifup-eth ifup-sit [root@localhost network-scripts]# cat ifcfg-enp0s3 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=enp0s3 UUID=e5148472-bd96-4da0-97ca-3040fb54a102 DEVICE=enp0s3 ONBOOT=yes IPADDR=192.168.137.105 PREFIX=32 GATEWAY=192.168.137.1 DNS1=192.168.9.19 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_PRIVACY=no
3、
service network restart
4、关闭防火墙
chkconfig iptables off
service iptables status
5、connect automatically
开启