Managing VMware Virtual Networks and Adapters
|Previous||Table of Contents||Next|
|VMware Server Virtual Network Architecture||VMware Server NAT Configuration|
As outlined in the chapter entitled VMware Server Virtual Network Architecture, VMware Server provides two types of virtual network adapter. Virtual network adapters are installed into virtual machines and provide a mechanism for guest operating systems to establish network communications. Host virtual adapters, on the other hand, are installed in the host operating system and are used to establish communication between the host operating system and virtual machines running in VMware Server based NAT and HostOnly based virtual networks.
This chapter covers the creation, removal and configuration of both virtual network adapters and host virtual adapters.
Adding a New Virtual Network Adapter to a Virtual Machine
VMware Server 2 increased the number of virtual network adapters that can be added to a virtual machine from 4 to 10. Although the VI Web Access new virtual machine wizard allows virtual network adapters to be configured into a virtual machine it is quite common to need to add additional adapters later in the lifecycle of the virtual machine. Fortunately, VMware Server makes the addition of virtual network adapters quick and easy to achieve.
The first step in the process is to log into the VI Web Access management interface (details of which are covered in the A Guided Tour of the VMware Server 2.0 Infrastructure Web Access Interface chapter of this book). Once logged in, identify and select the required virtual machine from the Inventory panel. Just as a physical computer system needs to be shutdown and powered off before the cover is removed and a new network adapter card installed, the virtual machine must be powered off before a new virtual network adapter can be added. The currently select virtual machine may be shutdown by clicking the power off button in the VI Web Access toolbar, or by selecting the Power off link in the Commands panel of the workspace.
Once the virtual machine status panel indicates that the virtual machine has been successfully powered off, click on the Add Hardware link in the Commands panel to invoke the VMware Add Hardware Wizard. The wizard is generic in that it allows a variety of different virtual hardware devices to be added to a virtual machine in addition to a virtual network adapter. To proceed with the device installation click on the link labeled Network Adapter to proceed to the network adapter properties screen as illustrated in the following figure:
In order to be of use to the guest operating system, the virtual network adapter must be connected to a virtual network. The Network Connection drop down menu provides a list of virtual networks currently configured within the VMware Server environment. These were either selected during the VMware Server installation process, or subsequently configured by an administrator. If all virtual network options were configured during installation then NAT, HostOnly and Bridged virtual networks should be available for the virtual network adapter to connect to. In the absence of a required virtual network on Linux systems, run the vmware-config.pl script as super-user and configure the missing virtual network type. Assuming the required virtual network is listed in the connections menu, select it and then choose whether the new virtual network device is to be automatically connected to the virtual machine at power on.
Finally, click Next to proceed to the Ready to complete screen and review the configuration summary information listed. If the virtual machine is to power on automatically immediately after the new virtual network adapter has been added, set the Power on your virtual machine now option before clicking on the Finish button. The new virtual machine will subsequently power up with the new virtual network adapter installed and, subject to the configuration settings, connected to the selected virtual network. The new adapter will also be listed in the Hardware panel of the selected virtual machine, together with the name of the network to which it is currently connected.
Removing Virtual Network Adapters
Virtual network adapters may be removed from a VMware Server virtual machine at any time, once again using the VI Web Access management interface. As with the process to add a new virtual network adapter, the virtual machine must be powered off before an adapter can be removed. Begin by selecting the virtual machine from which the virtual device is to be removed from the Inventory panel and clicking the power off button in the toolbar or the appropriate link in the Commands panel. Once the virtual machine is listed as Powered off in the Status panel, click on the down arrow next to the required network adapter in the Hardware panel and select Remove:
Once the Remove option has been selected a dialog will appear seeking confirmation that the virtual device is to be removed from the virtual machine. Selection of the Yes button will proceed with the removal process. The virtual network adapter will disappear from the virtual machine's hardware list and will be absent next time the virtual machine is powered on.
Modifying Virtual Network Adapter Settings
In addition to adding and removing virtual network adapters, it is also possible to configure the current settings of existing adapters. The virtual machine may be powered on or off during the editing phase, although the range of options available for configuration differs depending on the current power state (for example, it is not possible to configure the MAC address settings when the virtual machine is powered on).
To modify the settings of a particular virtual network adapter, select the virtual machine to which it is connected from the VI Web Access inventory list, click on the down arrow next to the required device in the Hardware panel and select the Edit... menu option. This will invoke the network adapter settings dialog as illustrated in the following figure:
In the above figure, the virtual machine is currently powered on causing the MAC Address settings to be disabled (since it is unwise to change the MAC address of a device while it is in operation). Conversely, had the virtual machine been powered off the options to connect or disconnect the virtual network adapter would have been disabled. An overview of the various settings available is as follows:
- Connect - This setting is only active when the virtual machine is in the powered on state. If the virtual network adapter is not currently connected to the designated virtual network, this option establishes a connection.
- Disconnect - Also only active when the virtual machine is powered on. Disconnects the virtual machine from the designated virtual network (much like unplugging the network cable from a physical network interface card).
- Connect at power on - Controls whether the virtual network adapter is automatically connected to the specified virtual network when the virtual machine is powered on.
- Network Connection - Specifies the virtual network to which the virtual network adapter is to be connected. This will be one of NAT, HostOnly, Bridged, or a custom network.
- MAC Address - All network devices (including network adapters) require a MAC address as a form of identification. VMware Server provides the option to have a host generated MAC address assigned to the virtual network adapter, or to assign one manually. If manually assigned, the MAC address must fall within the 00:50:56:00:00:00 through 00:50:56:3F:FF:FF address range to avoid conflicts. This settings is only available for modification when the virtual machine is in the powered off state.
Managing VMware Server Host Virtual Adapters
Host virtual adapters are installed by VMware Server to enable the host to communicate with the virtual machines which are connected to HostOnly and NAT based virtual networks. By default, two host virtual adapters are configured, one for each of these two virtual networks. Additional host virtual adapters may be installed, and existing adapters may be enabled, disabled and removed.
On Windows hosts, virtual host adapters are managed using the Manage Virtual Networks tool which is accessed via Start -> Programs -> VMware Server -> Manage Virtual Networks. Once the tool has loaded, select the Host Virtual Adapters tab to view a list of currently configured adapters. To remove, enable or disable a virtual adapter, simply select it from the list and click on the appropriate button beneath the list. To add a new host virtual adapter, click on the Add... button and select an available VMnet setting to assign to the new adapter.
Host virtual adapters are managed on Linux systems using the vmware-config.pl script which much be run as super-user, for example:
su - vmware-config.pl
The vmware-config.pl script requires that all virtual machines be powered off and VMware services stopped before configuration settings are changed. If the script detects running virtual machines, it will display the following message and provide the option to shutdown them all down:
Making sure services for VMware Server are stopped. At least one instance of VMware Server is still running. Do you want to force a shutdown on the running VMs? [no]
Once the virtual machines have been powered off, the VMware services stopped and the license terms accepted, vmware-config.pl will prompt to change the network settings for the host:
You have already setup networking. Would you like to skip networking setup and keep your old settings as they are? (yes/no) [yes]
Enter no to proceed with network configuration, at which point the script will ask whether networking is to be provided for the virtual machines running on the host. To disable all networking answer no, otherwise accept the default, yes.
The next prompt provides options for different ways to configure existing settings. At this prompt select the editor option:
Would you prefer to modify your existing networking configuration using the wizard or the editor? (wizard/editor/help) [wizard] editor
At this point, vmware-config.pl will display the currently configured virtual networks:
The following virtual networks have been defined: . vmnet0 is bridged to eth0 . vmnet1 is a host-only network on private subnet 192.168.103.0. . vmnet8 is a NAT network on private subnet 172.16.86.0. Do you wish to make any changes to the current virtual networks settings? (yes/no) [no]
Answer yes to proceed and at the subsequent prompt, enter the number of a network (an existing network must be referenced to make changes, or a new number entered to add a new virtual network). At this point it is important to keep in mind that vmnet0 is the bridged network, vmnet1 host-only and vmnet8 NAT. All other numbers between 2 and 255 are available for new virtual networks.
To add a new virtual network (and corresponding host virtual adapter), enter a number which is not already in use and press enter. The script will then ask for the type of virtual network to be used, bridged, hostonly, nat or none:
Which virtual network do you wish to configure? (0-254) 6 What type of virtual network do you wish to set vmnet6? (bridged,hostonly,nat,none) [none]
Enter the required type of virtual network and press enter to proceed. Finally, the script will prompt for the name of the virtual network. The selection of a descriptive and unique name is important to avoid later confusion when administering virtual machines and networks:
Configuring a bridged network for vmnet6. Please specify a name for this network. [Bridged]
If bridged networking is selected it will be necessary to decide which physical network device on the host will be bound to the virtual network to provide access to the external network. The script will list all detected network devices and prompt for a selection. Note that if a host network adapter is already in use by another virtual network it will unavailable for use in the new virtual network. In this case, it will be necessary to select another physical network device, or install an additional network card into the host.
In the case of new NAT or Host Only virtual networks a private subnet will need to be allocated to the virtual network. One may be provided manually, or the script instructed to probe the network to identify an unused subnet:
Probing for an unused private subnet (this can take some time)... The subnet 172.16.125.0/255.255.255.0 appears to be unused. The following virtual networks have been defined: . vmnet0 is bridged to eth0 . vmnet1 is a host-only network on private subnet 192.168.103.0. . vmnet6 is a host-only network on private subnet 172.16.125.0. . vmnet8 is a NAT network on private subnet 172.16.86.0.
Once a suitable subnet has been identified, the new virtual network and associated host virtual adapter will be created, and the new list of adapters displayed as illustrated above.
To remove a virtual network and host adapter from the configuration repeat the above steps, selecting the number of the virtual network to be removed, and enter none when asked to define the virtual network type. For example, the following transcript shows the removal of the vmnet6 network created in the preceding steps:
Do you want networking for your virtual machines? (yes/no/help) [yes] Would you prefer to modify your existing networking configuration using the wizard or the editor? (wizard/editor/help) [editor] The following virtual networks have been defined: . vmnet0 is bridged to eth0 . vmnet1 is a host-only network on private subnet 192.168.103.0. . vmnet6 is a host-only network on private subnet 172.16.125.0. . vmnet8 is a NAT network on private subnet 172.16.86.0. Do you wish to make any changes to the current virtual networks settings? (yes/no) [yes] Which virtual network do you wish to configure? (0-254) 6 What type of virtual network do you wish to set vmnet6? (bridged,hostonly,nat,none) [hostonly] none Removing a host-only network for vmnet6. The following virtual networks have been defined: . vmnet0 is bridged to eth0 . vmnet1 is a host-only network on private subnet 192.168.103.0. . vmnet8 is a NAT network on private subnet 172.16.86.0.