Use bridging to realize host interconnection under VirtualBox

Use bridging to realize host interconnection under VirtualBox

 

Smile Huang,

School of Computing, CUG, Wuhan,

Email: smilehuang AT yahoo DOT com.

 

 

1. Introduction to the Five Network Types of VirtualBox

1.1 Unspecified - Not attached

This type is similar to having a network card but no network cable in the virtual machine. Used to tell the virtual machine that the networking aspects within the virtual machine have been reconfigured due to a network disconnect.

1.2 NAT-Network Address Translation

In this type, you can use the virtual machine to download things online, check emails, etc., but this mode will have some limitations in file sharing.

There is no independent IP in the virtual machine, and the virtual machine does not exist in the real network.

The virtual machine can access the host, but the host cannot access the virtual machine.

In VirtualBox, the NAT configuration is used by default.

1.3 Bridged Network Card - Bridged Networking

This configuration makes the virtual machine have its own independent IP, just like other computers in the same local area network. The popular understanding is to use such a configuration. The virtual machine and the host machine are similar to two machines on the same network segment. .

1.4 Internal Network-Internal Networking

Similar to bridged NICs, but virtual machines in this configuration can only be accessed by other virtual machines belonging to the same host.

1.5 Host-Only Adapter - Host-Only Networking

It is used to create a network without the physical network card of the host. In this network, there is only the host of the host and some virtual machines under it. It can be understood as the result of a mixture of bridged network cards and internal networks.

Different virtual machines and hosts can communicate with each other just like a physical network card switch Switch is connected in the middle. However, in fact, the physical network interface does not exist, so the virtual machine cannot communicate and communicate with the external network.

 

2. Use bridge configuration to achieve host interconnection

First, the host is connected to a wireless network, and its IP address related information is shown in Figure 1:

figure 1

Next, we first use the ifconfig command in VirtualBox to view the relevant configuration of the following current network card, as shown in Figure 2:

figure 2

Now let's start configuring the bridge.

First of all, we select the bridge mode in [Device]->[Network]->[Change Network Settings] to select a network card for it. Since I am a wireless network card, I choose a wireless network card, as shown in Figure 3:

image 3

Open the network connection in interface mode, as shown in Figure 4. After opening, you can see the result shown in Figure 5. The Bridge in Figure 4 is added later by me, and I will explain it to you here .

Figure 4

Figure 5

Then you click [Wired] -> [Add] to see the interface shown in Figure 6:

Image 6

We give the link a name, and select [Add] in the address column to add an IP address, subnet mask and gateway. When adding, pay attention to the same network segment as the host, and combine the relevant network of the host in Figure 1. Information, the information I configured is as follows:

IP address: 192.168.1.120

Subnet mask: 255.255.255.0

Gateway: 192.168.1.1

Then click [Save].

 

Then we select the Bridge connection method according to the interface shown in Figure 7:

Figure 7

After selecting, you can see the result shown in Figure 8:

 

Figure 8

Then we use the ifconfig command to view the network card information under the VirtualBox system terminal. We can see that the configuration we just made has taken effect, as shown in Figure 9; then ping the host's IP 192.168.1.119, and get the result shown in Figure 10:

Figure 9

Figure 10

Next, we ping the IP 192.168.1.120 under VirtualBox under the windows host, and the result is shown in Figure 11:

Figure 11

 

It can be seen from the above results that we use the bridge mode to realize the interconnection of the host. This also lays the foundation for us to configure the Hadoop cluster later.

 

Thanks.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325896384&siteId=291194637