Updated for 2012 R2: http://blogs.technet.com/b/letsdothis/archive/2013/11/11/configuring-hyper-v-for-multiple-subnets-with-only-one-nic-server-2012-r2.aspxI 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.
4. Click New virtual network and select Internal and click Add.
5. On the New Virtual Network window, fill in the following fields.
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:
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.
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)
I don't get it since the title says that you have only one NIC, yet your environment is configured with two NICs on the host. Did I misunderstand something? And isn't a Hyper-V server not suppored to perform any other services? I mean, I know that Enterprise/datacenter edition can, but is it recommended on production servers?
This is more for a lab configuration. I should have made that more clearly in the beginning of the blog and I'll be sure to update this blog to reflect that. I do have 2 physical NICs installed but only one is in use. In the first image of the blog, you can see that the Intel NIC does not have any connectivity. I don’t have the proper hardware or the space in my lab to host allow me to have an ideal environment.
Typically you would not run other services on the Hyper-V host, such as a file and print server or in my case, the RRAS role. Most organizations would not be faced with the challenge I was… (requiring multiple subnets without a router). They would most likely have their networking team configure a switch port with the required subnet and the routing would take place on the switches/routers rather than the Hyper-V host.
Normally, a virtual host would be dedicated as a virtual host without other roles installed to avoid impacting the virtual guests. I cannot state whether or not the configurations I used above are supported or not. That would be something you would have to discuss with Microsoft support.
Hopefully this provides some clarification for you.. I have updated the blog to reflect your comments/concerns and they are greatly appreciated! Thanks!
Hi Chris. I was looking for this solution for quite some time now and this is exactly what I want to achieve. I followed through your guide but I am unable to RDP to my home server right after I do step 27. My Server only has hyper V role installed. I have installed NPAS and RRAS. It is connected to the internet via Network Cable and WiFi interfaces. I tried enabling NAT for both interfaces (fail). Then tried just WiFi (Fail) then tried just Network Cable (fail). Any idea why? Thanks alot.
@Red Prado: Not sure why you wouldn't be able to connect...
- You were able to connect via RDP prior to this?
- Is the server configured with a static IP?
- Is the firewall enabled and if so, does RDP have an exception made?
- When you say that it fails when you enable NAT, what errors are you seeing?
- Do the EventLogs show any further error messages?
Excellent instructions. This was just what I was looking for as I want to simulate my network environment in a test lab. I have four seperate locations connected via T1-MPLS WAN with 2 servers at each location. The only thing you forgot to mention is at the end in step 29. Since I created these Internal Vnet interfaces after I already had my Hyper-V guests installed, first I needed to assign the Hyper-V guest to the appropriate Internal Vnet Interface in Hyper-V manager. Then I could start the Hyper-V Guest and configure the IP information as you show. Thanks for these instructions, they helped a lot.
could you please also describe your settings for the onboard device and the vexternal device ?
I have crated a Hyper V external vn, not listed on task 26.
@Hyper-V Newb, glad they helped! I added a line at the end of the blog to cover your concerns. Thanks for the tip!
Perfect, this is exactly what I was looking for, thanks!
This is great information. Thanks a lot.
Apologies for leaving a new comment on your article that dates from more than a year.
I liked the setup and explanation you gave and did the same with my lab. All works well: same concepts as yours, internal VMs accessing perfectly the external and public networks.
But I also wanted access from the External to the Internal networks, for example RDP to the internal VMs using external IPs. This is not working and I don't understand why!
I've enabled RDP on the VMs. On the NAT-enabled interface (Public interface), I've added in the "Services and Ports" section a Remote Desktop rule to translate incoming RDP connections on the interface (192.168.0.51) on port 3391 and 3392 into 10.10.10.2-3 port 3389. I've made sure Firewall rules were open, but also disabling the firewall didn't change a thing. I cannot RDP or telnet using 192.168.0.1:3391 or 3392, although off course telnetting/RDP to the 10.10.10.x addresses from the Host works.
Tried checking the RRAS and Firewall logs but there was nothing related.
Any ideas what I am missing with what seems to be a basic NAT configuration? If not, do you have clues on how better to debug this?
@ Chris Jones Possible to do this on server 2012?? Not working for me at all.. anyone?
@Chris, can you possibly give us the same exact article but for windows 2012 server?
updated for 2012 R2: blogs.technet.com/.../configuring-hyper-v-for-multiple-subnets-with-only-one-nic-server-2012-r2.aspx
This was a great help!!!
This is one amazing article. Thanks Chris, I got my networking setup on my lab environment with ease.