mac + virtualbox + centos7 virtual machine network
linux version used herein is centos7, corresponding virtualbox version 5.1.6
1, into the virtualbox -> Preferences
2, switch to the network Tab pages, a new network NAT
In the new NAT network above right click and select Edit, and note the gateway address
Here the gateway address is 10.0.2.0
3, change the virtual machine's network settings, and select just the new NAT network
After setting need to restart the virtual machine
4, restart the virtual machine, enter modify the network card settings
Administrator user to enter / etc / sysconfig / network-scripts directory, you can see a ifcfg-xxx file. Where xxx is the name of the network card, different on each machine. Edit this file, you need to modify the content as follows:
BOOTPROTO = static # dhcp changed from static
IPONBOOT = yes # # Set boot automatically take effect for the following new
IPADDR = 10.0.2.8 # 10.0.2.x again in this segment to set a static IP for your own virtual machine
GATEWAY=10.0.2.1
NETMASK=255.255.255.0
DNS1=10.0.2.1
After completing the editing save and exit and restart network services:
service network restart
5, complete the configuration
At this point you can see the IP of the machine through the command ip addr address