17

I have set up Ubuntu 14.04 on hyper-v in Windows 8.1. I also have an external network switch linked to Ethernet. The internet and LAN works fine on my host windows 8.1 PC. But I am not able to use internet on Ubuntu hyper-v, although I am able to use LAN(internal network of my organization) on Ubuntu hyper-v.

Please help me resolving the issue.

23

I've read a lot of articles about this issues, and many claim to share the internet connection of the wifi adapter to solve the issue. This did not work in my case. What did work for me, and it should answer your question:

  1. Created an internal virtual switch under Hyper-V.

    1. Open "Hyper V Manager"
    2. Select "Virtual Switch Manager"
    3. Under New Virtual Switch, select "Internal"
    4. Select "Create Virtual Switch"
  2. Shutdown the Ubuntu VM

  3. Add a legacy adapter with the internal virtual switch that was just created in step 1.

  4. Open "Network and Sharing Center"

  5. Select "Change Adapter Settings".

  6. Select your Wifi Adapter and the Virtual Switch you just made, right click menu option "Create Bridge"

  7. Start the Ubuntu VM

  8. Login to Ubuntu

  9. Wait a minute, the connection should connect...

7
  • What does step 3 mean? Add a legacy adapter?
    – CornSmith
    May 13 '16 at 4:41
  • 4
    Step 3 really needs more information... Jun 7 '16 at 8:22
  • Step 3: In your VM settings, under "Network adapters" add the virtual switch which you created in step 1. Jul 12 '16 at 14:56
  • These steps didn't help until I switched to the 2.4 GHz end-point on my dual band router.
    – IPSUS
    Nov 5 '16 at 23:56
  • Why type should be Internal?
    – Eugene
    Feb 13 '17 at 12:16
3

After following above steps you should be able to connect but if you are seeing that your host (Windows) and guest (Ubuntu) have the same IP Addresses, you may not be able to connect to the Internet from guest machine:

You can follow steps below to switch to manual IP settings to make it work, as that helped me :)

  1. Run ipconfig /all on windows command prompt and note:

    a) IPv4 Address (may be suffixed as Preferred)

    b) DNS Server IP Address

    c) Subnet Mask

    d) Default Gateway

  2. Open Network and Sharing Center and select Change Adapter Settings

  3. Take your virtual switch vEthernet adapter out of the bridge (if bridged)
  4. Go to properties of the virtual switch
  5. You will found option Internet Protocol Version 4 (TCP/IPv4) under list box
  6. Go to Properties of IPv4 option. It will open another dialog box
  7. Go to Alternate Configuration tab
  8. Select User configured option
  9. You can put an IP address of your choice here. It's easier to change the last portion of IP address (with some higher number) noted at step 1-a and put here. e.g. if my IPv4 IP address at step 1-a is 192.168.0.102, I would put 192.168.0.135 here.
  10. Put address noted at step 1-c in field Subnet Mask
  11. Put address noted at step 1-d in field Default gateway
  12. Put address noted at step 1-b in field Preferred DNS server
  13. You can leave the other fields
  14. Click OK and come out of IPv4 properties and vEthernet properties dialog boxes.
  15. Bridge it again (if you removed it earlier)
  16. Log into the Ubuntu hyper-v machine
  17. Go to Network via Unity
  18. You should see Wired network connected otherwise wait for couple of minutes. (If no wired option is visible there please select Auto Ethernet once from top right desktop menu option)
  19. Click-on Options button that will open dialog box
  20. Go to IPv4 Settings tab
  21. Select Method as Manual
  22. Put IP Address that you have configured in virtual switch (vEthernet) adapter. As per example it should be 192.168.0.135.
  23. Put subnet mask (step 1-c) & default gateway (step 1-d) under Netmask and Gateway field respectively.
  24. Put DNS Server IP Address in DNS servers field.
  25. Check Require IPv4 addressing..... option
  26. Save and close the dialog boxes
  27. This has given a fixed IP Address to your Ubuntu machine. You should be able to ping Default gateway from Ubuntu machine and connect the internet.
2
  • Welcome to Ask Ubuntu! ;-) You are allowed to edit existing answers and improve them! A reviewer like me will then review your edits and approve them if deemed valuable! Please don't add partial answers as answers here! ;-)
    – Fabby
    Apr 3 '16 at 23:10
  • Configuring a static IP worked for me when the DHCP wouldn't work. Apr 20 '16 at 20:58
0

On my laptop I have similar issue. What was more strange is that some time it works on WiFi and some times it was not.

During playing with it i found that it is working when it use 2.4 Ghz to make the connection while when 5 Ghz is used its need to be maed @BobBrown describe.

I set to forget the 5 Ghz network on my WiFi settings on my Win2012R2.

Best BaS

3
  • This also works on CentOS 7 and Ubuntu 16 as guest system
    – BaS
    Jul 23 '16 at 18:40
  • 1
    Welcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) Jul 23 '16 at 21:53
  • It was on the contrary for me. 5 GHz did work, 2.4 GHz didn't. Apr 2 '20 at 22:13

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