You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by illusion <sa...@hotmail.com> on 2008/06/12 23:14:11 UTC

mapping tomcat to ip address behind router

Hey,

I want to set-up tomcat to serve http requests from behind a router.  When
there is a direct internet connection and no router, and the address
property is added and port number is changed in server.xml as below in
example 1, tomcat serves requests fine for http://99.153.32.456. 

When I set it up to run behind a router as show in example 2, with the
router forwarding requests to 192.168.0.54 which is the computer behind the
router with tomcat, it does not work for the url http://99.153.32.456.  What
is the correct way to set it tomcat behind a router?

thanks in advance for your assistance

Example 1 - no router - works

<Connector port="80" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               address="99.153.32.456"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="80" protocol="HTTP/1.1"
               address="99.153.32.456" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    -->       

Example 2 - behind router - does not work

<Connector port="80" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               address="192.168.0.54"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="80" protocol="HTTP/1.1"
               address="192.168.0.54" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    -->   

    
-- 
View this message in context: http://www.nabble.com/mapping-tomcat-to-ip-address-behind-router-tp17809837p17809837.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by Steve Ochani <oc...@ncc.edu>.
On 12 Jun 2008 at 14:14, illusion wrote:

Date sent:      	Thu, 12 Jun 2008 14:14:11 -0700 (PDT)
From:           	illusion <sa...@hotmail.com>
Subject:        	mapping tomcat to ip address behind router
To:             	users@tomcat.apache.org
Send reply to:  	Tomcat Users List <us...@tomcat.apache.org>

> 
> Hey,
> 
> I want to set-up tomcat to serve http requests from behind a router.
> When
> there is a direct internet connection and no router, and the
> address
> property is added and port number is changed in server.xml as below
> in
> example 1, tomcat serves requests fine for http://99.153.32.456. 
> 
> When I set it up to run behind a router as show in example 2, with
> the
> router forwarding requests to 192.168.0.54 which is the computer
> behind the
> router with tomcat, it does not work for the url
> http://99.153.32.456.  What
> is the correct way to set it tomcat behind a router?

Your ISP, like most others, blocks port 80 for home/non business connections. You will have 
to run tomcat on a non standard port such as 10000. Keep in mind that running servers on 
your connection may violate the terms of service of your ISP.


-Steve O.




> 
> thanks in advance for your assistance
> 
> Example 1 - no router - works
> 
> <Connector port="80" protocol="HTTP/1.1" 
>                connectionTimeout="20000" 
>                address="99.153.32.456"
>                redirectPort="8443" />
>     <!-- A "Connector" using the shared thread pool-->
>     <!--
>     <Connector executor="tomcatThreadPool"
>                port="80" protocol="HTTP/1.1"
>                address="99.153.32.456" 
>                connectionTimeout="20000" 
>                redirectPort="8443" />
>     -->       
> 
> Example 2 - behind router - does not work
> 
> <Connector port="80" protocol="HTTP/1.1" 
>                connectionTimeout="20000" 
>                address="192.168.0.54"
>                redirectPort="8443" />
>     <!-- A "Connector" using the shared thread pool-->
>     <!--
>     <Connector executor="tomcatThreadPool"
>                port="80" protocol="HTTP/1.1"
>                address="192.168.0.54" 
>                connectionTimeout="20000" 
>                redirectPort="8443" />
>     -->   
> 
>     
> -- 
> View this message in context:
> http://www.nabble.com/mapping-tomcat-to-ip-address-behind-router-tp1
> 7809837p17809837.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> --------------------------------------------------------------------
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: mapping tomcat to ip address behind router

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: illusion [mailto:sanjay_sss@hotmail.com]
> Subject: mapping tomcat to ip address behind router
>
> I want to set-up tomcat to serve http requests from
> behind a router.

I think you mean proxy, not router; strictly speaking, routers don't fiddle with IP addresses, they just pass them on.

> <Connector port="80" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                address="192.168.0.54"
>                redirectPort="8443" />

What happens if you simply remove the address attribute, since it is highly likely to be unnecessary?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Illusion,

illusion wrote:
| I tried taking the address="192..." portion out in the example 2 where
| tomcat is behind a router and it made no difference.  In relation to
port 80
| being blocked, in example 1 above where there is no router, it works fine
| when tested with the url with the ip address assigned by the ISP,
| "http://99.....", so port 80 is not being blocked.

If you really are talking about a router (and not a proxy, as Chuck
suggests), have you set up your router to forward requests to port 80 to
go to your internal IP address (192.168.0.54)? If not, there's no reason
to expect your router to automagically forward port 80 traffic to one
specific machine on your internal network.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhRrAUACgkQ9CaO5/Lv0PDNuwCguS7M60B1pIYsjM/2wTD9fcNm
yDoAnjVoQi0pBGqThx4wAKR2wACJjx/m
=OI9K
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by illusion <sa...@hotmail.com>.
Hey,

I tried taking the address="192..." portion out in the example 2 where
tomcat is behind a router and it made no difference.  In relation to port 80
being blocked, in example 1 above where there is no router, it works fine
when tested with the url with the ip address assigned by the ISP,
"http://99.....", so port 80 is not being blocked.





   



-- 
View this message in context: http://www.nabble.com/mapping-tomcat-to-ip-address-behind-router-tp17809837p17811501.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Illusion,

illusion wrote:
| Yes I do have it setup to forward to port 80 of the internal ip address
| "192....".  Not sure what I'm missing or have incorrect.

Well, whatever the solution is, there's no need to specify the "address"
in server.xml unless you want to specify a single network interface for
your server. For the time being, you should leave that out.

Have you tried to hit your server from outside your network, or only
from inside? Some crappy routers don't properly route internal traffic
back into the internal network when you use the outside IP address
(though it is unlikely to be affecting you, here).

Just grasping at straws since your setup seems to be sane, yet the
observations are not. :(

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhRsYQACgkQ9CaO5/Lv0PCI/wCfYStwRI/0Q2hqs5J/Prt2ScSQ
978AoIn8z+22bMVgDvFcWI/kiYZIaaRG
=zGnZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by illusion <sa...@hotmail.com>.
Hey,

Yes I do have it setup to forward to port 80 of the internal ip address
"192....".  Not sure what I'm missing or have incorrect.

thanks for the suggestions
-- 
View this message in context: http://www.nabble.com/mapping-tomcat-to-ip-address-behind-router-tp17809837p17811853.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by Eric Gichuhi <Er...@kemri-ucsf.org>.
Hi, 

Try using a subdomain DNS eg myservice.mydomain.com that will resolve
internally to http://192.168.0.54 (behind router) and externally to
http://99.153.32.456(direct internet connection). The DNS Server should do
the rest - basically forward all requests from behind the router to the
given subdomain.

Cheers!

Rgds,
Eric 


-----Original Message-----
From: "Johnny Kewl" <jo...@kewlstuff.co.za>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Date: Fri, 13 Jun 2008 06:07:42 +0200
Subject: Re: mapping tomcat to ip address behind router

> 
> ----- Original Message ----- 
> From: "illusion" <sa...@hotmail.com>
> To: <us...@tomcat.apache.org>
> Sent: Thursday, June 12, 2008 11:14 PM
> Subject: mapping tomcat to ip address behind router
> 
> 
> >
> > Hey,
> >
> > I want to set-up tomcat to serve http requests from behind a router. 
> When
> > there is a direct internet connection and no router, and the address
> > property is added and port number is changed in server.xml as below
> in
> > example 1, tomcat serves requests fine for http://99.153.32.456.
> >
> > When I set it up to run behind a router as show in example 2, with
> the
> > router forwarding requests to 192.168.0.54 which is the computer
> behind 
> > the
> > router with tomcat, it does not work for the url
> http://99.153.32.456. 
> > What
> > is the correct way to set it tomcat behind a router?
> >
> > thanks in advance for your assistance
> >
> > Example 1 - no router - works
> >
> > <Connector port="80" protocol="HTTP/1.1"
> >               connectionTimeout="20000"
> >               address="99.153.32.456"
> >               redirectPort="8443" />
> >    <!-- A "Connector" using the shared thread pool-->
> >    <!--
> >    <Connector executor="tomcatThreadPool"
> >               port="80" protocol="HTTP/1.1"
> >               address="99.153.32.456"
> >               connectionTimeout="20000"
> >               redirectPort="8443" />
> >    -->
> >
> > Example 2 - behind router - does not work
> >
> > <Connector port="80" protocol="HTTP/1.1"
> >               connectionTimeout="20000"
> >               address="192.168.0.54"
> >               redirectPort="8443" />
> >    <!-- A "Connector" using the shared thread pool-->
> >    <!--
> >    <Connector executor="tomcatThreadPool"
> >               port="80" protocol="HTTP/1.1"
> >               address="192.168.0.54"
> >               connectionTimeout="20000"
> >               redirectPort="8443" />
> >    -->
> 
> illusion, you have now probably screwed up the TC config...
> Reload the the standard TC config, and just change the 8080, to 80,
> dont 
> touch other stuff for now.
> 
> Then google, I think you have one of those ADSL Nat Router things
> Heres an article with someone else struggling along
> http://sanzon.wordpress.com/2008/04/04/setting-up-web-server-behind-rou
> ter-wrt54g2/
> 
> Whats probably screwing you up is even though you have it forwarding,
> the 
> IP's internally are being dynamicly assigned, you have to give the
> server a 
> fixed IP, typically this is not the ISP IP, its the machine IP, and
> then you 
> need to check the machine and make sure its using your router as the 
> gateway.
> 
> Its not really a TC thing, best thing is to look at the router name and
> google for it and web server.
> These little box's now a days have some amazing functionality, so you
> need 
> to find the manual for the thing.
> 
> You need to check the Dynamip DNS is not on, DHCP is not assinged to
> the 
> server, the DNS discovery is set or on auto, the network masks are
> right 
> etc.
> If your SP supplied the router, they "should" know how to set the thing
> up, 
> dont mention tomcat, its got nothing to do with it, just tell em its a
> web 
> server on a machine.... if that works, TC will work.
> 
> And then learn to do things like ping a machine etc.
> 
> Have fun....
> 
> 
> -----------------------------------------------------------------------
> ----
> HARBOR : http://www.kewlstuff.co.za/index.htm
> The most powerful application server on earth.
> The only real POJO Application Server.
> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
> -----------------------------------------------------------------------
> ----  
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mapping tomcat to ip address behind router

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "illusion" <sa...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Thursday, June 12, 2008 11:14 PM
Subject: mapping tomcat to ip address behind router


>
> Hey,
>
> I want to set-up tomcat to serve http requests from behind a router.  When
> there is a direct internet connection and no router, and the address
> property is added and port number is changed in server.xml as below in
> example 1, tomcat serves requests fine for http://99.153.32.456.
>
> When I set it up to run behind a router as show in example 2, with the
> router forwarding requests to 192.168.0.54 which is the computer behind 
> the
> router with tomcat, it does not work for the url http://99.153.32.456. 
> What
> is the correct way to set it tomcat behind a router?
>
> thanks in advance for your assistance
>
> Example 1 - no router - works
>
> <Connector port="80" protocol="HTTP/1.1"
>               connectionTimeout="20000"
>               address="99.153.32.456"
>               redirectPort="8443" />
>    <!-- A "Connector" using the shared thread pool-->
>    <!--
>    <Connector executor="tomcatThreadPool"
>               port="80" protocol="HTTP/1.1"
>               address="99.153.32.456"
>               connectionTimeout="20000"
>               redirectPort="8443" />
>    -->
>
> Example 2 - behind router - does not work
>
> <Connector port="80" protocol="HTTP/1.1"
>               connectionTimeout="20000"
>               address="192.168.0.54"
>               redirectPort="8443" />
>    <!-- A "Connector" using the shared thread pool-->
>    <!--
>    <Connector executor="tomcatThreadPool"
>               port="80" protocol="HTTP/1.1"
>               address="192.168.0.54"
>               connectionTimeout="20000"
>               redirectPort="8443" />
>    -->

illusion, you have now probably screwed up the TC config...
Reload the the standard TC config, and just change the 8080, to 80, dont 
touch other stuff for now.

Then google, I think you have one of those ADSL Nat Router things
Heres an article with someone else struggling along
http://sanzon.wordpress.com/2008/04/04/setting-up-web-server-behind-router-wrt54g2/

Whats probably screwing you up is even though you have it forwarding, the 
IP's internally are being dynamicly assigned, you have to give the server a 
fixed IP, typically this is not the ISP IP, its the machine IP, and then you 
need to check the machine and make sure its using your router as the 
gateway.

Its not really a TC thing, best thing is to look at the router name and 
google for it and web server.
These little box's now a days have some amazing functionality, so you need 
to find the manual for the thing.

You need to check the Dynamip DNS is not on, DHCP is not assinged to the 
server, the DNS discovery is set or on auto, the network masks are right 
etc.
If your SP supplied the router, they "should" know how to set the thing up, 
dont mention tomcat, its got nothing to do with it, just tell em its a web 
server on a machine.... if that works, TC will work.

And then learn to do things like ping a machine etc.

Have fun....


---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------  


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org