<s>
iptables	B-Application
is	O
a	O
user-space	B-Operating_System
utility	O
program	O
that	O
allows	O
a	O
system	B-Application
administrator	I-Application
to	O
configure	O
the	O
IP	B-Protocol
packet	I-Protocol
filter	I-Protocol
rules	I-Protocol
of	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
firewall	B-Application
,	O
implemented	O
as	O
different	O
Netfilter	B-Application
modules	O
.	O
</s>
<s>
The	O
filters	O
are	O
organized	O
in	O
different	O
tables	O
,	O
which	O
contain	O
chains	O
of	O
rules	O
for	O
how	O
to	O
treat	O
network	O
traffic	O
packets	B-Protocol
.	O
</s>
<s>
Different	O
kernel	B-Operating_System
modules	O
and	O
programs	O
are	O
currently	O
used	O
for	O
different	O
protocols	O
;	O
iptables	B-Application
applies	O
to	O
IPv4	O
,	O
ip6tables	B-Application
to	O
IPv6	O
,	O
arptables	O
to	O
ARP	O
,	O
and	O
to	O
Ethernet	B-Protocol
frames	I-Protocol
.	O
</s>
<s>
iptables	B-Application
requires	O
elevated	O
privileges	O
to	O
operate	O
and	O
must	O
be	O
executed	O
by	O
user	O
root	B-Application
,	O
otherwise	O
it	O
fails	O
to	O
function	O
.	O
</s>
<s>
On	O
most	O
Linux	B-Operating_System
systems	O
,	O
iptables	B-Application
is	O
installed	O
as	O
and	O
documented	O
in	O
its	O
man	B-Protocol
pages	I-Protocol
,	O
which	O
can	O
be	O
opened	O
using	O
man	O
iptables	B-Application
when	O
installed	O
.	O
</s>
<s>
It	O
may	O
also	O
be	O
found	O
in	O
/sbin/iptables	O
,	O
but	O
since	O
iptables	B-Application
is	O
more	O
like	O
a	O
service	O
rather	O
than	O
an	O
"	O
essential	O
binary	O
"	O
,	O
the	O
preferred	O
location	O
remains	O
.	O
</s>
<s>
The	O
term	O
iptables	B-Application
is	O
also	O
commonly	O
used	O
to	O
inclusively	O
refer	O
to	O
the	O
kernel-level	O
components	O
.	O
</s>
<s>
x_tables	O
is	O
the	O
name	O
of	O
the	O
kernel	B-Operating_System
module	O
carrying	O
the	O
shared	O
code	O
portion	O
used	O
by	O
all	O
four	O
modules	O
that	O
also	O
provides	O
the	O
API	O
used	O
for	O
extensions	O
;	O
subsequently	O
,	O
Xtables	O
is	O
more	O
or	O
less	O
used	O
to	O
refer	O
to	O
the	O
entire	O
firewall	B-Application
(	O
v4	O
,	O
v6	O
,	O
arp	O
,	O
and	O
eb	O
)	O
architecture	O
.	O
</s>
<s>
iptables	B-Application
superseded	O
ipchains	B-Application
;	O
and	O
the	O
successor	O
of	O
iptables	B-Application
is	O
nftables	B-Application
,	O
which	O
was	O
released	O
on	O
19	O
January	O
2014	O
and	O
was	O
merged	O
into	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
mainline	O
in	O
kernel	B-Operating_System
version	O
3.13	O
.	O
</s>
<s>
iptables	B-Application
allows	O
the	O
system	B-Application
administrator	I-Application
to	O
define	O
tables	O
containing	O
chains	O
of	O
rules	O
for	O
the	O
treatment	O
of	O
packets	B-Protocol
.	O
</s>
<s>
Each	O
table	O
is	O
associated	O
with	O
a	O
different	O
kind	O
of	O
packet	B-Protocol
processing	O
.	O
</s>
<s>
Packets	B-Protocol
are	O
processed	O
by	O
sequentially	O
traversing	O
the	O
rules	O
in	O
chains	O
.	O
</s>
<s>
Every	O
network	B-Protocol
packet	I-Protocol
arriving	O
at	O
or	O
leaving	O
from	O
the	O
computer	O
traverses	O
at	O
least	O
one	O
chain	O
.	O
</s>
<s>
The	O
origin	O
of	O
the	O
packet	B-Protocol
determines	O
which	O
chain	O
it	O
traverses	O
initially	O
.	O
</s>
<s>
There	O
are	O
five	O
predefined	O
chains	O
(	O
mapping	O
to	O
the	O
five	O
available	O
Netfilter	B-Application
hooks	O
)	O
,	O
though	O
a	O
table	O
may	O
not	O
have	O
all	O
chains	O
.	O
</s>
<s>
Predefined	O
chains	O
have	O
a	O
policy	O
,	O
for	O
example	O
DROP	O
,	O
which	O
is	O
applied	O
to	O
the	O
packet	B-Protocol
if	O
it	O
reaches	O
the	O
end	O
of	O
the	O
chain	O
.	O
</s>
<s>
The	O
system	B-Application
administrator	I-Application
can	O
create	O
as	O
many	O
other	O
chains	O
as	O
desired	O
.	O
</s>
<s>
These	O
chains	O
have	O
no	O
policy	O
;	O
if	O
a	O
packet	B-Protocol
reaches	O
the	O
end	O
of	O
the	O
chain	O
it	O
is	O
returned	O
to	O
the	O
chain	O
which	O
called	O
it	O
.	O
</s>
<s>
PREROUTING	O
:	O
Packets	B-Protocol
will	O
enter	O
this	O
chain	O
before	O
a	O
routing	O
decision	O
is	O
made	O
.	O
</s>
<s>
INPUT	O
:	O
Packet	B-Protocol
is	O
going	O
to	O
be	O
locally	O
delivered	O
.	O
</s>
<s>
FORWARD	O
:	O
All	O
packets	B-Protocol
that	O
have	O
been	O
routed	O
and	O
were	O
not	O
for	O
local	O
delivery	O
will	O
traverse	O
this	O
chain	O
.	O
</s>
<s>
OUTPUT	O
:	O
Packets	B-Protocol
sent	O
from	O
the	O
machine	O
itself	O
will	O
be	O
visiting	O
this	O
chain	O
.	O
</s>
<s>
Packets	B-Protocol
enter	O
this	O
chain	O
just	O
before	O
handing	O
them	O
off	O
to	O
the	O
hardware	O
.	O
</s>
<s>
Unless	O
preceded	O
by	O
the	O
option	O
-t	O
,	O
an	O
iptables	B-Application
command	O
concerns	O
the	O
filter	O
table	O
by	O
default	O
.	O
</s>
<s>
Each	O
rule	O
in	O
a	O
chain	O
contains	O
the	O
specification	O
of	O
which	O
packets	B-Protocol
it	O
matches	O
.	O
</s>
<s>
As	O
a	O
packet	B-Protocol
traverses	O
a	O
chain	O
,	O
each	O
rule	O
in	O
turn	O
is	O
examined	O
.	O
</s>
<s>
If	O
a	O
rule	O
does	O
not	O
match	O
the	O
packet	B-Protocol
,	O
the	O
packet	B-Protocol
is	O
passed	O
to	O
the	O
next	O
rule	O
.	O
</s>
<s>
If	O
a	O
rule	O
does	O
match	O
the	O
packet	B-Protocol
,	O
the	O
rule	O
takes	O
the	O
action	O
indicated	O
by	O
the	O
target/verdict	O
,	O
which	O
may	O
result	O
in	O
the	O
packet	B-Protocol
being	O
allowed	O
to	O
continue	O
along	O
the	O
chain	O
or	O
may	O
not	O
.	O
</s>
<s>
Matches	O
make	O
up	O
the	O
large	O
part	O
of	O
rulesets	O
,	O
as	O
they	O
contain	O
the	O
conditions	O
packets	B-Protocol
are	O
tested	O
for	O
.	O
</s>
<s>
There	O
are	O
numerous	O
third-party	O
software	O
applications	O
for	O
iptables	B-Application
that	O
try	O
to	O
facilitate	O
setting	O
up	O
rules	O
.	O
</s>
<s>
Front-ends	O
in	O
textual	B-Language
or	O
graphical	O
fashion	O
allow	O
users	O
to	O
click-generate	O
simple	O
rulesets	O
;	O
scripts	O
usually	O
refer	O
to	O
shell	B-Application
scripts	I-Application
(	O
but	O
other	O
scripting	O
languages	O
are	O
possible	O
too	O
)	O
that	O
call	O
iptables	B-Application
or	O
(	O
the	O
faster	O
)	O
iptables-restore	O
with	O
a	O
set	O
of	O
predefined	O
rules	O
,	O
or	O
rules	O
expanded	O
from	O
a	O
template	O
with	O
the	O
help	O
of	O
a	O
simple	O
configuration	O
file	O
.	O
</s>
<s>
Linux	B-Operating_System
distributions	O
commonly	O
employ	O
the	O
latter	O
scheme	O
of	O
using	O
templates	O
.	O
</s>
<s>
Users	O
who	O
reasonably	O
understand	O
iptables	B-Application
and	O
want	O
their	O
ruleset	O
optimized	O
are	O
advised	O
to	O
construct	O
their	O
own	O
ruleset	O
.	O
</s>
