CentOS Network configuration in VirtualBox

Source: Internet
Author: User

Do not understand, the first collection .....



Reference URL: http://www.virtualbox.org/manual/ch06.html

VirtualBox graphical interface with four kinds of network access mode, each of them is:

1. NAT Network Address Translation mode (Nat,network addressing translation)
2, bridged Adapter bridge mode
3. Internal Internal network mode

4. Host-only Adapter Host Mode

In the commandline, there are eight ways, in addition to the four listed above, there are the following four kinds:

1.UDP Tunnel Networking

2.VDE Networking

3.Limiting Bandwidth for network I/O

4.Improving Network Performance


Virturalbox provides eight virtual PCI NICs for each virtual machine, and for each virtual network card, you can choose from one of the following six network hardware:

  • AMD pcnet PCI II (am79c970a)

  • AMD pcnet FAST III (am79c973, the default)

  • Intel pro/1000 MT Desktop (82540EM) (Windows Vista and later versions)

  • Intel pro/1000 T Server (82543GC) (Windows XP)

  • Intel pro/1000 MT Server (82545EM) (OVF imports from other platforms)

  • Paravirtualized network adapter (virtio-net)


Features:

1. Nat mode is the simplest way to implement virtual machine access, you can understand: Vhost access to the network all the data is provided by the host, Vhost is not real in the network, the host and any machine in the network can not view and access to the existence of vhost.
virtual machine vs. host Relationship: Only one-way access, virtual machines can be accessed over the network to the host, the host cannot access the virtual machine over the network.
the relationship between the virtual machine and other hosts in the network: one-way access only, virtual machines can access other hosts on the network, other hosts cannot access the virtual machine over the network.
the relationship between the virtual machine and the virtual machine: it is inaccessible to each other, the virtual machine and the virtual machine are completely independent and cannot access each other through the network.
ip:10.0.2.15
Gateway: 10.0.2.2
dns:10.0.2.3

2. Bridged adapter mode It is through the host network card, erected a bridge, directly connected to the network. As a result, it allows the virtual machine to be assigned to a network of independent IPs, all of which function exactly like real machines in the network.

virtual machine and host relationship: can access each other, because the virtual machine in the real network segment has a separate IP, the host and the virtual machine in the same network segment, each other through the respective IP access to each other.
virtual machines in the network other host relationships: to mutual access, also because the virtual machine in the real network segment has a separate IP, the virtual machine and all network other hosts in the same network segment, each other through the respective IP access to each other.
virtual machines in virtual machine relationships: You can access each other for the same reason.

feature: An IP in an exclusive network

Note This method is not available if the host is directly connected by dial-up, not routed.

3. The internal mode is the internal network mode as its name implies, the virtual machine is completely disconnected from the external network, and the virtual machine is only implemented in the internal network mode between virtual machines.

virtual machine vs. host relationships: They cannot access each other, are not part of the same network, and cannot access each other.
virtual machines and other host relationships on the network: cannot access each other for the same reason.
virtual machines and virtual machine relationships: You can access each other, provided the network is set up with the same network name as the two virtual machines. As in the configuration diagram above, the name is intnet.

4. Host-only Adapter Mode

host mode, this is a more complex mode, need to have a relatively solid network of basic knowledge to play around. Can be described in the previous several modes of implementation of the function, in this mode, through the virtual machine and network card settings can be implemented.
we can understand that vbox in the host to simulate a dedicated virtual machine to use the network card, all virtual machines are connected to the network card, we can set up this network card to achieve the Internet and many other functions, such as (network card sharing, network card bridging, etc.).
virtual machine and host relationship: The default cannot access each other, the two sides do not belong to the same IP segment, the HOST-ONLY network card default IP field is 192.168.56.X subnet mask is 255.255.255.0, the subsequent virtual machines are assigned to this network segment. Through network card sharing, network card bridging, etc., virtual machines can be accessed by the host.
Virtual machine and network host relationship: The default is not accessible to each other, the same reason, through the settings, you can achieve mutual access.
virtual machine vs. virtual machine Relationship: The default is to access each other, all in one network segment.
Virtual Machine Access host is the host of the VirtualBox host-only Network network card ip:192.168.56.1, regardless of the host "local connection" there is no red fork, always pass.
host access to the virtual machine, with the virtual machine's network card 3 ip:192.168.56.101, regardless of the host "local connection" there is no red fork, always pass.
virtual machine access to the Internet, with its own network card 2, then the host to be able to through the "local connection" wired Internet, (wireless card not)

==================================

The following configuration of the CentOS virtual machine can be Sisu network, and the host and the CentOS virtual machine can also be connected.

the best way is to use two network cards, NAT (virtual machine access to the Internet, using 10.0.2.x) and host-only (virtual machines and hosts to communicate with each other, using 192.168.56.x segments), and the VirtualBox configuration of the network is: Open the host interface, Press CTRL+G, and then network, you can enable vboxnet0.

Open the configuration of the virtual machine and add a second NIC to the networking inside the host-only.

Next, install CentOS in the VirtualBox.

Ping Baidu, does not pass, need in/etc/sysconfig/network-scripts/ifcfg-eth0 will onboot= "no" to Yes, and then add bootproto= "DHCP", save, exit, restart. Ping Baidu again, pass the. At this point you can use the command route to look at, record the route, if there is no Internet access, and then use the route to see what is abnormal

then ping the host on the virtual network card 192.168.56.1, found that there is no problem, is through, but the host can not access the virtual machine, this headache, this time will use our second NIC host-only to complete the host to the virtual machine access. The operation is as follows:

under/etc/sysconfig/network-scripts/See there is no ifcfg-eth1 file, if not, will ifcfg-eth0 copy one, renamed to Ifcfg-eth1, and then change the Onboot value to Yes, Here I set the static IP, configured as follows:

bootproto=static #获取IP的方式是dhcp或bootp自动获取, Static is fixed Ip,none is manual
ipaddr=192.168.56.2
netmask=255.255.255.0

Note The gateway cannot be set because:
Linux dual NIC default routing Problem
after the installation of the second NIC network problems, the use of route discovery is the default route problems, after many checks, only know that the original Linux load network card configuration file is loaded eth0, and then load eht1, so, if eth1 set the gateway item, Will overwrite the gateway settings in the eth0, so the workaround is to remove the Eth1 gateway settings


CentOS Network configuration in VirtualBox

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.