VirtualBox-Communication configuration between host and virtual machine, virtual machine and virtual machine under virtual machine

Source: Internet
Author: User

Read the article on the Internet written by others: http://www.it165.net/os/html/201401/7063.html

The article uses Debian, I configure the virtual machine system one is Ubuntu 14.10, the other is Red Hat 5.0, virtual machine software is Vitualbox

Follow the steps in that article to complete the Ubuntu configuration, but Red Hat is a bit different.

Briefly summarize, first turn off the virtual machine, and then click Set-Up network, the original will open a NIC with Nat to the virtual machine to the Internet, now open another, choose Host-only, two virtual machines are set up, and then open the virtual machine. With Ifconfig check is not more a net card. In Ubuntu, open/etc/network/interfaces with administrator privileges to modify, append:

1 Auto eth1     2 iface eth1 inet DHCP

Then restart the service (of course, if you feel the trouble can restart the virtual machine →_→ directly):

/etc/init.d/networking restart

Then confirm the configuration of the NIC.

followed by the configuration of Red Hat, Red Hat is a little different from Ubuntu. It puts each NIC's configuration in a single file, not uniformly in a file. These files are located at:

/etc/sysconfig/network-scripts/ifcfg-ethn

where n represents the network card number.

Open Ifcfg-eth1 (if the new network card is eth1) and then do a configuration like Ubuntu and restart the service.

Use Ifconfig to look at the network card configuration of the two virtual machines, this should be th1 the IP address should be different.

Ping, the other side, should be able to ping, ping host IP should also be able to ping the pass.

Here by the way note how to match the static IP (although I do not have a static IP), when doing experiments, if you feel that dynamic trouble can be set to static.

Two virtual machines, A, b

Host and virtual machine communication (one-way, virtual machine guest to host hosts, can Sisu network)
In general, when you install the VBox and mount the guest OS (debian6.0.7), the guest OS is NAT that can be sisu directly to the network, and the IP address is obtained through DHCP. The reference address is described in detail and is also indicated in user manual.
Here we can change to static IP address. Open Guest A
Settings are as follows:
Vi/etc/network/interfaces

  

1 # The Loopback network interface2 Auto Lo3 iface Lo inet loopback4 # The Primary network interface5 Auto Eth06#allow-hotplug eth07 iface eth0 inet static8Address10.0.2.109Netmask255.255.255.0TenGateway10.0.2.2

You can also set guest B, only the address line to 10.0.2.20 (where the IP address can be set to 10.0.2.4-10.0.2.254, 2.2 is the gateway, and 2.3 is DNS).
Restart Network:/etc/init.d/networking restart.

If the original DHCP is used directly here, the IP address of the guest is found to be the same (typically 10.0.2.15). It does not seem to matter, however, because host hosts cannot access the virtual machine. It is also impossible to ping between two virtual machines (even if they appear to be in a network segment, which is related to the principle of NAT). At first I thought I could ping it, so I had to configure the static IP for a while. Configuring this step ensures that the virtual machine has access to the extranet.
Then:
Guest A:
Eth0 10.0.2.10
Guest B:
Eth0 10.0.2.20

  

VirtualBox-Communication configuration between host and virtual machine, virtual machine and virtual machine under virtual machine

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.