• Digital accessories
  • Server
  • Digital life
  • Privacy policy
  • Contact us
  1. Home
  2. Article
  3. Routing between Two Host-Only Networks

Routing between Two Host-Only Networks

Rsdaa 05/12/2021 1835

VMware Workstation 5.0

Features | Documentation | Knowledge Base | Discussion Forums

Prev ContentsLastNext

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

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.

Setting Up the Second Host-Only Interface — Windows Host

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

1.Go to Edit > Virtual Network Settings > Host Virtual Adapters.

2.Click Add new adapter.

3.Choose the virtual network on which you want to use the adapter and click OK.

4.Click Apply.

5.Click OK to close the virtual network editor.

Setting Up the Second Host-Only Interface — Linux Host

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

/usr/bin/vmware-config.pl

2.Use the wizard to modify your configuration. After asking about a NAT network, the program 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

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

1.Create the virtual machine using the New Virtual Machine Wizard or use an existing virtual machine.

2.Launch VMware Workstation and open the virtual machine.

3.Edit the configuration using the virtual machine settings editor (VM > Settings).

Select Network Adapter and choose 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.

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

1.Create the virtual machine using the New Virtual Machine Wizard or use an existing virtual machine.

2.Launch VMware Workstation and open the virtual machine.

3.Edit the configuration using the virtual machine settings editor (VM > Settings).

Select Network Adapter and choose 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.

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 or use an existing virtual machine.

2.Launch VMware Workstation and open the virtual machine.

3.Edit the configuration using the virtual machine settings editor (VM > Settings).

Select the first network adapter in the list of devices and choose 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.

1.Stop the VMnet DHCP server service.

Windows host: Choose Edit > Virtual Network Settings > DHCP and click Stop service.

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 in 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.

Prev ContentsLastNext


PREV: Azure Functions networking options | Microsoft Docs

NEXT: What is Server: Definition, Types, Examples, Functions, and Uses

Popular Articles

Hot Articles

Navigation Lists

Back to Top