How To Enable/Disable Firewall On Centos / RedHat / Fedora

by lifeLinux on May 18, 2011

Iptables should be installed by default on all CentOS 3.x, 4.x and 5.x installations. You can check to see if iptables is installed on your system by:

# rpm -q iptables


Sample output

iptables-1.3.5-5.3.el5_4.1

How to enable firewall

Login as root and type the following command

# /etc/init.d/iptables start
# chkconfig iptables on

If you are using IPv6, enter:

# /etc/init.d/ip6tables start
# chkconfig ip6tables on

And to see if iptables is actually running, we can check that the iptables modules are loaded, type the following command

# lsmod | grep ip_tables

Something look like:

ip_tables              29288  1 iptable_filter
x_tables               29192  6 ip6t_REJECT,ip6_tables,ipt_REJECT,xt_state,xt_tcpudp,ip_tables

How to disable firewall

Login as root and type the following command

# /etc/init.d/iptables stop
# chkconfig iptables off

If you are using IPv6, enter:

# /etc/init.d/ip6tables stop
# chkconfig ip6tables off

Related Posts:

Previous post:

Next post: