How to configure the network in a virtual machine using VMware and options

When we install a virtual machine using VMware Workstation, we have at our disposal different ways to configure the network of said virtual machine, with which it will connect to the local home network, to the Internet and even to other virtual machines that we have on the computer. Correctly configuring the network is very important, not only from the point of view of network operation but also with a view to security, in case we are testing “dangerous” software on these virtual machines. Today in this article we are going to explain in detail what each of the different configuration modes at the network level that we have in VMware Workstation is for.

configure the network in a virtual machine using VMware and options

all network options

When we create a virtual machine, regardless of the operating system we use (Windows, Linux, FreeBSD or another), we have the same configuration options at the network level. Depending on our needs and the type of connectivity we want to provide to the virtual machine, we will have to choose between some options or others.

If we enter the virtual machine configuration menu, and go to the « Hardware / Network Adapter » section, we can see all the configuration options available in this menu. We can activate or deactivate the network card and select the different network connection modes:

  • bridged
  • NAT
  • host-only
  • customized
  • LAN Segment

From this menu is where we can configure an already established network to a specific virtual machine. VMware allows us to configure each virtual machine as we want at the network level, of course, we could also choose the possibility of creating a specific virtual network to later use it for one or more VMs at the same time.

Once we have seen the menu where all the network-level options available in VMware appear when we have to edit a virtual machine, we are going to explain in detail how each configuration mode that we have seen previously works.

bridged

In this configuration mode, the virtual machine will be in ” bridge mode “, that is, it will connect directly to the physical network of the computer where we have it installed. If our computer is connected via cable to a local network with the 192.168.1.0/24 subnet, the virtual machine will be like a new computer within the local network, and all users of this local home network will be able to access the virtual machine via network, that is, it is reachable at the network level. In this configuration mode, the virtual machine will have a virtual MAC address and will connect like any other computer on the network, there is no difference.

In this configuration mode we also have the possibility to select the “ Replicate physical network connection state ” option. If you are using a laptop, it is recommended to choose this option because it will allow you to renew the IP address of the virtual machine if we change the network. This option is ideal for the cases in which we change quite continuously between a wireless network (or several) and the wired network, with the aim that the VM always has a connection to the local network.

In the “ Edit / Virtual Network Editor ” part, if we click on “Change Settings” at the bottom right we can configure this bridge with the physical network card that we want. By default we have this option in “Automatic”, however, our recommendation is that you always choose the network card with which you want to make the bridge mode. This is due to the fact that many times it might not properly detect the appropriate network card that provides us with the Internet, or because it may not be important for it to “bridge” the wireless network card, but rather the wired one.

In this “Virtual Network Editor” menu is where we can configure all the local network profiles in an advanced way.

NAT

In this configuration mode, VMware is responsible for performing a NAT against the private IP address of the computer connected to the network. In this operating mode, all the VMs will have a specific “nate” subnet, that is, they will have communication between all the virtual machines, and they will also have communication with the computers on the local network and the Internet. What we do not have in this case is the possibility that the computers on the local home network can communicate with the virtual machines, because all the configured VMs will go out to the network using the private IP address of the real computer.

This configuration mode is the default, since it allows us to have the VMs isolated so that other computers on the local network do not access these VMs, however, the VMs will be able to access the different computers.

In the advanced menu of «Virtual Network Editor» we can configure the subnet to be used by this NAT that VMware itself does, we can put the subnet that we want. We also have the possibility of forwarding ports, just as we would do in our router so that from outside the NAT network they can reach the computers within the NAT. Let’s imagine that we want to configure a VM in NAT mode and we want to have an SSH or FTP server, in this case we will be able to configure a NAT rule for access from the outside (local network) to the inside (VMware itself).

If you don’t want to make each VM appear on the local network as a new machine, then this configuration option is recommended, and it is the default option.

host-only

When we install VMware on a Windows or Linux host computer, a Host-only network is set up on VMnet1. Host-only networks are very useful if we need to configure a virtual network isolated from the rest, in this case both the virtual machine and the virtual network adapter of the host will be connected to a private network, the network is contained within the real operating system of the host. equipment. The network connection between the real and virtual machine is made through the virtual network adapter, VMware is responsible for providing private IP addresses of “Host-only” to perform the communication between the real and virtual machine.

In the default configuration of “Host-only”, virtual machines cannot connect to the Internet, it is something that we must take into account. In this case, we could also configure the subnet that we have configured by default in VMware, to do so we will have to go to the “Host-only” section and define the available configuration options, in fact, we have more advanced options such as using a local DHCP service to provide private IPs.

customized

In this configuration mode we have to add a new network from scratch, and configure it as we want with all the available configuration options. If you want to configure a custom network in an advanced way, you will first have to configure the new network in « Virtual Network Editor » by clicking on « Add Network «, then we choose the «VMnetX» that we want, and continue with the available options.

VMware allows us to configure a large number of new interfaces with the configurations that we want. Of course, when editing the virtual machine we will have to select the “Custom” option and choose the VMnet that we have previously configured.

LAN Segment

A LAN segment is a private network shared by other virtual machines. Configuring one or more machines in this mode is very useful for multi-level testing, such as network performance analysis or situations where VM isolation is very important. To be able to choose this option, the first thing we must do is configure the LAN segment in the advanced settings, and then put a fixed IP address on the different virtual machines. Unlike the NAT and Host-only mode, VMware does not provide a DHCP server on these “LAN segments”, so we must manually configure the network level.

If we click on “LAN Segments” we can create new LAN segments, edit the ones that already exist and even delete the ones we want. Of course, if we delete a LAN segment that is in use, all the virtual network adapters that we have configured will be disconnected, so we must reconfigure the network of the virtual machines.

As you have seen, VMware allows us a large number of configuration options available at the network level. Depending on our needs, and the isolation and connectivity needs of the different VMs, we will have to choose one option or another. In addition, we must not forget that we have the possibility of adding several network cards to the same VM with different configuration options.