1

i have added a rule in iptables in my server like this.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8005 -j ACCEPT

allowing port 8005. when run this command netstat -plunt it shows that port 8005 is opened. result is as under

tcp        0      127.0.0.1:8005                0.0.0.0:*                   LISTEN      22128/java

i have saved iptables, restarted services for iptables and tomcat5. but still i am unable to access tomcat5 from browser.

what might be the issue?

i have configured port 8005 for tomcat in server.xml my iptables -L -nv out put is as attached enter image description here

connector port config is as under

<Server port="8005" shutdown="SHUTDOWN">   

1
  • 1
    Do you have a rule that allows RELATED and ESTABLISHED traffic ? You might want to add the output of iptables -L -nv to your question. Since you're only listening on localhost, I'm curious, how are you testing this?
    – Ladadadada
    Apr 3, 2012 at 13:26

1 Answer 1

4

The part 127.0.0.1:8005 from netstat output indicates that your server is listening on the loop address 127.0.0.1 which means you can connect only locally to the port 8005.

If you want to access the service remotely from another machine, you need to change the tomcat configuration to allow it listen on all interfaces or on a specific interface.

9
  • Khaled thanks, you are right. can you please help me , how can i allow tomcat to be accessed from other interfaces?
    – Asghar
    Apr 3, 2012 at 13:42
  • It's not so much "allowing it to be accessed from" as "telling it to listen on". Somewhere in the Tomcat configuration it will say something like "Listen 127.0.0.1:8005". You should change this to the IP address on your other interface. (I haven't touched Tomcat in years so that configuration option might be completely different in reality.)
    – Ladadadada
    Apr 3, 2012 at 14:12
  • @Asghar: You need to change the connector in server.xml file.
    – Khaled
    Apr 3, 2012 at 14:14
  • @Khaled i have edited my question and added configuration for connector in server.xml , is it good?
    – Asghar
    Apr 3, 2012 at 14:21
  • 1
    I don't see port 8005 in your server.xml.
    – Ladadadada
    Apr 3, 2012 at 14:29

You must log in to answer this question.

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