Using VM Workstation for Advanced Networking
VM Workstation is software that can be installed on top of an existing operating system to host different Virtual Machines (Figure 1). It is great for trying out new operating systems and testing new software in controlled environments. It is perfect for developers; it is a very valuable tool to create complete labs and it can do much more, even in hosting some production virtual machines.
Figure 1 – Windows 7 virtual machine
If you need to know how to create a new virtual machine, see this tutorial on installing Windows 7 in VMware Workstation.
NATting
The most common configuration and the default for newly created machines is to NAT (Figure 2). In this configuration the host will act as a router that hides the virtual machine behind it. The virtual machine will have access to the network through the default connection of the host. To other devices on the network all traffic will appear to be coming from the host. This means that although a virtual machine should be able to access network resources (and the Internet), it will not be able to offer resources to the network. This network connection will have its own private range that is assigned by DHCP (Figure 3).
Figure 2 – Virtual machine network configuration – NAT
Figure 3 – IP configuration and route trace from a NATed VM
Host-Only
This option can be used when you do not want the virtual machine to see the rest of the network or the Internet (Figure 4). This network connection can also take its IP through DHCP (Figure 5), but the IP range will be different than that of NATed machines (More on this later).
Figure 4 – Virtual machine network configuration – Host-Only
Figure 5 – IP config and PING to host from Host-Only VM
Bridged Network
As the name implies, this option “bridges” the virtual network to the physical network (Figure 6). This means that the virtual machine will appear to the network as an identifiable separate machine. It will even ask the local DHCP server (if any) for its IP address (Figure 7) and will appear in the DHCP leases of that DHCP server as a separate machine with a unique MAC address (Figure 8).
This connection will allow the virtual machine to offer resources to the network. For example, it can host a file server, a web server or any sort of server you need. You do not need to have a separate physical machine to host your home server: it can be a VM on your always-on desktop!
This option is also called Auto-bridging because it will automatically detect a functional LAN card installed on the host machine.
If your VMware Workstation is installed on a laptop or a mobile device, then you may want to consider the “Replicate physical network connection state” under bridged network option. If selected, the IP address of the virtual machine is automatically renewed as you move from one wired or wireless network to another.
Figure 6 – Virtual machine network configuration – Bridged
Figure 7 – IP config for a bridged VM
Figure 8 – DHCP leases showing a virtual machine MAC address
More Advanced: Custom Networking
The fourth option is actually nine different options (Figure 9), three of which we have already discussed. They include Auto-bridging, NATing and host-only. The other six options are available for you to use or to customize.
For example, you can have separate test environments that do see each other or the host: Environment A that contains a domain controller(s), member server(s) and some test workstation(s) on VMnet2. Environment B is a complete replica on VMnet3. Both environments can have the same IP scheme and never conflict as they are isolated from each other. This option is also great for testing VMs and/or applications that you do not trust without any risk to your host or network.
Figure 9 – Custom networking
However, the true power of custom networks is the ability to customize them (which is not available in the same dialog screen). For that you will need the Virtual Network Editor (Figure 10) which can be used to edit all nine virtual networks.
Figure 10 – Virtual Network Editor
In the virtual network Editor you can specify to which physical network you want to map your virtual machine bridged network (Figure 11). Doing so will allow you to create a custom Virtual Machine network (VMnets) that is mapped to one of the other physical network cards (Figure 12).
This becomes very important if you need a multi-homed Virtual Machine like a router or a firewall. For example, if you want to test Microsoft ISA, you can bridge one of the network cards to the Internet while bridging the second to the rest of the network, offering your home/lab network filter/accelerated Internet.
It can also be very useful if you want different VMs to be on different Internet links. I have this setup for one of the customers I do remote support for. I once had a complete failure on the network which made me unable to connect remotely. Since then I’ve created a VM that is directly connected to a separate WiMax Internet link from the rest of the network. The VM has another NIC to give me visibility to the internal network.
You can also use the editor to edit the IP address ranges of NAT and Host-Only DHCP servers or disable it completely. An example of this occurs when you need to simulate a 192.168.100.0/24 network rather than the 192.168.13.0 /24 chosen in this setup for NAT Network.
Figure 11 – Specify which physical network card to bridge VMs to.
Figure 12 – Two physical networks bridged to two different virtual networks.
Figure 13 – A multi-homed VM bridged to two different physical networks.
The virtual machine network card can be configured to “connect at power on”. It can also be made “Connected” or ”Not connected” at any time while the virtual machine is running (Figures 13). It also has an advanced configuration that simulates different bandwidths with its own packet loss. The same dialog box can be used to modify or generate the MAC address of the network card.
Figure 14 – Virtual network adapter advanced settings
Summary
A virtualization solution is never complete without the ability to virtualize the network. VMware Workstation capabilities in this regard are second to none; It can build and simulate different types of testing and production networks, put bandwidth limits and approximate different types of WAN and LAN networks.