Sunday, November 18, 2012

Virtual Machine Networking: NAT or Bridged?

VMWare and other desktop or embedded hypervisors create virtual networks that the virtual machines connect to when running on the hosting software.  These virtual networks provide network connectivity from the guest machines through the host machine out to the general LAN/WAN.  There are two main modes.

  1. NAT:  The host puts the virtual machines on their own private network and acts as a network gateway for that virtual network.  Guest machines can communicate over the shared network and communicate to the WAN/Internet through the host machine.  Guest machines consume none of the physical network's address space because they are connected on the hosts "virtual network".

    Guest network interfaces can be configured using DHCP, provided by the host, or with fixed IP addresses to simulate a stable server environment.  Fixed IP addresses are handy when the virtual machines need to communicate with each other. VMWare typically uses the host network's VMnet8 VLAN which doesn't change network range across reboots.

    This mode works well where the guest machines only need outbound access to the global network.  It is also useful where the host machine is mobile and plugs into multiple other physical networks.  No guest reconfiguration is necessary when the host is connected to a new network.
  2. Bridged: The host essentially creates a new IP adapter for each virtual machine and bridges the virtual network adapters to the physical network.  Guest machines consume address space on the physical network. A host running 2 virtual machines with Bridged networking has 3 IP addresses on the main network. It has one for the host and one for each virtual machine.

    Guest interfaces can be configured using DHCP provided by the network or with fixed IP addresses. Fixed IP addresses make it easier to route requests to the VMs.

    This method is the best method to use if the guest / virtual machines accept inbound traffic from the greater LAN/WAN or Internet. This mode works well if the capacity to allocate to the additional IP addresses.

Oracle has a good explanation of NAT and Bridged in VirtualBox at https://blogs.oracle.com/fatbloke/entry/networking_in_virtualbox1
VMWare has a good NAT explanation in their virtual networking environment http://www.vmware.com/support/ws45/doc/network_nat_details_ws.html

No comments:

Post a Comment