As previously mentioned, bridging is suitable for use in a unified network environment (same gateways and licenses).
If the network environment changes, then it is embarrassing-this is the problem I have, the company's each person's IP is fixed.
Workaround, change to NAT network address translation mode.
But the problem is again, so that the virtual machine can access the external network and host, but the host cannot directly communicate with the virtual machine! This means that the host cannot connect to the virtual machine!
Workaround: Add a host-only network card, and then modify it--the following are the specific steps:
The first step, Nic 1: connect to the NAT network (or NAT network address translation, one meaning); promiscuous mode change to allow all (if you refuse to surf the internet); Select Access network cable .
The second step, Nic 2: connection mode Select only the host (host-only) network, promiscuous mode to all allow, check the access network cable .
OK, now the VBox setup is complete, the following is the operating system network settings, including enabling network cards, setting IP, etc., depending on the operating system and different.
See CentOS 6.8 First, install in basic server mode, no GUI.
Enter the setup (Redhat-specific command, if the minimum mode installation does not include the command), the interface is as follows:
Select Network Configuration, enter:
Select Device Configuration, enter:
Above I have added a NIC eth1, in fact, there should be only one eth0! Select <new device> (new device), enter:
Here the main three items: Name (eth1), Device (eth1), use DHCP (Space key type *), check OK, enter to save.
Add: For legacy eth0, use DHCP.
Once the above steps are completed, the previous page will be returned, where the new network card (ETH1) needs to be activated, as follows:
Any way out, go back to bash and type "service network restart" To restart the network service. If not, reboot directly.
looking at Ubuntu 1604 again, this installs the GUI, so it's relatively simple.
Click on the network-edit, and then directly edit the corresponding network card, no longer detailed.
Under Bash, type ifconfig to view the IP of the virtual machine's ETH1 network card, and then ping it in the host.
VirtualBox NAT mode communicates with host