Tomcat – Access tomcat from outside LAN

local-area-networktomcatwide-area-network

Hi I'm developing a web app in eclipse and using a tomcat server (6.0) integrated with the IDE.
I'm perfectly able to access the webapp from localhost or another computer in the LAN (http://192.168.0.2:8080/ works fine) and using https://www.grc.com/x/portprobe=8080 I can see that the router and my firewall work fine and the port is open. But still I can't access the from the URL I've created with dyndns. It just timeouts. Doesn't work using directly my IP from whatsmyip, so is not a problem of dyndns

Anyone can help me access tomcat from outside LAN?

Thanks

Best Answer

Are you trying to test this access to your "dyndns" URL from a computer on the LAN? The hostname in that URL is going to resolve to your public IP address, and it may be that your firewall / router doesn't support "hairpin NAT-- that is, having a request coming in from the LAN-side interface that needs to be routed back to the LAN-side interface.

If, indeed, you're trying to access it from off-site and it's not working then you probably need to check a few thngs:

  • Is the Tomcat server able to access the Internet itself? (i.e. is its default-gateway set properly) If not, then rectify that problem first.

  • When you attempt to source a connection from the Internet to the Tomcat server do you see the packets ever make it to the Tomcat server? (You don't mention your OS, but you should get familiar with the built-in packet sniffing tools in your OS. I "reach for the sniffer" earlier than most admins, but my philosophy is something like "If I have a tool that will let me see what's going on down on the wire then I'm going to use it.) If the Tomcat server is a Linux box, fire up tcpdump with a command-line like "tcpdump port 8080" (assuming that the box has a single interface-- you'll need to specify the interface number of not) and watch for your TCP SYN's coming in from the Internet. If it's a Windows machine, install the built-in Network Monitor or Wireshark and run a quick sniff. If you can establish early that your firewall/router is getting the packets to you then you won't end up fighting for hours only to find out that the port-foward there is the issue.