Tuesday, March 5, 2013

Iptables Example

This is an example on how to allow some traffic input to CentOS server.

At first you already install apache, mod_ssl and mysql, but you still cannot access apache or mysql.
There is a possibility that you have not set up your firewall.

Open iptables configuration using your favorite editor.
/etc/sysconfig/iptables
Add 3 rule input to allow traffic for http, https and mysql.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
iptables

Don't forget to restart iptables
#service iptables restart
You could check your current iptables configuration with:
#iptables -L
iptables



1 comment: