Networking – What it means and possible configurations in VMWare Workstation
At some point, you would like your shining new Virtual Machine (VM) to access the Internet or communicate with other devices (computers, printers), be it VMs on same host or external computers. To configure this networking, you need to understand the fundamentals of computer networks and the components of VMWare virtual networks.
We all have internet at home these days and connected our PC, laptop or our smart phone to our broadband modem. So what’s a modem, is it a Switch or a Router or both?
- Ethernet adapter or a network interface card (NIC): is a hardware device that allows your computer to connect to other devices. It’s where on your computer you connect that Ethernet cable coming from the broadband modem.
- Network switch: is a hardware device that connects other networking devices. Switch creates a local area network (LAN) whereby you connect Ethernet cables from your devices to ports on a Switch. E.g. you can connect multiple computers in your home to a shared printer using a Switch to build a private local area network.
- Router: you have seen this, in its basic form it’s your broadband modem. Router connects one network to another. A multi port broadband modem is basically a Switch and Router combined which allows you to connect multiple devices at home so they can communicate with each other while at the same time connect to Internet.
Difference between a Switch and Router: Remember a Switch creates a network whereas Router connects one network to another.
Networking in VMWare Workstation
Now that you know what a network adapter, a switch or router is, we can move onto how networking works in VMWare.
When you install VMware Workstation, many networking components are configured on your host computer.
Virtual switches are created as needed by the VMware Workstation software, up to a total of nine switches. By default three switches are configured for three different types of networks – Bridged on switch VMNet0, Host-only on Switch VMnet1 and NAT on VMnet8.
Two virtual network adapters are added to the configuration of your host operating system upon Workstation installation. In addition, when you create a new VM, it automatically comes with a virtual network adapter of its own.
A virtual network is formed when network adapters of your host computer and VM connect to a virtual switch.
Bridged network on switch VMnet0: Physical network adapter of the host computer participates in the network and is connected to virtual switch VMnet0 and so does the virtual adapter of the VM. The host’s network adapter enables the VM to connect to the LAN that the host system uses.
- Virtual Machines on a bridged network act similar to a standalone physical computer. VM has its own identity and its own dedicated IP address, separate from host’s IP address.
- VMWare virtual DHCP server can’t be used in bridged networking i.e. you must obtain an IP address on your own from your network administrator or VM can connect to an external DHCP server which allocates a dynamic one.
- Every computer on the LAN (other than host itself) can see the VM and can ping or connect to it
Host only network on switch VMnet1: Virtual network adapter on the VM and host’s virtual network adapter are connected to switch VMnet1 to create a private virtual network. Host’s physical network adapter doesn’t participate in this configuration. Main points are:
- Most secure and isolated network configuration as the entire network is contained inside the host only. VM can only communicate with the host and other VMs on the same host.
- VM has no identity on the LAN i.e. to other computers on the LAN, VM doesn’t exist
- VM will have no access to Internet even if the host does
- VMWare virtual DHCP server provides IP address to VM. You can configure the DHCP to assign a static IP if required.
NAT network on switch VMnet8: VM’s virtual adapter and host’s virtual adapter connects to virtual switch VMnet8 to create a private virtual network whose traffic passes through the NAT device.
- To external devices, VM and the host act as one machine
- VM gets its IP address from virtual DHCP server which can be either static or dynamic
- NAT works by translating the IP addresses of VMs in the private network to the IP address of the host system. When a virtual machine sends a request to access a network resource, it appears to the network resource as if the request is coming from the host system. It identifies incoming data packets intended for each virtual machine, and sends them to the correct destination.
Following are the list of resources I used and would highly recommend to anyone new to computer networking or VMWare.