Routing Traffic between Subnets in your Hyper-V Lab

Sometimes I need to replicate customer issues in a Hyper-V lab to fully understand and fix the problem. My labs are typically pretty small and disposable - I set them up for a specific purpose and then trash them.  For this reason I  use Windows 8 Hyper-V running locally on my laptop.  This was working great for me until recently when I needed to replicate a customer problem involving a specific site/subnet configuration. I wanted a way to route between subnets within my Hyper-V lab.

This is a quick and painless guide to quickly set yourself up a software-based router (Windows 2008R2 Routing and Remote Access) to route traffic between subnets in your Hyper-V lab. There may be other methods out there but this works for me.

1.      Set up your lab as normal. I’m going to use the diagram below for my example. The goal is to route traffic from Network A to Network B and back the other way.



2.      Create a new VM in Hyper-V. Name it something obvious like “Router”. Allocate at least 512MB RAM and 10GB Storage.

3.      Give it a second Network Adapter. In the settings for the “Router” VM, click “Add hardware-> Network Adapter->Add”.

Ensure both of your network adapters are connected to the same Hyper-V Network. In my diagram below, you’ll see I’m using a virtual network called “Private Switch”.


4.      Install Windows Server 2008 R2 on the “Router” VM.

5.      In Server manager, Install the “Network Policy and Access Services” Role, Followed by “Routing and Remote Access Services”


6.      Configure your two Network Interfaces on the “Router” VM.

Network A (NIC1)

Network B (NIC2)

IP Address:

Subnet Mask:

Default Gateway: blank

DNS Server: blank

IP Address:

Subnet Mask:

Default Gateway: blank

DNS Server: blank


7.      In Server Manager, Right click “Routing and Remote Access” and select “Configure and Enable Routing and Remote Access”

8.      Select “Secure connection between two private networks”. Select “No” then “finish”



9.      Your Windows router is now set up!

 Now you just have to set the default gateway for the rest of the machines in your lab (by using DHCP options or static configuration).

Network A – Default gateway of

Network B – Default gateway of


Clients in Network A can now be routed to Network B and vice-versa. Use Ping to test it works.






Comments (5)

  1. Simon says:

    I run a RouterOS instance for this with hardly any storage/memory, it has features like iBGP and OSPF which make it very useful and you can't get with RRAS unfortunately.  You can also control routing between various VLAN's when supplied with a single tagged interface and it has a nice windows UI you can run without needing to remote desktop.

    There are other solutions out there that also have decent features, but I haven't managed to get by with RRAS for this purpose.  It's good for client access but there's some weird behaviour and not enough control or protocols supported at all.  Plus some odd packet loss sometimes with traceroutes going through it.

  2. Joao Paulo says:

    Another method which does not need an additional VM serving as a router is by simply changing the following registry key on your localhost: HKLMSystemCurrentControlSetServicesTcpipParameters – IPEnableRouter to 1.

  3. Indraneel Nandoskar says:

    Thanks for the wonderful information. Let me tell what i tried!

    I want to have Networks.

    Network A :

    Network B:

    I created a new windows 2008 R2 machine as router. I installed routing and remote access as mentioned above. I added two network adaptors in this machine.

    I have a domain controller in Network A (IP :; hence i assigned as default gatewaye to it.

    I added another stand alone machine in network B (IP: with default gateway as

    All the network adaptors on the same Hyper Network

    from router, I am trying to ping as following

    from to>>>>>>>Success

    from to>>>>>>Request time out

    from to>>>>>>Success

    form to>>>>>failed.

    can anybody tell me if i have missed anything ??

    1. Ihtesham says:

      Don’t ping the router VM, ping the machines in both subnets to each other.

  4. asda says:

    add a route between A and B and B and A

Skip to main content