Firewall with Netfilter
Protect your network with Linux’s powerful firewalling features.
Linux
has
long had the capability for filtering packets, and it has come a long
way since the early days in terms of both power and flexibility. The
first generation of packet-filtering code was called ipfw
(for “IP firewall”) and
provided basic filtering capability. Since it was somewhat inflexible
and inefficient for complex configurations, ipfw
is rarely used now. The second generation of IP filtering
was called IP chains. It improved greatly on
ipfw
and is still in common use. The latest
generation of filtering is called Netfilter and is manipulated with
the iptables
command. It is used exclusively with
the 2.4.x and later series of kernels. Although
Netfilter is the kernel component and
iptables
is the user-space configuration tool,
these terms are often used interchangeably.
An important concept in Netfilter is the
chain
,
which consists of a list of rules that are applied to packets as they
enter, leave, or traverse through the system. The kernel defines
three chains by default, but new chains of rules can be specified and
linked to the predefined chains. The
INPUT
chain applies to packets that are
received and are destined for the local system, and the
OUTPUT
chain applies to packets that are
transmitted by the local system. Finally, the
FORWARD
chain applies whenever a packet will be routed from one network interface to another through the system. It is used whenever the system ...
Get Network Security Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.