Jitendra, one of the readers of Sysprobs requested the below information with his home testing/lab environment scenario. Also, he sent his lab setup diagram. This small guide shows how to configure and use a virtual machine in VMware to act as a LAN router between two networks. This will be very helpful for learning purpose with a real-world scenario and even in a production environment to connect two separate networks. Instead of using a physical router or routing appliance, we will be using the Windows server service to connect two networks.
Update: This article originally published in the year 2011, since it has older versions of products such as Windows 2003 server and VMware workstation. But generally, these methods apply to any versions of the product at the moment, either it can be Windows 2019 server or latest Vmware workstation.
Here is the picture describing the current lab setup of Jitendra. Even though one network switch is placed in the setup, but you can notice two networks in this setup.
Our target is to make communication (let’s say ping and reply) between these two networks by using VMware virtual machine as a router between these networks.
Note – By adding another network IP address range as the secondary IP in each network adapter will help to make network communication when all devices connected to the same network switch. But, that will not be in a real-world practical environment and you may face issues while configuring domains, sites and DNS.
I don’t have more than two physical computers to demonstrate the exact scenario described in the above picture.
I have two physical computers.
1) Desktop computer with VMware workstation
These two computers physically connected via network cable.
Desktop IP – 192.168.2.100
Subnet mask – 255.255.255.0
Laptop IP – 192.168.1.100
Subnet mask – 255.255.255.0
Obviously, these two devices can’t communicate now since both are in a separate network.
Important Note – Before doing anything, make sure Windows or other firewall programs are turned off or set to allow network connectivity.
Steps Involved in Using VMware Virtual Machine as a LAN Router between Two Networks
1) Add one more virtual network adapter to VMware virtual machine. Make sure that VM is having two network adapters and connected. Configure both network types to ‘Bridged Mode’, so Windows OS can communicate to both 192.168.1.x and 192.168.2.x networks.
2) Configure each network adapter inside the virtual machine for each network. In my case, I configured one adapter to 192.168.1.10 and the other one to 192.168.2.10.
Before going to the next step, test this network configuration by pinging from server to other network nodes on each network.
So, from Windows server virtual machine in VMware, I could ping to my desktop host (192.168.2.100) and laptop host (192.168.1.100), in the opposite direction, I could ping to Windows Server virtual machine from my Desktop and Laptop physical computers.
These steps make sure that the current network setup including bridged mode and two virtual network adapters are working fine.
3) Now go to ‘Routing and Remote Access’ under ‘Administrative Tools’ Windows server virtual machine. If you do not find this option or tool, you need to install the ‘Routing and Remote Access’ feature on the latest Windows Server Operating Systems such as 2016 and 2019.
Right-click on Server and select ‘Configure…’ option as shown below.
4) Press Next and select ‘Custom Configuration’. Select ‘LAN Routing’ option and start the service at the end.
5) That’s it, it will simply start the routing service in the server. Make sure your both network adapters are listed.
6) Now, we need to configure the Windows server IP address as Gateway to other networked nodes.
All devices in 192.168.1.x network should have 192.168.1.10 (Windows server IP) as the gateway and 192.168.2.x devices should have 192.168.2.10 as the gateway.
7) Now all packets will be routed through Windows server routing services. I can ping to desktop (192.168.2.100) from the laptop (192.168.1.100) now.
If you face any difficulties in about setup, disable and enable the physical network adapter where VMware workstation and the virtual machine is running.
The Windows server which is working as a virtual machine will act as the router to connect these two networks. Instead of doing any other tricks, we are using the proper Windows service to manage routing in this scenario. Typically, this method can be applied to the production environment on a physical or virtual server as long as you have more than two network cards and each of them connected to a separate network.
I hope this guide is helpful to use VMware virtual machine as a router to connect two networks in testing or production environment without using the real network router.
This method is applicable for all latest Windows servers that support ‘Routing and Remote Access’ feature. Also, this method can be used on Oracle VirtualBox and Hyper-V If you properly configure two network adapters in bridged networking type with the physical network.