1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY iptables-download-http "http://www.netfilter.org/projects/iptables/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 "645941dd1f9e0ec1f74c61918d70d52f">
|
---|
10 | <!ENTITY iptables-size "456 KB">
|
---|
11 | <!ENTITY iptables-buildsize "10.5 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 | </sect1info>
|
---|
22 |
|
---|
23 | <title>Iptables-&iptables-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="iptables">
|
---|
26 | <primary sortas="a-Iptables">Iptables</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to Iptables</title>
|
---|
31 |
|
---|
32 | <para>The next part of this chapter deals with firewalls. The principal
|
---|
33 | firewall tool for Linux is <application>iptables</application>. You will
|
---|
34 | need to install <application>iptables</application> if you intend on using
|
---|
35 | any form of a firewall.</para>
|
---|
36 |
|
---|
37 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
38 | <itemizedlist spacing="compact">
|
---|
39 | <listitem>
|
---|
40 | <para>Download (HTTP): <ulink url="&iptables-download-http;"/></para>
|
---|
41 | </listitem>
|
---|
42 | <listitem>
|
---|
43 | <para>Download (FTP): <ulink url="&iptables-download-ftp;"/></para>
|
---|
44 | </listitem>
|
---|
45 | <listitem>
|
---|
46 | <para>Download MD5 sum: &iptables-md5sum;</para>
|
---|
47 | </listitem>
|
---|
48 | <listitem>
|
---|
49 | <para>Download size: &iptables-size;</para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>Estimated disk space required: &iptables-buildsize;</para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>Estimated build time: &iptables-time;</para>
|
---|
56 | </listitem>
|
---|
57 | </itemizedlist>
|
---|
58 |
|
---|
59 | <para condition="html" role="usernotes">User Notes:
|
---|
60 | <ulink url="&blfs-wiki;/iptables"/></para>
|
---|
61 |
|
---|
62 | </sect2>
|
---|
63 |
|
---|
64 | <sect2 role="kernel" id='iptables-kernel'>
|
---|
65 | <title>Kernel Configuration</title>
|
---|
66 |
|
---|
67 | <para>A firewall in Linux is accomplished through a portion of the
|
---|
68 | kernel called netfilter. The interface to netfilter is
|
---|
69 | <application>iptables</application>. To use it, the appropriate
|
---|
70 | kernel configuration parameters are found in Networking Support ⇒
|
---|
71 | Networking Options ⇒ Network Packet Filtering Framework.</para>
|
---|
72 |
|
---|
73 | <indexterm zone="iptables iptables-kernel">
|
---|
74 | <primary sortas="d-iptables">Iptables</primary>
|
---|
75 | </indexterm>
|
---|
76 |
|
---|
77 | </sect2>
|
---|
78 |
|
---|
79 | <sect2 role="installation">
|
---|
80 | <title>Installation of Iptables</title>
|
---|
81 |
|
---|
82 | <note>
|
---|
83 | <para>The installation below does not include building some specialized
|
---|
84 | extension libraries which require the raw headers in the
|
---|
85 | <application>Linux</application> source code. If you wish to build the
|
---|
86 | additional extensions (if you aren't sure, then you probably don't), you
|
---|
87 | can look at the <filename>INSTALL</filename> file to see an example of
|
---|
88 | how to change the <parameter>KERNEL_DIR=</parameter> parameter to point
|
---|
89 | at the <application>Linux</application> source code. Note that if you
|
---|
90 | upgrade the kernel version, you may also need to recompile
|
---|
91 | <application>iptables</application> and that the BLFS team has not tested
|
---|
92 | using the raw kernel headers.</para>
|
---|
93 |
|
---|
94 | <!-- <para>Installation of <application>iptables</application> will fail
|
---|
95 | if raw kernel headers are found in <filename
|
---|
96 | class='directory'>/usr/src/linux</filename> either as actual files
|
---|
97 | or a symlink. As of the Linux 2.6 kernel series, this directory
|
---|
98 | should no longer exist because appropriate headers were installed
|
---|
99 | from the <application>Linux-Libc-Headers</application> package during
|
---|
100 | the base LFS installation.</para> -->
|
---|
101 |
|
---|
102 | <para>For some non-x86 architectures, the raw kernel headers may be
|
---|
103 | required. In that case, modify the <parameter>KERNEL_DIR=</parameter>
|
---|
104 | parameter to point at the <application>Linux</application> source
|
---|
105 | code.</para>
|
---|
106 | </note>
|
---|
107 |
|
---|
108 | <para>Install <application>iptables</application> by running the following
|
---|
109 | commands:</para>
|
---|
110 |
|
---|
111 | <screen><userinput>
|
---|
112 | ./configure --prefix=/usr \
|
---|
113 | --bindir=/sbin \
|
---|
114 | --sbindir=/sbin \
|
---|
115 | --libdir=/lib \
|
---|
116 | --libexecdir=/lib \
|
---|
117 | --with-pkgconfigdir=/usr/lib/pkgconfig &&
|
---|
118 | make</userinput></screen>
|
---|
119 |
|
---|
120 | <para>This package does not come with a test suite.</para>
|
---|
121 |
|
---|
122 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
123 |
|
---|
124 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
125 |
|
---|
126 | </sect2>
|
---|
127 |
|
---|
128 | <sect2 role="commands">
|
---|
129 | <title>Command Explanations</title>
|
---|
130 |
|
---|
131 | <para><parameter>--bindir=/sbin</parameter>,
|
---|
132 | <parameter>--sbindir=/sbin</parameter>: Ensure all the executables go
|
---|
133 | in <filename class="directory">/sbin</filename>.</para>
|
---|
134 |
|
---|
135 | <para><parameter>--libdir=/lib</parameter>,
|
---|
136 | <parameter>--libexecdir=/lib</parameter>: Ensure all the libraries are
|
---|
137 | in the <filename class="directory">/lib</filename> directory tree.</para>
|
---|
138 |
|
---|
139 | <para><parameter>--with-pkgconfigdir=/usr/lib/pkgconfig</parameter>:
|
---|
140 | Ensure all the pkgconfig files are in the standard location.</para>
|
---|
141 |
|
---|
142 | </sect2>
|
---|
143 |
|
---|
144 | <sect2 role="configuration">
|
---|
145 | <title>Configuring Iptables</title>
|
---|
146 |
|
---|
147 | <para>Introductory instructions for configuring your firewall are
|
---|
148 | presented in the next section: <xref linkend="fw-firewall"/></para>
|
---|
149 |
|
---|
150 | <sect3 id="iptables-init">
|
---|
151 | <title>Boot Script</title>
|
---|
152 |
|
---|
153 | <para>To set up the iptables firewall at boot, install the
|
---|
154 | <filename>/etc/rc.d/init.d/iptables</filename> init script included
|
---|
155 | in the <xref linkend="bootscripts"/> package.</para>
|
---|
156 |
|
---|
157 | <indexterm zone="iptables iptables-init">
|
---|
158 | <primary sortas="f-iptables">iptables</primary>
|
---|
159 | </indexterm>
|
---|
160 |
|
---|
161 | <screen role="root"><userinput>make install-iptables</userinput></screen>
|
---|
162 |
|
---|
163 | </sect3>
|
---|
164 |
|
---|
165 | </sect2>
|
---|
166 |
|
---|
167 | <sect2 role="content">
|
---|
168 | <title>Contents</title>
|
---|
169 |
|
---|
170 | <segmentedlist>
|
---|
171 | <segtitle>Installed Programs</segtitle>
|
---|
172 | <segtitle>Installed Libraries</segtitle>
|
---|
173 | <segtitle>Installed Directories</segtitle>
|
---|
174 |
|
---|
175 | <seglistitem>
|
---|
176 | <seg>iptables, iptables-restore, iptables-save, iptables-xml,
|
---|
177 | iptables-multi, ip6tables, ip6tables-restore, ip6tables-save,
|
---|
178 | and ip6tables-multii</seg>
|
---|
179 | <seg>libip4tc.so, libip6tc.so, libiptc.so, libxtables.so,
|
---|
180 | and numerous modules in /lib/xtables/</seg>
|
---|
181 | <seg>/lib/xtables/xtables and /usr/include/libiptc</seg>
|
---|
182 | </seglistitem>
|
---|
183 | </segmentedlist>
|
---|
184 |
|
---|
185 | <variablelist>
|
---|
186 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
187 | <?dbfo list-presentation="list"?>
|
---|
188 | <?dbhtml list-presentation="table"?>
|
---|
189 |
|
---|
190 | <varlistentry id="iptables-prog">
|
---|
191 | <term><command>iptables</command></term>
|
---|
192 | <listitem>
|
---|
193 | <para>is used to set up, maintain, and inspect the tables of
|
---|
194 | IP packet filter rules in the Linux kernel. It is a
|
---|
195 | symbolic link to iptables-multi.</para>
|
---|
196 | <indexterm zone="iptables iptables-prog">
|
---|
197 | <primary sortas="b-iptables">iptables</primary>
|
---|
198 | </indexterm>
|
---|
199 | </listitem>
|
---|
200 | </varlistentry>
|
---|
201 |
|
---|
202 | <varlistentry id="iptables-restore">
|
---|
203 | <term><command>iptables-restore</command></term>
|
---|
204 | <listitem>
|
---|
205 | <para>is used to restore IP Tables from data
|
---|
206 | specified on STDIN. Use I/O redirection provided by your
|
---|
207 | shell to read from a file. It is a symbolic link to
|
---|
208 | iptables-multi.</para>
|
---|
209 | <indexterm zone="iptables iptables-restore">
|
---|
210 | <primary sortas="b-iptables-restore">iptables-restore</primary>
|
---|
211 | </indexterm>
|
---|
212 | </listitem>
|
---|
213 | </varlistentry>
|
---|
214 |
|
---|
215 | <varlistentry id="iptables-save">
|
---|
216 | <term><command>iptables-save</command></term>
|
---|
217 | <listitem>
|
---|
218 | <para>is used to dump the contents of an IP Table
|
---|
219 | in easily parseable format to STDOUT. Use I/O-redirection
|
---|
220 | provided by your shell to write to a file. It is a symbolic link to
|
---|
221 | iptables-multi.</para>
|
---|
222 | <indexterm zone="iptables iptables-save">
|
---|
223 | <primary sortas="b-iptables-save">iptables-save</primary>
|
---|
224 | </indexterm>
|
---|
225 | </listitem>
|
---|
226 | </varlistentry>
|
---|
227 |
|
---|
228 | <varlistentry id="iptables-xml">
|
---|
229 | <term><command>iptables-xml</command></term>
|
---|
230 | <listitem>
|
---|
231 | <para>is used to convert the output of
|
---|
232 | <command>iptables-save</command> to an XML format. Using the
|
---|
233 | <filename>iptables.xslt</filename> stylesheet converts the XML
|
---|
234 | back to the format of <command>iptables-restore</command>.
|
---|
235 | It is a symbolic link to iptables-multi.</para>
|
---|
236 | <indexterm zone="iptables iptables-xml">
|
---|
237 | <primary sortas="b-iptables-xml">iptables-xml</primary>
|
---|
238 | </indexterm>
|
---|
239 | </listitem>
|
---|
240 | </varlistentry>
|
---|
241 |
|
---|
242 | <varlistentry id="ip6tables">
|
---|
243 | <term><command>ip6tables*</command></term>
|
---|
244 | <listitem>
|
---|
245 | <para>are a set of commands for IPV6 that parallel the iptables
|
---|
246 | commands above. All of these commands are symbolic
|
---|
247 | links to ip6tables-multi.</para>
|
---|
248 | <indexterm zone="iptables ip6tables">
|
---|
249 | <primary sortas="b-ip6tables">ip6tables</primary>
|
---|
250 | </indexterm>
|
---|
251 | </listitem>
|
---|
252 | </varlistentry>
|
---|
253 |
|
---|
254 | </variablelist>
|
---|
255 |
|
---|
256 | </sect2>
|
---|
257 |
|
---|
258 | </sect1>
|
---|