[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY iptables-download-http "http://www.iptables.org/files/iptables-&iptables-version;.tar.bz2">
|
---|
| 8 | <!ENTITY iptables-download-ftp "ftp://ftp.netfilter.org/pub/iptables/iptables-&iptables-version;.tar.bz2">
|
---|
[2197589] | 9 | <!ENTITY iptables-size "157 KB">
|
---|
| 10 | <!ENTITY iptables-buildsize "4.4 MB">
|
---|
[b4b71892] | 11 | <!ENTITY iptables-time "0.13 SBU">
|
---|
| 12 | ]>
|
---|
| 13 |
|
---|
[1d602a9d] | 14 | <sect1 id="iptables" xreflabel="iptables-&iptables-version;">
|
---|
[a0f03b0] | 15 | <sect1info>
|
---|
[5cd0959d] | 16 | <othername>$LastChangedBy$</othername>
|
---|
| 17 | <date>$Date$</date>
|
---|
[a0f03b0] | 18 | </sect1info>
|
---|
[bae6e15] | 19 | <?dbhtml filename="iptables.html"?>
|
---|
[ca3bcd40] | 20 | <title>iptables-&iptables-version;</title>
|
---|
[f45b1953] | 21 |
|
---|
[b4b71892] | 22 | <para>The next part of this chapter deals with firewalls. The principle
|
---|
| 23 | firewall tool for Linux, as of the 2.4 kernel series, is
|
---|
[e760c5c] | 24 | <application>iptables</application>. It replaces
|
---|
| 25 | <application>ipchains</application> from the 2.2 series and
|
---|
[b4b71892] | 26 | <application>ipfwadm</application> from the 2.0 series. You will need to
|
---|
| 27 | install <application>iptables</application> if you intend on using any form of
|
---|
| 28 | a firewall.</para>
|
---|
| 29 |
|
---|
| 30 | <sect2>
|
---|
| 31 | <title>Introduction to <application>iptables</application></title>
|
---|
| 32 |
|
---|
| 33 | <para>To use a firewall, as well as installing
|
---|
| 34 | <application>iptables</application>, you will need
|
---|
| 35 | to configure the relevant options into your kernel. This is discussed
|
---|
[2197589] | 36 | in the next part of this chapter –
|
---|
| 37 | <xref linkend="postlfs-security-fw-kernel"/>.</para>
|
---|
[b4b71892] | 38 |
|
---|
| 39 | <para>If you intend to use <acronym>IP</acronym>v6 you might consider extending
|
---|
| 40 | the kernel by running <command>make patch-o-matic</command> in the top-level
|
---|
[2197589] | 41 | source tree directory of <application>iptables</application>. If you are
|
---|
[b4b71892] | 42 | going to do this, on a freshly untarred kernel, you need to run
|
---|
| 43 | <command>yes "" | make config && make dep</command> first because
|
---|
| 44 | otherwise the patch-o-matic command is likely to fail while setting up
|
---|
| 45 | some dependencies.</para>
|
---|
| 46 |
|
---|
| 47 | <para>If you are going to patch the kernel, you need to do it before you
|
---|
| 48 | compile <application>iptables</application>, because during the compilation,
|
---|
| 49 | the kernel source tree is checked (if it is available at <filename
|
---|
| 50 | class="directory">/usr/src/linux-<replaceable>[version]</replaceable>
|
---|
| 51 | </filename>) to see which features are available. Support will only be compiled
|
---|
| 52 | into <application>iptables</application> for the features recognized at
|
---|
| 53 | compile-time. Applying a kernel patch may result in errors, often because the
|
---|
[2197589] | 54 | hooks for the patches have changed or because the <command>runme</command>
|
---|
| 55 | script doesn't recognize that a patch has already been incorporated.</para>
|
---|
[b4b71892] | 56 |
|
---|
| 57 | <para>Note that for most people, patching the kernel is unnecessary.
|
---|
| 58 | With the later 2.4.x kernels, most functionality is already available
|
---|
| 59 | and those who need to patch it are generally those who need a specific
|
---|
| 60 | feature; if you don't know why you need to patch the kernel, you're
|
---|
| 61 | unlikely to need to!</para>
|
---|
| 62 |
|
---|
| 63 | <sect3><title>Package information</title>
|
---|
| 64 | <itemizedlist spacing='compact'>
|
---|
| 65 | <listitem><para>Download (HTTP): <ulink
|
---|
| 66 | url="&iptables-download-http;"/></para></listitem>
|
---|
| 67 | <listitem><para>Download (FTP): <ulink
|
---|
| 68 | url="&iptables-download-ftp;"/></para></listitem>
|
---|
| 69 | <listitem><para>Download size: &iptables-size;</para></listitem>
|
---|
[518538f] | 70 | <listitem><para>Estimated disk space required:
|
---|
[b4b71892] | 71 | &iptables-buildsize;</para></listitem>
|
---|
| 72 | <listitem><para>Estimated build time:
|
---|
| 73 | &iptables-time;</para></listitem></itemizedlist>
|
---|
| 74 | </sect3>
|
---|
| 75 |
|
---|
[d7b8efd2] | 76 | <!-- <sect3><title>Additional downloads</title>
|
---|
[721f994b] | 77 | <itemizedlist spacing='compact'>
|
---|
| 78 | <listitem><para>Required Patch (fixes a build issue with
|
---|
| 79 | <application>linux</application>-2.6.7): <ulink
|
---|
| 80 | url="&patch-root;/iptables-&iptables-version;-build_fix-1.patch"/></para>
|
---|
| 81 | </listitem>
|
---|
[d7b8efd2] | 82 | </itemizedlist></sect3> -->
|
---|
[721f994b] | 83 |
|
---|
[b4b71892] | 84 | </sect2>
|
---|
| 85 |
|
---|
| 86 | <sect2>
|
---|
| 87 | <title>Installation of <application>iptables</application></title>
|
---|
| 88 |
|
---|
[2197589] | 89 | <para>Install <application>iptables</application> by running the following
|
---|
| 90 | commands:</para>
|
---|
[b4b71892] | 91 |
|
---|
[d7b8efd2] | 92 | <screen><userinput><command>make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin &&
|
---|
[b4b71892] | 93 | make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin install</command></userinput></screen>
|
---|
| 94 |
|
---|
| 95 | </sect2>
|
---|
| 96 |
|
---|
| 97 | <sect2>
|
---|
| 98 | <title>Command explanations</title>
|
---|
| 99 |
|
---|
[2197589] | 100 | <para><parameter>PREFIX=/usr LIBDIR=/lib BINDIR=/sbin</parameter>: Compiles
|
---|
| 101 | and installs <application>iptables</application> libraries into
|
---|
| 102 | <filename class="directory">/lib</filename>, binaries into
|
---|
| 103 | <filename class="directory">/sbin</filename> and the remainder into the
|
---|
[b4b71892] | 104 | <filename class="directory">/usr</filename> hierarchy instead of
|
---|
| 105 | <filename class="directory">/usr/local</filename>. Firewalls are
|
---|
[2197589] | 106 | generally activated during the boot process and
|
---|
| 107 | <filename class="directory">/usr</filename> may not be mounted at that
|
---|
| 108 | time.</para>
|
---|
[b4b71892] | 109 |
|
---|
| 110 | </sect2>
|
---|
| 111 |
|
---|
| 112 | <sect2>
|
---|
| 113 | <title>Contents</title>
|
---|
| 114 |
|
---|
[2197589] | 115 | <para>The <application>iptables</application> package contains
|
---|
| 116 | <command>iptables</command>, <command>iptables-restore</command>,
|
---|
| 117 | <command>iptables-save</command>, <command>ip6tables</command>
|
---|
| 118 | and the <filename class='libraryfile'>libip*.so</filename> library
|
---|
| 119 | modules.</para>
|
---|
[b4b71892] | 120 |
|
---|
| 121 | </sect2>
|
---|
| 122 |
|
---|
| 123 | <sect2><title>Description</title>
|
---|
| 124 |
|
---|
| 125 | <sect3><title>iptables</title>
|
---|
| 126 | <para><command>iptables</command> is used to set up, maintain, and inspect the
|
---|
| 127 | tables of <acronym>IP</acronym> packet filter rules in the Linux kernel.</para>
|
---|
| 128 | </sect3>
|
---|
| 129 |
|
---|
| 130 | <sect3><title>iptables-restore, iptables-save</title>
|
---|
| 131 | <para>These are used to save and to restore your elaborated set of chains and
|
---|
| 132 | rules. Until <application>iptables</application>-1.2.5, they were declared
|
---|
| 133 | experimental.</para>
|
---|
| 134 | </sect3>
|
---|
| 135 |
|
---|
| 136 | <sect3 id="ip6tables" xreflabel="ip6tables"><title>ip6tables</title>
|
---|
| 137 | <para>This is the same as <command>iptables</command> but for use with
|
---|
| 138 | <acronym>IP</acronym>v6. As of v1.2.5, it is not as complete as the standard
|
---|
[2197589] | 139 | <acronym>IP</acronym>v4 version, especially with regard to some of the
|
---|
| 140 | modules.</para>
|
---|
[b4b71892] | 141 | </sect3>
|
---|
| 142 |
|
---|
[2197589] | 143 | <sect3><title>libip*.so library modules</title>
|
---|
[b4b71892] | 144 | <para>These are various modules (implemented as dynamic libraries) which
|
---|
| 145 | extend the core functionality of <command>iptables</command>.</para>
|
---|
| 146 | </sect3>
|
---|
| 147 |
|
---|
| 148 | </sect2>
|
---|
[f45b1953] | 149 |
|
---|
| 150 | </sect1>
|
---|