34

I am unable to connect the Ubuntu guest (both 12.10 and 12.04) to the internet via hyper-V.

Here is what I have done so far (with much thanks due to @Kronos's blog post on the topic):

  • Created a switch in the switch manager with connection set to external, selected my wifi card (Intel Centrino Ultimate-N 6300 AGN). If it matters, the Microsoft Filtering Platform is checked under extensions.
  • Added this switch to my Ubuntu guest.
  • I also tried a different wireless card (Aethros 9285) and had the same issue.
  • Connecting through my wired card works just fine (assuming that I select that card, and I am wired in of course).
  • Making it a legacy network adapter does not fix the issue.

Ubuntu can see this connection, but is unable to connect to it. What follows is what I attempted to do to get Ubuntu to connect:

  • Start and restart the network manager
  • Restart the machine
  • Verify that it could in fact see the adapter (resulted in device not ready a few times) enter image description here

How can I get this to work properly?

Update: It works when connected to another wireless network (just not my university one). Additionally, Ubuntu still seems to be connected to the network even when I switched locations, though everything returns a "Destination Host Unreachable" from 10.0.44.159 (I assume that that is my host, as the guest can ping it just fine, but my host cannot). Why should the wireless network that it is on matter?

6
  • Firing up the vm right now :) Oct 19, 2012 at 14:11
  • As far as the bridge goes, that is the way that things were implemented for Client Hyper-V (Look at Figure 2) Oct 19, 2012 at 14:16
  • Do you have any other virtual machine software installed other than Hyper-V? For example, having VirtualBox installed can cause network issues with Hyper-V. forums.virtualbox.org/viewtopic.php?f=6&t=48044
    – James T
    Oct 20, 2012 at 3:47
  • @JamesT nope, just Hyper-V
    – soandos
    Oct 20, 2012 at 23:20
  • I don't suppose it's down to your university network, is it? Do they have any restrictions on number of devices or needs authentication to connect?
    – tombull89
    Oct 22, 2012 at 8:48

3 Answers 3

35

What appears to have been the problem is that the bridging protocol was not supported by the AP (access points) of my university.

Here is the workaround (as far as I can tell this way is more robust than the bridging way that is done by default, but there might be some additional overhead (not sure how much)):

  1. Create an internal network switch
  2. Connect it to the guest OS
  3. Connect the internal virtual adapter to the virtual adapter created by Hyper-V like so: enter image description here.
    Go to the adapter that provides internet access to the machine, and then click sharing. Select the adapter created in step 1.
  4. Everything should work well.

Credit for this solution goes to the networking people at Binghamton University, more specifically Joe and Alan.

11
  • Get Joe and Alan to join SU and let's get them some rep :P Oct 24, 2012 at 19:41
  • @KronoS actually they did comment about SU (I have one of the stickers on my keyboard) but told me to post it for them "just doing their jobs" etc.
    – soandos
    Oct 24, 2012 at 19:43
  • @soandos: Can you provide more detailed step-by-step instructions? Mar 12, 2013 at 3:56
  • @RichardCook what do you want me to add?
    – soandos
    Mar 12, 2013 at 5:07
  • Could you provide more information for step 3? Mar 12, 2013 at 5:27
11

I had the same problem. I was using my laptop which only has a wireless connection. No build in Ethernet card.

The system is windows server 2012 standard. I was trying to use hyper-v to install ubuntu 12.04 lts. I got the same issue. Ubuntu wont be able to access the internet, the network keeps connecting and disconnected.

So, i followed "Joe and Alan" 's approach. It works.

But I want to find why the external virtual switch wont work.

After i read through this blog,

Bringing Hyper-V to “Windows 8”

I found the issue and maybe a better solution.

for hyper-v, if the external virtual switch is on top of a wireless NIC, hyper-v used the Microsoft bridge in between to do the MAC translation. Because one wireless channel is bound with one MAC. Read the full article if you really want to understand.

Now, based on the information of that article, I can easily conclude that, there will be two IP addresses for that same MAC of the physical NIC if you look at the server from outside.

Of course the two IP addresses are assigned to two different virtual NIC with different MAC address if you look inside. But those two MAC are hidden behind the bridge and are not visual from outside.

The first IP will be used by host OS ( windows server 2012 in my case). That one has no problem because the DHCP server assign one when the machine boots up.

The issue comes with the second IP address, when you boot up the virtual machine, (ubuntu in my case), the virtual machine will try to get the IP address from DHCP server but it will fail. Most DHCP server, at least the router I have in my home, wont assign two different IP addresses to the same MAC. It probably give the same IP address back upon the virtual machine's DHCP request, but, it wont work because we can not use the same IP address to two machines. If some one can capture the packets of the DHCP might find the detail of the issue.

here some more information on DHCP

I am not sure if any DHCP server can provides two IP to one MAC. Based on @soandos 's description , seems yes.

Now, we know the real issue is that the virtual machine can not get the ip address assigned.

So, what's the solution?

The easiest one is just assign a static IP address in the virtual machine. After you boot up the virtual machine, you can assign a static IP address to that virtual machine. That works for me perfectly because i use my laptop at home only .

But in some situation, for example in a public wifi, you probably can not do this (safely).

1
  • Thanks for getting to the root of the problem. I had the same issue and I really needed an external connection rather than an internal one. Setting the static IPs with the external connection type did the trick. Thanks!
    – JohnP
    Nov 20, 2013 at 12:37
2

soandos's solution did not reliably work for me. Instead, liuhongbo's suggestion worked. The following was the setup that worked reliably. The network settings from within the Ubuntu virtual machine are on the left, and the ipconfig listings from Windows 8 are on the right.

Ubuntu and Windows 8 Network Configurations

Notice that the Subnet Mask, Default Gateway, and DNS Servers are the same both from within Ubuntu and within Windows 8. The only difference is the IPv4 Address, which is different only by one digit.

Not the answer you're looking for? Browse other questions tagged or ask your own question.