THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

John Paul Cook

Using Wireless with Hyper-V

For those of us who do demos on laptops, Hyper-V provides great performance but no wireless capability. You simply can't bind a Hyper-V virtual machine to a wireless adapter, but you can implement a workaround in just a few minutes. There are three options. One option is to use Internet Connection Sharing (ICS, see Ben Armstrong's blog http://blogs.msdn.com/virtual_pc_guy/archive/2008/01/09/using-hyper-v-with-a-wireless-network-adapter.aspx). ICS imposes a restriction that seems too inconvenient to me. It requires an IP address of 192.168.0.1, which is also the default address for many NAT routers. Although it is possible to change the NAT router's address, there are always networks you're not allowed to reconfigure. A second option is to use Routing and Remote Access Service (RRAS, see Ken Schaefer's blog http://www.adopenstatic.com/cs/blogs/ken/archive/2008/01/17/15530.aspx). RRAS offers the flexibility of being able to change the IP address it uses to avoid conflicts. It requires the most steps but it can still be configured in under 10 minutes. The third option, which was suggested by a reader, is to bridge network connections. It's simple and quick to implement. My personal recommendation is to use RRAS.

Ken described the steps in written form. After explaining this in person to several people, I'm providing the screen captures so you can see exactly what you need to do for implementing either a network bridge or RRAS. The initial steps are the same for both.

You'll need to bind your virtual machines to an internal only virtual network adapter. Use the Virtual Network Manager in Hyper-V to accomplish this. Notice a meaningful name of Virtual Internal Network was specified, which is referenced in the next step. This step is necessary for both RRAS and bridging network connections.

ras2

To implement RRAS or a network bridge, go to Manage network connections to configure the network adapter. Notice that in this example, the Virtual Internal Network name from the previous step appears under Local Area Connection 3.

ras3

Select Internet Protocol Version 4 (TCP/IPv4) and click the Properties button. This is the same for both RRAS and a network bridge.

ras4 

To implement a network bridge, configure the virtual network adapter to use DHCP.
To implement RRAS, assign a static IP address on a different subnet than the one the wireless adapter is connecting to. The wireless adapter is connecting to a 192.168.0.x network, so 192.168.1.1 is specified to provide a different subnet for the virtual machines.

image             ras5
                           DHCP for Network Bridge                                                                                      Static IP for RRAS

To implement a network bridge, select both the virtual network adapter and the wireless adapter. Right-click and select Bridge Connections.

bridge

Your virtual machines bound to this bridged network adapter can use the wireless network adapter but they will not be able to access the host partition (physical computer) because of Windows Firewall. If you need your child partitions to have full connectivity to the parent partition, you'll need to change your Windows Firewall settings. On the Advanced tab, uncheck the network bridge to allow communication between the parent and child partitions. This is similar to what is shown in the last screen capture in this post.

To implement RRAS, add the RRAS role to your Hyper-V server. In the Server Manager, right-click Roles and select Add Roles.

ras1

A wizard will appear. Click Next to advance to the dialog box shown below. Check the box for Network Policy and Access Services and then click Next.

ras6 

You'll see a dialog box with no options. Click Next to advance to the following dialog box. Check the box for Routing and Remote Access Services. Be sure the two checkboxes underneath it are checked and click Next.

ras8

Click the Install button to install RRAS. When the installation finishes, click the Close button.

ras9

Once RRAS is installed, use the Server Manager to configure it. Right-click on Routing and Remote Access and select Configure and Enable Routing and Remote Access.

ras11

Select Network address translation (NAT) and click Next.

ras12

Select your wireless network adapter and click Next.

ras13

Select the network interface you assigned the static IP address to and click Next.

ras14

Select Enable basic name and address services and click Next.

ras15

Click Next and then click Finish on the screen that follow.

ras16

At this point, your virtual machine (called the child partition in Hyper-V parlance) has network connectivity, but not to the host physical machine (called the parent partition). If you want to enable child partition network access to the parent partition, you'll need to configure exceptions in Windows Firewall or disable it completely on the virtual network adapter used by your virtual machines.

ras18

Keep in mind that what was disabled here is the firewall on the internal network connection. The virtual machines are being routed to the network using the wireless adapter which is still protected by Windows Firewall.

Published Sunday, March 23, 2008 6:52 PM by John Paul Cook

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Adam Machanic said:

Just a note for anyone doing this who doesn't know much about networking in general.  I thought that my child partitions didn't have network access after following these steps, but the real problem was that they had no domain name service.  Solution: Enable the DNS Server Role on the parent partition.  This took me an embarrassingly long time to figure out, so I hope this comment saves some time for people trying to implement this solution!

December 12, 2008 2:57 PM
 

Shan said:

This didn't quite work for me.  There isn't quite enough technical information in this article to assist in troubleshooting or to adapt to a particular topology.  For example, I could not see some of my adapters in the RRAS setup, and I don't know what the role of the bridge adapter is.  The article would be more useful with documented IP addresses and showing how to validate the configuration.

August 4, 2010 5:51 PM
 

Michael said:

Great post. I tried all three approaches but to no avail, until I realized that I had the Hyper-V role enabled on the guest OS. As soon as I removed it my bridged connection started working. (I was using the same based VHD for creating the host and guest, booting the host VHD in Windows 7 to run Hyper-V).

August 27, 2010 1:03 PM
 

cg said:

Excellent article.

One more question though. I can remote admin from a different machine to the host Hyper V machine (Parent partition) for admin purposes. Once In the host admin machine, I can remote into the guest machine (Child Partition) as well. But I can't seem to remote into the guest machine directly from a different machine on the network. Is there anyway to do this?

Also, the domain for the guest machine (named server1) seems to be Sever1.mshome.net even though the workgroup I set is "WORKGROUP". Is there anyway to change this? Perhaps to Server1.virtual.net?

February 6, 2011 9:29 AM
 

Mictian said:

Hi John Paul Cook, that's a good post.

I have some issues. I have completed all this steps, one by one. But my virtual OS doesn't connect :S!

I have in both cases Windows Server 2008 R2 recently installed.

Something curious is that RRAS report some problems:

Error: "Unable to add the interface {...} with the Router Manager for the IPV6 protocol. The following error occurred: Cannot complete this function".

Someone have any idea. ¿?

Thanks.

February 25, 2011 2:43 PM
 

Roland Strauss said:

Tried it with SBS2008 as guest OS and it worked like a charm.

May 5, 2011 1:54 PM
 

Joe Meree said:

Great article.  Warning: I tried the bridged network connection approach and I didn't like it.  Next I tried to install RRAS.  It stopped me and said I had Internet Connection Sharing (ICS) implemented, which I didn't.  I deleted the network bridge adapter and it took out all my network connections AND my w2k8 r2 server manager AND it broke all my virtual machines.  Fortunately I had the VHD's on another disk and none of them were running.

August 18, 2011 4:16 PM
 

Joe Meree said:

Some notes on how I got this working:

RRAS-specific notes:

I did my wired connection first and then added my wireless connection to RRAS afterwards.

I had a domain controller (DC) with a DNS server on it.  The first time I ran the rras setup, I had the DNS server from that virtual DC specified on my host internal adapter ipv4 settings and it didn't work.  I removed rras, removed the dns server from the host internal adapter ipv4 settings and ran rras setup again.

After running rras, I had to add the host internal adapter static IP address to each VM internal adapter default gateway (DG) field to get this to work.  

It took some playing around and a few clicks on the "diagnose this adapter" button to get this to work.  

I found this article very helpful:

http://social.technet.microsoft.com/Forums/en/windowsserver2008r2networking/thread/186debd5-c43f-40b7-b482-e9f8d3bbfee7

I found it helpful to always rename a virtual adapter after creating it to keep them all straight.

-------

All of the hoops I jumped through for a year to get this working:

I've struggled for a year with virtual network adapters.  I've found that adding and removing virtual network adapters can really mess up your networking.  It turns out if you add and remove network adapters, they accumulate as "hidden".  I found an article that helped a lot.  http://www.gfi.com/blog/how-to-remove-hidden-network-adapters-from-virtual-machines/

For each VM: 1. Shutdown VM  2. Remove all the virtual network adapters from hyperv console settings  3. Start the vm and then use these commands from THE SAME elevated command prompt to delete all of the network adapters:

set devmgr_show_nonpresent_devices=1

start devmgmt.msc

-------

network bridge

I tried using the network bridge approach with multiple virtual network adapters.  That worked, but later on, when preparing to try rras, I deleted the network bridge adapter from the host.  Bad move.  It took out all of the network adapters, my windows server 2008 r2 (w2k8 w2k8r2) Server Manager AND all of my VM's.  Had to restore everything from backup.

-------

ics connection sharing

Next I tried internet connection sharing (ICS) and that didn't work very well. When I tried to install rras, it kept complaining about ics sharing being active when it really wasn't (restore from backup)

-------

bitlocker

I have my VMs on a second internal hard drive in my laptop.  My company requires bitlocker on all my partitions :(  I found that turning off bitlocker for the duration of this exercise makes it a lot easier to restore my w2k8 partition from my windows home server (WHS) backups.  I wish you could do snapshots on the host ;)

Once again, thanks John for helping (it's too late for my hair, I've already pulled it all out...)

Joe Meree, Microsoft Consultant

August 19, 2011 10:58 AM
 

Joe Meree said:

August 19, 2011 10:59 AM
 

Joe Meree said:

I've been working on this more.  I've been having issues with the stability of my virtual network.  Sometimes I get connected to the internet and sometimes I don't.  I went back and setup RRAS again with only my wireless adapter and it works.  When I go to server manager under RRAS/NAT and add in the wired adapter my virtual machine guests lose connectivity to the internet.  I have added the DNS role to my host and on my guest virtual internal adapters under ipv4, I have 192.168.1.1 as my gateway and 192.168.1.1 as my DNS server.  Also on the wireless adapter under NAT/properties, I have "enable NAT on this interface" checked.  Any ideas on how to get both the wired and wireless networks working at the same time?

September 9, 2011 12:37 PM
 

Joe Meree said:

So in the Network and Sharing Center, the Network types can pile up and mess up the virtual machine guest networking just like the virtual network adapters can (see above).  So, I clicked on the picnic bench icon (for public network type) and clicked on the "merge or delete network locations" link at the bottom of the dialog box.  In my case, on each guest, I removed all the networks except the domain network for my little domain.

For the DNS server I added, it turns out I can specify either the dns server on the domain controller or the dns server on my host.  I don't know if that was really necessary for my setup to work.  I'm certainly not going to screw around with it because everything is working now...

September 9, 2011 5:18 PM
 

Filoupe said:

Because my Win2008 R2 laptop is a direct access client I cannot completely remove the firewall on the virtual network adapter (For your security, some settings are controlled by Group policy).

I cannot remove a NIC from the profile using NETSH.(from Microsoft: you cannot use netsh to configure per profile enabling or disabling of specific connection types).

What are the exceptions I should have to enable child partition network access to the parent partition?

Thanks

November 23, 2011 6:32 AM
 

Jockie said:

thanks, so helpful :)

December 22, 2011 3:27 AM
 

Emmanuel said:

how would the set up look like if a relay agent was used with the RRAS? is it also possible?

January 9, 2012 8:05 AM
 

Emmanuel said:

just so that ki do not have to keep setting up RRAS if i change networks, as i use a usb wireless internet dongle.

and my adapter disappears everytime i unplug. i quiet remember seeing a similar setup like the one abve completed with a relay agent.

can someone please help me with that. i am just a student trying to set up my study Lab with my laptop.

thanks

January 9, 2012 8:09 AM
 

Fantastic Article - worked for me said:

This article is excellent!! I followed the steps to implement RRAS on my Hyper-V host and it works like a dream. The only additional step I had to make was to add the public DNS server (as configured by DHCP on the wireless card) as a secondary DNS server on my guests.

Thanks very much for taking the time to share this knowledge with us!

January 16, 2012 10:29 AM
 

Andrew Carter said:

Excellent work just the article I required ..

April 27, 2012 11:50 AM
 

Seyed said:

Answer to CG question to provide access to guests from different machines on the host:

CG: you should use external networks to do so.

February 13, 2013 11:44 AM
 

Seyed said:

Great Post John.

February 13, 2013 11:45 AM
 

Dips said:

Hi gurus

Just a quick question. I have tried everything mentioned in this post  without any success. I am running the following config:

Windows 2012 server, standalone on a workgroup, connected to the internet using a wire. The system has got 3 VMs running on Hyper-v. The 3 VMs are in their own network, part of their own domain, one DC, one server and one client. I want all 3 VMs to be able to access the internet through the host connection. On the virtual switch manager I have created an internal only switch and connected all the 3 Vms to it. On the host I have configured RRAS and NAT. From the host I can ping the 3 VMs. But from the VMs I can't communicate to outside. Both the wired network adapter and the vswitch has been configured to use dynamic IP. I can set the vswitch adapter with static IP, but then do I need to configure the vswitch as the gateway for the VMs? At this point the VMs are using the DC as the default gateway. I am trying to get a configmgr 2012 lab going and that is why having outside internet access should be ideal.Am I making some glaring errors?

Any help will be greatly appreciated.

Thanks and kind regards,

March 4, 2013 1:00 AM
 

mjmart61 said:

Thank you so much for making this so clear and easy to follow.  I could not find the help I needed anywhere else.  Everything is working great!  Thanks again.

April 8, 2013 1:19 PM
 

Bhism said:

Thanks

April 9, 2014 4:21 PM
 

qix.dk » John Paul Cook : Using Wireless with Hyper-V said:

PingBack from http://qix.dk/?p=1210

April 9, 2014 7:33 PM
 

Orionshop.info said:

thank so much, i can't connect to Hyper-V virtual machine from another machine,

I have read in web, so good : http://superuser.com/questions/686473/how-to-use-multiple-desktops-within-a-hyper-v-hosted-vm

Thank, http://orionshop.info/

May 13, 2014 3:18 AM

Leave a Comment

(required) 
(required) 
Submit

About John Paul Cook

John Paul Cook is both a Registered Nurse and a Microsoft SQL Server MVP experienced in Microsoft SQL Server and Oracle database application design, development, and implementation. He has spoken at many conferences including Microsoft TechEd and the SQL PASS Summit. He has worked in oil and gas, financial, manufacturing, and healthcare industries. Experienced in systems integration and workflow analysis, John is passionate about combining his IT experience with his nursing background to solve difficult problems in healthcare. He sees opportunities in using business intelligence and Big Data to satisfy healthcare meaningful use requirements and improve patient outcomes. John graduated from Vanderbilt University with a Master of Science in Nursing Informatics and is an active member of the Sigma Theta Tau nursing honor society. Contributing author to SQL Server MVP Deep Dives and SQL Server MVP Deep Dives Volume 2.
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement