Virtual Machine (Ubuntu) cannot connect to internet

64,699

Solution 1

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

Solution 2

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

Solution 3

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

Share:
64,699

Related videos on Youtube

Charlo123
Author by

Charlo123

Updated on September 18, 2022

Comments

  • Charlo123
    Charlo123 over 1 year

    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.

  • sourav c.
    sourav c. almost 10 years
    did you able to connect?
  • Charlo123
    Charlo123 almost 10 years
    It failed to connect.
  • sourav c.
    sourav c. almost 10 years
    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.
  • Charlo123
    Charlo123 almost 10 years
    Yes I have followed all ur setting above. I also have restarted the vm.
  • sourav c.
    sourav c. almost 10 years
    which version of virtual box and Ubuntu are you using?
  • Charlo123
    Charlo123 almost 10 years
    Hi VB version 4.3.12 and ubuntu is the ubuntu 14.04. I cannot either to drag drop file to my host OS. is it due to firewall of my office? I am installing it on my office pc.
  • sourav c.
    sourav c. almost 10 years
    versions are fine. But it is highly unusual. usually in NAT guest uses the network of host without any trouble. I have no clue what is happening to you. I will inform you if I find anything. drag and drop or sharing the clipboard are different issue. you need to install virtualbox extendtion pack and guest addition for those.
  • Charles Green
    Charles Green almost 7 years
    I think this is pretty well covered in the July 2014 answer