Niraj Chapla Niraj Chapla - 1 month ago 5
Linux Question

How to open port in centOS

I have installed and web application which is running on port 8080 on centOS. I only have command line access (through putty) to that machine. I have tried to access that application from my windows machine from which I am connected through putty, but it is giving connection time out error.

Then I have tried to open port 8080. I have added following entry into the iptables.

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

After adding this into the iptables I have restarted it with -
/etc/init.d/iptables restart

But still I am not able to access that application from my windows machine.

Can someone please advise am I doing any mistake or missing something.

Thanks a lot in advance.


First, you should disable selinux, edit file /etc/sysconfig/selinux so it looks like this:


Save file and restart system.

Then you can add the new rule to iptables:

iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT

and restart iptables with /etc/init.d/iptables restart

If it doesn't work you should check other network settings.