Types of Virtual Networks
Virtual networking is similar to traditional physical networking; however, in virtual networking, some or all of the hardware components are replaced with virtual network components comprised of software. This eliminates the need to configure physical hardware components physically. Virtual network components can be configured more easily than physical components, allowing the networking of virtual machines to be managed with greater ease and flexibility.
Virtual machines must be connected to a virtual network component, and that virtual component must have access to the physical network. There are several ways the virtualized components can be connected to a physical network in order to allow VMs to communicate with each other and with other devices. This section explores the three main network types used to set up VMs with a connection.
A bridged network is a network type where both a virtual machine and the host that it is running on are connected to the same network. Bridged networking connects a virtual machine to the network using the host computer's Ethernet adapter. The network used by the host is the main public network, which is generally referred to as “the internet”. This is possible because the host shares its IP address with the VM.
With bridged networking, the virtual network adapter (vnic) in the virtual machine connects to a physical network adapter (NIC) in the host system. The host network adapter enables the virtual machine to connect to the LAN (Local Area Network) that the host system uses. Bridged networking works with both wired and wireless host network adapters.
Recall that in this course, the terms Network Interface Card and Network Adapter are used interchangeably.
Bridged networking configures the virtual machine as a unique identity on the network, separate from and unrelated to the host system. The virtual machine is a full participant in the network. It has access to other machines on the network, and other machines on the network can contact it as if it were a physical computer on the network.
NAT (Network Address Translation) takes an IP address and translates it into another IP address. On a NAT network, a virtual machine does not have its own IP address on the external network. Instead, a separate private network is set up on the host computer.
NAT is useful when you have a limited supply of IP addresses. NAT works by translating addresses of virtual machines in a private network called a VMnet to that of the host machine. When a virtual machine sends a request to access a network resource, to the network resource it appears as if the request came from the host machine.
The NAT device on the network translates the information going to the host's public IP address and forwards it to the private IP address for the VMs.
The VMnet is able to connect to the public external network using the translated IP addresses enabled by a feature called port forwarding. Port forwarding allows incoming web traffic to pass through a specific port, chosen by the administrator, to the internal network.
Incoming network traffic is transmitted in the form of data packets. The NAT device is able to sort the packets intended for each virtual machine and sends them to the correct destination. A data packet contains a unit of data, information about the network it is traveling on, and where it is going. When a packet does not reach its destination, this is called packet loss.
The topology of a NAT network generally involves a VM connected to a virtual network interface card (vnic) which allows it to connect to the virtual switch (vswitch). The vswitch is also connected to a NAT device that translates the IP addresses and allows port forwarding to connect to the external network.
In the default configuration, virtual machines get an address on this private network from the virtual DHCP server. DHCP is an acronym for Dynamic Host Control Protocol. A DHCP server is a system that uses the DHCP protocol to assign IP addresses to the devices on the network.
Host-only networking creates a private internal network for the VMs to connect to, similar to a NAT network. However, without IP address translation, the VMs can only stay in the private network and do not have direct access to the public external network.
Host-only networking provides a network connection between the virtual machine and the host computer, using a virtual Ethernet adapter (vnic) that is visible to the host operating system. This approach can be useful if you need to set up an isolated virtual network.
If you use host-only networking, your virtual machine and the host virtual adapter are connected to a private Ethernet network. Addresses on this type of network are also provided by a DHCP server.