aspose file tools*
The moose likes General Computing and the fly likes Resolving IP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Resolving IP" Watch "Resolving IP" New topic
Author

Resolving IP

Robbie McKinstry
Greenhorn

Joined: Dec 24, 2012
Posts: 5
Hi! I'm trying to set up a server to run on my home computer. I have TomEE up and running, the servlet's working fine when accessed through my localhost. However, when I try to access the servlet through my IP address or my hostname, I get an Unable to Connect error. My router is set up to port forward. I have purchased a domain name and I'm using http://freedns.afraid.org to support my domain name. What am I missing?

Any help would be appreciated. Thank you!

- Rob
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1067
    
  10

A couple of possibilities -
1) your firewall is blocking the traffic,
2) your router is like mine and will not route to my external IP address from my local area network. To test this just use a machine outside of your local area network to access your site. For development purposes I fool the router by going through an external proxy.
Robbie McKinstry
Greenhorn

Joined: Dec 24, 2012
Posts: 5
Unfortunately no luck on either front. I don't have a firewall running and I can't access the site from outside of my local area network. I called my registrar and they were able to determine that it's a problem on my machine, but with registration or with my dynamic DNS host. So we're able to narrow down the problem but still not luck with resolution.
All help is appreciated.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

What does the HTTP connector configuration in server.xml look like?

[My Blog] [JavaRanch Journal]
Robbie McKinstry
Greenhorn

Joined: Dec 24, 2012
Posts: 5
It says the following:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

That looks fine. What does the following command return from your client machine:

Robbie McKinstry
Greenhorn

Joined: Dec 24, 2012
Posts: 5
It produces the following:

Trying <the host ip here>...
telnet: Unable to connect to remote host: Network is unreachable
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

Robbie McKinstry wrote:It produces the following:

Trying <the host ip here>...
telnet: Unable to connect to remote host: Network is unreachable


That effectively means that this issue is related to your network settings and hasn't got anything to do with TomEE. That's what my initial thought was but I wanted to make sure that I wasn't taking a guess. So at this point you'll have to figure out why the server isn't accessible from that machine. Which OS is the server machine? Depending on that there are different ways to try and figure out why the server may not be accessible.

Robbie McKinstry
Greenhorn

Joined: Dec 24, 2012
Posts: 5
I'm running ubuntu.

I think my problem is with iptables. My rules are as follows:

sudo iptables -F
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p tcp --sport 80 -j ACCEPT
sudo iptables -A INPUT -p udp --sport 53 -j ACCEPT
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 8443 -j ACCEPT
sudo iptables -A OUTPUT -j ACCEPT
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

And -L looks like this:

Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp spt:http
ACCEPT udp -- anywhere anywhere udp spt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:http-alt
ACCEPT tcp -- anywhere anywhere tcp dpt:8443

Chain FORWARD (policy DROP)
target prot opt source destination

Chain OUTPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain INBOUND (0 references)
target prot opt source destination

Chain LOG_FILTER (0 references)
target prot opt source destination

Chain LSI (0 references)
target prot opt source destination

Chain LSO (0 references)
target prot opt source destination

Chain OUTBOUND (0 references)
target prot opt source destination


I haven't the slightest clue what I'm doing wrong. I've been at this forever.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Resolving IP