Saturday, March 14, 2015

CentOS - Open port in Firewall

Step 1: Edit file /etc/systemconfig/iptables


vi /etc/sysconfig/iptables


Append rule as follows:
If you want to open port 80:


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


If you want to open port 443:


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


If you want to open port 8888:


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


Step 2: Save this file by pressing ESC and type :wq! then Enter


Step 3: Restart iptables service


service iptables restart

Done!

References




No comments:

Post a Comment