Setting up a network of virtualbox core modes. Setting up a network on the Oracle VM VirtualBox virtualization platform

This article is devoted to the VirtualBox virtualization platform, and more specifically, to setting up its network part, i.e. ensuring full network interaction between the virtual machine and the host system. Installation story and basic setting VirtualBox you will find in this article.

Basically, we will consider the use of Virtual Host-Only Ethernet Adapter, the use of which allows you to provide full interaction of machines among themselves and exit of both to the outside world, although a description of the setting will be given for each type of network interface.

Configuring the Host Part of VirtualBox

The host system in this case is the operating system. Windows Vista Home Premium SP2, but as a guest Windows XP Pro SP3. As in the previous article, the VirualBox platform version 3.2.8 r64453 (download) will be considered.

So, first of all, let's decide on the actual connection of the host machine to the Internet, and the most important and necessary property is the type of IP address - static or dynamic.

In the VirtualBox application settings, through the "File" menu, open the "Network" tab and perform the following actions.

First, set the IPv4 address and IPv4 subnet mask (Fig. 1).

Fig.1: adapter parameters.

The IPv4 address and IPv4 subnet mask specified here are selected based on the following factors:

  • my computer to connect to global network uses one of two network adapters, where the first adapter has a static IPv4 address 10.184.1.10, and the second one 192.168.0.121, also static;
  • The IPv4 address entered here must be in the address range of the real adapters;
  • The ipv4 subnet mask must match the mask used by the real adapter (at least one of the two).

Then we turn on the DHCP server (regardless of whether the IP address of your real network adapter is static or dynamic), Fig.2.

Figure 2: DHCP server parameters.

The server address must also be in the address range of the real adapters, the IPv4 subnet mask must match the mask used by the real adapter (at least one of the two), the upper and lower address bounds must capture all addresses used in the system.

VM network settings

In the Settings settings of the installed virtual machine, open the Network tab and perform the following actions:

  1. Turn on the Host-only adapter;
  2. Turn on the NAT adapter;
  3. We turn on the Bridge Adapter and select your real Internet interface for it, but since we are talking about setting it up specifically for the Virtual Host-Only Ethernet Adapter, then it doesn’t matter what is selected there;
  4. Turn on the Internal Network adapter;
  5. For each adapter, select the type of network card PCnet-Fast III (Am79C973), because the Windows XP operating system installed in the guest only supports this adapter;
  6. In the settings of each adapter, we set a flag to connect the cable.

Now I will briefly explain for each adapter:

  • NAT- the simplest way provide the guest OS with access to the Internet, in this mode, packets are simply redirected (transactions);
  • Bridge Adapter- network adapter the virtual machine gets the same access to the network as the network adapter of the host machine, but there is no access to the outside world;
  • Internal Network - an internal network for connecting virtual machines into a local network, without going outside and to the host machine;
  • Host-only adapter - Your virtual machine is like a living one, it has access to the Internet, is located in one local network with the real one and has access to it.

Configuring Network Bridge and Internet Gateway

Now open the "Network Connections" folder, using the "Ctrl" key, select real connection to the Internet and the VirtualBox Host-Only Network created by the VirtualBox program, and through the context menu of the right mouse button, select the "Network Bridge" item. After that, we agree with the message that this adapter (network bridge) has been assigned a gateway address of 192.168.0.1.

Note. If you decide to limit yourself to the NAT or Bridge network interface, then you do not need a network bridge and you can skip this part of the settings.

The Network Connections folder should have the following picture:

Figure 3: "Network Connections"

But that's not all, we open the "Network Map" and see the following there:

Fig.4: "Network map"

And now the most unpleasant thing is that we lost our connection to the Internet. In order to put things in order, you need to configure the network bridge, Fig. 5:

Figure 5: Network bridge setup

For the IPv4 address, we use any address from the previously set address range in the VirtualBox DHCP server, take the same subnet mask, the gateway is already set, and the DNS server address set the same as the gateway address. Apply the settings by pressing the OK button.

Note. If your real network adapter uses a dynamic IPv4 address, then in the settings of the network bridge, as well as for all network interfaces of the virtual machine (their settings will be given below), select the item "Obtain an IP address automatically", but if there is no Internet connection You should make the settings specified for the static IP address.

Open the “Network Map” again and now we see the following there, Fig. 6:

Fig.6: "Network map" after configuring the network bridge

Note. It is possible that the switch element will not be displayed in your "Network Map", but this is not important, but the important thing is that our Internet connection is active again!

Configuring virtual machine network connections

Now it's time to deal with the settings of the virtual machine, for which we launch it and go to the "Network Connections" folder, Fig. 7.

Fig. 7: "Network connections" of the virtual machine

All created connections are in place - let's configure each of them by clicking right click mouse on the interface and in context menu select the "Properties" item:

Figure 10: Bridge Ethernet Adapter

Note. Please note that all IPv4 addresses used are taken from the previously set address range in the VirtualBox DHCP server, using the range from the gateway address (192.168.0.1) to the upper address limit. In no case do not expose addresses that are not included in the specified area. For example, a virtual machine adapter with an IP address of 192.167.0.111 set to it will not allow you to connect to the custom network. The subnet mask, gateway, and DNS server addresses correspond to the addresses set for the network bridge for the host machine.

After you have performed all the specified operations, the notification “The Internet is now connected” will appear in the system tray, but we will check this at the very end.

Setting up workgroups

After the operations we performed, we first reboot the virtual machine, and then the host machine. After our real operating system has loaded, we launch VirtualBox and turn on our virtual machine and on the host machine (Windows Vista) open the "Network Map":

Fig.11: "Network map" after virtual machine settings

Here we see a host machine (HPPavilion-PC) and a virtual machine (Virtual-PC) connected via two adapters (Bridge Ethernet Adapter and Virtual Host-Only Ethernet Adapter). For greater clarity, brief comments are given on the image.

Most importantly - we see our both machines, the same can be determined by running a session command line on both machines and run the command net view. The image below (Fig. 12) shows the results of this command - on the right for Windows Vista, on the left for Windows XP.

Figure 12: Result of executing the net view command

Now let's define workgroups - there is often a requirement on the Internet that both machines must be in the same workgroup, but this is not the case. In our case, the working groups are different, because by default, Windows XP is included in Workgroup, and Windows Vista is included in MShome.

To see what this means, let's go to the Network Places folder on our virtual machine. In this location, we see two workgroups - Workgroup and MShome:

Fig.13: Different working groups

Let's open the MShome workgroup and see our host machine (HPPavilion-PC).

Figure 14: MShome workgroup and host machine (HPPavilion-PC).

Let's go back a step and open the Workgroup, in it we will see our virtual machine (Virtual-PC).

Figure 15: Workgroup and virtual machine (Virtual-PC).

Despite the fact that everything works, we will transfer Virtual-PC, i.e. our virtual machine to the same workgroup as the host machine (HPPavilion-PC). To do this, open the properties of My Computer, go to the "Computer Name" tab and click the "Change" button. In the window that opens, in the "Workgroup" field, enter the name working group, which contains a real machine (in our case, MShome), to see the result, go to the "Network Places" folder of both machines and make sure that both stations are in the same workgroup.

Let's see what we got first on our Windows XP virtual machine:

Figure 16: Shared workgroup on a virtual machine

And now on the Windows Vista host machine:

Figure 17: Shared workgroup on the host machine

Completing the setup

Of course, there is no point in using all four adapters in a virtual machine, so we leave only one, but the most necessary one - Virtual Host-Only Ethernet Adapter. To do this, on our virtual machine, open the "Network Connections" folder and disable the interfaces we do not need. Additionally, check whether the settings of the specified adapter have been saved by running the command ipconfig in the command line window. The image below shows a view of the Network Connections folder, in which we must definitely see all our four adapters and the Internet Gateway, which must be connected.

Figure 18: Final network interface configuration.

In order to make sure that the Internet connection is really active, open the command prompt window again and run the command ping for host ya.ru , the output of the command should look like this:

Figure 19: Output of the ping command

Thus, everything works, interacts, is on the same network, and both machines have access to the global network.

Note. If, when starting your host machine or virtual machine, you find that there is no Internet connection on one or both of them, you should check the settings of your network bridge, as a rule, the problem is that the address of the main gateway is missing and is solved by entering it (198.162 .0.1).

Simplifying the verification function

In order not to open "Network Connections", "Network Places" or "Network Map" every time, you can use a simple Windows Script Host script written in Vbscript (download).

When you run the script, you will see a message containing the name of your workgroup and the list of machines in it:

Fig.20: List of workstations

Conclusion

Finally, I would like to note that the Oracle VM VirtualBox virtualization platform is very easy to use (if only because it has a completely Russian interface), intuitive, and consumes PC resources very modestly. This program is a very flexible and functional tool for conducting experiments both within the local machine and network interaction between remote workstations with different operating systems installed on them. It should also be noted that virtual machines built on this platform can be used as RDP servers (remote desktop servers), which makes it absolutely safe to allow remote monitor connections, for example, for open interactive broadcasts.

Viewed: 242300

4

Configuring the VirtualBox Host Part:
In this case, the Windows 7 operating system acts as a host system, and as a guest system Windows Server 2008R2. As in the previous article, the VirtualBox-4.1.14 platform will be considered.

In the VirtualBox application settings, through the "File" menu, open the "properties", "Network" tab, and perform the following actions:

First, set the IPv4 address and IPv4 subnet mask:

Then we enable the DHCP server (regardless of whether the IP address of your real network adapter is static or dynamic):

The server address must be in the address range of the real adapters, the IPv4 subnet mask must match the mask used by the real adapter, and the upper and lower address bounds must capture all addresses used in the system.

In the column "Type of connection", in the drop-down menu, you need to select the required connection.

For each network interface it is possible to specify in which of the following modes they will function:

Not connected

In this mode, VirtualBox tells the guest that the network adapter is present, but not connected -- as if the Ethernet cable were not connected to the card. In this way, it is possible to simulate "pulling" the cable from the virtual network card and breaking the connection, which can be useful for informing the guest OS about the absence network connection, but the possibility of its customization.

Network Address Translation (NAT)

NAT - the simplest way to provide a guest OS with Internet access, with this mode, packets are simply redirected (transactions)

If you need to browse the Web, download files and use by e-mail in the guest system, then this network configuration the default is fine for you and you can skip reading this section.

network bridge

This mode is needed for more advanced networking features, such as modeling networks and running servers in the guest. When enabled, VirtualBox connects to one of the installed network cards and works directly with network packages without using the networking stack of the host OS.

Internal network

This mode can be used to create virtual network which is accessible from the virtual machine, but not to applications running on the host or other external network devices.

Virtual host adapter

This mode can be used to create networks from a host and several virtual machines, without using the host's physical network interface. A virtual network interface (similar to a loopback interface) is created on the host to provide connections between the host system and virtual machines.

Universal driver

Rarely used modes share the same generic network interface, allows the user to select a driver that may be included with VirtualBox or shipped with an extension pack.

Two subtypes are currently available:

UDP tunnel

Can be used to easily and transparently connect virtual machines running on different hosts through existing network infrastructure.
VDE (Virtual Distributed Ethernet) network

Allows the use of Virtual Distributed Ethernet switch on a Linux or FreeBSD host. IN this moment, you need to build VirtualBox from source to use it. it is not included in the Oracle distribution.

Since a static ip is required for the normal functioning of Windows Server, we can choose "network bridge" or "virtual host adapter".
Consider "network bridge":

After we have selected the type of connection: Network bridge, in the "name" column, we can select the required connection.
Since my Internet is distributed through the miniport adapter virtual wifi, I chose it.

Select: Internet protocol version 4 (TCP / IPv4) and click properties:

Here we set the IP address mask and gateway.
Since my real adapter has an IP address of 192.168.137.1 , I assign that address as the gateway and I assign the IP address 192.168.137.2.
Next OK, close.
In order to make sure that the Internet connection is really active, open the command prompt window again and execute the ping command for the host

For each network interface, you can select the hardware that will be connected to the virtual machine. VirtualBox can emulate the following network hardware:

AMD PCNet PCI II (Am79C970A);

AMD PCNet FAST III ( Am79C973, default);

Intel PRO/1000 MT Desktop (82540EM);

Intel PRO/1000T Server (82543GC);

Intel PRO/1000 MT Server (82545EM);

Paravirtualized network adapter (virtio-net).

The PCNet FAST III network card is installed by default. it is supported by almost all operating systems, as well as the GNU GRUB boot manager.

And indeed, this card in NAT mode installed well and without problems in Windows 98:


PCNet FAST III network cardin NAT mode, it is also installed well and without problems in Windows XP:



1.Network Address Translation (NAT)

Network Address Translation (NAT) mode provides the easiest way to access the external environment from a virtual machine. It usually does not require any host or guest configuration. Therefore he is network mode, configured by default.

A virtual machine with a network interface in NAT mode connects to the network just like a real computer connects to the Internet through a router. The "router" in this case is the VirtualBox network module, which processes the network traffic of the virtual machine. The disadvantage of the NAT mode, as in the case of a local network behind a router, is that the virtual machine is not accessible to the external network (internet); you cannot process network requests until you set up port forwarding.

The virtual machine receives network address and its other settings on the local network from the DHCP server built into VirtualBox. Thus, the IP address assigned to the virtual machine is different from the network address of the host network. It is possible to configure the use of several network cards in a virtual machine in NAT mode, then the first card will belong to the local network 10.0.2.0, the second 10.0.3.0, etc.

In NAT mode, the guest's network interface is assigned by default an IPv4 address on the network 10.0.x.0/24 , where x is the virtual machine's interface serial number plus 2. That is, x is 2 if there is only one active NAT interface. In this case, the guest is assigned an address 10.0.2.15 , the gateway address is set to 10.0.2.2 , and the name server (dns) 10.0.2.3 .

Indeed, practice has confirmed that with the NAT mode in VirtualBox, the network in virtual Windows machines XP and Windows 98 are self-configuring without any difficulties. It is enough to set the NAT mode when installing the system into the VirtualBox virtual machine and the network will be established. Also, the network is installed without problems if the card is connected after the installation of the operating system.

2. Execution of the ipconfig /all command for the NAT mode of virtual machines.

Windows 98 has the following network settings:




Not so long ago we wrote about a wonderful program for virtualization - VirtualBox. Since at that time we were not even going to connect the virtual machine to the Internet, we omitted this question until better times. And finally, the miracle happened. We bring to your attention one of the options for setting up the Internet in VirtualBox using the example of a real computer network.

(mosload position debug)

As an example, we took VirtualBox version 2.1.0 with a stable network. Our VirtualBox is installed on the operating Windows system Vista, and we installed Windows XP SP2 on the virtual machine created in VirtualBox.
The Windows Vista computer is connected to the Internet through a gateway that has the address 192.168.0.100. This gateway distributes the Internet to all computers on the local network via wi-fi. Gateway and wi-fi settings are not related to the topic, so we will not dwell on them, but will go straight to the point.
First of all, let's check on our real computer the properties of the real network connection through which it interacts with the Internet. So, in Windows Vista, open "Start" - "Control Panel" - "Network and Control Center" public access» - «Manage network connections».
Right-click on the name of the network connection through which the PC is connected to the Internet or local network, and select Properties. On the "Network" tab, the "VirtualBox Host Interface Networking Driver" item must be enabled. If the checkbox is not checked, check it and click OK.

Now let's deal with firewalls - we need to allow them to release VirtualBox to the network. In the built-in Windows firewall ("Start" - "Control Panel" - " Windows Firewall") VirtualBox should be added to the exclusion list. If another firewall is installed on the computer, for example, Agnitum Outpost, turn it on in the learning mode, because. later we will have to allow VirtualBox to connect to the network and create the appropriate rules. It would be better if the firewall asks us about it, rather than silently blocking all attempts by VirtualBox to go online.
On this we leave the real operating system alone and turn our eyes to VirtualBox. We need to add a network adapter to the virtual machine and configure it: by selecting the virtual machine in the VirtualBox list, click the "Properties" button.

In the list on the left, select the "Network" section. On the "Adapter 1" tab, check the box next to "Enable network adapter". You can choose the type of adapter, as in the screenshot, but you can also experiment by choosing different adapters from the list.
In the "Attached to:" list, select "Host interface". This means that the network card of the virtual operating system will interact directly with the Internet and the local network.
We want to say right away that you can choose other settings, but by the method of a scientific experiment, we managed to make the Internet work only in this way. And all because the virtual network settings are closely related to the configuration of your Internet connection and your real computer network. In every specific case will have to experiment. But most of all, by applying the options indicated in the screenshot, we were able to get the Internet working in VirtualBox.
Do not forget to check the box next to "Cable connected", and in the list of host interfaces below, select the one network card our real computer through which it is connected to the Internet or local network.
This completes adding the network adapter to the virtual machine. Click "OK" to apply the settings.

We launch the operating system created in VirtualBox (we have Windows XP SP2). Now we have to configure the previously added network adapter. In Windows XP, these settings are available through "Start" - "Settings" - "Control Panel" - "Network Connections".
In the list of network connections, find "Local Area Connection", right-click on it and select "Properties".

On the "General" tab, in the list of components used by the connection, select "Internet Protocol (TCP / IP)" and click the "Properties" button.

The settings below are entirely dependent on your network configuration. As we have already said, we have a gateway with the address 192.168.0.100, which distributes the Internet to the entire local network. Therefore, our virtual computer must fit into the configuration of a real network and have the address 192.168.0.X, where X is any number from 1 to 254 that is not found in any other address of computers on the network. Since we already have a computer with the address 192.168.0.100, we can choose any number from 1 to 254, except 100.
In our example, the choice fell on the address 192.168.0.77. The subnet mask is entered automatically, just click in this field with the mouse. In the "Main gateway" field, enter the address of the computer that distributes the Internet or the provider's gateway. In the Preferred DNS Server field, enter the address of the appropriate server. It may or may not be the same as the gateway address. If your network has another (alternate, secondary) DNS server, enter its address in the field below.

This completes the network connection setup in the virtual operating system completed. Click "OK".
Now you need to check the connection with the gateway. Open "Start" - "Run" and enter the command "cmd" in the field (without quotes and in English).

The Windows command interpreter will open. We type "ping 192.168.0.100" (without quotes), where 192.168.0.100 is the address of the gateway or other computer on the network with which you want to ping from the virtual machine. If you see that the response from the gateway is received, then the Internet is working. Now you can enjoy surfing the world wide web directly from VirtualBox.

If there is no response from the gateway or any other computer on the network, you should change the settings to those more suitable for your network. Here everything is in your hands.

05/23/2017 Romchik

Good day. In one of the articles, we installed Ubuntu as a guest system and gave it access to the Internet. We didn't have any problems. But I would like to have access to the guest from the host Ubuntu system, while keeping our Ubuntu behind NAT. There are several options for implementing this task. And I will look at one - creating another network interface. The second option, I will not consider port forwarding, because. he didn't fit me. Let's get started.

We need to add another virtual adapter (one already exists and is used to access the Internet of guest OSes)

To do this, open the VirtualBox settings

You can also set up and DHCP server.

Click "OK". Now let's move on to setting up the virtual machine.

Setting up a network in a virtual machine.

Open the settings of our virtual machine.

Select "Network" and go to the "Adapter 2" tab

Turn on the network adapter. Then select the connection type "Virtual adapter" and select a name from the list. Click "OK"

This completes the configuration of the virtual machine. We start the car.

Ubuntu guest setup

Open a terminal and enter the ifconfig command.

And so, the enp0s3 interface is used to access the Internet, and enp0s8 is used to connect the guest system to the host. Ok, let's write enp0s8 a static IP. For example, 10.0.1.10.

Open sudo gedit /etc/network/interfaces

And add:

Auto enp0s8 iface enp0s8 inet static address 10.0.1.10 netmask 255.255.255.0

Save and restart the network with the command:

sudo /etc/init.d/networking restart

We are waiting and checking, we will start ping on 8.8.8.8

Everything works great. Now let's check the access from the host to the guest system. We start ping on 10.0.1.10

That's all.

Conclusion.

We have configured access to the guest system from the host, while there is access from the guest system to the Internet (via NAT)

In order not to miss the release of new articles, we subscribe.



Loading...
Top