3

My host is windows 7 and my guest (virtual machine) is ubuntu. I cannot connect to internet when I am on virtual environment. I am using Oracle VirtualBox. Any idea? Thanks.

5 Answers 5

9

1- edit the file " interfaces":

sudo nano /etc/network/interfaces 

2- then make sure this line is in that file :

iface eth0 inet dhcp

3- run dhclient

4- run ping 8.8.8.8

5

There are several modes in which you can connect to internet inside from a virtual machine. Easiest is using NAT.

Select your Ubuntu virtual machine in virtual box manager and go to settings. Navigate to Network and select NAT as shown in the screenshot.

enter image description here

When you open Ubuntu go to Network Connection and go to Wired tab and select your connection and Edit. Use Automatic (DHCP) under IPv4 Settings. Also you can check the connect automatically. Then your system will be connected to network every time you open it.

enter image description here

7
  • did you able to connect?
    – sourav c.
    Jul 18, 2014 at 8:38
  • It failed to connect.
    – Charlo123
    Jul 18, 2014 at 8:56
  • is your host network functioning properly? Was the connection established at all in guest? how did you check? usually it should connect if you would able to follow the instruction properly. try restarting the virtual machine and check all the settings once. we need some more info to help you to troubleshoot.
    – sourav c.
    Jul 18, 2014 at 9:40
  • Yes I have followed all ur setting above. I also have restarted the vm.
    – Charlo123
    Jul 18, 2014 at 9:42
  • which version of virtual box and Ubuntu are you using?
    – sourav c.
    Jul 18, 2014 at 9:46
2

Close Virtual Box

Right click on Virtual Box instance, and select Settings.

On the Network Tab > Adapter 1, Select Bridged Adapter option to the Attached to dropdown .

Start Virtual Box instance

ping google.com

0

This same problem was solved for me by changing a previously selected setting. When I originally set up VB I configured it to use a wireless connection. But then wireless for me became unavailable because of my situation, but I had forgotten that I needed to change the setting in VB to use a wired connection instead.

I don't know if this reflects your situation, but here are the steps for changing connection type:

Open VB, go to Settings, Network, Adapter 1, "Name", choose connection type.

1
  • I think this is pretty well covered in the July 2014 answer May 23, 2017 at 21:21
0

I also had the problem that I couldn't access the Internet from my Ubuntu VM. I forgot that on the host machine (Windows 10 x64) still, an OpenVPN connection was active.

I closed OpenVPN on the Windows machine and it worked again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .