Linux Operating Iptables
Linux Operating Iptables
This chapter guides you how firewall works in Linux Operating system and what
is IPTables in Linux? Firewall decides fate of packets incoming and outgoing
in system. IPTables is a rule based firewall and it is pre-installed on most
of Linux operating system. By default it runs without any rules. IPTables was
included in Kernel 2.4, prior it was called ipchains or ipfwadm. IPTables is
a front-end tool to talk to the kernel and decides the packets to filter.
This guide may help you to rough idea and basic commands of IPTables where we
are going to describe practical iptables rules which you may refer and
customized as per your need.
Different services are used for different protocols as:
iptables applies to IPv4.
ip6tables applies to IPv6.
arptables applies to ARP.
ebtables applies to Ethernet frames..
# /etc/init.d/iptables start
# /etc/init.d/iptables stop
# /etc/init.d/iptables restart
Saving IPTables rulesets with below command. Whenever system rebooted and
restarted the IPTables service, the exsiting rules flushed out or reset.
Below command save TPTables rulesets in /etc/sysconfig/iptables file by
default and rules are applied or restored in case of IPTables flushes out.
Checking the status of IPTables / Firewall. Options “-L” (List ruleset), “-v”
(Verbose) and “-n” (Displays in numeric format).
Display IPTables rules with numbers. With the help of argument “–line-
numbers” you can append or remove rules.
Flushing or deleting IPTables rules. Below command will remove all the rules
from tables. Take rulesets backup before executing above command.
Let’s say if you want to delete rule no 5 from INPUT chain. Use the following
command.
We have just tried to cover basic usages and functions of IPTables for
begineer. You may create complex rules once you have complete understanding
of TCP/IP and good knowledge of your setup.