Understanding and practice of VirtualBox host-only

Source: Internet
Author: User
Tags virtual environment


1 Conceptual Understanding

Host-only, as the name suggests, provides a network of visits between hosts and virtual machines, rather than the technology of virtual machines accessing the Internet.

In some special network debugging environment, the requirements of the real environment and virtual environment isolation (that is, do not want the extranet environment to access the virtual machine, and do not want the virtual machine to access the extranet environment), then you can use the host-only mode. In host-only mode, all virtual systems can communicate with each other, but virtual systems and real networks are isolated.

Hint: In host-only mode, the virtual system and host machine system can communicate with each other, which is equivalent to the two machines connected by twisted-pair wires.
Personally think that the use of host-only is not to communicate with the external network to ensure security. But is not host-only can not set access to the Internet. The answer is that you can set up access to the Internet.

You can take advantage of the Internet connection share (in fact, a simple route NAT) that comes with Windows to enable the virtual machine to access the virtual system's TCP/IP configuration information (such as IP address gateway address DNS server, etc.) through the real network card of the host. are dynamically allocated by DHCP servers that are VirtualBox host-only virtual networks.


2 VirtualBox Knowledge points add here with VirtualBox install Linux Redflag operating system for demo example. Knowledge Point 1:virtualbox can make up to four network cards for each Linux guest.
Knowledge Point 2: If you install guest, but do not give it a network card. Then the guest does not have the corresponding network card eth0 and so on, so the virtual machine can not communicate with the host or other virtual machines on the host. Knowledge point 3: If you want to give the installed guest to configure the network card, you must first turn off the guest.


3 host-only Intranet mode 3.1 VirtualBox to the client host-onlyConfigure the network card for the virtual machine on the VirtualBox, and the attach point of the network card (there are Nat,bridge adapter,host-only adapter, etc.), where only host-only adapter are selected.
When the configuration is ready, start the corresponding virtual machine. You will find that there will be a corresponding network card eth0 on the virtual machine. If you want to prepare a eth1 again, you need to enable a network card. At this point, you will find a VirtualBox host-only network card added to Windows.
You can also see from the Windows window:
3.2 Test the connection between the virtual machine and the host. Now the virtual machine and the host can ping through. Between the virtual machine and the virtual machine, then we clone or install a virtual machine (I used another Fedora operating system installed), and found that the virtual machine can also ping each other. Note: The IP of the virtual machine and the VirtualBox of the host host-only the configuration of the network card only need to be in the same network segment, then can exchange.
Given that virtual machines can communicate with each other, the virtual machine guest and the network outside of the host. Test by pinging the www.baidu.com. Practice has proved to be unable to ping.
4 host-only External network mode 4.1 Host ConfigurationWindows settings allow the Host-only network card to share the network card on the Windows host: Right---> properties-->sharing-->select the Allow-->choose VirtualBox Host-only Network
After sharing, and then to see the VirtualBox host-only network card, is set to the default IP (192.168.137.1), if you do not want to use the IP, you can modify it, I modified here to 192.168.56.101, compounding as shown:
Note that the IP is in the same network segment as the virtual guest's IP. and the default gateway for guest, to be set to this IP.
Set up a network of local network adapters for automatic acquisition, note: This step does not have to be done. You can skip it, too.
Now the settings on Windows are basically complete, and then the Linux virtual machines are set up.


4.2 is prepared on the VirtualBox. Use your own DHCP service: First deactivate the VirtualBox DHCP service to make the DHCP service more unified.
Stop the DHCP service on the VirtualBox: on VirtualBox: file-->preferences-->network-->host-only networks--> screwdriver--> DHCP server--> Cancel Enable Server

4.3 Configure the network environment on the virtual machine:Adding a default gateway: Route add default GW 192.168.56.101 Note: 192.168.56.101 is the IP address on the HOST-ONLY network card on the Windows host. Compounding DNS servers: vim/etc/resolv.cnf nameserver 150.236.34.180 Note: 150.236.34.180 is consistent with DNS servers on Windows. about how to check DNS: Windows: Ipconfig/all to the extranet, the default gateway and DNS configuration must be correct and necessary.
4.4 Test:Ping www.baidu.com Test results: OK.

















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.