(We'll install CentOS 6 on a server for you, use promo code PACKETS for 15% off your first invoice)
Introduction
CentOS 6 uses iptables as system firewall.
We configure iptables in our default installation to drop all incoming traffic (including incoming traffic for routing) except for ICMP and TCP port 22 (SSH).
iptables -nL
to see current firewall rules.Disabling firewall
To disable firewall perform one of the following:1. Â use text interface for basic firewall setup
system-config-firewall-tui
from system-config-firewall-tui package. Mark firewall as disabled, press Ok to save the changes.
2.  disable firewall service: to stop firewall service runservice iptables
stop &
&
service ip6tables stop
 Â
then to prevent firewall from starting on boot, if necessary runÂ
chkconfig iptables off && chkconfig ip6tables off
3. delete files /etc/sysconfig/ip6tables and /etc/sysconfig/iptables and to reload blank firewall configuration runÂ
service iptables restart &&
service ip6tables restart
To disable firewall only until first reboot run:Â iptables -F
.
Configuring firewall
To configure firewall perform one of the following:1. use text interface for basic firewall setup system-config-firewall-tui
from system-config-firewall-tui package. Mark firewall as enabled, press Customize, mark required services, add additional ports, etc. Follow program's interface instructions. Press Ok to save the changes.
2. edit /etc/sysconfig/iptables and /etc/sysconfig/ip6tables to add additional firewall rules. This requires firewall restart (service iptables restart &&
service ip6tables restart
). For example, to allow HTTP incoming rule one should add the line below before the COMMIT
 line and restart firewall.Â
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Â