source: postlfs/security/iptables.xml@ 067f07b6

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 067f07b6 was 067f07b6, checked in by Andrew Benton <andy@…>, 12 years ago

Fix compiling iptables with the linux-3.2 kernel headers

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@9178 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 9.6 KB
Line 
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 &rArr;
73 Networking Options &rArr; 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>sed -i '/if_packet/i#define __aligned_u64 __u64 __attribute__((aligned(8)))' \
106 extensions/libxt_pkttype.c &amp;&amp;
107./configure --prefix=/usr \
108 --bindir=/sbin \
109 --sbindir=/sbin \
110 --libdir=/lib \
111 --libexecdir=/lib \
112 --with-pkgconfigdir=/usr/lib/pkgconfig &amp;&amp;
113make</userinput></screen>
114
115 <para>This package does not come with a test suite.</para>
116
117 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
118
119<screen role="root"><userinput>make install &amp;&amp;
120ln -sfv xtables-multi /sbin/iptables-xml</userinput></screen>
121
122 </sect2>
123
124 <sect2 role="commands">
125 <title>Command Explanations</title>
126
127 <para><command>sed -i '/if_packet/i#define ...</command>: This sed fixes
128 compiling <application>iptables</application> with the linux-3.2 kernel
129 headers installed. It's not needed if you built LFS with an older
130 kernel&apos;s headers, but in that case it does no harm.</para>
131
132 <para><parameter>--bindir=/sbin</parameter>,
133 <parameter>--sbindir=/sbin</parameter>: Ensure all the executables go
134 in <filename class="directory">/sbin</filename>.</para>
135
136 <para><parameter>--libdir=/lib</parameter>,
137 <parameter>--libexecdir=/lib</parameter>: Ensure all the libraries are
138 in the <filename class="directory">/lib</filename> directory tree.</para>
139
140 <para><parameter>--with-pkgconfigdir=/usr/lib/pkgconfig</parameter>:
141 Ensure all the pkgconfig files are in the standard location.</para>
142
143 <para><command>ln -sfv xtables-multi /sbin/iptables-xml</command>: Ensure
144 the symbolic link for <command>iptables-xml</command> is relative.</para>
145
146 </sect2>
147
148 <sect2 role="configuration">
149 <title>Configuring Iptables</title>
150
151 <para>Introductory instructions for configuring your firewall are
152 presented in the next section: <xref linkend="fw-firewall"/></para>
153
154 <sect3 id="iptables-init">
155 <title>Boot Script</title>
156
157 <para>To set up the iptables firewall at boot, install the
158 <filename>/etc/rc.d/init.d/iptables</filename> init script included
159 in the <xref linkend="bootscripts"/> package.</para>
160
161 <indexterm zone="iptables iptables-init">
162 <primary sortas="f-iptables">iptables</primary>
163 </indexterm>
164
165<screen role="root"><userinput>make install-iptables</userinput></screen>
166
167 </sect3>
168
169 </sect2>
170
171 <sect2 role="content">
172 <title>Contents</title>
173
174 <segmentedlist>
175 <segtitle>Installed Programs</segtitle>
176 <segtitle>Installed Libraries</segtitle>
177 <segtitle>Installed Directories</segtitle>
178
179 <seglistitem>
180 <seg>iptables, iptables-restore, iptables-save, iptables-xml,
181 iptables-multi, ip6tables, ip6tables-restore, ip6tables-save,
182 and ip6tables-multii</seg>
183 <seg>libip4tc.so, libip6tc.so, libiptc.so, libxtables.so,
184 and numerous modules in /lib/xtables/</seg>
185 <seg>/lib/xtables/xtables and /usr/include/libiptc</seg>
186 </seglistitem>
187 </segmentedlist>
188
189 <variablelist>
190 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
191 <?dbfo list-presentation="list"?>
192 <?dbhtml list-presentation="table"?>
193
194 <varlistentry id="iptables-prog">
195 <term><command>iptables</command></term>
196 <listitem>
197 <para>is used to set up, maintain, and inspect the tables of
198 IP packet filter rules in the Linux kernel. It is a
199 symbolic link to iptables-multi.</para>
200 <indexterm zone="iptables iptables-prog">
201 <primary sortas="b-iptables">iptables</primary>
202 </indexterm>
203 </listitem>
204 </varlistentry>
205
206 <varlistentry id="iptables-restore">
207 <term><command>iptables-restore</command></term>
208 <listitem>
209 <para>is used to restore IP Tables from data
210 specified on STDIN. Use I/O redirection provided by your
211 shell to read from a file. It is a symbolic link to
212 iptables-multi.</para>
213 <indexterm zone="iptables iptables-restore">
214 <primary sortas="b-iptables-restore">iptables-restore</primary>
215 </indexterm>
216 </listitem>
217 </varlistentry>
218
219 <varlistentry id="iptables-save">
220 <term><command>iptables-save</command></term>
221 <listitem>
222 <para>is used to dump the contents of an IP Table
223 in easily parseable format to STDOUT. Use I/O-redirection
224 provided by your shell to write to a file. It is a symbolic link to
225 iptables-multi.</para>
226 <indexterm zone="iptables iptables-save">
227 <primary sortas="b-iptables-save">iptables-save</primary>
228 </indexterm>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry id="iptables-xml">
233 <term><command>iptables-xml</command></term>
234 <listitem>
235 <para>is used to convert the output of
236 <command>iptables-save</command> to an XML format. Using the
237 <filename>iptables.xslt</filename> stylesheet converts the XML
238 back to the format of <command>iptables-restore</command>.
239 It is a symbolic link to iptables-multi.</para>
240 <indexterm zone="iptables iptables-xml">
241 <primary sortas="b-iptables-xml">iptables-xml</primary>
242 </indexterm>
243 </listitem>
244 </varlistentry>
245
246 <varlistentry id="ip6tables">
247 <term><command>ip6tables*</command></term>
248 <listitem>
249 <para>are a set of commands for IPV6 that parallel the iptables
250 commands above. All of these commands are symbolic
251 links to ip6tables-multi.</para>
252 <indexterm zone="iptables ip6tables">
253 <primary sortas="b-ip6tables">ip6tables</primary>
254 </indexterm>
255 </listitem>
256 </varlistentry>
257
258 </variablelist>
259
260 </sect2>
261
262</sect1>
Note: See TracBrowser for help on using the repository browser.