Accessing guest app using host-only networking.

Discussions related to using VirtualBox on Windows hosts.
Post Reply
randymized
Posts: 4
Joined: 10. May 2009, 23:19
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: ubuntu 9.04

Accessing guest app using host-only networking.

Post by randymized »

Using VirtualBox 2.2.2
Windows XP SP2 host
Ubuntu 9.04 guest

I want to run an application (couchdb) that listens to port 5984 on the guest system and access it from the host system. My interpretation of the manual is that I should be able to do that using host-only networking. I also want to be able to access the internet from the guest.

I've tried several combinations of configurations, but with no success. While I have no problem reaching the Internet from the guest, I am unable to connect with couchdb.

My initial approach was to leave the original NAT networking on adapter 1 while installing host-only networking on adapter 2. If I then configure couchdb to listen to 127.0.0.1 and run it on the guest, I can connect to it from the guest but, to no surprise, not from the host. But if I reconfigure it to listen to 192.168.0.1 or 192.168.0.2, I cannot reach it from either the host nor the guest (in each case addressing port 5984).

One recommendation I've seen reading through other postings is to make the gateway address the same as the rest of the system, but I don't see any way to configure the gateway address for the adapter.

Beyond that, after a lot of experimentation and looking to other postings for suggestions, I am out of ideas and possibilities. Thank you in advance for any suggestions.
randymized
Posts: 4
Joined: 10. May 2009, 23:19
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: ubuntu 9.04

Re: Accessing guest app using host-only networking.

Post by randymized »

vbox4me2 wrote:The only option for this is Bridge networking.
Based upon this suggestion, I reconfigured the network so that there was only one adapter set up and it was configured as a bridged adapter. With that configuration, the guest could access the Internet, and if couchdb was configured to listen on 127.0.0.1, I could access couchdb from the guest, where it was running, but not from the host. But if I reconfigured couchdb to listen to 192.168.56.2, I could not access it from either box.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Accessing guest app using host-only networking.

Post by Perryg »

What you need to know is what is the address of the host and the guest. They both should be in the same subnet.
Let's say 192.168.1.1 is the gateway (your router) for both and their addresses are 192.168.1.3 subnet 255.255.255.0 and 192.168.1.4 subnet 255.255.255.0.
If the (couchdb) listens on the guest 192.168.1.4:5984 then the host will be able to talk to it.
It the address scheme subnets do not match then you still have something set wrong in their network settings.
You also need to make sure that you have a valid DNS on both to be able to talk to the internet. Usually all you need to do is give it the gateway of the router as they are usually set to provide this.
randymized
Posts: 4
Joined: 10. May 2009, 23:19
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: ubuntu 9.04

Re: Accessing guest app using host-only networking.

Post by randymized »

Perryg wrote:What you need to know is what is the address of the host and the guest.
I guess I don't know how to determine the address of the guest. The host's address is obtained from DHCP. It is visible in the router's user list. But even though I am able to browse the Internet from the guest, the guest does not show up separately in the router's list. I've been essentially pulling IP addresses out of the air. In the latest manifestation, I at least chose an address within the router's subnet, but I am still unable to access a server on that address from either the host or the guest.
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Accessing guest app using host-only networking.

Post by vbox4me2 »

Ip addresses: windows: ipconfig, linux: ifconfig.
randymized
Posts: 4
Joined: 10. May 2009, 23:19
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: ubuntu 9.04

Re: Accessing guest app using host-only networking.

Post by randymized »

That did the trick! To summarize, I am now using bridged networking, determine the IP address assigned by my router using ifconfig and then configure server applications to listen to that address. I can then access the serving application from both the host and guest machines.

I do anticipate the need to reconfigure should the router assign a different IP address at a different time and I'm not sure if there is any way to automate that or to assign a static address.
baf
Volunteer
Posts: 829
Joined: 27. Sep 2008, 06:18
Primary OS: Mac OS X Leopard
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,win7
Location: Luleå or Skellefteå, Sweden

Re: Accessing guest app using host-only networking.

Post by baf »

Many or perhaps most routers allows you to configure the dhcp server in them so that it will give out static address.
Look in your routers manual.
Some say: "You learn as long as you live".
My way: "You live as long as you learn".
Post Reply