Oracle VirtualBox uses a bridge network to achieve two-way communication between hosts and virtual machines. oraclevirtualbox

Source: Internet
Author: User

Oracle VirtualBox uses a bridge network to achieve two-way communication between hosts and virtual machines. oraclevirtualbox

I recently changed my laptop and finally used the intel i7 processor to install the system using hardware virtualization technology. The configuration is as follows:

Host ThinkPad P50s OS Window 10

Virtual Machine Software Oracle VirtualBox (I personally feel that it is fast and can create virtual machine file formats compatible with VMWare and Hyper-V)

Virtual Machine operating system Ubuntu Server 12.04.5 64-bit

In VirtualBox, network adapter settings for Network Address Translation (NAT) are used by default. The advantage of this method is that the system can access the Internet on the virtual terminal without any configuration after the installation is complete, but the disadvantage is that you cannot access the virtual end in the network.

After the Virtual Machine network is set as a bridge network, the virtual machine and the host can use the IP address of the same network segment. In the network, the host and the virtual machine are equal and can access each other. After setting, I encountered the following problems:

1. the IP address of the VM can be pinged on the host, but the IP address of the VM cannot be pinged on the VM;

2. You cannot use apt-get to install software on a virtual machine. Run the apt-get update command to report the following errors:

Sudo apt-get update

Get: 1 http://archive.ubuntu.com precise Release. gpg

Get: 2 http://ppa.launchpad.net precise Release. gpg

Get: 3 http://archive.ubuntu.com precise Release

Get: 4 http://ppa.launchpad.net precise Release. gpg

Get: 5 http://ppa.launchpad.net precise Release

Ign http://archive.ubuntu.com precise Release

E: GPG error: http://archive.ubuntu.com precise Release: The following signatures were invalid: NODATA 1 NODATA 2

The solution to these two problems is:

1. Disable the Windows network firewall;

2. Add a NIC for the VM. Set the NIC in the Network Address Translation (NAT) mode.

Here are my operations:

 

Note: After the configuration and completion, the virtual machine's network uses DHCP to automatically obtain the IP address. At this time, the IP address is already in the same network segment as the host IP address. At the same time, according to the official instructions of VirtualBox, the control chip automatically selects the Intel PRO/1000 MT desktop. There are multiple control chips to choose from, intel PRO/1000 MT desktop is preferred when the host version is Windows Vista or later.

At this time, after the host closes the firewall, the host and the virtual machine can ping each other,

Virtual Machine ping Host:

 

Host ping VM:

 

 

However, when you execute the apt-get command, the error GPG error will be reported:

 

To solve this error, You need to perform the Second Step. For the Virtual Machine Nic, the NIC is set in the Network Address Translation (NAT) mode.

 

 

Then restart the VM. The network hardware configuration of the virtual machine is as follows:

 

After the VM is restarted, run the ifconfig-a command to view the network device of the VM as follows:

To facilitate subsequent development, we recommend that you set the eth3 static IP address and use the sudo vi/etc/network/interfaces command to edit it as follows:

 

Run the sudo/etc/init. d/networking restart command to reload the network. In this case, the virtual machine is a system that is completely equal to the host and can download software for updates.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.