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

You can run the router software on the host system or on its own virtual machine. In both cases, you need two host-only networks.

In a simple configuration, you configure one virtual machine on each of the host-only networks. For more complex configurations, you can add more virtual machines and host-only networks.

Prerequisites

Create a second host-only network. On Windows and Linux host systems, the first host-only network (VMnet1) is set up for you when you install Workstation Pro. See Add a Host-Only Network.

Procedure

  1. Set up the connection to the first host-only network.
    1. Select the virtual machine and select VM > Settings.
    2. On the Hardware tab, select Network Adapter.
    3. Select Host-only to connect to the default host-only network (VMnet1).
  2. Set up the connection to the second host-only network.
    1. Select the virtual machine and select VM > Settings.
    2. On the Hardware tab, select Network Adapter.
    3. Select Custom and select the custom host-only network from the drop-down menu.
  3. (Optional) To run the router software on a virtual machine, set up a third virtual machine that has connections to the two host-only networks.
    1. Select the virtual machine and select VM > Settings.
    2. On the Hardware tab, select Network Adapter.
    3. Select Host-only.

      The adapter is connected to the default host-only interface (VMnet1).

    4. Select the second network adapter, select Custom, and select the custom host-only network from the drop-down menu.
  4. Stop the VMware DHCP Server service.

    Option

    Description

    Windows host

    Use the services.msc command to open the Services Console and stop the VMware DHCP Service.

    Linux host

    Use the killall -TERM vmnet-dhcpd command to stop the vmnet-dhcpd service.

  5. Install the router software on the host system or in the third virtual machine, depending on the approach you are using.
  6. Configure networking in the first two virtual machines to use addresses on the appropriate host-only network.

    Option

    Description

    Windows host

    Use the ipconfig /all command to determine which IP addresses each host-only network is using.

    Linux host

    Use the ifconfig command to determine which IP addresses each host-only network is using.

  7. Assign IP addresses.

    Option

    Description

    The router software is on the host system

    Assign default router addresses based on the addresses of the host-only adapters on the host computer. In the first virtual machine, the default router address should be the IP address for the host-only adapter connected to VMnet1. In the second virtual machine, the default router address should be the IP address for the host-only adapter connected to VMnet2.

    The router software is in a third virtual machine

    Set the default router addresses in the first two virtual machines based on the addresses that the third virtual machine. In the first virtual machine, the default router address should be the IP address for the network adapter connected to VMnet1 in third virtual machine. In the second virtual machine, the default router address should be the IP address for the network adapter connected to VMnet2 in third virtual machine.

  8. Ping the router machine from the first and second virtual machines.

    If the router software is set up correctly, you can communicate between the first and second virtual machines.