1

I've tried the following posts, as well as skimming through the VirtualBox manual:

I have a fresh Ubuntu 14.04.2 LTS installation. I installed the version of VirtualBox 4.3 available through the software center. I created two images, a Windows 7 image which I got from the modern.ie site, and an Ubuntu 14.04.2 LTS image which I created from an ISO disk image download from the Ubuntu site.

On the host computer, I am running a Tomcat server at port 8080.

The problem I'm having is that using 10.0.2.2 in my guest system hosts files as indicated in other threads does not work. I've tried both the bridged and default NAT network configurations. I also disabled the firewall in the Windows guest just in case.

My Ubuntu guest hosts file:

127.0.0.1   localhost
127.0.1.1   myguestimage

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

10.0.2.2 myhostimage.site.org

My Windows guest hosts file:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
(SNIP!)

10.0.2.2 myhostimage.site.org

The network tab on each of my Virtual Host boxes looks like this:

VirtualBox Settings Network Adapter 1 Tab Attached to: NAT

When I browse to http://myhostimage.site.org:8080 from a browser on either host image, the connection times out. I'm expecting to see the Tomcat server.

Next I tried switching to bridged networking, which didn't work. Then I tried changing 10.0.2.2 in the guest hosts files to the IP address of my host (192.168.1.41), which I got from running ifconfig. This hasn't worked either.

In the bridged/192.168.1.41 configuration, I ran nmap on the guest against the address of the host tomcat server and got the following.

me@myguestimage:~$ nmap myhostimage.site.org -p 8080

Starting Nmap 6.40 ( http://nmap.org ) at 2015-07-29 16:23 CDT
Nmap scan report for myhostimage.site.org (192.168.1.41)
Host is up (0.00012s latency).
PORT     STATE  SERVICE
8080/tcp closed http-proxy

What should I try next?

1 Answer 1

1

The nmap results were the biggest hint that the problem was not the network configuration with VirtualBox. The issue was with Tomcat.

I opened the conf/server.xml file in my Tomcat home directory. Then I changed the line

<Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443"
               address="myhostimage.site.org" URIEncoding="UTF-8"/>

to

<Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443"
               address="0.0.0.0" URIEncoding="UTF-8"/>

Suddenly, I could reach my host Tomcat from the guest VirtualBoxes. I even changed my VirtualBox settings back to NAT/10.0.2.2 and it still works.

I prefer the NAT/10.0.2.2 solution because I work on a laptop which I move from network to network, where it gets new IP addresses from DHCP. If I have to put the IP address in all of the hosts files, that's a pain.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .