In the enterprise network environment, Ubuntu 16.04 vm is installed on VirtualBox, and the network cannot be connected to the bridge. At home!

Solution:

1. Enable two network cards instead of “Bridge network card”

2. Set connection mode of NIC 1 to network Address Translation (NAT).

3. Set the connection mode of NIC 2 to Host-only adapter.

4. Start the VM and use Ubuntu 16.04 as an example to modify the configuration file.

Edit the configuration file /etc/network/interfaces

# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 Inet DHCP # Virtualbox host-only mode auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 # # # network 192.168.56.0 Virtualbox Bridged mode auto eth1 # iface eth1 inet static address # # 192.168.0.190 netmask 255.255.255.0 # gateway 192.168.0.1Copy the code

This configuration sets VM IP addresses on the internal network to static assignment (192.168.56.101
), so that the host can bind the IP address to the hosts to access the VM. After saving the configuration, run the following command to restart the network service:

$ sudo /etc/init.d/networking restart

The Host can access the external network using NAT. In host-only mode, the Host can access the VM using the INTERNAL NETWORK IP address of the VM. Even if the external network is unavailable, the Host can access the VM.

Advantages:

1. To solve the problem I encountered, “bridge network card” can be connected to the Internet at home, but not in the company.

2. The host can connect to VMS even when the host cannot access the Internet.

3. Both hosts and VMS can access the Internet.

Disadvantages:

1. Only the host can connect to the VM. Other VMS in the LAN cannot connect to the VM.