Host-only Adapter Host mode virtual machine can be accessed between ... Hosts can access virtual machines
NAT Network address translation mode (translation) virtual machines can access the extranet
Bridged Adapter full function. But occupy the IP segment
So host-only Adapter + NAT
Change Virtual box to host-only mode, because you can use VirtualBox to simulate a virtual network card on the host (MAC), and then use this network card to access the virtual machine.
First open the Virtual box's preferences, network, click on the + sign to add a piece of dummy card, click the Edit button to modify
Network card IP (gateway address), I will use the default 192.168.56.1
Then enter the virtual machine settings interface, network, modify the connection mode for Host-only, Interface name (interface name/interface name) Select the virtual network card that you just created, OK. The network within the virtual machine is then set to obtain the IP automatically, or it can be set to 192.168.56.* the same network segment. At this point the Mac can ping the virtual machine's IP.
PS: If you find that the Mac does not ping the virtual machine IP, check the virtual machine XP is not open the firewall, shut down.
However, the above settings in the virtual machine is not accessible to the public network, because the network card and my route is not a network segment, the solution is to add a network adapter to the virtual machine: Enter the virtual machine settings, network, choose Network Card 2, (note that the virtual machine does not start the case can be selected), Add a NAT network card, at this time the virtual machine has two network cards, a piece for the host to access the virtual machine (host-only), a piece for the virtual machine to access the host (as well as the external network) (NAT).
VI/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETH1//Modify Script
hwaddr=00:0c:29:8d:24:73 type=ethernet bootproto=static #启用静态IP地址 defroute=yes peerdns=yes PEERROUTES=yes IPV4_ Failure_fatal=no ipv6init=yes ipv6_autoconf=yes ipv6_defroute=yes ipv6_peerdns=yes IPV6_PEERROUTES=yes IPV6_FAILURE_ Fatal=no name=eno16777736 uuid=ae0965e7-22b9-45aa-8ec9-3f0a20a85d11 onboot=yes #开启自动启用网络连接 IPADDR=192.168.59.128 # Set IP Address
netmask=255.255.255.0 #子网掩码
prefix=2 gateway=192.168.59.2 #设置网关 dns1=8.8.8.8 #设置主DNS dns2=8.8.4.4 #设置备DNS: wq! #保存退出 Service Network Restart #重启网络 Ping www.baidu.com #测试网络是否正常
Yum install-y net-tools//mini package does not have:
Ifconfig
Mac book air and virtual box network visits install CENTOS7 Mini