How to open specific port on iptables

How to open specific port on iptables


1. In order to open specific ports in iptables firewall on your Linux Server, you need first to login via ssh on the server.

2. Then run the following command for incoming connections:

iptables -I INPUT -m tcp -p tcp --dport 80 -j ACCEPT

Make sure that you are using -I to insert the rule on top of the list, and not -A as this will place it on the bottom. Also in case you would like to do it for a particular source, you can use the following:

iptables -I INPUT -s SourceIPAdress -m tcp -p tcp --dport 80 -j ACCEPT

3. To save the rule run the following command:


Please note that even the port is already open on iptables, some servers (FlexCloud instances for example) are behind shared firewall, so it must be open there too!


Was this article helpful?
0 out of 0 found this helpful

Have more questions? Contact our support instantly via Live Chat