Host-Only guest can't reach the net... - Solved

Discussions about using Windows guests in VirtualBox.

Host-Only guest can't reach the net... - Solved

Postby markfilipak » 22. Jul 2012, 03:31

...Well, it does reach the net for DNS, but it can't ping (or http). I think I've tried everything but you may see something. What am I doing wrong?

Note: NAT worked, but I'd like to use Host-Only for various reasons.

My Current Network:
The Wi-Fi (192.168.1.100) has Internet Connection Sharing enabled for the VirtualBox Host-Only Network. I believe that it turns the host into the Host-Only network's Gateway. It works for DNS but not for data packets. I have all the well-known ports and protocols enabled in the Internet Connection Sharing, "Advanced Settings" dialog. I have set up (real) machines for such (real) interior networks in the past and it always worked. But not this time.

Guest's IP: 192.168.56.102/24
Guest's Gateway: 192.168.56.101
Guest's DHCP server: 192.168.56.100 <- set automagically?
Guest's DNS server: 192.168.56.101
Guest >ping 192.168.56.102 ...succeeds (<1ms)
Guest >ping 192.168.56.101 ...succeeds (1ms)
Guest >ping 192.168.56.100 ...fails
Guest >ping 192.168.1.100 ...succeeds (1ms)
Guest >ping 192.168.1.1 ...succeeds (2ms)
Guest >ping yahoo.com ...fails but DNS succeeds

Host's Host-Only IP: 192.168.56.101/24
Host's Host-Only Gateway: 192.168.1.100
Host's Host-Only DHCP server: 192.168.56.100 <- set automagically?
Host's Host-Only DNS server: 192.168.1.100
Host's Wi-Fi IP: 192.168.1.100/24
Host's Wi-Fi Gateway: 192.168.1.1
Host's Wi-Fi DHCP server: 192.168.1.1
Host's Wi-Fi DNS server: 192.168.1.1
Host >ping 192.168.1.1 ...succeeds (1ms)
Host >ping 192.168.1.100 ...succeeds (<1ms)
Host >ping 192.168.56.100 ...fails
Host >ping 192.168.56.101 ...succeeds (<1ms)
Host >ping 192.168.56.102 ...succeeds (<1ms)

Observations:
1 - 192.168.56.100 appears to be a DHCP server that just... appears! It does not ping.
2 - The first guest ping to yahoo.com fails completely but I can see what I assume to be DNS caching in the various activity lights. It goes all the way out to the Wi-Fi Gateway (and presumably out to the router and from there to the ISP's DNS server). Then, the second ping to yahoo.com, while also failing, shows the DNS which, due to caching, makes it only to the Host-Only DNS server where it is answered (the IP is 209.191.122.70). It's as though the 'reach' to Yahoo is just taking too long. I tried increasing the ping timeout all the way to 20 seconds but that didn't make a difference.
3 - Network discovery of workgroups, shares, etc. (i.e., My Network Places) is very fast in the guest. That is, the guest discovers the host's shares and printers almost immediately. However, in the host, network discovery of the guest is very, very slow, often taking 20 seconds.
4 - It sure would be nice if the virtual routers supported an HTTP console like a real router does.

Assumed DHCP & pools:
192.168.1.1 < Gateway Router < 65.185...
192.168.1.[100-199] < Wi-Fi < 192.168.1.1
192.168.56.[101-???] < Host-Only < 192.168.1.100

Comments? Help? Thanks in advance - Mark.
Last edited by markfilipak on 3. Aug 2012, 00:27, edited 2 times in total.
I tried godaddy.com & domainsbyproxy.com ...and I'm sorry I did!
markfilipak
 
Posts: 141
Joined: 15. Jul 2012, 18:23
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux Mint 14

Re: Host-Only guest can't reach the net...

Postby Perryg » 22. Jul 2012, 04:37

Host-only can not talk to the outside world.

Host-only networking is another networking mode that was added with version 2.2 of VirtualBox. It can be thought of as a hybrid between the bridged and internal networking modes: as with bridged networking, the virtual machines can talk to each other and the host as if they were connected through a physical ethernet switch. Similarly, as with internal networking however, a physical networking interface need not be present, and the virtual machines cannot talk to the world outside the host since they are not connected to a physical networking interface.
Perryg
Site Moderator
 
Posts: 25914
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Other

Re: Host-Only guest can't reach the net...

Postby markfilipak » 23. Jul 2012, 08:45

This is embarrassing. I could have sworn that I read that, in addition to allowing the host & guest to share, Host-Only would also allow both of them to access the net by enabling the host's Internet Connection Sharing. It DID work, but only for DNS. Why it didn't work for data packets is a mystery. Oh well. I guess I read it in one of those misinforming forum posts found via Google.
I tried godaddy.com & domainsbyproxy.com ...and I'm sorry I did!
markfilipak
 
Posts: 141
Joined: 15. Jul 2012, 18:23
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux Mint 14

Re: Host-Only guest can't reach the net... - Solved

Postby ASeales » 27. Jul 2012, 17:20

I'm not sure why the docs say this because it's not true. I'm using a Linux host and a Windows 7 guest with host-only adapter, and the Windows 7 guest can access the outside world. The outside world cannot access my guest, but my host can.

You need to configure your host to use internet connection sharing, as you correctly guessed.

I also had to configure my guest a bit by manually adding a default route to the routing table, manually add in a DNS server to the network interface, and adjust the Windows firewall to allow my host to connect to it.
ASeales
 
Posts: 2
Joined: 27. Jul 2012, 17:11

Re: Host-Only guest can't reach the net... - Solved

Postby BillG » 29. Jul 2012, 01:46

There is nothing special about the host only interface. It is just an interface in the host which a virtual machine can connect to. It behaves much like the Microsoft Loopback Adapter in Windows. Virtual machines connected to host only are in the same network as each other and also the host. By default the guests can only see each other and the host, but you can certainly route this network to any other network through the host. If you only want Internet access for the guests, ICS on the host will do fine.
BillG
Volunteer
 
Posts: 2200
Joined: 19. Sep 2009, 04:44
Location: Sydney, Australia
Primary OS: MS Windows 8
VBox Version: PUEL
Guest OSses: Win 7, Win8, Windows Server 2008&2012

Re: Host-Only guest can't reach the net... - Solved

Postby markfilipak » 29. Jul 2012, 05:31

Thanks for your reply. I use the Microsoft loopback on occasions when I want to snoop the net. My impression of Host-Only is loopback with NAT. I couldn't figure out why I couldn't get it to work.
ASeales wrote:I also had to configure my guest a bit by manually adding a default route to the routing table,
What default route was needed? Where? Host-Only is not a router, so I don't know to what route you're referring. Can you illuminate further?
ASeales wrote:manually add in a DNS server to the network interface,
I just put my exterior Wi-Fi router's IP (192.168.1.1) as the DNS server... I think I did that... so to what DNS server do you refer?
ASeales wrote:and adjust the Windows firewall to allow my host to connect to it.
I think that's not needed if the exterior router does DNS. (I don't like to punch holes in my firewall.)

Comments?

Thanks - Mark.
I tried godaddy.com & domainsbyproxy.com ...and I'm sorry I did!
markfilipak
 
Posts: 141
Joined: 15. Jul 2012, 18:23
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux Mint 14

Re: Host-Only guest can't reach the net... - Solved

Postby mpack » 29. Jul 2012, 10:54

markfilipak wrote:My impression of Host-Only is loopback with NAT.

I don't know what would give you that impression. Host-only is an Ethernet network, so NAT doesn't apply. Though as Bill says, ICS could provide a conduit for internet access.
mpack
Site Moderator
 
Posts: 13141
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Host-Only guest can't reach the net... - Solved

Postby markfilipak » 30. Jul 2012, 03:19

Thank you mpack. I didn't know that Host-Only is a link-layer switch. That's good information and may help me figure out why my original set up (see initial post in this thread) didn't work. The first time I was trying out Host-Only I thought I saw IPs like 10.0.2.1 but now I realize I'm confusing Host-Only with NAT. Sorry. This still leaves me with the question why my original setup worked for DNS but not for packets.

I'm going to do more experimentation. I may be revising the " - Solved" suffix I added to the subject. Ciao - Mark.
I tried godaddy.com & domainsbyproxy.com ...and I'm sorry I did!
markfilipak
 
Posts: 141
Joined: 15. Jul 2012, 18:23
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux Mint 14

Re: Host-Only guest can't reach the net... - Solved

Postby ASeales » 30. Jul 2012, 11:38

markfilipak wrote:
ASeales wrote:I also had to configure my guest a bit by manually adding a default route to the routing table,
What default route was needed? Where? Host-Only is not a router, so I don't know to what route you're referring.


In my guest OS(Windows 7) the default route was missing. Specifically, I had to run
Code: Select all   Expand viewCollapse view
route -p add 0.0.0.0 mask 0.0.0.0 192.168.56.1

192.168.56.1 is the address of the virtual interface in my guest os, so yours will be different. This is basically telling Windows how to access the internet. It's possible you don't need to do this if your DNS was working, but I did. You can tell if you need to. If you type
Code: Select all   Expand viewCollapse view
route print
There should be a similar line.

markfilipak wrote:
ASeales wrote:manually add in a DNS server to the network interface,
I just put my exterior Wi-Fi router's IP (192.168.1.1) as the DNS server... I think I did that... so to what DNS server do you refer?

That sounds right. In my case, there is a DNS server on my LAN, and that's the address I used. By default, my guest OS didn't know about it so I had to manually add it.

markfilipak wrote:
ASeales wrote:and adjust the Windows firewall to allow my host to connect to it.
I think that's not needed if the exterior router does DNS. (I don't like to punch holes in my firewall.)

Nothing to do with DNS. My guest was able to access the internet file, but my host was not allowed to connect to my guest(my host is Linux, my guest is WIndows). I want my host to access the guest, so I had to disable the Windows firewall to allow this. Alternatively, I could have opened up specific ports, but since my guest is not accessible to the world, I'm not bothered about completely disabling it.

If you don't need your host to access your guest, then you don't need a host-only adaptor. NAT will do fine.
ASeales
 
Posts: 2
Joined: 27. Jul 2012, 17:11

Re: Host-Only guest can't reach the net... - Solved

Postby markfilipak » 30. Jul 2012, 21:48

Thanks for the tips, ASeales. When I do what I think is needed (vis-a-vis DNS & gateway IP), I get in trouble. So I'm going to take it slowly this time. If you would kindly take a look at the attached file (I didn't know about the "route" cmd!), I'd appreciate your thoughts.
Guest ipconfig & routes.txt
(1.94 KiB) Downloaded 435 times
It sure seems like Host-only includes a router to me! Right now, the host side of Host-only is unreachable in the Guest. Thanks in advance - Mark.
I tried godaddy.com & domainsbyproxy.com ...and I'm sorry I did!
markfilipak
 
Posts: 141
Joined: 15. Jul 2012, 18:23
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Linux Mint 14

Re: Host-Only guest can't reach the net... - Solved

Postby B0zmeister » 13. Aug 2013, 20:59

Yeah I had this problem it was a total pain! But I solved it by simply installing Squid Cache Proxy server on my physical PC, and that way - my host-only internet virtualbox PCs could connect to the internet !

I did a quick 3 minute guide here - for anyone who want's to how it works !
b0zmeister,wordpress,com\allowing-host-only-virtualbox-guest-to-connect-to-the-internet
B0zmeister
 
Posts: 1
Joined: 10. Aug 2013, 15:51

Re: Host-Only guest can't reach the net... - Solved

Postby mpack » 14. Aug 2013, 11:01

I don't know why anyone would struggle - or write blogs - to give host only mode VMs access the internet. The whole point of the feature is that you not access the internet. If you want internet access then you would use one of the other built in networking modes, such as NAT or bridged. "Host Only" == "In a private network where the only accessible physical PC is the Host".
mpack
Site Moderator
 
Posts: 13141
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP


Return to Windows Guests

Who is online

Users browsing this forum: No registered users and 12 guests