[an error occurred while processing this directive] [an error occurred while processing this directive]
VMware

VMware Workstation 3.2

Features | Documentation | Knowledge Base | Discussion Forums

previous Prev   Contents   Last   Next next

Selecting IP Addresses on a Host-Only Network or NAT Configuration

Selecting IP Addresses on a Host-Only Network or NAT Configuration

A host-only network uses a private virtual network. The host and all virtual machines configured for host-only networking are connected to the network through a virtual switch. Typically all the parties on this private network use the TCP/IP protocol suite, although other communication protocols may be used.

A network address translation (NAT) configuration also sets up a private network, which must be a TCP/IP network. The virtual machines configured for NAT are connected to that network through a virtual switch. The host computer is also connected to the private network used for NAT.

Each virtual machine and the host must be assigned addresses on the private network. This is typically done using the DHCP server that comes with VMware Workstation. Note that this server does not service virtual (or physical) machines residing on bridged networks.

Addresses can also be assigned "statically" from a pool of addresses that are not assigned by the DHCP server.

When host-only networking is enabled at the time VMware Workstation is installed, the network number to use for the virtual network is automatically selected as an unused private IP network number. To find out what network is used, run ipconfig from a command prompt on a Windows host or ifconfig on a Linux host.

A NAT configuration also uses an unused private network automatically selected when you install VMware Workstation. To check what network is used in a Windows .NET Server, Windows XP, Windows 2000 or Windows NT guest, run ipconfig. In a Windows Me or Windows 9x guest, run winipcfg. In a Linux guest, run ifconfig.

Using DHCP to assign IP addresses is simpler and more automatic than statically assigning them. Most Windows operating systems, for example, come preconfigured to use DHCP at boot time, so Windows virtual machines can connect to the network the first time they are booted, without additional configuration. If you want your virtual machines to communicate with each other using names instead of IP addresses, however, you must set up a naming convention, a name server on the private network, or both. In that case it may be simpler to use static IP addresses.

In general, if you have virtual machines you intend to use frequently or for extended periods of time, it is probably most convenient to assign them static IP addresses or configure the VMware DHCP server to always assign the same IP address to each of these virtual machines.

Configuring the DHCP Server on a Linux Host

Configuring the DHCP Server on a Linux Host

On a Linux host, you configure the host-only DHCP server by editing the DHCP configuration file for VMnet1 (/etc/vmware/vmnet1/dhcp/dhcp.conf). To configure the DHCP server for the NAT network, edit the configuration file for VMnet8 (/etc/vmware/vmnet8/dhcp/dhcp.conf).

Editing the DHCP server configuration file requires information that is best obtained directly from the DHCP server documentation. Consult the manual pages dhcpd(8) and dhcpd.conf(8).

Configuring the DHCP Server on a Windows Host

Configuring the DHCP Server on a Windows Host

Follow these steps to change the subnet of the DHCP server for the host-only network on VMnet1. In this example, you set the IP address of your host-only network to 192.168.3.1. To change the subnet used by a host-only DHCP server, you need to make the change to the IP address in two places: in the registry and in the vmnetdhcp.conf file.

  1. Open the Windows registry.

    Choose Start > Run. Then type regedit.

  2. Look for the registry key
    \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
    VMnetDHCP\Parameters\VirtualEthernetSegments\1.

    In that key, there is a value with the name HostIpAddress. The data is a hexadecimal value corresponding to the IP address of the host. Change this hexadecimal value to that of the new IP address. For example, the registry may contain the value 01dea8c0. This corresponds to the IP address 192.168.222.1.
    c0 = 192
    a8 = 168
    de = 222
    01 = 1

    Notice that the hexadecimal number seems backwards - with the pairs of digits in the opposite order from the way they are usually given when you write an IP address.

    Change the value of this registry key to 0103a8c0, which corresponds to 192.168.3.1.

  3. Find the file vmnetdhcp.conf in the system directory. On most systems, this will be C:\WINNT\system32\vmnetdhcp.conf. Look for the text Virtual ethernet segment 1 in the file. Sample text from the file:

    # Virtual ethernet segment 1
    # Added at 07/05/01 14:30:18
    subnet 192.168.222.0 netmask 255.255.255.0 {
    range 192.168.222.128 192.168.222.254; # up to 126 VMs
    option broadcast-address 192.168.222.255;
    option domain-name-servers 192.168.222.1;
    option domain-name "localdomain";
    }
    host VMnet1 {
    hardware ethernet 00:50:56:C0:00:01;
    fixed-address 192.168.222.1;
    option domain-name-servers 0.0.0.0;
    option domain-name "";
    }

    Replace all instances of the old IP address - 192.168.222.1 - with the new IP address - 192.168.3.1 - as shown below.

    # Virtual ethernet segment 1
    # Added at 07/05/01 14:30:18
    subnet 192.168.3.0 netmask 255.255.255.0 {
    range 192.168.3.128 192.168.3.254; # up to 126 VMs
    option broadcast-address 192.168.3.255;
    option domain-name-servers 192.168.3.1;
    option domain-name "localdomain";
    }
    host VMnet1 {
    hardware ethernet 00:50:56:C0:00:01;
    fixed-address 192.168.3.1;
    option domain-name-servers 0.0.0.0;
    option domain-name "";
    }

  4. Reboot the host computer so the new settings will take effect.

To make corresponding changes to the DHCP server for the NAT network, follow the same procedure, with these changes:

  • Edit the registry key
    \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
    VMnetDHCP\Parameters\VirtualEthernetSegments\8.
  • In vmnetdhcp.conf, edit the sections that begin with
    # Virtual ethernet segment 8
    and
    host VMnet8 {
Choosing the Method for Assigning IP Addresses

Choosing the Method for Assigning IP Addresses

For virtual machines that you do not expect to keep for long, use DHCP and let it allocate an IP address.

For each host-only network, the available IP addresses are split up using the conventions shown in the table below, where <net> is the network number assigned to your host-only network. VMware Workstation always uses a Class C address for host-only and NAT networks.

Address Use on a Host-Only Network <table border="1" cellpadding="5" cellspacing="0"> <caption></caption> <tr bgcolor="#CCCCCC"> <th><div style="font-size: 9pt"><b>  Range </b></div> </th> <th><div style="font-size: 9pt"><b> Address use </b></div> </th> <th><div style="font-size: 9pt"><b> Example </b></div> </th> </tr> <tr> <td><div style="font-size: 9pt">  <net>.1 </div> </td> <td><div style="font-size: 9pt"> Host machine </div> </td> <td><div style="font-size: 9pt"> 192.168.0.1 </div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.2-<net>.127 </div> </td> <td><div style="font-size: 9pt"> Static addresses </div> </td> <td><div style="font-size: 9pt"> 192.168.0.2-192.168.0.127 </div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.128-<net>.254 </div> </td> <td><div style="font-size: 9pt"> DHCP-assigned </div> </td> <td><div style="font-size: 9pt"> 192.168.0.128-192.168.0.254 </div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.255 </div> </td> <td><div style="font-size: 9pt"> Broadcasting </div> </td> <td><div style="font-size: 9pt"> 192.168.0.255 </div> </td> </tr> </table>

Address Use on a Host-Only Network
  Range
 Address use
 Example
  <net>.1
 Host machine
 192.168.0.1
  <net>.2-<net>.127
 Static addresses
 192.168.0.2-192.168.0.127
  <net>.128-<net>.254
 DHCP-assigned
 192.168.0.128-192.168.0.254
  <net>.255
 Broadcasting
 192.168.0.255

Address Use on a NAT Network <table border="1" cellpadding="5" cellspacing="0"> <caption></caption> <tr bgcolor="#CCCCCC"> <th><div style="font-size: 9pt"><b>  Range </b></div> </th> <th><div style="font-size: 9pt"><b> Address use </b></div> </th> <th><div style="font-size: 9pt"><b> Example </b></div> </th> </tr> <tr> <td><div style="font-size: 9pt">  <net>.1 </div> </td> <td><div style="font-size: 9pt"> Host machine </div> </td> <td><div style="font-size: 9pt"> 192.168.0.1 </div> </td> </tr> <tr> <td><div style="font-size: 9pt"> <net>.2</div> </td> <td><div style="font-size: 9pt"> NAT device</div> </td> <td><div style="font-size: 9pt"> 192.168.0.2</div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.3-<net>.127 </div> </td> <td><div style="font-size: 9pt"> Static addresses </div> </td> <td><div style="font-size: 9pt"> 192.168.0.3-192.168.0.127 </div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.128-<net>.254 </div> </td> <td><div style="font-size: 9pt"> DHCP-assigned </div> </td> <td><div style="font-size: 9pt"> 192.168.0.128-192.168.0.254 </div> </td> </tr> <tr> <td><div style="font-size: 9pt">  <net>.255 </div> </td> <td><div style="font-size: 9pt"> Broadcasting </div> </td> <td><div style="font-size: 9pt"> 192.168.0.255 </div> </td> </tr> </table>

Address Use on a NAT Network
  Range
 Address use
 Example
  <net>.1
 Host machine
 192.168.0.1
 <net>.2
 NAT device
 192.168.0.2
  <net>.3-<net>.127
 Static addresses
 192.168.0.3-192.168.0.127
  <net>.128-<net>.254
 DHCP-assigned
 192.168.0.128-192.168.0.254
  <net>.255
 Broadcasting
 192.168.0.255

previous Prev   Contents   Last   Next next