I have opened a vm with hostonly network as networking option on my desktop. I have assigned an appropriate static ip to the vm. I can establish an ssh connection to it from my desktop and I can also ping my desktop from the vm. However, I can not reach to outside network inside the vm.

command ifconfig vboxnet0 returns on the desktop:

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
inet addr:  Bcast:  Mask:
inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:0 (0.0 B)  TX bytes:328130 (328.1 KB)

on the vm, ifconfig eth0 command returns:

eth0      Link encap:Ethernet  HWaddr 08:00:27:a1:65:a1  
inet addr:  Bcast:  Mask:
inet6 addr: fe80::a00:27ff:fea1:65a1/64 Scope:Link
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:15459 (15.4 KB)  TX bytes:15973 (15.9 KB)

The ip of the vm is static. vboxnet0 is assigned as virtual NIC of this vm. Wht further configuration should I do to provide internet connection with vboxnet0? Any help is appreciated.

My desktop os: ubuntu 12.04

The vm os: ubuntu server 12.04

Virtualization tool : virtualbox 4.3.6 r91406

3 Answers 3


That's the normal behavior of HostOnly. Only your host will be able to access your VM. If you want it to have internet access either use NAT or Bridge as Networking Option.

NAT will use your host computer as a relay to internet (but still in the 10.20.0.x range) and Bridge will make your VM part of your network like any other computer on the (probably) 192.168.x.x range.

Both solution will work, it's now up to you to choose what suit you best.

  • You don't have to choose. You can set up two adapters for the VM, and set one to be NAT while the other is host-only.
    – Kenster
    Jan 16, 2014 at 18:47

AH but it can be done as I had the same question a few weeks ago. Here's how I did it

Give the guest OS a Host Only Adapter (default one is vboxnet0) and make sure vboxnet0 does dhcp.

Install squid proxy (sudo apt-get install squid3

Open the file /etc/squid3/squid.conf and make the following changes:

A. Find the line with "http_access deny all" and comment it out by placing a # at the beginning of the line.

B. Paste the following two lines into the file:

acl allcomputers src

http_access allow allcomputers

Restart the squid 3 service by running: sudo service squid3 restart

In the guest OS make sure dhcp is set for the network card

Open Internet Explorer's Internet Options, Go to the Connections Tab, Click on Lan Settings..., Check the box for Proxy Server and make the address and the port 3128.

Internet works now on the guest and the guest can not see the local network.


From the manual, p 98:

the virtual machines cannot talk to the world outside the host since they are not connected to a physical networking interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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