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