VMware Server 2.0 DHCP Configuration

Revision as of 15:28, 21 October 2008 by Neil (Talk | contribs) (NAT Virtual Network IP Addresses)

Revision as of 15:28, 21 October 2008 by Neil (Talk | contribs) (NAT Virtual Network IP Addresses)

In order for a client to connect to a TCP/IP based network, it needs a Internet Protocol (IP) address which uniquely identifies it among the other devices connected to the network. In addition, the addresses of one or more DNS servers and a gateway may optionally be configured. One way to configure this is to manually assign this information to each client on the network. Whilst this approach can work for small network, it quickly becomes unmanageable in larger enterprises. To alleviate this problem, the Dynamic Host Configuration Protocol was created. This takes the form of one or more servers on a network which dynamically allocate IP addresses and other network configuration information to network clients.

As outlined in the chapter entitled VMware Server Virtual Network Architecture, the VMware Server infrastructure includes a built-in Dynamic Host Control Protocol (DHCP) server for the purpose of assigning dynamic IP addresses, DNS and gateway information to virtual machines running in NAT and Host Only virtual networks. Virtual machines running on a bridged VMware Server virtual network must either have a static IP address assigned, or obtain one from a DHCP server running on the external network to which the bridge connects.

As with any other DHCP server, the one embedded into VMware Server provides a number of different configuration options. As such, this chapter will focus of configuring the VMware Server DHCP server on both Linux and Windows host operating systems.

Static and DHCP IP Address Allocation Ranges

When a NAT or HostOnly network is created it is assigned a Class C IP subnet address range (for example 192.168.33.0 - 192.168.33.254). In practice, VMware divides this address range and allocates specific addresses and address ranges for specific uses. These divisions differ between NAT and HostOnly virtual networks and are outlined in the following tables:


HostOnly Virtual Network IP Addresses

IP Range

Description

subnet.1

The IP address of the host machine. Provides a way for the virtual machines to communicate with the host. Example: 192.168.33.1.

subnet.2 - subnet.127 Reserved for use as static addresses for virtual machines which are not configured to obtain an IP address from the VMware DHCP server. Example: 192.168.33.2 - 192.168.33.127

subnet.128 - subnet.253

The pool of IP addresses available for dynamic allocation to virtual machines by the VMware DHCP server. Example: 192.168.33.128 - 192.168.33.254

subnet.254 Used as the IP address of the VMware DHCP server.

subnet.255

The HostOnly virtual network broadcast address.

NAT Virtual Network IP Addresses

bgcolor="#e9e9e6">

IP Range

Description

subnet.1

The IP address of the host machine. Provides a way for the virtual machines to communicate with the host. Example: 192.168.33.1.

subnet.2 The IP address to the VMware Server NAT device.
subnet.3 - subnet.127 Reserved for use as static addresses for virtual machines which are not configured to obtain an IP address from the VMware DHCP server. Example: 192.168.33.3 - 192.168.33.127

subnet.128 - subnet.253

The pool of IP addresses available for dynamic allocation to virtual machines by the VMware DHCP server. Example: 192.168.33.128 - 192.168.33.253

subnet.254 Used as the IP address of the VMware DHCP server.

subnet.255

The NAT virtual network broadcast address.

Configuring the VMware Server DHCP Server on Windows Hosts

The built-in VMware DHCP server is configured on Windows host systems using the Virtual Network Editor tool, launched via the Start -> All Programs -> VMware -> VMware Server -> Manage Virtual Networks menu option. Once loaded, the DHCP settings are accessed by clicking on the DHCP tab as illustrated in the following figure:


Configuring the DHCP settings on a VMware Server Windows host


The screen displays a list of currently configured virtual networks for which the built-in DHCP server is available. In the above example this includes the vmnet1 (host only) and vmnet8 (NAT) virtual networks. Beneath the virtual network list is the DHCP service panel which lists the current status of the server and provides options to stop, start and restart the service.

To adjust the DHCP settings for a specific virtual network, simply select the network from the list and click the Properties button to display the DHCP settings dialog:


Configuring the DHCP settings for a specific virtual network


The range IP address pool (essential the range of addresses from which the DHCP server can allocate addresses to clients) may be altered by changing start and end address fields.

Also available for configuration are the lease values. A lease time is the duration for which an IP address is assigned to the same network client before it is returned to the pool for future use by another client. The lease time may be anything from a few minutes up to thousands of days. The optimal lease value depends on the network. If the virtual network environment is one in which virtual machines are frequently created and destroyed it is better to have a shorter lease time to prevent the pool of available IP addresses being exhausted. The reason for this being that the DHCP server will reserve IP addresses long beyond the life expectancy of the virtual machines to which they are assigned, thereby limiting the pool of available addresses for new virtual machines. For more virtual networks with a low turnover of virtual machines, longer lease times are often preferred, allowing each virtual machine to retain the same IP address for as long as possible.

The Default lease time is the lease time that will be used by the DHCP server if the network client does not specify a lease time when requesting an IP address from the DHCP server. The Max lease time is the maximum lease length permitted by the DHCP server, regardless of the lease requested by the client.

Once the necessary modifications have been made on the DHCP Settings dialog, click the OK button to return to the DHCP page of the Virtual Network Editor and click on Apply followed by OK to commit the changes.

Configuring the VMware Server DHCP Server on Linux Hosts

The built-in DHCP server is configured on Linux host systems by manually editing the DHCP configuration files. There is one DHCP configuration for each HostOnly or NAT virtual network. These files can be found in:

/etc/vmware/vmnetn/dhcpd/dhcpd.conf

where n represents the number of the virtual network, for example /etc/vmware/vmnet1/dhcpd/dhcpd.conf. A typical dhcp.conf file will read as follows when viewing in suitable text editor:

allow unknown-clients;
default-lease-time 1800;                # 30 minutes
max-lease-time 7200;                    # 2 hours

subnet 192.168.103.0 netmask 255.255.255.0 {
    range 192.168.103.128 192.168.103.254;
    option broadcast-address 192.168.103.255;
    option domain-name-servers ns1.techotopia.com, ns2.techotopia.com;
    option domain-name "techotopia.com";

}

The file conforms to the standard dhcpd.conf file, and extensive details can be obtain via the Linux dhcpd.conf man page. The default settings are as follows:

  • allow unkown-clients - Controls whether the DHCP server is permitted to assign IP addresses to clinets which do not have a host declaration.
  • default-lease-time - The length of lease (in seconds) associated with an IP address when the requesting client does not specify a required lease time.
  • max-lease-time - The maximum permitted lease time, in seconds, allowed for an IP address by the DHCP server. A request for a greater lease length by a client will be fulfilled at using the max-lease-time value.
  • subnet / netmask' - The Class C subnet and netmask for the HostOnly or NAT virtual network to which the DHCP server is assigned.
  • range - The range of addresses which constitute the pool from which IP addresses may be dynamically allocated to clients by the DHCP server.
  • option broadcast-address - The TCP/IP broadcast address of the VMware virtual network.
  • option domain-name-servers - The optional IP addresses or fully qualified domain name (FQDN) of name servers on the network. For example, ns1.virtuatopia.com. Multiple servers must be comma separated.
  • 'option domain-name - The optional name of the network domain. For example, techotopia.com.