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