Q: There are some VMs with different subnets in the Hyper-V host, we want to make the VMs communicate with each other. Then, how to achieve this?
A: To achieve this, we need install and configure RRAS role on the Hyper-V Host, and here is the guide.
Lab Environment
- Hyper-V Host: Windows Server 2012 R2
- Computer Name: SERVERLAB-03
- Virtual Machines (with different subnets):
- Server2012test1 (with internal switch named virtualswitch1)
- Server2012test2 (with internal switch named virtualswitch2)
Note: if you use external virtual switches, then you need to create router for different subnet externally.
1. Configure IP address for each virtual switch
- Internal virtual switch 1 (Figure 1)
- IP Address: 192.168.1.1/24
Figure 1: IP configuration of Internal virtual switch 1
- Internal virtual switch 2 (Figure 2)
- IP Address: 192.168.2.1/24
Figure 2: IP configuration of Internal virtual switch 2
2. Configure IP Address, Gateway for Virtual Machines
If VMs want to access each other, we need to configure gateway for Server2012test1 and Server2012test2.
- Server2012test1 (Figure 3)
- IP address: 192.168.1.2/24
- Gateway: 192.168.1.1
- Connect to: Internal virtual switch 1
Figure 3: IP Configuration of Server2012test1
- Server2012test2 (Figure 4)
- IP Address: 192.168.2.2/24
- Gateway: 192.168.2.1
- Connect to: Internal virtual switch 2
Figure 4: IP Configuration of Server2012test2
3. Install RRAS on the Hyper-V Host
Open server manager and choose Add Roles and Features. Select the role “Remote Access”, then select “Routing” of “Role Services” tab and finish the wizard. (Figure 5, 6 and 7)
Figure 5: Install RRAS-1
Figure 6: Install RRAS-2
Figure 7: Install RRAS-3
4. Configure routing on RRAS
1) Click the “routing and remote access” in “tools” of “server manager” (Figure 8)
Figure 8: Configure routing-1
2) In the pop-up window, Right Click “your hostname”, choose “configure and enable routing and remote access” (Figure 9)
Figure 9: Configure routing-2
3) In the wizard, select “secure connection between two private networks” and click “next”. (Figure 10)
Figure 10: Configure routing-3
4) Then choose “no” in Demand-Dial connections to finish it. (Figure 11)
Figure 11: Configure routing-4
Now, Server2012test1 and Server2012test2 can communicate with each other.
In addition, you can setup a VM and configure RRAS on it.
Tag RRAS, Hyper-V, Routing between VMs
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.