Linux – opening port for tomcat on centos server using iptables

centosiptableslinuxtomcat

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">   

Best Answer

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.