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.
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 program 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 program again to set up host-only networking.
Follow these steps to set up the second host-only interface on a Windows host.
/usr/bin/vmware-config.pl
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.
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.
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.
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.
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.
If you plan to run the router software on your host computer, you can skip the next section.
If you plan to run the router software on a virtual machine, set up a third virtual machine for that purpose.
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.
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.
Windows host: Choose Edit > Virtual Network Settings > DHCP and click Stop service.
Linux host: Stop the vmnet-dhcpd service.
killall -TERM vmnet-dhcpd
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.
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.
© 1998-2004 VMware, Inc. All rights reserved.