[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

Routing between Two Host-Only Networks

Routing between Two Host-Only Networks

If you are setting up a complex test network using virtual machines, you may want to have two independent host-only networks with a router between them.

There are two basic approaches. In one, the router software runs on the host computer. In the other, the router software runs in its own virtual machine. In both cases, you need two host-only interfaces.

The examples described here outline the simplest case, with one virtual machine on each of the host-only networks. For more complex configurations, you can add more virtual machines and host-only networks as appropriate.

Setting Up the First Host-Only Interface

Setting Up the First Host-Only Interface

On Windows hosts, the first host-only network is set up automatically when you install VMware Workstation.

On Linux hosts, the first host-only network was set up when you ran the vmware-config.pl script after you installed VMware Workstation, provided you agreed to install host-only networking. If you did not agree to use host-only networking, you need to run the script again to set up host-only networking.

Setting Up the Second Host-Only Interface - Windows NT Host

Setting Up the Second Host-Only Interface - Windows NT Host

Follow these steps to set up the second host-only interface on Windows NT.

  1. Open a command prompt window. Change to the VMware Workstation programs folder. If you accepted the default path, use this command:

    cd C:\Program Files\VMware\Programs

  2. Run the following command:

    vnetconfig -ih vmnet2

This creates a second host-only adapter, which can be configured from the Network control panel.

Setting Up the Second Host-Only Interface - Windows 2000 Host

Setting Up the Second Host-Only Interface - Windows 2000 Host

  1. Open the Control Panel (Start > Settings > Control Panel).

  2. Start the Add/Remove Hardware Wizard from the Control Panel.

    Note: You must have sufficient privileges to do this.

  3. Click Next to continue past the Welcome screen.

  4. Select Add/Troubleshoot a Device and click Next.

  5. Wait while Windows searches for new Plug and Play devices, then select Add a New Device from the Choose a Hardware Device screen and click Next.

  6. Select No, I want to select the hardware from a list and click Next.

  7. Select Network Adapters from the list and click Next.

  8. Select VMware, Inc. from the manufacturers list on the Select Network Adapter screen to get the list of available host-only network adapters, then select VMware Virtual Ethernet Adapter (for VMnet2) and click Next.

  9. Click Next in the Start Hardware Installation screen.

  10. Click Yes when prompted that the Microsoft digital signature is not present for the software about to be installed.

  11. Click Finish on the screen that indicates the adapter has been installed.

Setting Up the Second Host-Only Interface - Windows XP or Windows .NET Server Host

Setting Up the Second Host-Only Interface - Windows XP or Windows .NET Server Host

  1. Start the Add Hardware Wizard.

    Start > Control Panel > Add Hardware

    Note: You must have sufficient privileges to do this.

  2. Click Next.

  3. When prompted, select Yes, I have already connected the hardware.

  4. On the screen that lets you select the hardware, select Add a new hardware device, then click Next.

  5. Select Install the hardware that I manually select from a list (Advanced).

  6. Select Network Adapter.

  7. Select VMware, Inc. as the manufacturer.

  8. Select the host-only adapter for the appropriate VMnet.

  9. Click Yes when prompted that the Microsoft digital signature is not present for the software about to be installed.

  10. Click Finish on the screen that indicates the adapter has been installed.

Setting Up the Second Host-Only Interface - Linux Host

Setting Up the Second Host-Only Interface - Linux Host

  1. As root (su), run the VMware Workstation configuration script.

    /usr/bin/vmware-config.pl

  2. Use the wizard to modify your configuration. After asking about a NAT network, the script asks:

    Do you want to be able to use host-only networking in your virtual machines?

    Answer Yes.

    The wizard reports on host-only networks that you have already set up on the host or, if none is present, configures the first host-only network.

  3. The wizard asks:

    Do you wish to configure another host-only network?

    Answer Yes.

    Repeat this step until you have as many host-only networks as you want. Then answer No.

  4. Complete the wizard. When it is finished, it restarts all services used by VMware Workstation.

  5. Run ifconfig. You should see at least four network interfaces - eth0, lo, vmnet1 and vmnet2. If the VMnet interfaces do not show up immediately, wait for a minute, then run the command again. These four interfaces should have different IP address on separate subnets.

Setting Up the Virtual Machines

Setting Up the Virtual Machines

Now you have two host-only network adapters on the host computer. Each is connected to its own virtual switch (VMnet1 and VMnet2). You are ready to create and configure your virtual machines and connect them to the appropriate virtual switches.

Virtual Machine 1 - Connected to the Default Host-Only Interface

Virtual Machine 1 - Connected to the Default Host-Only Interface

  1. Create the virtual machine using the New Virtual Machine Wizard (on a Windows host) or Configuration Wizard (on a Linux host) or use an existing virtual machine.

  2. Launch VMware Workstation and open the virtual machine.

  3. Edit the configuration using the Configuration Editor (Settings > Configuration Editor).

    Windows host: Select Network Adapter and select Host-only (VMnet1) from the drop-down list on the right.

    If no network adapter is shown in the list of devices, click Add, then use the Add Hardware Wizard to add an adapter.

    Linux host: Click the + sign to expand the Ethernet Adapters list and select the first adapter. From the Connection Type drop-down list on the right, select Host-only.

    If the list of devices indicates the adapter is not installed, click Install.

Virtual Machine 2 - Connected to the Newly Created Host-Only Interface

Virtual Machine 2 - Connected to the Newly Created Host-Only Interface

  1. Create the virtual machine using the New Virtual Machine Wizard (on a Windows host) or Configuration Wizard (on a Linux host) or use an existing virtual machine.

  2. Launch VMware Workstation and open the virtual machine.

  3. Edit the configuration using the Configuration Editor (Settings > Configuration Editor).

    Windows host: Select Network Adapter and select Custom (VMnet2) from the drop-down list on the right.

    If no network adapter is shown in the list of devices, click Add, then use the Add Hardware Wizard to add an adapter.

    Linux host: Click the + sign to expand the Ethernet Adapters list and select the first adapter. From the Connection Type drop-down list on the right, select Custom. In the VMnet field, type /dev/vmnet2.

    If the list of devices indicates the adapter is not installed, click Install.

If you plan to run the router software on your host computer, you can skip the next section.

Virtual Machine 3 - Connected to Both Host-Only Interfaces

Virtual Machine 3 - Connected to Both Host-Only Interfaces

If you plan to run the router software on a virtual machine, set up a third virtual machine for that purpose.

  1. Create the virtual machine using the New Virtual Machine Wizard (on a Windows host) or Configuration Wizard (on a Linux host) or use an existing virtual machine.

  2. Launch VMware Workstation and open the virtual machine.

  3. Edit the configuration using the Configuration Editor (Settings > Configuration Editor).

    Windows host: Select the first network adapter in the list of devices and select Host-only (VMnet1) from the drop-down list on the right. Select the second network adapter in the list of devices, then select Custom (VMnet2) from the drop-down list on the right.

    If you need to add one or more network adapters, click Add, then use the Add Hardware Wizard to add an adapter.

    Linux host: Click the + sign to expand the Ethernet Adapters list and select the first adapter. From the Connection Type drop-down list on the right, select Host-only.

    If the list of devices indicates the adapter is not installed, click Install.

    Select the second adapter, then from the Connection Type drop-down list on the right, select Custom. In the VMnet field, type /dev/vmnet2.

    If the list of devices indicates the adapter is not installed, click Install.

Now you need to configure the networking components on the host and in the virtual machines. The recommended approach uses static IP addresses for all the virtual machines.

  1. Stop the VMnet DHCP server service.

    Windows host: In the Services control panel, find VMware DHCP Server and be sure it is stopped.

    Linux host: Stop the vmnet-dhcpd service.

    killall -TERM vmnet-dhcpd

  2. Install guest operating systems in each of the virtual machines.

  3. Install the router software - on the host computer or in the third virtual machine, depending on the approach you are using.

  4. Configure networking in the first two virtual machines to use addresses on the appropriate host-only network.

    On Windows hosts, you can open a command prompt and run
    ipconfig /all to see what IP addresses each host-only network is using.

    On Linux hosts, you can open a terminal and run ifconfig to see what IP addresses each host-only network is using.

  5. If you are running the router on the host computer, assign default router addresses based on the addresses of the host-only adapters on the host computer. In the first virtual machine's networking configuration, the default router address should be the IP address for the host-only adapter connected to VMnet1. In the second virtual machine's networking configuration, the default router address should be the IP address for the host-only adapter connected to VMnet2.

    If you are running the router software on the third virtual machine, set the default router addresses in the first two virtual machines based on those used by the third virtual machine. In the first virtual machine's networking configuration, the default router address should be the IP address for the third virtual machine's Ethernet adapter connected to VMnet1. In the second virtual machine's networking configuration, the default router address should be the IP address for the third virtual machine's Ethernet adapter connected to VMnet2.

At this point you should be able to ping the router machine from virtual machines one and two. And if the router software is set up correctly, you should be able to communicate between the first and second virtual machines.

previous Prev   Contents   Last   Next next