Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:10.20.0.1  Bcast:10.20.0.255  Mask:255.255.255.0
inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
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:10.20.0.10  Bcast:10.20.0.255  Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fea1:65a1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
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

share|improve this question

migrated from serverfault.com Jan 16 at 17:34

This question came from our site for professional system and network administrators.

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer
    
got it. Thanks for the answer. –  Shnkc Jan 16 at 14:44
    
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 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 192.168.56.0/255.255.255.0

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 192.168.56.1 and the port 3128.

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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