An illustration of how a firewall works.
Image via Wikipedia

In my good old days with LINUX I struggle quite a bit to understand what is a port number & how it works, what is firewall & why the hell it is blocking, etc. You have to understand port number when you work with tomcat server (remember server.xml 🙂 – man it sucks), it works in 8080 but not in 8090 or you name it, it just doesn’t work at all :-).

Today I think I should publish this tip, because if you are asking me about IPTABLES I will say it is a nightmare :-), any small mistake you do with it’s conf file then you are gone.

Generally iptables (firewall) stores its configuration in iptables file (/etc/sysconfig/iptables). You need to edit this file and add rules to open port number. You need a root credentials to execute the following steps.

Open the file:

vi /etc/sysconfig/iptables

Append rule as follows:

-A INPUT -m state –state NEW -m tcp -p tcp –dport port_number -j ACCEPT
-make sure you change the port_number to actual number (8090 or 8088)

Restart iptables:

# /etc/init.d/iptables restart

Verify that port is open:

# netstat -tulpn | less

Happy Securing!


2 thoughts on “[TIPS] – How To Open a PORT NUMBER in IPTABLES – LINUX

  1. Bose says:

    Excellent site you have here but I was wondering if you knew of any message boards that cover the same topics talked about in this article? I’d really love to be a part of community where I can get feedback from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Cheers!

  2. Arafin Rubab says:

    I am impressed by the quality of information on this website. There are a lot of good resources here. I am sure I will visit this place again soon.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s