1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/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-md5sum "86d88455520cfdc56fd7ae27897a80a4">
|
---|
10 | <!ENTITY iptables-size "176 KB">
|
---|
11 | <!ENTITY iptables-buildsize "4.8 MB">
|
---|
12 | <!ENTITY iptables-time "0.2 SBU">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="iptables" xreflabel="iptables-&iptables-version;">
|
---|
16 | <?dbhtml filename="iptables.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | <keywordset>
|
---|
22 | <keyword role="package">iptables-&iptables-version;.tar</keyword>
|
---|
23 | <keyword role="ftpdir">iptables</keyword>
|
---|
24 | </keywordset>
|
---|
25 | </sect1info>
|
---|
26 |
|
---|
27 | <title>Iptables-&iptables-version;</title>
|
---|
28 |
|
---|
29 | <indexterm zone="iptables">
|
---|
30 | <primary sortas="a-Iptables">Iptables</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 | <sect2 role="package">
|
---|
34 | <title>Introduction to Iptables</title>
|
---|
35 |
|
---|
36 | <para>The next part of this chapter deals with firewalls. The principal
|
---|
37 | firewall tool for Linux, as of the 2.4 kernel series, is
|
---|
38 | <application>iptables</application>. It replaces
|
---|
39 | <application>ipchains</application> from the 2.2 series and
|
---|
40 | <application>ipfwadm</application> from the 2.0 series. You will need to
|
---|
41 | install <application>iptables</application> if you intend on using any
|
---|
42 | form of a firewall.</para>
|
---|
43 |
|
---|
44 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
45 | <itemizedlist spacing="compact">
|
---|
46 | <listitem>
|
---|
47 | <para>Download (HTTP): <ulink url="&iptables-download-http;"/></para>
|
---|
48 | </listitem>
|
---|
49 | <listitem>
|
---|
50 | <para>Download (FTP): <ulink url="&iptables-download-ftp;"/></para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>Download MD5 sum: &iptables-md5sum;</para>
|
---|
54 | </listitem>
|
---|
55 | <listitem>
|
---|
56 | <para>Download size: &iptables-size;</para>
|
---|
57 | </listitem>
|
---|
58 | <listitem>
|
---|
59 | <para>Estimated disk space required: &iptables-buildsize;</para>
|
---|
60 | </listitem>
|
---|
61 | <listitem>
|
---|
62 | <para>Estimated build time: &iptables-time;</para>
|
---|
63 | </listitem>
|
---|
64 | </itemizedlist>
|
---|
65 |
|
---|
66 | </sect2>
|
---|
67 |
|
---|
68 | <sect2 role="kernel" id='iptables-kernel'>
|
---|
69 | <title>Kernel Configuration</title>
|
---|
70 |
|
---|
71 | <para>A firewall in Linux is accomplished through a portion of the
|
---|
72 | kernel called netfilter. The interface to netfilter is
|
---|
73 | <application>iptables</application>. To use it, the appropriate
|
---|
74 | kernel configuration parameters are found in Device Drivers ->
|
---|
75 | Networking Support -> Networking Options ->
|
---|
76 | Network Packet Filtering -> IP: Netfilter Configuration.</para>
|
---|
77 |
|
---|
78 | <indexterm zone="iptables iptables-kernel">
|
---|
79 | <primary sortas="d-iptables">Iptables</primary>
|
---|
80 | </indexterm>
|
---|
81 |
|
---|
82 | </sect2>
|
---|
83 |
|
---|
84 | <sect2 role="installation">
|
---|
85 | <title>Installation of Iptables</title>
|
---|
86 |
|
---|
87 | <note>
|
---|
88 | <para>Installation of <application>iptables</application> will fail
|
---|
89 | if raw kernel headers are found in <filename
|
---|
90 | class='directory'>/usr/src/linux</filename> either as actual files
|
---|
91 | or a symlink. As of the Linux 2.6 kernel series, this directory
|
---|
92 | should no longer exist because appropriate headers were installed
|
---|
93 | from the <application>Linux-Libc-Headers</application> package during
|
---|
94 | the base LFS installation.</para>
|
---|
95 |
|
---|
96 | <para>For some non-x86 architectures, the raw kernel headers may be
|
---|
97 | required. In that case, add the environment variable
|
---|
98 | <envar>KERNEL_DIR=/usr/src/linux</envar> to the make commands below.</para>
|
---|
99 | </note>
|
---|
100 |
|
---|
101 | <para>Install <application>iptables</application> by running the following
|
---|
102 | commands:</para>
|
---|
103 |
|
---|
104 | <screen><userinput>make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin</userinput></screen>
|
---|
105 |
|
---|
106 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
107 |
|
---|
108 | <screen role="root"><userinput>make PREFIX=/usr LIBDIR=/lib BINDIR=/sbin install</userinput></screen>
|
---|
109 |
|
---|
110 | </sect2>
|
---|
111 |
|
---|
112 | <sect2 role="commands">
|
---|
113 | <title>Command Explanations</title>
|
---|
114 |
|
---|
115 | <para><parameter>PREFIX=/usr LIBDIR=/lib BINDIR=/sbin</parameter>:
|
---|
116 | Compiles and installs <application>iptables</application> libraries
|
---|
117 | into <filename class="directory">/lib</filename>, binaries into
|
---|
118 | <filename class="directory">/sbin</filename> and the remainder into
|
---|
119 | the <filename class="directory">/usr</filename> hierarchy instead of
|
---|
120 | <filename class="directory">/usr/local</filename>. Firewalls are
|
---|
121 | generally activated during the boot process and
|
---|
122 | <filename class="directory">/usr</filename> may not be mounted at
|
---|
123 | that time.</para>
|
---|
124 |
|
---|
125 | </sect2>
|
---|
126 |
|
---|
127 | <sect2 role="configuration">
|
---|
128 | <title>Configuring Iptables</title>
|
---|
129 |
|
---|
130 | <para>Introductory instructions for configuring your firewall are
|
---|
131 | presented in the next section: <xref linkend='fw-firewall'/></para>
|
---|
132 |
|
---|
133 | <sect3 id="iptables-init">
|
---|
134 | <title>Boot Script</title>
|
---|
135 |
|
---|
136 | <para>To set up the iptables firewall at boot, install the
|
---|
137 | <filename>/etc/rc.d/init.d/iptables</filename> init script included
|
---|
138 | in the <xref linkend="bootscripts"/> package.</para>
|
---|
139 |
|
---|
140 | <indexterm zone="iptables iptables-init">
|
---|
141 | <primary sortas="f-iptables">iptables</primary>
|
---|
142 | </indexterm>
|
---|
143 |
|
---|
144 | <screen role="root"><userinput>make install-iptables</userinput></screen>
|
---|
145 |
|
---|
146 | </sect3>
|
---|
147 |
|
---|
148 | </sect2>
|
---|
149 |
|
---|
150 | <sect2 role="content">
|
---|
151 | <title>Contents</title>
|
---|
152 |
|
---|
153 | <segmentedlist>
|
---|
154 | <segtitle>Installed Programs</segtitle>
|
---|
155 | <segtitle>Installed Libraries</segtitle>
|
---|
156 | <segtitle>Installed Directory</segtitle>
|
---|
157 |
|
---|
158 | <seglistitem>
|
---|
159 | <seg>iptables, iptables-restore, iptables-save and ip6tables</seg>
|
---|
160 | <seg>libip6t_*.so and libipt_*.so</seg>
|
---|
161 | <seg>/lib/iptables</seg>
|
---|
162 | </seglistitem>
|
---|
163 | </segmentedlist>
|
---|
164 |
|
---|
165 | <variablelist>
|
---|
166 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
167 | <?dbfo list-presentation="list"?>
|
---|
168 | <?dbhtml list-presentation="table"?>
|
---|
169 |
|
---|
170 | <varlistentry id="iptables-prog">
|
---|
171 | <term><command>iptables</command></term>
|
---|
172 | <listitem>
|
---|
173 | <para>is used to set up, maintain, and inspect the tables of
|
---|
174 | IP packet filter rules in the Linux kernel.</para>
|
---|
175 | <indexterm zone="iptables iptables-prog">
|
---|
176 | <primary sortas="b-iptables">iptables</primary>
|
---|
177 | </indexterm>
|
---|
178 | </listitem>
|
---|
179 | </varlistentry>
|
---|
180 |
|
---|
181 | <varlistentry id="iptables-restore">
|
---|
182 | <term><command>iptables-restore</command></term>
|
---|
183 | <listitem>
|
---|
184 | <para>is used to restore IP Tables from data
|
---|
185 | specified on STDIN. Use I/O redirection provided by your
|
---|
186 | shell to read from a file.</para>
|
---|
187 | <indexterm zone="iptables iptables-restore">
|
---|
188 | <primary sortas="b-iptables-restore">iptables-restore</primary>
|
---|
189 | </indexterm>
|
---|
190 | </listitem>
|
---|
191 | </varlistentry>
|
---|
192 |
|
---|
193 | <varlistentry id="iptables-save">
|
---|
194 | <term><command>iptables-save</command></term>
|
---|
195 | <listitem>
|
---|
196 | <para>is used to dump the contents of an IP Table
|
---|
197 | in easily parseable format to STDOUT. Use I/O-redirection
|
---|
198 | provided by your shell to write to a file.</para>
|
---|
199 | <indexterm zone="iptables iptables-save">
|
---|
200 | <primary sortas="b-iptables-save">iptables-save</primary>
|
---|
201 | </indexterm>
|
---|
202 | </listitem>
|
---|
203 | </varlistentry>
|
---|
204 |
|
---|
205 | <varlistentry id="ip6tables">
|
---|
206 | <term><command>ip6tables</command></term>
|
---|
207 | <listitem>
|
---|
208 | <para>is used to set up, maintain, and inspect the tables of
|
---|
209 | IPv6 packet filter rules in the Linux kernel. Several different
|
---|
210 | tables may be defined. Each table contains a number of built-in
|
---|
211 | chains and may also contain user-defined chains.</para>
|
---|
212 | <indexterm zone="iptables ip6tables">
|
---|
213 | <primary sortas="b-ip6tables">ip6tables</primary>
|
---|
214 | </indexterm>
|
---|
215 | </listitem>
|
---|
216 | </varlistentry>
|
---|
217 |
|
---|
218 | <varlistentry id="libip-iptables">
|
---|
219 | <term><filename class='libraryfile'>libip*.so</filename></term>
|
---|
220 | <listitem>
|
---|
221 | <para>library modules are various modules (implemented as dynamic
|
---|
222 | libraries) which extend the core functionality of
|
---|
223 | <command>iptables</command>.</para>
|
---|
224 | <indexterm zone="iptables libip-iptables">
|
---|
225 | <primary sortas="c-libip-iptables">libip*.so</primary>
|
---|
226 | </indexterm>
|
---|
227 | </listitem>
|
---|
228 | </varlistentry>
|
---|
229 |
|
---|
230 | </variablelist>
|
---|
231 |
|
---|
232 | </sect2>
|
---|
233 |
|
---|
234 | </sect1>
|
---|