[Solved] Host Interface -> Guest can't connect internet

Discussions related to using VirtualBox on Windows hosts.
Post Reply
thundersnows
Posts: 4
Joined: 4. Apr 2009, 16:36
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu

[Solved] Host Interface -> Guest can't connect internet

Post by thundersnows »

Hi,
I'm using Virtualbox 2.1.4 on WinXP.
I have internet cable
IP : <public>
Subnet : 255.255.255.0
Gateway : <provider>
DNS Servers : 61.247.0.8, 202.73.99.8
I run Ubuntu on Guest OS and use Host Interface
IP : <public>
Subnet : 255.255.255.0
Gateway : <provider>
DNS Servers : 118.136.79.1, 61.247.0.8, 202.73.99.8
Right now I can ping from host to guest and vice versa.
But I can't connect to internet from my guest OS.
Can someone point me what did I missed ?
Thanks.

Modedit: removed your public internet IP address for safety. Never post your IP address on the web.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Host Interface -> Guest can't connect internet

Post by vbox4me2 »

Remove the primary DNS from the Guest(leave other 2).
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host Interface -> Guest can't connect internet

Post by Sasquatch »

Problem is your internet connection. You try to get a second IP on an interface where your provider will only supply one. You're not connected to the internet using a router, so your Guest will never be able to use HIF like it's supposed to. If you want to use HIF, you have to install the loopback adapter (see the VirtualBox FAQ). For just internet, use NAT.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Host Interface -> Guest can't connect internet

Post by vbox4me2 »

Why? before you removed the IP's it clearly shows .74 for the Host and .75 for the Guest, only the dns was a bit mixed up, unless he set the Guest static with a 'stolen' second public ip...
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host Interface -> Guest can't connect internet

Post by Sasquatch »

True. Some providers don't limit it, while they actually should. And there is already a shortage on IPv4 addresses.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
thundersnows
Posts: 4
Joined: 4. Apr 2009, 16:36
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu

Re: Host Interface -> Guest can't connect internet

Post by thundersnows »

Thanks for replying.

I set static IP to my guest OS. How can we know if we're limited to 1 IP only from ISP ?
I'd like to use host interface, so I can try setup a server on my guest OS, and pretend my host OS as the client.
If I use NAT, my host can't connect to guest.

I'll try another way :
- use NAT on guest OS, DHCP IP (internet should be working fine)
- set MS Loopback adapter on host OS, set static IP to the same class as guest OS

I think my host OS should be able to connect guest OS and vice versa.
I'll update you all the result.
Thanks for your help.
thundersnows
Posts: 4
Joined: 4. Apr 2009, 16:36
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu

Re: Host Interface -> Guest can't connect internet

Post by thundersnows »

Here's the result

Host OS
IP : 10.0.2.10
Subnet : 255.255.255.0
Gateway : not set
Guest OS (DHCP)
IP : 10.0.2.15
Subnet : 255.255.255.0
Gateway : 10.0.2.2
DNS : 10.0.2.3
I'm not able to ping between host and guest :(
I tried to change host gateway to be the same with guest (10.0.2.2) with no result (even ping to the gateway)
It seem like virtualbox does not allow direct connection between host and guest in NAT mode.
is there anyway I can connect my host to guest, and guest can connect to internet ?
Thanks.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Host Interface -> Guest can't connect internet

Post by vbox4me2 »

What you want is only possible with the Host interface, so get a second IP address from your ISP or place a router and forward services as needed which is what a router is made to do.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host Interface -> Guest can't connect internet

Post by Sasquatch »

thundersnows wrote:Here's the result

Host OS
IP : 10.0.2.10
Subnet : 255.255.255.0
Gateway : not set
Guest OS (DHCP)
IP : 10.0.2.15
Subnet : 255.255.255.0
Gateway : 10.0.2.2
DNS : 10.0.2.3
I'm not able to ping between host and guest :(
I tried to change host gateway to be the same with guest (10.0.2.2) with no result (even ping to the gateway)
It seem like virtualbox does not allow direct connection between host and guest in NAT mode.
is there anyway I can connect my host to guest, and guest can connect to internet ?
Thanks.
Using NAT, and then set HIF to use the same range as NAT is asking for problems. Like vbox4me2 said, get some things straight first. And please learn a thing or two about networking, saves us both a lot of throuble.

If you want to do it the easiest way, and the cheapest, use only one HIF interface, no NAT or whatever. Then right click on your internet connection on the Host, go to the advanced tab of the properties and enable Internet Sharing. Select the loopback adapter if you have more than one additional NIC and that's it. Now use DHCP on the Guest with HIF selected to the loopback.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
thundersnows
Posts: 4
Joined: 4. Apr 2009, 16:36
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu

Re: Host Interface -> Guest can't connect internet

Post by thundersnows »

Thanks Sasquatch for the idea ICS, I almost forgot this feature :)
It works now.
ironmonger
Posts: 2
Joined: 25. Jul 2009, 22:49
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: Host Interface -> Guest can't connect internet

Post by ironmonger »

If you want to do it the easiest way, and the cheapest, use only one HIF interface, no NAT or whatever. Then right click on your internet connection on the Host, go to the advanced tab of the properties and enable Internet Sharing. Select the loopback adapter if you have more than one additional NIC and that's it. Now use DHCP on the Guest with HIF selected to the loopback.
This appears to be the solution to the same problem I am having. However, I am finding it difficult to implement. Can someone please post detailed, step-by-step instructions?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Host Interface -> Guest can't connect internet

Post by Sasquatch »

You can't get it more detailed than that. It's just these steps you need to take. What isn't working on your end now? Remember, the steps I described were for an older version of VB that used virtual interfaces for it's Host Interface, or Bridged mode. VB now no longer needs them and can access the NIC directly.

For your situation, it might be best to use the Host-Only adapter for ICS. Go to the preferences of VB itself and select network. There you can change the configuration for the interface. Set the IP address to 192.168.0.1, netmask 255.255.255.0. Disable the DHCP server if it isn't already and that's it. Now the Guest should get an IP from Windows itself and be able to get onto the internet, while you can also access the Host.

Something more easy is to set up two network interfaces for the Guest. One with NAT for internet, the other with Host-Only for Host <> Guest communication.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
ironmonger
Posts: 2
Joined: 25. Jul 2009, 22:49
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu

Re: Host Interface -> Guest can't connect internet

Post by ironmonger »

Thank you. What confused me were the differences between the two versions of VirtualBox. The second solution of setting up a Host-only and NAT adapter works just fine.
Post Reply