Virtualbox Virtual Machine network settings

Source: Internet
Author: User

Recently, VMWare was unable to install it, so it chose virtualbox. Unexpectedly, virtualbox is quite good, free, and small (less than 100 MB of the latest version ).

It took some time to re-install the RedHat Virtual Machine and found that the Network was a problem. It is always greedy and convenient to use bridging. But now the laptop uses wireless Internet access, which is too troublesome to bridge. The biggest problem with bridging is that virtual machines and hosts are isolated when there is no network.

After searching the Internet, the solution is Nat + host only to solve two problems: communication between virtual machines and hosts and connection to the Internet.

Nat accesses the Internet through the host, and host only communicates with the virtual machine.

 

1. Virtual Machine Software sets two NICs, one being Nat and the other being host.

2. Add two NICs in the virtual machine environment. My environment is RedHat monitoring ice 6.4. Add ifcfg-th0 and ifcfg-th1 under/etc/sysconfig/network-srcept.

Here, the virtual machine and the host can ping each other, but the virtual machine still cannot ping the internet. For a long time, I wonder if it is a routing problem. If you have two NICs, You have to select one as the egress. I checked the knowledge of the route table online.

 

[[Email protected] ~] # Route
Kernel IP routing table
Destination gateway genmask flags metric ref use iface
10.0.2.0*255.255.255.0 u 0 0 0 eth0
192.168.56.0*255.255.255.0 u 0 0 0 eth1
Link-local * 255.255.0.0 U 1002 0 0 eth0
Link-local * 255.255.0.0 U 1003 0 0 eth1
Default bogon 0.0.0.0 ug 0 0 0 eth0

 

The preceding figure shows the kernel route table. The default route table is eth0. Eth0 is the NAT Nic, and the problem of connecting to the Internet is solved. (Here is the configuration I changed. The default route table exit is eth1, so it cannot be connected.

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.