Configuring Hyper-V for multiple subnets with only one NIC (Server 2008 R2 Edition)

 

 

Updated for 2012 R2: https://blogs.technet.com/b/letsdothis/archive/2013/11/11/configuring-hyper-v-for-multiple-subnets-with-only-one-nic-server-2012-r2.aspx

I wanted to configure my Hyper-V host with multiple subnets to give me a more realistic network configuration. Seeing how I do not have a full blown lab environment consisting of switches and routers which I could configure for multiple networks, I need a way to meet my needs. I came across numerous sites that contained some good information on achieving this and ultimately, I was not able to get this working properly with the information I found. They did however; lead me down the right path to accomplish what I needed…One Hyper-V host, multiple subnets, without the use of additional hardware or servers wasting my precious resources.

Typically, a virtual host would be dedicated as a virtual host without other roles installed to avoid impacting the performance of the virtual guests. Seeing how this is only used for my lab, I'm not too concerned with a performance impact.

Keep in mind...this post is intended for lab environments only! I do not claim this is a Microsoft supported configuration. You should contact Microsoft Support if you are in question of supported configurations.

 

My lab setup is as follows:

 

One Hyper-V host with 2 physical NICs (One NIC is not in use) and the host is running 14 virtual guests: (2 ConfigMgr, 2 DC, 2 App-V, 2 SQL, 2 Win7, 2 XP, 2 general use servers). All servers are running Windows Server 2008 R2 SP1 (host and guests).

My intentions are to divide the servers up, placing one of each type in each of the subnets/AD sites.

Now for the fun stuff…

 Configuring Virtual Networks

Assuming you have Hyper-V loaded already perform the following actions:

1. Open Hyper-V Manager and click on Virtual Network Manager on the Actions pane.

 

2. Click New virtual network and select Internal and click Add.

3. On the New Virtual Network window, fill in the following fields.

  • Name: vNet Internal 10.10.10.0/24
  • Notes: (optional)
  • Connection type: Internal only
  • Click OK

4. Click New virtual network and select Internal and click Add.

5. On the New Virtual Network window, fill in the following fields.

  • Name: vNet Internal 10.10.20.0/24
  • Notes: (optional)
  • Connection type: Internal only
  • Click OK

Configuring Network Adapters on the Hyper-V host

6. On the Hyper-V host, open your Network Connections so you can see the network adapters on the Hyper-V host. Once you have completed steps 2 through 5 above, you will see 2 new network adapters in the network connections window. It is recommended that you rename these from “Local Area Connection ‘X’” to match the names you provided in the previous steps or to something that will make it easy for you to distinguish which adapter belongs to what network. This will help eliminate any confusion when selecting the correct adapter for your VMs. It should look similar to this:

You can create as many different networks as you’d like by repeating the steps above.

7. Right click on the network adapter name vNet Internal 10.0 and click properties.

8. Click Internet Protocol Version 4 (TCP/IPv4) and click Properties.

9. Click the radio button for Use the following IP address:

  • IP Address: 10.10.10.1
  • Subnet mask: 255.255.255.0
  • Default Gateway: <blank>
  • DNS: <optional>
    • For each of the networks you created, you will need to perform the steps above. Keep in mind; you will need to give each additional network adapter the proper IP address. Since I used 10.10.20.0 as my second network; I would enter 10.10.20.1 in the IP address of the other NIC.

Configuring Routing and Remote Access Service (RRAS)

10. On the Hyper-V host, launch Server Manager.

11. Right-click Roles and select Add Roles.

12. When the Add Roles Wizard launches; on the Before you Begin page, click Next.

13. Select Network Policy and Access Services and click Next.

14. Read the introduction to Network Policy and Access Services page and click Next.

15. On the Role Services page, select Routing and Remote Access Services (if Remote Access Service and Routing are not automatically selected, select them at this time) and click Next.

16. On the Confirmation page, review your selections and click Install.

17. Click Close when the installation completes.

18. In Server Manager, expand the Roles node and then expand Network Policy and Access Services.

19. Right-click Routing and Remote Access and click Configure and Enable Routing and Remote Access.

20. Click Next at the setup wizard.

21. Select Custom configuration and click Next.

22. Select NAT and LAN routing.

  • Selecting NAT will allow your virtual machines to access the internet. If this isn't your intentions, do NOT select this setting.

23. Review your selections and click Finish.

24. Click Start Service when prompted.

25. Under Routing and Remote Access in the Server Manager, expand IPv4, click NAT and right-click and select New Interface.

26. In the New Interface for IPNAT window, select the network connection with internet access.

27. Select the option for Public interface connected to the Internet and also select Enable NAT on this interface and click OK.

28. You should now see something similar to this:

 

29. On each of your Hyper-V guests, configure the default gateway to the respective subnet. Below are how I have mine configured:

I have my Preferred DNS server pointing to a public DNS server to test my internet connection since I haven’t configured DNS for my new site. Once the site is configured, I’ll switch to the IP of the DNS server on my new site.

 If you can’t ping or access any UNC paths to servers on the other subnets, make sure you check the Windows Firewall and your user permissions. Good luck and enjoy your new setup! Cheers!

 PS...don't forget to assign your NICs to the appropriate network in the VM settings! (thanks Hyper-V Newb)