[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">
|
---|
[af167ffb] | 9 | <!ENTITY iptables-md5sum "0a5f5f226e41ce408a895bec995e8c05">
|
---|
[2197589] | 10 | <!ENTITY iptables-size "157 KB">
|
---|
| 11 | <!ENTITY iptables-buildsize "4.4 MB">
|
---|
[b4b71892] | 12 | <!ENTITY iptables-time "0.13 SBU">
|
---|
| 13 | ]>
|
---|
| 14 |
|
---|
[1d602a9d] | 15 | <sect1 id="iptables" xreflabel="iptables-&iptables-version;">
|
---|
[a0f03b0] | 16 | <sect1info>
|
---|
[5cd0959d] | 17 | <othername>$LastChangedBy$</othername>
|
---|
| 18 | <date>$Date$</date>
|
---|
[a0f03b0] | 19 | </sect1info>
|
---|
[bae6e15] | 20 | <?dbhtml filename="iptables.html"?>
|
---|
[ca3bcd40] | 21 | <title>iptables-&iptables-version;</title>
|
---|
[48ecffe8] | 22 | <indexterm zone="iptables">
|
---|
| 23 | <primary sortas="a-Iptables">Iptables</primary>
|
---|
| 24 | </indexterm>
|
---|
[f45b1953] | 25 |
|
---|
[b4b71892] | 26 | <para>The next part of this chapter deals with firewalls. The principle
|
---|
| 27 | firewall tool for Linux, as of the 2.4 kernel series, is
|
---|
[e760c5c] | 28 | <application>iptables</application>. It replaces
|
---|
| 29 | <application>ipchains</application> from the 2.2 series and
|
---|
[b4b71892] | 30 | <application>ipfwadm</application> from the 2.0 series. You will need to
|
---|
| 31 | install <application>iptables</application> if you intend on using any form of
|
---|
| 32 | a firewall.</para>
|
---|
| 33 |
|
---|
| 34 | <sect2>
|
---|
| 35 | <title>Introduction to <application>iptables</application></title>
|
---|
| 36 |
|
---|
| 37 | <para>To use a firewall, as well as installing
|
---|
| 38 | <application>iptables</application>, you will need
|
---|
| 39 | to configure the relevant options into your kernel. This is discussed
|
---|
[2197589] | 40 | in the next part of this chapter –
|
---|
[dd362e5] | 41 | <xref linkend="fw-kernel"/>.</para>
|
---|
[b4b71892] | 42 |
|
---|
| 43 | <para>If you intend to use <acronym>IP</acronym>v6 you might consider extending
|
---|
| 44 | the kernel by running <command>make patch-o-matic</command> in the top-level
|
---|
[2197589] | 45 | source tree directory of <application>iptables</application>. If you are
|
---|
[b4b71892] | 46 | going to do this, on a freshly untarred kernel, you need to run
|
---|
| 47 | <command>yes "" | make config && make dep</command> first because
|
---|
| 48 | otherwise the patch-o-matic command is likely to fail while setting up
|
---|
| 49 | some dependencies.</para>
|
---|
| 50 |
|
---|
| 51 | <para>If you are going to patch the kernel, you need to do it before you
|
---|
| 52 | compile <application>iptables</application>, because during the compilation,
|
---|
| 53 | the kernel source tree is checked (if it is available at <filename
|
---|
| 54 | class="directory">/usr/src/linux-<replaceable>[version]</replaceable>
|
---|
| 55 | </filename>) to see which features are available. Support will only be compiled
|
---|
| 56 | into <application>iptables</application> for the features recognized at
|
---|
| 57 | compile-time. Applying a kernel patch may result in errors, often because the
|
---|
[2197589] | 58 | hooks for the patches have changed or because the <command>runme</command>
|
---|
| 59 | script doesn't recognize that a patch has already been incorporated.</para>
|
---|
[b4b71892] | 60 |
|
---|
| 61 | <para>Note that for most people, patching the kernel is unnecessary.
|
---|
| 62 | With the later 2.4.x kernels, most functionality is already available
|
---|
| 63 | and those who need to patch it are generally those who need a specific
|
---|
| 64 | feature; if you don't know why you need to patch the kernel, you're
|
---|
| 65 | unlikely to need to!</para>
|
---|
| 66 |
|
---|
| 67 | <sect3><title>Package information</title>
|
---|
| 68 | <itemizedlist spacing='compact'>
|
---|
| 69 | <listitem><para>Download (HTTP): <ulink
|
---|
| 70 | url="&iptables-download-http;"/></para></listitem>
|
---|
| 71 | <listitem><para>Download (FTP): <ulink
|
---|
| 72 | url="&iptables-download-ftp;"/></para></listitem>
|
---|
[af167ffb] | 73 | <listitem><para>Download MD5 sum: &iptables-md5sum;</para></listitem>
|
---|
[b4b71892] | 74 | <listitem><para>Download size: &iptables-size;</para></listitem>
|
---|
[518538f] | 75 | <listitem><para>Estimated disk space required:
|
---|
[b4b71892] | 76 | &iptables-buildsize;</para></listitem>
|
---|
| 77 | <listitem><para>Estimated build time:
|
---|
| 78 | &iptables-time;</para></listitem></itemizedlist>
|
---|
| 79 | </sect3>
|
---|
| 80 |
|
---|
| 81 | </sect2>
|
---|
| 82 |
|
---|
| 83 | <sect2>
|
---|
| 84 | <title>Installation of <application>iptables</application></title>
|
---|
| 85 |
|
---|
[2197589] | 86 | <para>Install <application>iptables</application> by running the following
|
---|
| 87 | commands:</para>
|
---|
[b4b71892] | 88 |
|
---|
[48ecffe8] | 89 | <screen><userinput><command>make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin</command></userinput></screen>
|
---|
| 90 |
|
---|
| 91 | <para>Now, as the root user:</para>
|
---|
| 92 |
|
---|
| 93 | <screen><userinput role='root'><command>make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin install</command></userinput></screen>
|
---|
[b4b71892] | 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 |
|
---|
[48ecffe8] | 115 | <segmentedlist>
|
---|
| 116 | <segtitle>Installed Programs</segtitle>
|
---|
| 117 | <segtitle>Installed Libraries</segtitle>
|
---|
| 118 | <segtitle>Installed Directory</segtitle>
|
---|
| 119 |
|
---|
| 120 | <seglistitem>
|
---|
| 121 | <seg>iptables, iptables-restore, iptables-save and ip6tables</seg>
|
---|
| 122 | <seg>libip6t_*.so and libipt_*.so</seg>
|
---|
| 123 | <seg>/lib/iptables</seg>
|
---|
| 124 | </seglistitem>
|
---|
| 125 | </segmentedlist>
|
---|
| 126 |
|
---|
| 127 | <variablelist>
|
---|
| 128 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 129 | <?dbfo list-presentation="list"?>
|
---|
| 130 |
|
---|
| 131 | <varlistentry id="iptables-prog">
|
---|
| 132 | <term><command>iptables</command></term>
|
---|
| 133 | <listitem><para>is used to set up, maintain, and inspect the tables of
|
---|
| 134 | <acronym>IP</acronym> packet filter rules in the Linux kernel.</para>
|
---|
| 135 | <indexterm zone="iptables iptables-prog">
|
---|
| 136 | <primary sortas="b-iptables">iptables</primary>
|
---|
| 137 | </indexterm></listitem>
|
---|
| 138 | </varlistentry>
|
---|
| 139 |
|
---|
| 140 | <varlistentry id="iptables-restore">
|
---|
| 141 | <term><command>iptables-restore</command></term>
|
---|
| 142 | <listitem><para>is used to restore <acronym>IP</acronym> Tables from data
|
---|
| 143 | specified on <acronym>STDIN</acronym>. Use I/O redirection provided by your
|
---|
| 144 | shell to read from a file.</para>
|
---|
| 145 | <indexterm zone="iptables iptables-restore">
|
---|
| 146 | <primary sortas="b-iptables-restore">iptables-restore</primary>
|
---|
| 147 | </indexterm></listitem>
|
---|
| 148 | </varlistentry>
|
---|
| 149 |
|
---|
| 150 | <varlistentry id="iptables-save">
|
---|
| 151 | <term><command>iptables-save</command></term>
|
---|
| 152 | <listitem><para>is used to dump the contents of an <acronym>IP</acronym> Table
|
---|
| 153 | in easily parseable format to <acronym>STDOUT</acronym>. Use I/O-redirection
|
---|
| 154 | provided by your shell to write to a file.</para>
|
---|
| 155 | <indexterm zone="iptables iptables-save">
|
---|
| 156 | <primary sortas="b-iptables-save">iptables-save</primary>
|
---|
| 157 | </indexterm></listitem>
|
---|
| 158 | </varlistentry>
|
---|
| 159 |
|
---|
| 160 | <varlistentry id="ip6tables">
|
---|
| 161 | <term><command>ip6tables</command></term>
|
---|
| 162 | <listitem><para>is used to set up, maintain, and inspect the tables of
|
---|
| 163 | <acronym>IP</acronym>v6 packet filter rules in the Linux kernel. Several
|
---|
| 164 | different tables may be defined. Each table contains a number of built-in
|
---|
| 165 | chains and may also contain user-defined chains.</para>
|
---|
| 166 | <indexterm zone="iptables ip6tables">
|
---|
| 167 | <primary sortas="b-ip6tables">ip6tables</primary>
|
---|
| 168 | </indexterm></listitem>
|
---|
| 169 | </varlistentry>
|
---|
| 170 |
|
---|
| 171 | <varlistentry id="libip-iptables">
|
---|
| 172 | <term><filename class='libraryfile'>libip*.so</filename></term>
|
---|
| 173 | <listitem><para>library modules are various modules (implemented as dynamic
|
---|
| 174 | libraries) which extend the core functionality of
|
---|
| 175 | <command>iptables</command>.</para>
|
---|
| 176 | <indexterm zone="iptables libip-iptables">
|
---|
| 177 | <primary sortas="c-libip-iptables">libip*.so</primary>
|
---|
| 178 | </indexterm></listitem>
|
---|
| 179 | </varlistentry>
|
---|
| 180 | </variablelist>
|
---|
[b4b71892] | 181 |
|
---|
| 182 | </sect2>
|
---|
[f45b1953] | 183 |
|
---|
| 184 | </sect1>
|
---|