Article Title: configure the VirtualBox virtual network environment. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
This document assumes that the Host system is Ubuntu 7.04 and the Guest system is CentOS 5.0. The configurations of other Linux systems are similar.
First, make sure that the bridge tool (bridge-utils) and the user mode Linux tool (uml-utilities) are installed. If not, run the following command to install the tool:
# Apt-get install bridge-utils uml-utilities
And make sure that normal users can access the virtual Nic device,
# Chmod 0666/dev/net/tun
1. NAT Mode
The VirtualBox software virtualizes the NAT network. The network is invisible to the Host system and cannot be configured. The Guest System sets the DHCP method to obtain the network address to directly access the Host network.
Note that you must ensure that the network is connected before starting the Guest system. Otherwise, the Guest system cannot access the network connected to the Host system, such as the ADSL dial-up Internet access.
2. Routing Mode
First, create a virtual network card for the Host system,
# Tunctl-t vb0-u marchday
The NIC name is vb0, and the authorized user is marchday.
Create a Guest, specify the Host Interface, and specify the Host Interface Name as vb0, that is, the virtual network card we created above. After the Guest system is started, its Nic is equivalent to being connected to vb0. Then we can configure the NIC of the Host and Guest respectively so that they can be connected to each other and allow the Guest system to access the external network.
Note that a virtual network card can only connect to one Guest system at the same time. If you have started several Guest systems at the same time, you need to create a virtual network card for each Guest.
3. Bridging
The bridge works on the second layer of TCP/IP and the data link layer. It can only perceive the MAC address, but cannot perceive the IP address or the above layer. You can think of a bridge as a switch. Generally, there are two ports for data forwarding between the two ports. In Linux, the bridge device can add many interfaces, like a multi-port switch, STP (spanning tree protocol) is also supported ).
In Linux, the MAC address of the bridge interface is the same as that of the first interface.
Here we consider two network topologies.
[1] [2] Next page