Menu
Is free
registration
the main  /  Internet/ Network bridge virtual machine. Wmware workstation configuring networking in virtual machines

A network bridge is a virtual machine. Wmware workstation configuring networking in virtual machines

Viewed: 242300

4

Setting up the Host-part of VirtualBox:
In this case, the operating system is Windows 7, and the guest is Windows Server 2008 R2. As in the previous article, the VirtualBox-4.1.14 platform will be considered.

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

First, we set the IPv4 address and IPv4 subnet mask:

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

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

In the "Connection type" column, 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 informs the guest that there is a network adapter, but it is not connected - as if the Ethernet cable were not connected to the card. Thus, it is possible to simulate "pulling" the cable from the virtual network card and disconnection, which can be useful for informing the guest OS about the absence of a network connection, but the possibility of setting it up.

Network Address Translation (NAT)

NAT is the simplest way to provide the guest OS with Internet access; in this mode, simply redirecting (transactions) packets

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

Network bridge

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

Internal network

This mode can be used to create a virtual network that is accessible from the virtual machine, but not for 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 multiple virtual machines, without using the host's physical network interface. A virtual network interface (like 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 choose a driver that can be included in VirtualBox or come with an extension pack.

There are currently two subtypes available:

UDP tunnel

Can be used for simple and transparent direct connection of virtual machines running on different hosts through the existing network infrastructure.
VDE (Virtual Distributed Ethernet) network

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

Since Windows Server requires a static ip to function properly, we can choose between "network bridge" or "virtual host adapter".
Consider a "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 virtual Wi-Fi mini-port adapter, I chose it.

We select: Internet Protocol version 4 (ТСР / 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 this address by the gateway and the IP address is 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

VirtualBox allows virtual machines to use the host system's network connections as well as create virtual networks for virtual machines.

Using GUI tools, up to 4 network adapters can be configured for each of the virtual machines registered in VirtualBox.

The procedure for configuring network interfaces is well described in the proprietary Oracle VM VirtualBox® user manual in English.

Up to 4 network adapters can be emulated for each virtual machine. Each of the network adapters can operate in one of 6 modes:

  • Not connected... In this mode, the adapter is present in the guest system, but behaves as if the network cable is not plugged into it.
  • NAT... In this mode, the adapter uses the network settings of the main system when interacting with the network of the physical host and other external networks. The VirtualBox networking subsystem translates IP traffic from the source IP address of the virtual machine to traffic from the source address of the host system's network adapter (Network Address Translation). The NAT implementation in VirtualBox has certain limitations related to its support for ICMP, UDP broadcast traffic, and VPN technologies. This mode is used by default.
  • Network bridge... In this mode, the VM network adapter connects to the host system's network adapter and processes network packets directly bypassing the host system's network stack (the host system adapter works with the VM adapter in bridge mode).
  • Internal network... Network adapters of virtual machines are combined to form an isolated network segment.
  • Virtual host adapter... A network that connects the host system and virtual machines included in this segment in this segment. For this mode, VirtualBox creates a programmatic network interface on the host system and sets an IP address on it.
  • Universal driver... The user chooses the driver for the network adapter, which can be included with VirtualBox or loaded with the VirtualBox add-on package. At the moment, there are 2 drivers that implement 2 modes of operation of the virtual adapter:
    • UDP Tunnel... Mode for linking virtual machines running on different hosts. Works on existing network infrastructure.
    • VDE(Virtual Distributed Ethernet). This mode can be used to connect distributed virtual machines to a Virtual Ethernet Switch on Linux or FreeBSD hosts.

For each of the 4 network adapters of a virtual machine, you can choose one of 5 drivers that emulate real network adapters from different hardware manufacturers or the Virtio-net driver, which is part of an open-source KVM project. The Virtio-net driver avoids the complexity of emulating network hardware and improves network performance. Linux kernel version 2.6.25 and later can support Virtio-net adapter. For Windows 2000, XP and Vista guests, the Virtio-net driver can be

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. You will find a description of the installation and basic configuration of VirtualBox in this article.

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

Configuring the VirtualBox Host Part

In this case, the operating system is Windows Vista Home Premium SP2, and the guest is 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 determine the real 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 settings of the VirtualBox application, through the "File" menu, open the "Network" tab and proceed as follows.

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

Fig. 1: adapter parameters.

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

  • my computer uses one of the two network adapters to connect to the WAN, where the first adapter has a static IPv4 address of 10.184.1.10, and the second one is 192.168.0.121, also static;
  • the IPv4 address entered here must be in the range of 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 it is a static or dynamic IP address of your real network adapter), Fig. 2.

Fig. 2: DHCP server parameters.

The server address must also be in the range of addresses of 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 boundaries must capture all addresses used in the system.

Virtual machine network settings

In the Settings of the installed virtual machine, open the Network tab and do the following:

  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. we are talking about configuring specifically for the Virtual Host-Only Ethernet Adapter, it doesn't matter what is selected there yet;
  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 by the guest only supports this adapter;
  6. In the settings of each adapter, we put a flag on the connection of the cable.

Now I will briefly explain for each adapter:

  • NAT is the simplest way to provide the guest OS with Internet access; in this mode, packets are simply redirected (transactions);
  • Bridge Adapter - the network adapter of 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 combining virtual machines into a local network, without outside and to the host machine;
  • Host-only adapter - your virtual machine is like a living one, it has access to the Internet, is in the same local network with the real one and has access to it.

Configuring a Network Bridge and Internet Gateway

Now open the "Network Connections" folder, use the "Ctrl" key to select the 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) is assigned the gateway address 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 following picture should be in the "Network Connections" folder:

Fig. 3: "Network connections"

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

Fig. 4: "Network map"

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

Fig. 5: Configuring a network bridge

For the IPv4 address, we use any address from the previously set range of addresses in the VirtualBox DHCP server, we take the same subnet mask, the gateway has already been set, and the DNS server address set the same as the gateway address... Apply the settings by clicking 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), you should select the "Obtain an IP address automatically" item, 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 item will not be displayed in the "Network Map", but this is not important, but it is important that our Internet connection is active again!

Configuring virtual machine network connections

Now it's time to start configuring 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 right-clicking on the interface and selecting Properties from the context menu:

Figure 10: Bridge Ethernet Adapter

Note... Please note that all used IPv4 addresses 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 for it will not allow you to connect to the configured 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 have performed, we first reboot the virtual machine, and then the host machine. After our real operating system has booted, we launch VirtualBox and turn on our virtual machine and open the Network Map on the host machine (Windows Vista):

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

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 clarity, the image contains brief comments.

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

Fig. 12: Result of the net view command

Now let's decide on the working groups - on the Internet there is often a certain requirement according to which both machines must be in the same working group, 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 Neighborhood folder on our virtual machine. At this location, we see two workgroups - Workgroup and MShome:

Figure 13: Different working groups

Let's open the MShome working group 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 which 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 of the workgroup that contains the real machine (in our case, MShome). To see the result, go to the "Network Neighborhood" 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:

Fig. 16: Shared workgroup in a virtual machine

And now on a Windows Vista host machine:

Fig. 17: Common 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 needed 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, let's check if the settings of the specified adapter have been saved by running the command ipconfig in the command prompt window. The image below shows a view of the "Network Connections" folder, in which we must see all our four adapters and the Internet Gateway, which must be in a connected state.

Figure 18: Final configuration of the network interface.

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

Figure 19: Output of the ping command

Thus, everything works, communicates, 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 one or both of them are not connected to the Internet, you should check the settings of your network bridge, as a rule, the problem is that the address of the default gateway is missing and is solved by entering it (198.162 .0.1).

Simplifying the check function

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

When you run the script, you will see a message containing the name of your workgroup and a list of machines located 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), it is intuitive, and very modestly consumes PC resources. This program is a very flexible and functional tool for conducting experiments, both within the local machine, and network interaction between remote workstations with various operating systems installed on them. It should also be noted the possibility of using virtual machines built on this platform as RDP servers (remote desktop servers), which allows you to completely safely allow remote monitor connections, for example, for open interactive broadcasts.

Setting up a local network between a computer and a virtualbox virtual machine is quite easy, you just need to know some of the nuances, which I will discuss in this article.

The first step is to set up networking in virtualbox. The virtual machine must be turned off. Go to "Settings -> Network", select an unused adapter, enable it and select the connection type - "virtual host adapter":

In windows, the network can be checked with the "ipconfig" command:

On Linux OS from the terminal, the network can be checked as follows:

Ifconfig

In response, you should see working network interfaces:

By ip, you can guess which interface is responsible for organizing the local network between the computer and the virtual machine, by default (if you did not configure ip in virtualbox yourself) such ip should look like this: 192.168.56. * (Instead of * it is usually 101 or 102 and etc.).

This ip must be used to access the virtual machine.

By default ip is issued by dhcp virtualbox server. For convenience, you can set a static ip address in the virtual machine itself. For example, in windows, this is done by editing the properties of the network. In the linux interface, everything is the same, but how to do it in the terminal, without a graphical shell, will be shown below, using the example of adding a new network interface to the ubuntu server.

In linux, it happens that the local network interface between the computer and the virtual machine is not used by default, and as a result, there is no local network. In this case, you must manually bring up the LAN interface between the computer and the virtual machine. Next, we will describe the process of enabling the network interface in the ubuntu server.

First, we need to find the name of the network interface that we need. In the terminal we type:

As a result, you will get a list of all network interfaces.

We find the desired interface, it is most often the last one. Perhaps most likely it is either eth1 (for ubuntu server 14.04) or enp0s8 (for ubuntu server 16.04), it all depends on the number of network adapters connected to the virtual machine.

Nano / etc / network / interfaces

File / etc / network / interfaces for ubuntu server 14.04:

# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp

Add a line to the end of the file (for dynamically set ip):

Auto eth1 iface eth1 inet dhcp

For static ip:

Auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0

There may be a different interface name instead of eth1, depending on your configuration.

After that, you need to reboot the virtual machine and type the command again:

Ifconfig

The eth1 interface, or the one you specified, should appear in the list.

Setting up the / etc / network / interfaces file for ubuntu server 16.04:

# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto enp0s3 iface enp0s3 inet dhcp

Here the interface is named enp0s3 instead of eth0. According to the data obtained by the "ip a" command, in my case, I need to add to the end of the file:

Auto enp0s8 iface enp0s8 inet dhcp

After making the changes, you also need to restart the virtual machine, or you can restart only the networking service:

Sudo service networking restart

On ubuntu server 14.04, it does not always restart for me, it just continues to work, with ubuntu 16.04 everything is fine in this regard, but for complete confidence, I think that it is better to restart the virtual machine.

After restarting the machine and typing the ifconfig command in the terminal, the enp0s8 interface should appear in the resulting list of network interfaces.

What if the network interface still doesn't work?

There are two main options: either you specified the wrong interface in the / etc / network / interfaces file - in this case, once again carefully look at the list of all available network interfaces with the "ip a" command and select the one you need. Or the virtual OS does not see the network adapter at all. In this case, most likely the OS does not have suitable drivers for this adapter. This problem can be solved by changing the adapter type, for example to "paravirtual network (virtio-net)":

You can experiment with the type of adapter to achieve the desired result.

ssh access to virtual machine in virtualbox

After successfully setting up the local network between the computer and the virtual machine, you can connect to it, for example, via ssh. To do this, we type the ip address, about which I wrote at the beginning of the article, in the ssh client and we are happy with the successful connection)

Proper networking in a VirtualBox virtual machine allows the host operating system to be linked to the guest operating system for the best interaction between the latter.

In this article, we will configure the network in a virtual machine running Windows 7.

Configuring VirtualBox starts with setting global options.

Let's go to the menu "File - Settings".

Then open the tab "Network" and "Host virtual networks"... Here we select the adapter and click the settings button.

First, we set the values IPv4 address and corresponding netmask (see screenshot above).

After that, go to the next tab and activate DHCP server (regardless of whether you are assigned a static or dynamic IP address).

The server address must be set to match the addresses of the physical adapters. The "Boundaries" values ​​must cover all addresses used in the OS.

Now about the VM settings. Go to "Settings", chapter "Network".

Set the appropriate option as the connection type. Let's consider these options in more detail.

1. If the adapter "Not connected", VB will inform the user that it is available, but there is no connection (it can be compared to the case when the Ethernet cable is not connected to the port). Selecting this option can simulate the absence of a cable connection to the virtual network card. Thus, it is possible to inform the guest operating system that there is no Internet connection, but it can be configured.

2. When selecting a mode "NAT" the guest OS will be able to access the Internet; in this mode, packets are redirected. If you need to open web pages from the guest system, read mail and download content, then this is a suitable option.

3. Parameter "Network Bridge" allows you to do more online activities. For example, this includes modeling networks and active servers in a virtual system. When this mode is selected, VB will connect to one of the available network cards and begin direct work with packets. The host system's networking stack will not be involved.

4. Mode "Internal network" used to organize a virtual network that can be accessed from a VM. This network has nothing to do with programs running on the host system or network equipment.

5. Parameter "Virtual Host Adapter" is used to organize networks from the main OS and several VMs without involving the real network interface of the main OS. A virtual interface is organized in the main OS, through which a connection is established between it and the VM.

6. Less commonly used than others "Universal driver"... Here the user gets the opportunity to choose a driver included in VB or in extensions.

Select the Network Bridge and assign an adapter to it.

After that, we will launch the VM, open network connections and go to "Properties".





Choose an Internet Protocol TCP / IPv4... We press "Properties".

Now you need to register the parameters of the IP address, etc. We set the address of the real adapter as the gateway, and the value following the gateway address can be the IP address.

After that, we confirm our choice and close the window.

The configuration of the Network Bridge is completed, and now you can go online and interact with the host machine.