Assigning an IP Address to a Virtual Machine

Whether you are using host-only, network address translation (NAT), or bridged networking, each virtual machine must be assigned an IP address. For host-only networking, the host must also be assigned an IP address.

Note: Be aware that if the host computer is set up to boot multiple operating systems and you run one or more of them in virtual machines, you need to configure each operating system with a unique network address. People who boot multiple operating systems often assign all systems the same address, since they assume only one operating system is running at a time. If you use one or more of the operating systems in a virtual machine, this assumption is no longer true.

Dynamic versus static

You have two choices for setting up IP addresses for virtual machines:

Using DHCP to assign IP addresses is simpler and more automatic than statically assigning them. Most Windows operating systems come pre-configured to use DHCP at boot time so they are functional the first time they are booted, without additional configuration. (Using this option requires you to have a DHCP server installed on your host.) 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 host-only DHCP server to always assign the same IP address to each of these virtual machines.

For virtual machines that you do not expect to keep for long, use DHCP and let it allocate an IP address. If you are using host-only or NAT networking, you can use the DHCP server that comes with VMware ESX Server. However, this DHCP server does not service virtual (or physical) machines residing on bridged networks.

Network addresses used for virtual private networks

Note that for each virtual private 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 or NAT network. VMware ESX Server always uses a Class C address for host-only and NAT networks.


Address Use



Host machine

<net>.2 -- <net>.127

Static IP addresses --

<net>.128 -- <net>.254

DHCP-assigned IP addresses --


Broadcasting IP addresses

If you are using host-only networking, you can find out the network address for your virtual private network using the following command from a shell window:

> ifconfig

Running this command from the host operating system does not work for NAT networking because the host operating system is not aware of the virtual private network. You can, however, run the command from a guest operating system running in a virtual machine to find out the network address of the virtual private network.

Note: When host-only networking or NAT is enabled at the time VMware ESX Server is installed, the network number to use for the virtual private network is automatically selected as an unused private IP network number. For NAT, the virtual private network is assigned as its IP address.

If the virtual private network is using a private IP network number that is in use, you can change it. The first option is to uninstall VMware ESX Server and then re-install it with host-only networking. The second option is to edit the virtual machine's configuration file (.cfg) and change the configuration parameters vmnet HostOnlyNetwork and vmnet HostOnlyNetmask to the intended values.

Configuring the VMware ESX Server DHCP server with static network addresses

If you want to configure the VMware ESX Server DHCP server with a fixed set of IP addresses, you must edit the DHCP configuration file for VMnet1 (/etc/vmware/vmnet1.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).

A virtual DHCP server can be attached to only one virtual switch. Additional virtual DHCP servers can be set up for configurations that need them.

Back to top

© 2001-2002 VMware, Inc. All rights reserved.