How to install IPTables on RedHat / Centos Linux

by lifeLinux on April 24, 2011

iptables is a user space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (implemented as different Netfilter modules) and the chains and rules it stores. Different kernel modules and programs are currently used for different protocols; iptables applies to IPv4, ip6tables to IPv6, arptables to ARP, and ebtables for Ethernet frames.
Iptables requires elevated privileges to operate and must be executed by user root, otherwise it fails to function. On most Linux systems, iptables is installed as /usr/sbin/iptables and documented in its man page,[2] which can be opened using man iptables when installed. It may also be found in /sbin/iptables, but since iptables is not an “essential binary”, but more like a service, the preferred location remains /usr/sbin.
iptables is also commonly used to inclusively refer to the kernel-level components. x_tables is the name of the kernel module carrying the shared code portion used by all four modules that also provides the API used for extensions; subsequently, Xtables is more or less used to refer to the entire firewall (v4,v6,arp,eb) architecture.
Source: http://en.wikipedia.org/wiki/Iptables


In most Linux distros including Redhat / CentOS Linux installs iptables by default. You can use the following procedure to verify that iptables has been installed. Open terminal and type the following command:

root@longvnit:~# iptables -V

Sample outputs:

iptables v1.3.5

You can use the following command to view the status of iptables command, enter:

root@longvnit:~#yum info iptables

Sample outputs:

Installed Packages
Name       : iptables
Arch       : i386
Version    : 1.3.5
Release    : 5.3.el5_4.1
Size       : 552 k
Repo       : installed
Summary    : Tools for managing Linux kernel packet filtering capabilities.
URL        : http://www.netfilter.org/
License    : GPL
Description: The iptables utility controls the network packet filtering code in
           : the Linux kernel. If you need to set up firewalls and/or IP
           : masquerading, you should install this package.

If the above message does not appear, then type the following command to install iptables

root@longvnit:~#yum install iptables

You can use the following command to view rules in all chains:

root@longvnit:~#iptables -L -n

Sample outputs:

Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Related Posts:

Previous post:

Next post: