virtualbox in Ubuntu host no internet connection

28,444

After trying this and that, I fixed the problem as follows.

sudo gedit /etc/network/interfaces

I commented out auto lo and added auto eth0. After that I did

sudo service network-manager restart

Now networking works in all VirtualBox guest OSes.

I don't know how this works, but in my Kubuntu 12.04 the network interfaces was set to eth0, so, I thought of giving it a try, and it works.

Edit:

As per jdthood suggestion, I had to put back the lo for network manager to work properly. After few days when I restart my computer, it started saying Could not detect network and I uncommented out lo, so, now I have both

auth lo
auth eth0

and everything is working fine.

Share:
28,444

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    My hair is in fire trying to make Internet connection work in guest OS.

    I have Ubuntu 12.10 machine with VirtualBox 4.1.18 installed from Ubuntu Software Center

    I set PC-BSD and FreeBSD to work as GuestOS

    Now both GuestOS have no internet connection. I have tried different methods like:

    sudo apt-get install dnsmasq and changed the /etc/dnsmasq.d/network-manager config to add except-interface=lo which blocked all of my internet connections.

    I also added dns-nameservers 8.8.8.8 8.8.4.4 to /etc/network/interfaces and restart the network-manager.

    Finally I did VBoxManage modifyvm "PC-BSD" --natdnshostresolver1 on and VBoxManage modifyvm "PC-BSD" --natdnshostresolver1 on but to no avail.

    I have already tried NAT and different options in Bridged too

    I still don't have internet connection in GuestOS, is there anyway I can fix this ? As far as I think the problem is in Ubuntu 12.10 for not sharing the internet, but I don't know how to fix this.

  • Admin
    Admin about 11 years
    the cable connected is on, I have tried both NAT and bridged... IDK what's wrong... I even reinstalled virtualbox, but no internet connection
  • Admin
    Admin about 11 years
    I don't think its BSD problem, neither I am saying its Virtualbox problem... the Problem is in Ubuntu 12.10 IMO. I have Kubuntu 12.04 on other machine and I run PC-BSD, FreeBSD, Fedora and OpenSUSE without any internet problem. They are all using default NAT settings... That pc is quiet old and often runs out of memory while using virtualbox.
  • jdthood
    jdthood about 11 years
    If that fixed it then the problem was the missing auto eth0. You should put the auto lo back, though. The lo interface is necessary and should be brought up automatically at boot.
  • zwets
    zwets about 11 years
    If your eth0 was not enabled previously, then how did you have internet access at all from the host? As I mentioned in my answer, IF your host has normal internet connectivity, you need to do nothing but configure a NAT interface.
  • Admin
    Admin about 11 years
    @zwets the host had normal internet connection (wireless) and but internet was not working in Guest. When I changed it to eth0 suddenly everything is working.
  • Admin
    Admin about 11 years
    @jdthood I don't understand what is with lo but certainly it look like it was blocking internet connection to pass to Guest. I use wireless network and everything is working perfectly even after reboot. I really don't know why is eth0 or lo needed but I don't have internet connection problem now. Thanks for formatting the answer, I will check about network in ubuntu in details