2005-06-01 15:57:52 +02:00
<?xml version="1.0" encoding="UTF-8"?>
2008-07-07 22:22:09 +02:00
< !DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
2004-02-14 19:06:39 +01:00
<article >
2005-06-01 15:57:52 +02:00
<!-- $Id$ -->
<articleinfo >
2004-02-14 19:06:39 +01:00
<title > Shorewall FAQs</title>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<authorgroup >
<corpauthor > Shorewall Community</corpauthor>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<author >
<firstname > Tom</firstname>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<surname > Eastep</surname>
</author>
</authorgroup>
2005-06-01 15:57:52 +02:00
2006-07-07 03:04:16 +02:00
<pubdate > <?dbtimestamp format="Y/m/d"?> </pubdate>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<copyright >
2009-06-02 17:21:52 +02:00
<year > 2001-2009</year>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<holder > Thomas M. Eastep</holder>
</copyright>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<legalnotice >
<para > Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version
1.2 or any later version published by the Free Software Foundation; with
no Invariant Sections, with no Front-Cover, and with no Back-Cover
2005-06-01 15:57:52 +02:00
Texts. A copy of the license is included in the section entitled <quote >
<ulink url= "GnuCopyright.htm" > GNU Free Documentation License</ulink>
</quote> .</para>
2004-02-14 19:06:39 +01:00
</legalnotice>
</articleinfo>
2005-06-01 15:57:52 +02:00
2005-08-31 00:46:02 +02:00
<caution >
2009-02-28 04:45:43 +01:00
<para > <emphasis role= "bold" > This article applies to Shorewall 4.3 and
2005-08-31 00:46:02 +02:00
later. If you are running a version of Shorewall earlier than Shorewall
2009-02-28 04:45:43 +01:00
4.3.0 then please see the documentation for that
2005-08-31 00:46:02 +02:00
release.</emphasis> </para>
</caution>
2007-06-28 17:40:13 +02:00
<section id= "Install" >
2004-02-14 19:06:39 +01:00
<title > Installing Shorewall</title>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Howto" >
2004-02-14 19:06:39 +01:00
<title > Where do I find Step by Step Installation and Configuration
Instructions?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Check out the <ulink
url="shorewall_quickstart_guide.htm">QuickStart Guides</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq37" >
2004-05-19 19:55:45 +02:00
<title > (FAQ 37) I just installed Shorewall on Debian and the
2006-12-05 19:25:40 +01:00
/etc/shorewall directory is almost empty!!!</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> </para>
2006-09-04 19:06:17 +02:00
2004-12-18 18:08:10 +01:00
<important >
<para > Once you have installed the .deb package and before you attempt
to configure Shorewall, please heed the advice of Lorenzo Martignoni,
2008-11-19 20:13:32 +01:00
former Shorewall Debian Maintainer:</para>
2005-06-01 15:57:52 +02:00
<para > <quote > For more information about Shorewall usage on Debian
2008-08-15 07:03:24 +02:00
system please look at /usr/share/doc/shorewall-common/README.Debian
provided by [the] shorewall-common Debian package.</quote> </para>
2004-12-18 18:08:10 +01:00
</important>
2005-06-01 15:57:52 +02:00
<para > If you install using the .deb, you will find that your <filename
2006-12-05 19:25:40 +01:00
class="directory">/etc/shorewall</filename> directory is almost empty.
This is intentional. The released configuration file skeletons may be
found on your system in the directory <filename
2008-08-15 02:12:01 +02:00
class="directory">/usr/share/doc/shorewall-common/default-config</filename> .
2005-06-01 15:57:52 +02:00
Simply copy the files you need from that directory to <filename
class="directory">/etc/shorewall</filename> and modify the
2004-08-17 00:17:09 +02:00
copies.</para>
2005-08-24 18:50:37 +02:00
2007-06-24 01:33:17 +02:00
<section id= "faq37a" >
<title > (FAQ 37a) I just installed Shorewall on Debian and I can't find
the sample configurations.</title>
2005-08-24 18:50:37 +02:00
2009-02-28 04:45:43 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> Beginning with
Shorewall 4.0, the samples are in the shorewall-common package and are
2008-11-19 20:13:32 +01:00
installed in <filename
2008-08-15 07:03:24 +02:00
class="directory">/usr/share/doc/shorewall-common/examples/</filename> .</para>
2007-06-24 01:33:17 +02:00
</section>
2005-08-24 18:50:37 +02:00
</section>
2007-11-21 00:59:19 +01:00
<section id= "faq75" >
<title > (FAQ 75) I can't find the Shorewall 4.x shorewall-common RPM.
Where is it?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> If you use Simon Matter's
2007-11-21 00:59:19 +01:00
Redhat/Fedora/CentOS rpms, be aware that Simon calls the
<emphasis > shorewall-common</emphasis> RPM
<emphasis > shorewall</emphasis> . So you should download and install the
appropriate <emphasis > shorewall-4.x.y</emphasis> RPM from his
site.</para>
</section>
2009-07-10 16:46:34 +02:00
<section id= "faq14" >
<title > (FAQ 14) I can't find the Shorewall 4.4 shorewall-common,
shorewall-shell and shorewall-perl packages? Where are they?</title>
<para > <emphasis role= "bold" > Answer</emphasis> :In Shorewall 4.4, the
2009-07-10 16:52:14 +02:00
<firstterm > shorewall-shell</firstterm> package was discontinued. The
<firstterm > shorewall-common</firstterm> and
<firstterm > shorewall-perl</firstterm> packages were combined to form a
single <firstterm > shorewall</firstterm> package.</para>
2009-07-10 16:46:34 +02:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-07-01 19:09:35 +02:00
<section id= "Upgrading" >
2007-07-02 16:50:57 +02:00
<title > Upgrading Shorewall</title>
2007-07-01 19:09:35 +02:00
<section id= "faq66" >
2008-11-19 20:13:32 +01:00
<title > (FAQ 66) I'm trying to upgrade to Shorewall 4.x; where is the
2007-07-01 19:09:35 +02:00
'shorewall' package?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Please see the <ulink
2007-07-01 19:09:35 +02:00
url="upgrade_issues.htm">upgrade issues.</ulink> </para>
<section id= "faq66a" >
2008-11-19 20:13:32 +01:00
<title > (FAQ 66a) I'm trying to upgrade to Shorewall 4.x; do I have to
2007-07-02 16:50:57 +02:00
uninstall the 'shorewall' package?</title>
2007-07-01 19:09:35 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Please see the <ulink
2007-07-01 19:09:35 +02:00
url="upgrade_issues.htm">upgrade issues.</ulink> </para>
</section>
<section id= "faq66b" >
2008-11-19 20:13:32 +01:00
<title > (FAQ 66b) I'm trying to upgrade to Shorewall 4.x: which of
2007-07-01 19:09:35 +02:00
these packages do I need to install?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Please see the <ulink
2007-07-01 19:09:35 +02:00
url="upgrade_issues.htm">upgrade issues.</ulink> </para>
</section>
</section>
2007-12-02 16:58:02 +01:00
2009-07-10 17:48:54 +02:00
<section id= "faq34" >
<title > (FAQ 34) I am trying to upgrade to Shorewall 4.4 and I can't find
the shorewall-common, shorewall-shell and shorewall-perl packages? Where
are they?</title>
<para > <emphasis role= "bold" > Answer</emphasis> :In Shorewall 4.4, the
<firstterm > shorewall-shell</firstterm> package was discontinued. The
<firstterm > shorewall-common</firstterm> and
<firstterm > shorewall-perl</firstterm> packages were combined to form a
single <firstterm > shorewall</firstterm> package. For further
information, please see the <ulink url= "upgrade_issues.htm" > upgrade
issues.</ulink> .</para>
</section>
2007-12-02 16:58:02 +01:00
<section id= "faq76" >
2008-11-19 20:13:32 +01:00
<title > (FAQ 76) I just upgraded my Debian (Ubuntu, Kubuntu, ...) system
and now masquerading doesn't work? What happened?</title>
2007-12-02 16:58:02 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> This happens to people
who ignore <ulink url= "Install.htm#Upgrade_Deb" > our advice</ulink> and
allow the installer to replace their working
<filename > /etc/shorewall/shorewall.conf</filename> with one that has
2007-12-02 17:04:04 +01:00
default settings. Failure to forward traffic (such as during masqueraded
2008-08-30 03:00:50 +02:00
net access from a local network) usually means that <filename > <ulink
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink> </filename>
contains the Debian default setting IP_FORWARDING=Keep; it should be
2007-12-02 16:58:02 +01:00
IP_FORWARDING=On.</para>
</section>
2007-07-01 19:09:35 +02:00
</section>
2006-08-15 16:38:55 +02:00
<section id= "PortForwarding" >
2004-08-07 04:13:32 +02:00
<title > Port Forwarding (Port Redirection)</title>
2005-06-01 15:57:52 +02:00
<section id= "faq1" >
<title > (FAQ 1) I want to forward UDP port 7777 to my personal PC with IP
address 192.168.1.5. I've looked everywhere and can't find how to do
2004-08-17 00:17:09 +02:00
it.</title>
2005-06-01 15:57:52 +02:00
2007-06-24 01:33:17 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> The format of a
2004-02-14 19:06:39 +01:00
port-forwarding rule to a local system is as follows:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT
2007-12-02 18:11:46 +01:00
DNAT net loc:<emphasis > local-IP-address</emphasis> [:<emphasis > local-port</emphasis> ] <emphasis > protocol</emphasis> <emphasis > port-number</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > So to forward UDP port 7777 to internal system 192.168.1.5, the
rule is:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT
DNAT net loc:192.168.1.5 udp 7777</programlisting>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > If you want to forward requests directed to a particular address (
2007-12-02 18:11:46 +01:00
<emphasis > external-IP</emphasis> ) on your firewall to an internal
system:</para>
2005-06-01 15:57:52 +02:00
2007-12-02 18:11:46 +01:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net loc:<emphasis > local-IP-address</emphasis> > [:<emphasis > local-port</emphasis> ] <emphasis > protocol</emphasis> <emphasis > port-number</emphasis> - <emphasis > external-IP</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2008-08-15 03:26:15 +02:00
<para > If you want to forward requests from a particular Internet address
2007-12-02 18:11:46 +01:00
( <emphasis > address</emphasis> ):</para>
2006-12-05 19:25:40 +01:00
2007-12-02 18:11:46 +01:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net:<emphasis > address</emphasis> loc:<emphasis > local-IP-address</emphasis> [:<emphasis > local-port</emphasis> ] <emphasis > protocol</emphasis> <emphasis > port-number</emphasis> -</programlisting>
2006-12-05 19:25:40 +01:00
2004-09-04 20:57:53 +02:00
<para > Finally, if you need to forward a range of ports, in the DEST PORT
2004-08-17 00:17:09 +02:00
column specify the range as
2007-12-02 18:11:46 +01:00
<emphasis > low-port:high-port</emphasis> .</para>
2005-06-01 15:57:52 +02:00
<section id= "faq1a" >
2007-08-09 20:31:14 +02:00
<title > (FAQ 1a) Okay -- I followed those instructions but it doesn't
2004-02-14 19:06:39 +01:00
work</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> That is usually the
2004-02-14 19:06:39 +01:00
result of one of four things:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
<para > You are trying to test from inside your firewall (no, that
2004-08-17 00:17:09 +02:00
won't work -- see <xref linkend= "faq2" /> ).</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > You have a more basic problem with your local system (the
one that you are trying to forward to) such as an incorrect
2008-03-13 00:19:31 +01:00
default gateway (it must be set to the IP address of your
firewall's internal interface; if that isn't possible for some
reason, see <link linkend= "faq1f" > FAQ 1f</link> ).</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2007-08-09 20:31:14 +02:00
<para > Your ISP is blocking that particular port inbound or, for
TCP, your ISP is dropping the outbound SYN,ACK response.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2005-11-25 01:07:10 +01:00
<para > You are running Mandriva Linux prior to 10.0 final and have
2005-10-25 21:58:40 +02:00
configured Internet Connection Sharing. In that case, the name of
your local zone is 'masq' rather than 'loc' (change all instances
of 'loc' to 'masq' in your rules). You may want to consider
re-installing Shorewall in a configuration which matches the
Shorewall documentation. See the <ulink
url="two-interface.htm">two-interface QuickStart Guide</ulink> for
details.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</itemizedlist>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq1b" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 1b) I'm still having problems with port forwarding</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> To further diagnose
2004-02-14 19:06:39 +01:00
this problem:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
2007-08-09 20:31:14 +02:00
<para > As root, type <quote > <command > shorewall reset</command>
</quote> ("<command > shorewall-lite reset</command> ", if you are
2008-08-15 03:26:15 +02:00
running Shorewall Lite). This clears all Netfilter
2007-08-09 20:31:14 +02:00
counters.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2004-08-17 00:17:09 +02:00
<para > Try to connect to the redirected port from an external
host.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2007-08-09 20:31:14 +02:00
<para > As root type <quote > <command > shorewall show nat</command>
</quote> ("<command > shorewall-lite show nat</command> ", if you are
running Shorewall Lite).</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > Locate the appropriate DNAT rule. It will be in a chain
2005-06-01 15:57:52 +02:00
called <emphasis > < source zone> </emphasis> _dnat
2004-08-17 00:17:09 +02:00
(<quote > net_dnat</quote> in the above examples).</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > Is the packet count in the first column non-zero? If so, the
connection request is reaching the firewall and is being
redirected to the server. In this case, the problem is usually a
missing or incorrect default gateway setting on the local system
(the system you are trying to forward to -- its default gateway
2004-08-17 00:17:09 +02:00
should be the IP address of the firewall's interface to that
2004-02-14 19:06:39 +01:00
system).</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > If the packet count is zero:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
<para > the connection request is not reaching your server
(possibly it is being blocked by your ISP); or</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > you are trying to connect to a secondary IP address on
your firewall and your rule is only redirecting the primary IP
address (You need to specify the secondary IP address in the
2004-08-17 00:17:09 +02:00
<quote > ORIG. DEST.</quote> column in your DNAT rule);
or</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2004-08-17 00:17:09 +02:00
<para > your DNAT rule doesn't match the connection request in
some other way. In that case, you may have to use a packet
2004-02-14 19:06:39 +01:00
sniffer such as tcpdump or ethereal to further diagnose the
problem.</para>
</listitem>
</itemizedlist>
</listitem>
2006-05-18 18:07:10 +02:00
<listitem >
<para > If the packet count is non-zero, check your log to see if
the connection is being dropped or rejected. If it is, then you
may have a zone definition problem such that the server is in a
different zone than what is specified in the DEST column. At a
2008-08-15 03:26:15 +02:00
root prompt, type "<command > shorewall show zones</command> "
2007-08-09 20:31:14 +02:00
("<command > shorewall-lite show zones</command> ") then be sure that
in the DEST column you have specified the <emphasis
role="bold">first</emphasis> zone in the list that matches
OUT=< dev> and DEST= < ip> from the REJECT/DROP log
message.</para>
2006-05-18 18:07:10 +02:00
</listitem>
2006-12-11 16:57:41 +01:00
<listitem >
<para > If everything seems to be correct according to these tests
but the connection doesn't work, it may be that your ISP is
blocking SYN,ACK responses. This technique allows your ISP to
2007-08-09 20:31:14 +02:00
detect when you are running a server (usually in violation of your
service agreement) and to stop connections to that server from
being established.</para>
2006-12-11 16:57:41 +01:00
</listitem>
2004-02-14 19:06:39 +01:00
</itemizedlist>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq1c" >
2008-08-15 03:26:15 +02:00
<title > (FAQ 1c) From the Internet, I want to connect to port 1022 on
2004-02-14 19:06:39 +01:00
my firewall and have the firewall forward the connection to port 22 on
local system 192.168.1.3. How do I do that?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> In
2006-09-04 19:06:17 +02:00
/<filename > etc/shorewall/rules</filename> :</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT
DNAT net loc:192.168.1.3:22 tcp 1022</programlisting>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq1d" >
2005-04-07 18:35:59 +02:00
<title > (FAQ 1d) I have a web server in my DMZ and I use port
forwarding to make that server accessible from the Internet. That
works fine but when my local users try to connect to the server using
the Firewall's external IP address, it doesn't work.</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See <link
2008-04-08 01:04:20 +02:00
linkend="faq2b">FAQ 2b</link> .</para>
2005-04-07 18:35:59 +02:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq1e" >
2005-05-02 18:28:11 +02:00
<title > (FAQ 1e) In order to discourage brute force attacks I would
like to redirect all connections on a non-standard port (4104) to port
22 on the router/firewall. I notice that setting up a REDIRECT rule
causes the firewall to open both ports 4104 and 22 to connections from
the net. Is it possible to only redirect 4104 to the localhost port 22
and have connection attempts to port 22 from the net dropped?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer </emphasis> courtesy of Ryan: Assume
2005-05-02 18:28:11 +02:00
that the IP address of your local firewall interface is 192.168.1.1.
2006-03-02 17:19:28 +01:00
If you configure SSHD to only listen on that interface and add the
following rule then from the net, you will have 4104 listening, from
your LAN, port 22.</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT(S)
DNAT net fw:192.168.1.1:22 tcp 4104</programlisting>
2005-05-02 18:28:11 +02:00
</section>
2008-03-13 00:19:31 +01:00
<section id= "faq1f" >
<title > (FAQ 1f) Why must the server that I port forward to have it's
default gateway set to my Shorewall system's IP address?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Let's take an example.
2008-03-13 00:19:31 +01:00
Suppose that</para>
<itemizedlist >
<listitem >
<para > Your Shorewall firewall's external IP address is
2008-08-30 03:00:50 +02:00
206.124.146.176 (eth0) and its internal IP address is 192.168.1.1
2008-03-13 00:19:31 +01:00
(eth1).</para>
</listitem>
<listitem >
<para > You have another gateway router with external IP address
130.252.100.109 and internal IP address 192.168.1.254.</para>
</listitem>
<listitem >
<para > You have an FTP server behind both routers with IP address
192.168.1.4</para>
</listitem>
<listitem >
<para > The FTP server's default gateway is through the second
router (192.168.1.254).</para>
</listitem>
<listitem >
<para > You have this rule on the Shorewall system:<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net loc:192.168.1.4 tcp 21 - 206.124.146.176</programlisting> </para>
</listitem>
<listitem >
<para > Internet host 16.105.221.4 issues the command <command > ftp
206.124.146.176</command> </para>
</listitem>
</itemizedlist>
<para > This results in the following set of events:</para>
<orderedlist >
<listitem >
2008-08-30 03:00:50 +02:00
<para > 16.105.221.4 sends a TCP SYN packet to 206.124.146.176
2008-03-13 00:19:31 +01:00
specifying destination port 21.</para>
</listitem>
<listitem >
<para > The Shorewall box rewrites the destination IP address to
192.168.1.4 and forwards the packet.</para>
</listitem>
<listitem >
<para > The FTP server receives the packet and accepts the
connection, generating a SYN,ACK packet back to 16.105.221.4.
Because the server's default gateway is through the second router,
it sends the packet to that router.</para>
</listitem>
</orderedlist>
2008-08-15 02:12:01 +02:00
<para > At this point, one of two things can happen. Either the second
2008-03-13 00:19:31 +01:00
router discards or rejects the packet; or, it rewrites the source IP
address to 130.252.100.109 and forwards the packet back to
16.105.221.4. Regardless of which happens, the connection is doomed.
Clearly if the packet is rejected or dropped, the connection will not
be successful. But even if the packet reaches 16.105.221.4, that host
will reject it since it's SOURCE IP address (130.252.100.109) doesn't
match the DESTINATION IP ADDRESS (206.124.146.176) of the original SYN
packet.</para>
<para > The best way to work around this problem is to change the
default gateway on the FTP server to the Shorewall system's internal
IP address (192.168.1.1). But if that isn't possible, you can work
around the problem with the following ugly hack in
<filename > /etc/shorewall/masq</filename> :<programlisting > #INTERFACE SOURCE ADDRESS PROTO PORT
eth1:192.168.1.4 0.0.0.0/0 192.168.1.1 tcp 21</programlisting> </para>
<para > This rule has the undesirable side effect that it makes all FTP
connections from the net appear to the FTP server as if they
originated on the Shorewall system. But it will force the FTP server
to reply back through the Shorewall system who can then rewrite the
SOURCE IP address in the responses properly.</para>
</section>
2008-03-13 01:04:31 +01:00
<section id= "faq1g" >
<title > (FAQ 1g) I would like to redirect port 80 on my public IP
2008-08-15 03:26:15 +02:00
address (206.124.146.176) to port 993 on Internet host
2008-03-22 17:11:52 +01:00
66.249.93.111</title>
2008-03-13 01:04:31 +01:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> This requires a vile
2008-03-13 01:04:31 +01:00
hack similar to the one in <link linkend= "faq2" > FAQ 2</link> . Assuming
that your Internet zone is named <emphasis > net</emphasis> and connects
on interface <filename class= "devicefile" > eth0</filename> :</para>
<para > In <filename > /etc/shorewall/rules</filename> :<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net net:66.249.93.111:993 tcp 80 - 206.124.146.176</programlisting> </para>
<para > In <filename > /etc/shorewall/interfaces</filename> , specify the
<emphasis role= "bold" > routeback</emphasis> option on
eth0:<programlisting > #ZONE INTERFACE BROADCAST OPTIONS
net eth0 detect <emphasis role= "bold" > routeback</emphasis> </programlisting> </para>
<para > And in <filename > /etc/shorewall/masq</filename> ;<programlisting > #INTERFACE SOURCE ADDRESS PROTO PORT
eth0:66.249.93.111 0.0.0.0/0 206.124.146.176 tcp 993</programlisting> </para>
<para > Like the hack in FAQ 2, this one results in all forwarded
connections looking to the server (66.249.93.11) as if they originated
on your firewall (206.124.146.176).</para>
</section>
2009-03-20 15:18:07 +01:00
<section id= "faq1h" >
<title > (FAQ 1h) How do I set shorewall to allow ssh on port 9022 from
net? SSHD is listening on port 22.</title>
<para > <emphasis role= "bold" > Answer</emphasis> : Use this rule.</para>
<programlisting > #ACTION SOURCE DEST PROTO DEST
# PORT(S)
REDIRECT net 22 tcp 9022</programlisting>
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq30" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 30) I'm confused about when to use DNAT rules and when to
use ACCEPT rules.</title>
2005-06-01 15:57:52 +02:00
2008-09-15 17:04:51 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> It would be a good idea
to review the <ulink url= "shorewall_quickstart_guide.htm" > QuickStart
2006-09-04 19:06:17 +02:00
Guide</ulink> appropriate for your setup; the guides cover this topic in
a tutorial fashion. DNAT rules should be used for connections that need
to go the opposite direction from SNAT/MASQUERADE. So if you masquerade
2008-08-15 03:26:15 +02:00
or use SNAT from your local network to the Internet then you will need
to use DNAT rules to allow connections from the Internet to your local
2006-09-26 00:32:45 +02:00
network. You also want to use DNAT rules when you intentionally want to
rewrite the destination IP address or port number. In all other cases,
you use ACCEPT unless you need to hijack connections as they go through
your firewall and handle them on the firewall box itself; in that case,
you use a REDIRECT rule.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2009-06-02 17:21:52 +02:00
<section id= "faq8" >
<title > (FAQ 8) I have several external IP addresses and use
/etc/shorewall/nat to associate them with systems in my DMZ. When I add
a DNAT rule, say for ports 80 and 443, Shorewall redirects connections
on those ports for all of my addresses. How can I restrict DNAT to only
a single address?</title>
<para > <emphasis role= "bold" > Answer</emphasis> : Specify the external
address that you want to redirect in the ORIGINAL DEST column.</para>
<para > Example:</para>
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net net:192.168.4.22 tcp 80,443 - <emphasis
role="bold">206.124.146.178</emphasis> </programlisting>
</section>
2007-06-28 17:40:13 +02:00
<section id= "faq38" >
2004-07-15 00:06:35 +02:00
<title > (FAQ 38) Where can I find more information about DNAT?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Ian Allen has written a
2009-06-25 13:17:01 +02:00
<ulink url= "http://idallen.com/dnat.txt" > Paper about DNAT and
2004-08-17 00:17:09 +02:00
Linux</ulink> .</para>
2004-07-15 00:06:35 +02:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq48" >
2006-12-05 19:25:40 +01:00
<title > (FAQ 48) How do I Set up Transparent HTTP Proxy with
2005-05-13 20:27:08 +02:00
Shorewall?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See <ulink
2005-06-01 15:57:52 +02:00
url="Shorewall_Squid_Usage.html">Shorewall_Squid_Usage.html</ulink> .</para>
2005-05-13 20:27:08 +02:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "DNS-DNAT" >
<title id= "DNS" > DNS and Port Forwarding/NAT</title>
2005-06-01 15:57:52 +02:00
<section id= "faq2" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 2) I port forward www requests to www.mydomain.com (IP
130.151.100.69) to system 192.168.1.5 in my local network. External
clients can browse http://www.mydomain.com but internal clients
2004-08-17 00:17:09 +02:00
can't.</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> I have two objections to
2004-02-14 19:06:39 +01:00
this setup.</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
2008-08-15 03:26:15 +02:00
<para > Having an Internet-accessible server in your local network is
2004-02-14 19:06:39 +01:00
like raising foxes in the corner of your hen house. If the server is
2004-08-17 00:17:09 +02:00
compromised, there's nothing between that server and your other
2004-02-14 19:06:39 +01:00
internal systems. For the cost of another NIC and a cross-over
cable, you can put your server in a DMZ such that it is isolated
from your local systems - assuming that the Server can be located
near the Firewall, of course :-)</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-07-13 23:18:37 +02:00
<para > The accessibility problem is best solved using
<firstterm > Split DNS</firstterm> (either <ulink
url="SplitDNS.html">use a separate DNS server</ulink> for local
clients or use <ulink url= "shorewall_setup_guide.htm#DNS" > Bind
Version 9 <quote > views</quote> </ulink> on your main name server)
such that www.mydomain.com resolves to 130.141.100.69 externally and
192.168.1.5 internally. That's what I do here at shorewall.net for
my local systems that use one-to-one NAT.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</itemizedlist>
2005-06-01 15:57:52 +02:00
2008-01-14 22:23:20 +01:00
<para > So the best and most secure way to solve this problem is to move
2008-08-15 03:26:15 +02:00
your Internet-accessible server(s) to a separate LAN segment with it's
2008-01-14 22:23:20 +01:00
own interface to your firewall and follow <link linkend= "faq2b" > FAQ
2008-01-14 22:28:34 +01:00
2b</link> . That way, your local systems are still safe if your server
2008-07-13 23:18:37 +02:00
gets hacked and you don't have to run a split DNS configuration
(separate server or Bind 9 views).</para>
2008-01-14 22:23:20 +01:00
2008-07-14 15:07:05 +02:00
<para > If physical limitations make it impractical to segregate your
servers on a separate LAN, the next best solution it to use Split DNS.
Before you complain "It's too hard to set up split DNS!", <ulink
url="SplitDNS.html"><emphasis role= "bold" > check
2008-07-13 19:43:53 +02:00
here</emphasis> </ulink> .</para>
2007-08-09 20:31:14 +02:00
<para > But if you are the type of person who prefers quick and dirty
hacks to "doing it right", then proceed as described below.<warning >
2005-03-01 21:20:26 +01:00
<para > All traffic redirected through use of this hack will look to
2007-08-09 20:31:14 +02:00
the server as if it originated on the firewall rather than on the
original client! So the server's access logs will be useless for
determining which local hosts are accessing the server.</para>
2005-06-01 15:57:52 +02:00
</warning> </para>
2007-08-09 20:31:14 +02:00
<para > Assuming that your external interface is eth0 and your internal
interface is eth1 and that eth1 has IP address 192.168.1.254 with subnet
192.168.1.0/24, then:</para>
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
<para > In <filename > /etc/shorewall/interfaces</filename> :</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ZONE INTERFACE BROADCAST OPTIONS
2005-06-01 15:57:52 +02:00
loc eth1 detect <emphasis role= "bold" > routeback</emphasis> </programlisting>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2004-08-11 02:18:47 +02:00
<para > In <filename > /etc/shorewall/masq</filename> :</para>
2005-06-01 15:57:52 +02:00
2008-01-09 16:52:02 +01:00
<programlisting > #INTERFACE SOURCE ADDRESS PROTO PORT(S)
2007-08-09 20:31:14 +02:00
<emphasis role= "bold" > eth1:192.168.1.5 eth1 192.168.1.254 tcp www</emphasis> </programlisting>
2004-08-11 02:18:47 +02:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-08-11 02:18:47 +02:00
<listitem >
<para > In <filename > /etc/shorewall/rules</filename> :</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
2007-08-09 20:31:14 +02:00
<emphasis role= "bold" > DNAT loc loc:192.168.1.5 tcp www - 130.151.100.69</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > That rule only works of course if you have a static external
2005-08-31 00:46:02 +02:00
IP address. If you have a dynamic IP address then include this in
2006-12-05 19:25:40 +01:00
<filename > /etc/shorewall/params</filename> (or your
<filename > < export directory> /init</filename> file if you are
using Shorewall Lite on the firewall system):</para>
2005-06-01 15:57:52 +02:00
<programlisting > <command > ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
2004-02-14 19:06:39 +01:00
<para > and make your DNAT rule:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
2007-08-09 20:31:14 +02:00
DNAT loc loc:192.168.1.5 tcp www - <emphasis
role="bold">$ETH0_IP</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > Using this technique, you will want to configure your
2006-12-05 19:25:40 +01:00
DHCP/PPPoE/PPTP/… client to automatically restart Shorewall each
2009-02-28 04:45:43 +01:00
time that you get a new IP address.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</itemizedlist>
2005-06-01 15:57:52 +02:00
<section id= "faq2a" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 2a) I have a zone <quote > Z</quote> with an RFC1918 subnet
and I use one-to-one NAT to assign non-RFC1918 addresses to hosts in
Z. Hosts in Z cannot communicate with each other using their external
2004-08-17 00:17:09 +02:00
(non-RFC1918 addresses) so they can't access each other using their
DNS names.</title>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<note >
<para > If the ALL INTERFACES column in /etc/shorewall/nat is empty or
contains <quote > Yes</quote> , you will also see log messages like the
following when trying to access a host in Z from another host in Z
2008-08-15 03:26:15 +02:00
using the destination host's public address:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<programlisting > Oct 4 10:26:40 netgw kernel:
Shorewall:FORWARD:REJECT:IN=eth1 OUT=eth1 SRC=192.168.118.200
DST=192.168.118.210 LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=1342 DF
2005-05-09 20:52:42 +02:00
PROTO=TCP SPT=1494 DPT=1491 WINDOW=17472 RES=0x00 ACK SYN URGP=0</programlisting>
2004-02-14 19:06:39 +01:00
</note>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> This is another problem
2008-11-19 20:13:32 +01:00
that is best solved using split DNS. It allows both external and
internal clients to access a NATed host using the host's DNS
name.</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > Another good way to approach this problem is to switch from
one-to-one NAT to Proxy ARP. That way, the hosts in Z have non-RFC1918
addresses and can be accessed externally and internally using the same
address.</para>
2005-06-01 15:57:52 +02:00
2006-12-05 19:25:40 +01:00
<para > If you don't like those solutions and prefer, incredibly, to
route all Z-> Z traffic through your firewall then:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<orderedlist >
<listitem >
<para > Set the routeback option on the interface to Z.</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > Set the ALL INTERFACES column in the nat file to
<quote > Yes</quote> .</para>
</listitem>
</orderedlist>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<example id= "Example1" >
2004-02-14 19:06:39 +01:00
<title > Example:</title>
2005-06-01 15:57:52 +02:00
2006-12-05 19:25:40 +01:00
<literallayout > Zone: dmz, Interface: eth2, Subnet: 192.168.2.0/24, Address: 192.168.2.254</literallayout>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > In <filename > /etc/shorewall/interfaces</filename> :</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ZONE INTERFACE BROADCAST OPTIONS
2005-06-01 15:57:52 +02:00
dmz eth2 192.168.2.255 <emphasis role= "bold" > routeback</emphasis> </programlisting>
2008-08-15 03:26:15 +02:00
<para > In <filename > /etc/shorewall/nat</filename> , be sure that you
2004-02-14 19:06:39 +01:00
have <quote > Yes</quote> in the ALL INTERFACES column.</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<para > In /etc/shorewall/masq:</para>
2005-06-01 15:57:52 +02:00
2008-01-09 16:52:02 +01:00
<programlisting > #INTERFACE SOURCE ADDRESS
2007-08-09 20:31:14 +02:00
<emphasis role= "bold" > eth2 eth2 192.168.2.254</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2006-12-05 19:25:40 +01:00
<para > Like the silly hack in FAQ 2 above, this will make all
2005-06-01 15:57:52 +02:00
dmz-> dmz traffic appear to originate on the firewall.</para>
2004-02-14 19:06:39 +01:00
</example>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq2b" >
2005-04-07 18:35:59 +02:00
<title > (FAQ 2b) I have a web server in my DMZ and I use port
forwarding to make that server accessible from the Internet as
www.mydomain.com. That works fine but when my local users try to
connect to www.mydomain.com, it doesn't work.</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Let's assume the
2005-04-07 18:35:59 +02:00
following:</para>
2005-06-01 15:57:52 +02:00
2005-04-07 18:35:59 +02:00
<itemizedlist >
<listitem >
2005-06-01 15:57:52 +02:00
<para > External IP address is 206.124.146.176 on <filename
class="devicefile">eth0</filename> (www.mydomain.com).</para>
2005-04-07 18:35:59 +02:00
</listitem>
2005-06-01 15:57:52 +02:00
2005-04-07 18:35:59 +02:00
<listitem >
<para > Server's IP address is 192.168.2.4</para>
</listitem>
</itemizedlist>
2005-06-01 15:57:52 +02:00
2005-04-07 18:35:59 +02:00
<para > You can enable access to the server from your local network
using the firewall's external IP address by adding this rule:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT(S) SOURCE ORIGINAL
# PORT DEST
2007-08-09 20:31:14 +02:00
<emphasis role= "bold" > DNAT loc dmz:192.168.2.4 tcp 80 - 206.124.146.176</emphasis> </programlisting>
2005-06-01 15:57:52 +02:00
2005-04-07 18:35:59 +02:00
<para > If your external IP address is dynamic, then you must do the
following:</para>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > In <filename > /etc/shorewall/params</filename> (or in your
2008-09-15 17:04:51 +02:00
<filename > < export directory> /init</filename> file if you are
using Shorewall Lite on the firewall system):</para>
2005-06-01 15:57:52 +02:00
<programlisting > <command > ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
2005-04-07 18:35:59 +02:00
<para > and make your DNAT rule:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
2007-08-09 20:31:14 +02:00
DNAT loc dmz:192.168.2.4 tcp 80 - <emphasis
role="bold">$ETH0_IP</emphasis> </programlisting>
2006-03-12 18:16:59 +01:00
<warning >
<para > With dynamic IP addresses, you probably don't want to use
2006-06-13 02:07:00 +02:00
<ulink
url="starting_and_stopping_shorewall.htm"><command > shorewall[-lite]
save</command> and <command > shorewall[-lite]
2006-03-12 18:16:59 +01:00
restore</command> </ulink> .</para>
</warning>
2005-04-07 18:35:59 +02:00
</section>
2006-03-15 04:45:49 +01:00
<section id= "faq2c" >
<title > (FAQ 2c) I tried to apply the answer to FAQ 2 to my external
interface and the net zone and it didn't work. Why?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Did you set <emphasis
2006-03-15 04:47:10 +01:00
role="bold">IP_FORWARDING=On</emphasis> in
2006-03-15 04:45:49 +01:00
<filename > shorewall.conf</filename> ?</para>
</section>
2004-02-14 19:06:39 +01:00
</section>
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Blacklisting" >
2007-01-21 04:52:04 +01:00
<title > Blacklisting</title>
<section id= "faq63" >
<title > (FAQ 63) I just blacklisted IP address 206.124.146.176 and I can
still ping it. What did I do wrong?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Nothing.</para>
2007-01-21 04:52:04 +01:00
<para > Blacklisting an IP address blocks incoming traffic from that IP
2008-08-30 03:00:50 +02:00
address. And if you set BLACKLISTNEWONLY=Yes in
2008-09-15 17:04:51 +02:00
<filename > shorewall.conf</filename> , then only new connections <emphasis
role="bold">from</emphasis> that address are disallowed; traffic from
that address that is part of an established connection (such as ping
replies) is allowed.</para>
2007-01-21 04:52:04 +01:00
</section>
2009-04-24 20:30:53 +02:00
<section id= "faq84" >
<title > (FAQ 84) I put some IPs in the blacklist file in /etc/shorewall
to block the ips but i'm still getting reports from PSAD from those ips
saying they're port scanning. Shouldn't being on the blacklist drop all
packets from those ips?</title>
<para > <emphasis role= "bold" > Answer</emphasis> : You probably forgot to
specify the <emphasis role= "bold" > blacklist</emphasis> option for your
external interface(s) in
<filename > /etc/shorewall/interfaces</filename> .</para>
</section>
2007-01-21 04:52:04 +01:00
</section>
2007-06-28 17:40:13 +02:00
<section id= "MSN" >
2004-02-14 19:06:39 +01:00
<title > Netmeeting/MSN</title>
2005-06-01 15:57:52 +02:00
<section id= "faq3" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 3) I want to use Netmeeting or MSN Instant Messenger with
Shorewall. What do I do?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> There is an <ulink
2008-08-30 03:00:50 +02:00
url="http://www.kfki.hu/~kadlec/sw/netfilter/newnat-suite/">H.323
2004-02-14 19:06:39 +01:00
connection tracking/NAT module</ulink> that helps with Netmeeting. Note
however that one of the Netfilter developers recently posted the
following:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<blockquote >
2005-06-01 15:57:52 +02:00
<para > <programlisting > > I know PoM -ng is going to address this issue, but till it is ready, and
> all the extras are ported to it, is there any way to use the h.323
2008-08-15 03:26:15 +02:00
> conntrack module kernel patch with a 2.6 kernel?
2005-06-01 15:57:52 +02:00
> Running 2.6.1 - no 2.4 kernel stuff on the system, so downgrade is not
> an option... The module is not ported yet to 2.6, sorry.
> Do I have any options besides a gatekeeper app (does not work in my
> network) or a proxy (would prefer to avoid them)?
2005-05-09 20:52:42 +02:00
I suggest everyone to setup a proxy (gatekeeper) instead: the module is
really dumb and does not deserve to exist at all. It was an excellent tool
2005-06-01 15:57:52 +02:00
to debug/develop the newnat interface.</programlisting> </para>
2004-02-14 19:06:39 +01:00
</blockquote>
2005-06-01 15:57:52 +02:00
<para > Look <ulink url= "UPnP.html" > here</ulink> for a solution for MSN IM
2005-05-13 20:27:08 +02:00
but be aware that there are significant security risks involved with
2005-06-01 15:57:52 +02:00
this solution. Also check the Netfilter mailing list archives at <ulink
url="http://www.netfilter.org">http://www.netfilter.org</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Openports" >
2004-02-14 19:06:39 +01:00
<title > Open Ports</title>
2005-06-01 15:57:52 +02:00
2006-09-04 18:55:31 +02:00
<section id= "faq51" >
<title > (FAQ 51) How do I Open Ports in Shorewall?</title>
2006-08-15 16:38:55 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> No one who has installed
Shorewall using one of the <ulink
url="shorewall_quickstart_guide.htm">Quick Start Guides</ulink> should
have to ask this question.</para>
2008-08-15 03:26:15 +02:00
<para > Regardless of which guide you used, all outbound communication is
2006-08-15 16:38:55 +02:00
open by default. So you do not need to 'open ports' for output.</para>
<para > For input:</para>
<itemizedlist >
<listitem >
<para > If you installed using the Standalone Guide, then please
2006-12-03 17:15:14 +01:00
<ulink url= "standalone.htm#Open" > re-read this
2006-08-15 16:38:55 +02:00
section</ulink> .</para>
</listitem>
<listitem >
<para > If you installed using the Two-interface Guide, then please
2006-12-03 17:15:14 +01:00
re-read these sections: <ulink url= "two-interface.htm#DNAT" > Port
Forwarding (DNAT)</ulink> , and <ulink
url="two-interface.htm#Open">Other Connections</ulink> </para>
2006-08-15 16:38:55 +02:00
</listitem>
<listitem >
<para > If you installed using the Three-interface Guide, then please
2006-12-03 17:15:14 +01:00
re-read these sections: <ulink url= "three-interface.htm#DNAT" > Port
Forwarding (DNAT)</ulink> and <ulink
url="three-interface.htm#Open">Other Connections</ulink> </para>
2006-08-15 16:38:55 +02:00
</listitem>
<listitem >
<para > If you installed using the <ulink
url="shorewall_setup_guide.htm">Shorewall Setup Guide</ulink> then
you had better read the guide again -- you clearly missed a
lot.</para>
</listitem>
</itemizedlist>
<para > Also please see the <link linkend= "PortForwarding" > Port Forwarding
section of this FAQ</link> .</para>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq4" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 4) I just used an online port scanner to check my firewall
and it shows some ports as <quote > closed</quote> rather than
<quote > blocked</quote> . Why?</title>
2005-06-01 15:57:52 +02:00
2005-08-31 00:46:02 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> The default Shorewall
setup invokes the <emphasis role= "bold" > Drop</emphasis> action prior to
2008-05-24 17:01:01 +02:00
enforcing a DROP policy and the default policy to all zones from the
2008-08-15 03:26:15 +02:00
Internet is DROP. The Drop action is defined in
2004-12-23 23:28:58 +01:00
<filename > /usr/share/shorewall/action.Drop</filename> which in turn
2006-03-12 18:16:59 +01:00
invokes the <emphasis role= "bold" > Auth</emphasis> macro (defined in
<filename > /usr/share/shorewall/macro.Auth</filename> ) specifying the
2006-09-04 18:55:31 +02:00
<emphasis role= "bold" > REJECT</emphasis> action (i.e., <emphasis
2009-03-15 21:46:56 +01:00
role="bold">Auth(REJECT)</emphasis> ). This is necessary to prevent
2006-09-04 18:55:31 +02:00
outgoing connection problems to services that use the
<quote > Auth</quote> mechanism for identifying requesting users. That is
the only service which the default setup rejects.</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > If you are seeing closed TCP ports other than 113 (auth) then
either you have added rules to REJECT those ports or a router outside of
2004-08-17 00:17:09 +02:00
your firewall is responding to connection requests on those
ports.</para>
2005-06-01 15:57:52 +02:00
<section id= "faq4a" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 4a) I just ran an nmap UDP scan of my firewall and it
showed 100s of ports as open!!!!</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Take a deep breath and
read the nmap man page section about UDP scans. If nmap gets <emphasis
role="bold">nothing</emphasis> back from your firewall then it reports
2004-02-14 19:06:39 +01:00
the port as open. If you want to see which UDP ports are really open,
2005-06-01 15:57:52 +02:00
temporarily change your net-> all policy to REJECT, restart
2004-02-14 19:06:39 +01:00
Shorewall and do the nmap UDP scan again.</para>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq4b" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 4b) I have a port that I can't close no matter how I
2004-02-14 19:06:39 +01:00
change my rules.</title>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > I had a rule that allowed telnet from my local network to my
firewall; I removed that rule and restarted Shorewall but my telnet
session still works!!!</para>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Rules only govern the
2004-02-14 19:06:39 +01:00
establishment of new connections. Once a connection is established
through the firewall it will be usable until disconnected (tcp) or
until it times out (other protocols). If you stop telnet and try to
2008-08-15 03:26:15 +02:00
establish a new session your firewall will block that attempt.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq4c" >
2004-11-09 22:55:11 +01:00
<title > (FAQ 4c) How do I use Shorewall with PortSentry?</title>
2005-06-01 15:57:52 +02:00
<para > <ulink
2006-09-05 05:34:09 +02:00
url="http://www.shorewall.net/pub/shorewall/contrib/PortsentryHOWTO.txt"><emphasis
role="bold">Answer:</emphasis> Here's a writeup</ulink> describing a
nice integration of Shorewall and PortSentry.</para>
</section>
2004-02-14 19:06:39 +01:00
</section>
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Connections" >
2004-02-14 19:06:39 +01:00
<title > Connection Problems</title>
2005-06-01 15:57:52 +02:00
2007-09-21 16:03:44 +02:00
<section id= "pseudofaq17" >
<title > Why are these packets being Dropped/Rejected? How do I decode
Shorewall log messages?</title>
<para > Please see <link linkend= "faq17" > FAQ 17</link> .</para>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq5" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 5) I've installed Shorewall and now I can't ping through the
firewall</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> For a complete
description of Shorewall <quote > ping</quote> management, see <ulink
url="ping.html">this page</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq15" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 15) My local systems can't see out to the net</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Every time I read
2004-08-17 00:17:09 +02:00
<quote > systems can't see out to the net</quote> , I wonder where the
2004-02-14 19:06:39 +01:00
poster bought computers with eyes and what those computers will
<quote > see</quote> when things are working properly. That aside, the
most common causes of this problem are:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<orderedlist >
<listitem >
2004-08-17 00:17:09 +02:00
<para > The default gateway on each local system isn't set to the IP
address of the local firewall interface.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-30 03:00:50 +02:00
<para > The entry for the local network in the
<filename > /etc/shorewall/masq</filename> file is wrong or
missing.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > The DNS settings on the local systems are wrong or the user is
2004-08-17 00:17:09 +02:00
running a DNS server on the firewall and hasn't enabled UDP and TCP
2006-12-05 19:25:40 +01:00
port 53 from the local net to the firewall or from the firewall to
2008-08-15 03:26:15 +02:00
the Internet.</para>
2004-02-14 19:06:39 +01:00
</listitem>
2005-12-10 00:00:21 +01:00
<listitem >
2005-12-10 00:16:19 +01:00
<para > Forwarding is not enabled (This is often the problem for
Debian users). Enter this command:</para>
2005-12-10 00:00:21 +01:00
<programlisting > cat /proc/sys/net/ipv4/ip_forward</programlisting>
2006-03-12 18:16:59 +01:00
<para > If the value displayed is 0 (zero) then set <emphasis
2005-12-10 00:00:21 +01:00
role="bold">IP_FORWARDING=On</emphasis> in
<filename > /etc/shorewall/shorewall.conf</filename> and restart
Shorewall.</para>
</listitem>
2004-02-14 19:06:39 +01:00
</orderedlist>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq29" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 29) FTP Doesn't Work</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See the <ulink
2006-09-04 19:06:17 +02:00
url="FTP.html">Shorewall and FTP page</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq33" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 33) From clients behind the firewall, connections to some
sites fail. Connections to the same sites from the firewall itself work
2004-08-17 00:17:09 +02:00
fine. What's wrong.</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Most likely, you need to
set CLAMPMSS=Yes in <filename > <ulink
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink> </filename> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq35" >
2004-03-17 16:03:46 +01:00
<title > (FAQ 35) I have two Ethernet interfaces to my local network which
2004-08-17 00:17:09 +02:00
I have bridged. When Shorewall is started, I'm unable to pass traffic
through the bridge. I have defined the bridge interface (br0) as the
2008-08-30 03:00:50 +02:00
local interface in <filename > /etc/shorewall/interfaces</filename> ; the
bridged Ethernet interfaces are not defined to Shorewall. How do I tell
Shorewall to allow traffic through the bridge?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Add the
2006-09-04 19:06:17 +02:00
<firstterm > routeback</firstterm> option to <filename
2008-08-30 03:00:50 +02:00
class="devicefile">br0</filename> in <filename > <ulink
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink> </filename> .</para>
2005-06-01 15:57:52 +02:00
<para > For more information on this type of configuration, see the <ulink
url="SimpleBridge.html">Shorewall Simple Bridge
2004-09-24 00:50:12 +02:00
documentation</ulink> .</para>
2004-03-17 16:03:46 +01:00
</section>
2007-04-23 17:11:05 +02:00
2007-06-28 17:40:13 +02:00
<section id= "faq64" >
<title > (FAQ 64) I just upgraded my kernel to 2.6.20 and my
2007-04-23 17:11:05 +02:00
bridge/firewall stopped working. What is wrong?</title>
<para > <emphasis role= "bold" > Answer:</emphasis> In kernel 2.6.20, the
Netfilter <firstterm > physdev match</firstterm> feature was changed such
that it is no longer capable of matching the output device of
non-bridged traffic. You will see messages such as the following in your
log:</para>
<programlisting > Apr 20 15:03:50 wookie kernel: [14736.560947] physdev match: using --physdev-out in the OUTPUT, FORWARD and POSTROUTING chains for
non-bridged traffic is not supported anymore.</programlisting>
<para > This kernel change, while necessary, means that Shorewall zones
2009-02-28 04:45:43 +01:00
may no longer be defined in terms of bridge ports. See the<ulink
url="bridge-Shorewall-perl.html"> Shorewall-perl bridging
documentation</ulink> for information about how to configure
bridge/firewalls.<note >
2007-08-08 22:12:03 +02:00
<para > Following the instructions in the new bridging documentation
will not prevent the above message from being issued.</para>
</note> </para>
2007-04-23 17:11:05 +02:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Logging" >
2004-02-14 19:06:39 +01:00
<title > Logging</title>
2005-06-01 15:57:52 +02:00
<section id= "faq6" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 6) Where are the log messages written and how do I change
the destination?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> NetFilter uses the
2004-08-17 00:17:09 +02:00
kernel's equivalent of syslog (see <quote > man syslog</quote> ) to log
messages. It always uses the LOG_KERN (kern) facility (see <quote > man
openlog</quote> ) and you get to choose the log level (again, see
2008-08-30 03:00:50 +02:00
<quote > man syslog</quote> ) in your <filename > <ulink
url="manpages/shorewall-policy.html">policies</ulink> </filename> and
2008-09-15 17:04:51 +02:00
<filename > <ulink
url="manpages/shorewall-rules.html">rules</ulink> </filename> . The
destination for messages logged by syslog is controlled by
2004-08-17 00:17:09 +02:00
<filename > /etc/syslog.conf</filename> (see <quote > man
2008-08-30 03:00:50 +02:00
syslog.conf</quote> ). When you have changed
<filename > /etc/syslog.conf</filename> , be sure to restart syslogd (on a
RedHat system, <quote > service syslog restart</quote> ).</para>
2005-06-01 15:57:52 +02:00
2006-03-12 18:16:59 +01:00
<para > By default, older versions of Shorewall rate-limited log messages
2007-07-04 02:23:43 +02:00
through <ulink url= "manpages/shorewall.conf.html" > settings</ulink> in
2004-02-14 19:06:39 +01:00
<filename > /etc/shorewall/shorewall.conf</filename> -- If you want to log
all messages, set:</para>
2005-06-01 15:57:52 +02:00
<programlisting > LOGLIMIT=""
LOGBURST=""</programlisting>
2005-08-31 00:46:02 +02:00
<para > It is also possible to <ulink url= "shorewall_logging.html" > set up
Shorewall to log all of its messages to a separate file</ulink> .</para>
2005-06-01 15:57:52 +02:00
<section id= "faq6a" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 6a) Are there any log parsers that work with
Shorewall?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Here are several links
2004-02-14 19:06:39 +01:00
that may be helpful:</para>
2005-06-01 15:57:52 +02:00
2005-05-26 23:09:37 +02:00
<literallayout >
2005-06-01 15:57:52 +02:00
<ulink url= "http://www.shorewall.net/pub/shorewall/parsefw/" > http://www.shorewall.net/pub/shorewall/parsefw/</ulink>
2008-08-30 03:00:50 +02:00
<ulink url= "http://aaron.marasco.com/linux.html" > http://aaron.marasco.com/linux.html</ulink>
2005-06-01 15:57:52 +02:00
<ulink url= "http://cert.uni-stuttgart.de/projects/fwlogwatch" > http://cert.uni-stuttgart.de/projects/fwlogwatch</ulink>
<ulink url= "http://www.logwatch.org" > http://www.logwatch.org</ulink>
2005-05-26 23:09:37 +02:00
</literallayout>
2005-06-01 15:57:52 +02:00
2006-12-05 19:25:40 +01:00
<para > I personally use <ulink
url="http://www.logwatch.org">Logwatch</ulink> . It emails me a report
each day from my various systems with each report summarizing the
logged activity on the corresponding system. I use the brief report
format; here's a sample:</para>
<blockquote >
<programlisting > --------------------- iptables firewall Begin ------------------------
Dropped 111 packets on interface eth0
From 58.20.162.142 - 5 packets to tcp(1080)
From 62.163.19.50 - 1 packet to udp(6348)
From 66.111.45.60 - 9 packets to tcp(192)
From 69.31.82.50 - 18 packets to tcp(3128)
From 72.232.183.102 - 2 packets to tcp(3128)
From 82.96.96.3 - 6 packets to tcp(808,1080,1978,7600,65506)
From 128.48.51.209 - 5 packets to tcp(143)
From 164.77.223.150 - 12 packets to tcp(873)
From 165.233.109.23 - 8 packets to tcp(22)
From 202.99.172.175 - 4 packets to udp(2,4081)
From 206.59.41.101 - 2 packets to tcp(5900)
From 217.91.30.224 - 24 packets to tcp(873)
From 218.87.47.114 - 6 packets to tcp(3128)
From 220.110.219.234 - 4 packets to tcp(22)
From 220.133.116.173 - 5 packets to tcp(3128)
---------------------- iptables firewall End -------------------------</programlisting>
</blockquote>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq6b" >
2005-05-09 16:49:08 +02:00
<title > (FAQ 6b) DROP messages on port 10619 are flooding the logs with
2008-08-30 03:00:50 +02:00
their connect requests. Can I exclude these error messages for this
2004-02-14 19:06:39 +01:00
port temporarily from logging in Shorewall?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Temporarily add the
2006-09-04 19:06:17 +02:00
following rule:</para>
2005-06-01 15:57:52 +02:00
2006-08-19 20:26:03 +02:00
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT(S)
DROP net fw udp 10619</programlisting>
<para > Alternatively, if you do not set BLACKLIST_LOGLEVEL and you have
specifed the 'blacklist' option on your external interface in
<filename > /etc/shorewall/interfaces</filename> , then you can blacklist
the port. In <filename > /etc/shorewall/blacklist</filename> :</para>
<programlisting > #ADDRESS/SUBNET PROTOCOL PORT
- udp 10619</programlisting>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq6d" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 6d) Why is the MAC address in Shorewall log messages so
long? I thought MAC addresses were only 6 bytes in length.</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> What is labeled as the
2006-09-04 19:06:17 +02:00
MAC address in a Netfilter (Shorewall) log message is actually the
Ethernet frame header. It contains:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<itemizedlist >
<listitem >
<para > the destination MAC address (6 bytes)</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > the source MAC address (6 bytes)</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-15 03:26:15 +02:00
<para > the Ethernet frame type (2 bytes)</para>
2004-02-14 19:06:39 +01:00
</listitem>
</itemizedlist>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<para > <example id= "Example5" >
<title id= "Example2" > Example</title>
2005-06-01 15:57:52 +02:00
<para > <programlisting > MAC=00:04:4c:dc:e2:28:00:b0:8e:cf:3c:4c:08:00</programlisting>
<itemizedlist >
2004-08-17 00:17:09 +02:00
<listitem >
<para > Destination MAC address = 00:04:4c:dc:e2:28</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-08-17 00:17:09 +02:00
<listitem >
<para > Source MAC address = 00:b0:8e:cf:3c:4c</para>
</listitem>
2005-06-01 15:57:52 +02:00
2004-08-17 00:17:09 +02:00
<listitem >
<para > Ethernet Frame Type = 08:00 (IP Version 4)</para>
</listitem>
2005-06-01 15:57:52 +02:00
</itemizedlist> </para>
</example> </para>
2004-02-14 19:06:39 +01:00
</section>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq16" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 16) Shorewall is writing log messages all over my console
making it unusable!</title>
2005-06-01 15:57:52 +02:00
2005-09-07 20:09:17 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> </para>
2005-06-01 15:57:52 +02:00
2007-08-06 21:48:31 +02:00
<para > Just to be clear, it is not Shorewall that is writing all over
your console. Shorewall issues a single log message during each
<command > start</command> , <command > restart</command> ,
<command > stop</command> , etc. It is rather the klogd daemon that is
writing messages to your console. Shorewall itself has no control over
where a particular class of messages are written. See the <ulink
url="shorewall_logging.html">Shorewall logging
documentation</ulink> .</para>
2008-05-26 18:35:57 +02:00
<para > The max log level to be sent to the console is available in
/proc/sys/kernel/printk:<programlisting > teastep@ursa:~$ <emphasis
role="bold">cat /proc/sys/kernel/printk</emphasis>
6 6 1 7
teastep@ursa:~$ </programlisting> The first number determines the maximum log
level (syslog priority) sent to the console. Messages with priority
<emphasis role= "bold" > less than</emphasis> this number are sent to the
console. On the system shown in the example above, priorities 0-5 are
sent to the console. Since Shorewall defaults to using 'info' (6), the
2008-08-15 03:26:15 +02:00
Shorewall-generated Netfilter rule set will generate log messages that
2008-05-29 05:07:06 +02:00
<emphasis role= "bold" > will not appear on the console.</emphasis> </para>
2008-05-26 18:35:57 +02:00
<para > The second number is the default log level for kernel printk()
calls that do not specify a log level.</para>
<para > The third number specifies the minimum console log level while the
fourth gives the default console log level.</para>
<para > If, on your system, the first number is 7 or greater, then the
default Shorewall configurations will cause messages to be written to
your console. The simplest solution is to add this to your
2008-09-15 17:04:51 +02:00
<filename > /etc/sysctl.conf</filename> file:<programlisting > kernel.printk = 4 4 1 7</programlisting> </para>
2008-05-26 18:35:57 +02:00
<para > then<programlisting > <command > sysctl -p /etc/sysctl.conf</command> </programlisting> </para>
2006-12-23 23:25:16 +01:00
<section id= "faq16a" >
<title > (FAQ 16a) Why can't I see any Shorewall messages in
/var/log/messages?</title>
2007-01-02 04:08:29 +01:00
<para > Some people who ask this question report that the only Shorewall
messages that they see in <filename > /var/log/messages</filename> are
'started', 'restarted' and 'stopped' messages.</para>
2007-01-02 00:33:28 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> First of all, it is
important to understand that Shorewall itself does not control where
Netfilter log messages are written. The LOGFILE setting in
<filename > shorewall.conf</filename> simply tells the
<filename > /sbin/shorewall[-lite]</filename> program where to look for
2007-01-02 04:43:51 +01:00
the log. Also, it is important to understand that a log level of
2007-08-06 22:04:19 +02:00
"debug" will generally cause Netfilter messages to be written to fewer
2007-01-02 04:43:51 +01:00
files in <filename class= "directory" > /var/log</filename> than a log
2008-11-19 20:13:32 +01:00
level of "info". The log level does not control the number of log
2007-01-02 04:43:51 +01:00
messages or the content of the messages.</para>
2007-01-02 00:33:28 +01:00
<para > The actual log file where Netfilter messages are written is not
2008-08-15 03:26:15 +02:00
standardized and will vary by distribution and distribution version.
2007-01-02 04:43:51 +01:00
But anytime you see no logging, it's time to look outside the
Shorewall configuration for the cause. As an example, recent
2008-08-15 07:03:24 +02:00
<trademark > SUSE</trademark> releases use syslog-ng by default and
2007-01-02 04:43:51 +01:00
write Shorewall messages to
2006-12-23 23:25:16 +01:00
<filename > /var/log/firewall</filename> .</para>
2007-01-02 00:33:28 +01:00
<para > Please see the <ulink url= "shorewall_logging.html" > Shorewall
logging documentation</ulink> for further information.</para>
2006-12-23 23:25:16 +01:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq17" >
2007-08-09 17:16:08 +02:00
<title > (FAQ 17) Why are these packets being Dropped/Rejected? How do I
2004-11-09 22:55:11 +01:00
decode Shorewall log messages?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Logging of
2004-09-24 00:50:12 +02:00
dropped/rejected packets occurs out of a number of chains (as indicated
in the log message) in Shorewall:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<variablelist >
2005-06-01 15:57:52 +02:00
<varlistentry id= "all2all" >
2007-12-02 18:11:46 +01:00
<term > all2<emphasis > zone</emphasis> , <emphasis > zone</emphasis> 2all
or all2all</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-30 03:00:50 +02:00
<para > You have a <filename > <ulink
2008-09-15 17:04:51 +02:00
url="manpages/shorewall-policy.html">policy</ulink> </filename>
that specifies a log level and this packet is being logged under
that policy. If you intend to ACCEPT this traffic then you need a
<ulink url= "manpages/shorewall-rules.html" > rule</ulink> to that
2007-07-04 21:26:51 +02:00
effect.</para>
2006-10-20 17:41:54 +02:00
2009-02-28 04:45:43 +01:00
<para > Packets logged out of these chains may have a source and/or
destination that is not in any defined zone (see the output of
<command > shorewall[-lite] show zones</command> ). Remember that
zone membership involves both a firewall interface and an ip
address.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
2007-12-02 18:11:46 +01:00
<term > <emphasis > zone</emphasis> 12<emphasis > zone2</emphasis> </term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2005-06-01 15:57:52 +02:00
<para > Either you have a <ulink
2007-12-02 18:11:46 +01:00
url="manpages/shorewall-policy.html">policy</ulink> for
2008-08-30 03:00:50 +02:00
<emphasis > zone1</emphasis> to <emphasis > zone2</emphasis> that
2007-12-02 18:11:46 +01:00
specifies a log level and this packet is being logged under that
policy or this packet matches a <ulink
url="manpages/shorewall-rules.html">rule</ulink> that includes a
log level.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-12-04 19:37:02 +01:00
<varlistentry >
2007-12-02 18:11:46 +01:00
<term > @<emphasis > source</emphasis> 2<emphasis > dest</emphasis> </term>
2005-06-01 15:57:52 +02:00
2004-12-04 19:37:02 +01:00
<listitem >
2007-12-02 18:11:46 +01:00
<para > You have a policy for traffic from
<emphasis > source</emphasis> to <emphasis > dest</emphasis> that
specifies TCP connection rate limiting (value in the LIMIT:BURST
column). The logged packet exceeds that limit and was dropped.
Note that these log messages themselves are severely rate-limited
so that a syn-flood won't generate a secondary DOS because of
excessive log message. These log messages were added in Shorewall
2.2.0 Beta 7.</para>
2004-12-04 19:37:02 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
2008-05-24 17:01:01 +02:00
<term > <emphasis > interface</emphasis> _mac or
<emphasis > interface</emphasis> _rec</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2005-06-01 15:57:52 +02:00
<para > The packet is being logged under the <emphasis
role="bold">maclist</emphasis> <ulink
2007-07-04 02:18:10 +02:00
url="manpages/shorewall-interfaces.html">interface
2004-08-17 00:17:09 +02:00
option</ulink> .</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
2008-08-15 03:26:15 +02:00
<term > blacklist</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > The packet is being logged because the source IP is
2005-06-01 15:57:52 +02:00
blacklisted in the <filename > <ulink
2007-07-04 02:23:43 +02:00
url="manpages/shorewall-blacklist.html">/etc/shorewall/blacklist</ulink>
2005-06-01 15:57:52 +02:00
</filename> file.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > INPUT or FORWARD</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2004-08-17 00:17:09 +02:00
<para > The packet has a source IP address that isn't in any of your
2006-10-20 17:41:54 +02:00
defined zones (<quote > <command > shorewall[-lite] show
zones</command> </quote> and look at the printed zone definitions)
or the chain is FORWARD and the destination IP isn't in any of
your defined zones. If the chain is FORWARD and the IN and OUT
interfaces are the same, then you probably need the <emphasis
role="bold">routeback</emphasis> option on that interface in
<filename > <ulink
2007-07-04 02:18:10 +02:00
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink>
2008-08-30 03:00:50 +02:00
</filename> , you need the <emphasis
2005-06-01 15:57:52 +02:00
role="bold">routeback</emphasis> option in the relevant entry in
<filename > <ulink
2008-05-24 17:01:01 +02:00
url="manpages/shorewall-hosts.html">/etc/shorewall/hosts</ulink>
or you've done something silly like define a default route out of
an internal interface.</filename> </para>
2006-10-20 17:41:54 +02:00
2009-02-28 04:45:43 +01:00
<para > With OPTIMIZE=1 in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> , such
packets may also be logged out of a < zone> 2all chain or the
all2all chain.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2005-03-01 22:20:02 +01:00
<varlistentry >
<term > OUTPUT</term>
2005-06-01 15:57:52 +02:00
2005-03-01 22:20:02 +01:00
<listitem >
<para > The packet has a destination IP address that isn't in any of
2006-10-20 17:41:54 +02:00
your defined zones(<command > shorewall[-lite] show zones</command>
and look at the printed zone definitions).</para>
2009-02-28 04:45:43 +01:00
<para > With OPTIMIZE=1 in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> , such
packets may also be logged out of the fw2all chain or the all2all
chain.</para>
2005-03-01 22:20:02 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > logflags</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > The packet is being logged because it failed the checks
2005-06-01 15:57:52 +02:00
implemented by the <emphasis role= "bold" > tcpflags</emphasis>
2007-07-04 02:18:10 +02:00
<ulink url= "manpages/shorewall-interfaces.html" > interface
2004-08-17 00:17:09 +02:00
option</ulink> .</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
</variablelist>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<example id= "Example3" >
2004-02-14 19:06:39 +01:00
<title > Here is an example:</title>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > Jun 27 15:37:56 gateway kernel:
2005-06-01 15:57:52 +02:00
Shorewall:<emphasis role= "bold" > all2all:REJECT</emphasis> :<emphasis
role="bold">IN=eth2</emphasis>
<emphasis role= "bold" > OUT=eth1</emphasis>
<emphasis role= "bold" > SRC=192.168.2.2</emphasis>
<emphasis role= "bold" > DST=192.168.1.3 </emphasis> LEN=67 TOS=0x00 PREC=0x00 TTL=63 ID=5805 DF <emphasis
role="bold">PROTO=UDP</emphasis>
SPT=1803 <emphasis role= "bold" > DPT=53</emphasis> LEN=47</programlisting>
2004-08-17 00:17:09 +02:00
<para > Let's look at the important parts of this message:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<variablelist >
<varlistentry >
<term > all2all:REJECT</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2005-06-01 15:57:52 +02:00
<para > This packet was REJECTed out of the <emphasis
role="bold">all2all</emphasis> chain -- the packet was rejected
under the <quote > all</quote> -> <quote > all</quote> REJECT
policy (<link linkend= "all2all" > all2all</link> above).</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > IN=eth2</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > the packet entered the firewall via eth2. If you see
<quote > IN=</quote> with no interface name, the packet originated
on the firewall itself.</para>
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > OUT=eth1</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > if accepted, the packet would be sent on eth1. If you see
<quote > OUT=</quote> with no interface name, the packet would be
2005-12-10 00:00:21 +01:00
processed by the firewall itself.</para>
2005-11-18 23:21:53 +01:00
<note >
<para > When a DNAT rule is logged, there will never be an OUT=
shown because the packet is being logged before it is routed.
Also, DNAT logging will show the <emphasis > original</emphasis>
2008-05-24 17:01:01 +02:00
destination IP address and destination port number. When a
REDIRECT rule is logged, the message will also show the
original destination IP address and port number.</para>
2005-11-18 23:21:53 +01:00
</note>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > SRC=192.168.2.2</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > the packet was sent by 192.168.2.2</para>
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > DST=192.168.1.3</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > the packet is destined for 192.168.1.3</para>
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > PROTO=UDP</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > UDP Protocol</para>
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > DPT=53</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
<para > The destination port is 53 (DNS)</para>
</listitem>
</varlistentry>
</variablelist>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > In this case, 192.168.2.2 was in the <quote > dmz</quote> zone and
2004-08-17 00:17:09 +02:00
192.168.1.3 is in the <quote > loc</quote> zone. I was missing the
rule:</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<programlisting > ACCEPT dmz loc udp 53</programlisting>
</example>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq21" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 21) I see these strange log entries occasionally; what are
they?</title>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<programlisting > Nov 25 18:58:52 linux kernel:
Shorewall:net2all:DROP:IN=eth1 OUT=
MAC=00:60:1d:f0:a6:f9:00:60:1d:f6:35:50:08:00 SRC=206.124.146.179
2007-01-02 00:44:20 +01:00
DST=192.0.2.3 LEN=56 TOS=0x00 PREC=0x00 TTL=110 ID=18558 <emphasis
role="bold">PROTO=ICMP</emphasis>
<emphasis role= "bold" > TYPE=3 CODE=3</emphasis> [SRC=192.0.2.3 DST=172.16.1.10 LEN=128 TOS=0x00 PREC=0x00
2004-02-14 19:06:39 +01:00
TTL=47 ID=0 DF PROTO=UDP SPT=53 DPT=2857 LEN=108 ]</programlisting>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > 192.0.2.3 is external on my firewall... 172.16.0.0/24 is my
internal LAN</para>
2005-06-01 15:57:52 +02:00
2007-01-02 00:44:20 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> First of all, please note
that the above is a very specific type of log message dealing with ICMP
2007-01-02 04:43:51 +01:00
port unreachable packets (PROTO=ICMP TYPE=3 CODE=3). Do not read this
answer and assume that all Shorewall log messages have something to do
with ICMP (hint -- see <link linkend= "faq17" > FAQ 17</link> ).</para>
2007-01-02 00:44:20 +01:00
<para > While most people associate the Internet Control Message Protocol
(ICMP) with <quote > ping</quote> , ICMP is a key piece of IP. ICMP is used
to report problems back to the sender of a packet; this is what is
happening here. Unfortunately, where NAT is involved (including SNAT,
2008-08-30 03:00:50 +02:00
DNAT and Masquerade), there are many broken implementations. That is
2007-01-02 00:44:20 +01:00
what you are seeing with these messages. When Netfilter displays these
messages, the part before the "[" describes the ICMP packet and the part
between the "[" and "]" describes the packet for which the ICMP is a
2004-11-26 19:53:04 +01:00
response.</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > Here is my interpretation of what is happening -- to confirm this
analysis, one would have to have packet sniffers placed a both ends of
the connection.</para>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<para > Host 172.16.1.10 behind NAT gateway 206.124.146.179 sent a UDP DNS
query to 192.0.2.3 and your DNS server tried to send a response (the
response information is in the brackets -- note source port 53 which
marks this as a DNS reply). When the response was returned to to
206.124.146.179, it rewrote the destination IP TO 172.16.1.10 and
forwarded the packet to 172.16.1.10 who no longer had a connection on
UDP port 2857. This causes a port unreachable (type 3, code 3) to be
generated back to 192.0.2.3. As this packet is sent back through
206.124.146.179, that box correctly changes the source address in the
2004-08-17 00:17:09 +02:00
packet to 206.124.146.179 but doesn't reset the DST IP in the original
DNS response similarly. When the ICMP reaches your firewall (192.0.2.3),
your firewall has no record of having sent a DNS reply to 172.16.1.10 so
this ICMP doesn't appear to be related to anything that was sent. The
final result is that the packet gets logged and dropped in the all2all
2009-06-05 19:51:30 +02:00
chain.</para>
2004-02-14 19:06:39 +01:00
</section>
2006-01-30 19:10:03 +01:00
<section id= "faq52" >
2006-06-13 02:07:00 +02:00
<title > (FAQ 52) When I blacklist an IP address with "shorewall[-lite]
drop www.xxx.yyy.zzz", why does my log still show REDIRECT and DNAT
entries from that address?</title>
2006-01-30 19:10:03 +01:00
<para > I blacklisted the address 130.252.100.59 using <command > shorewall
drop 130.252.100.59</command> but I am still seeing these log
messages:</para>
<programlisting > Jan 30 15:38:34 server Shorewall:net_dnat:REDIRECT:IN=eth1 OUT= MAC=00:4f:4e:14:97:8e:00:01:5c:23:24:cc:08:00
SRC=130.252.100.59 DST=206.124.146.176 LEN=64 TOS=0x00 PREC=0x00 TTL=43 ID=42444 DF
PROTO=TCP SPT=2215 DPT=139 WINDOW=53760 RES=0x00 SYN URGP=0</programlisting>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Please refer to the
2006-01-30 19:10:03 +01:00
<ulink url= "NetfilterOverview.html" > Shorewall Netfilter
Documentation</ulink> . Logging of REDIRECT and DNAT rules occurs in the
nat table's PREROUTING chain where the original destination IP address
is still available. Blacklisting occurs out of the filter table's INPUT
and FORWARD chains which aren't traversed until later.</para>
</section>
2006-07-29 18:12:50 +02:00
2009-01-24 17:36:43 +01:00
<section id= "faq81" >
<title > (FAQ 81) logdrop and logreject don't log.</title>
<para > I love the ability to type 'shorewall logdrop ww.xx.yy.zz' and
> > completely block a particular IP address. However, the log part
doesn't happen. When I look in the logdrop chain, there is no LOG
prefix.</para>
<para > <emphasis role= "bold" > Answer</emphasis> : You haven't set a value
for BLACKLIST_LOGLEVEL in <ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> (5).</para>
</section>
2009-06-04 02:11:14 +02:00
<section id= "faq36" >
2009-06-05 17:45:52 +02:00
<title > (FAQ 36) My log is filling up with these BANDWIDTH
messages!</title>
2009-06-04 02:11:14 +02:00
<programlisting > Dec 15 16:47:30 heath-desktop kernel: [17182740.184000] BANDWIDTH_IN:IN=eth1 OUT= MAC=ff:ff:ff:ff:ff:ff:00:01:5c:23:79:02:08:00 SRC=10.119.248.1 DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=64 ID=62081 PROTO=UDP SPT=67 DPT=68 LEN=308
Dec 15 16:47:30 heath-desktop last message repeated 2 times
Dec 15 16:47:30 heath-desktop kernel: [17182740.188000] BANDWIDTH_IN:IN=eth1 OUT= MAC=ff:ff:ff:ff:ff:ff:00:01:5c:23:79:02:08:00 SRC=10.112.70.1 DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=64 ID=62082 PROTO=UDP SPT=67 DPT=68 LEN=308
Dec 15 16:47:30 heath-desktop last message repeated 2 times</programlisting>
<para > <emphasis role= "bold" > Answer</emphasis> : The Webmin 'bandwidth'
2009-06-05 17:45:52 +02:00
module adds commands to <filename > /etc/shorewall/start</filename> that
creates rules to log every packet to/from/through the firewall. DON'T
START THE BANDWIDTH SERVICE IN WEBMIN!!!!!</para>
<para > To correct this situation once it occurs, edit
<filename > /etc/shorewall/start</filename> and insert 'return 0' prior to
the BANDWIDTH rules.</para>
2009-06-04 02:11:14 +02:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Routing" >
2004-02-14 19:06:39 +01:00
<title > Routing</title>
2005-06-01 15:57:52 +02:00
<section id= "faq32" >
2008-08-15 03:26:15 +02:00
<title > (FAQ 32) My firewall has two connections to the Internet from two
2004-02-14 19:06:39 +01:00
different ISPs. How do I set this up in Shorewall?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See <ulink
2009-05-26 16:19:49 +02:00
url="MultiISP.html">this article about Shorewall and Multiple
2006-12-05 19:25:40 +01:00
ISPs</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-07-20 05:18:23 +02:00
<section id= "faq49" >
<title > (FAQ 49) When I start Shorewall, my routing table gets blown
away. Why does Shorewall do that?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> This is usually the
2005-07-20 05:18:23 +02:00
consequence of a one-to-one nat configuration blunder:</para>
<orderedlist >
<listitem >
<para > Specifying the primary IP address for an interface in the
EXTERNAL column of <filename > /etc/shorewall/nat</filename> even
though the documentation (and the comments in the file) warn you not
to do that.</para>
</listitem>
<listitem >
<para > Specifying ADD_IP_ALIASES=Yes and RETAIN_ALIASES=No in
/etc/shorewall/shorewall.conf.</para>
</listitem>
</orderedlist>
<para > This combination causes Shorewall to delete the primary IP address
from the network interface specified in the INTERFACE column which
usually causes all routes out of that interface to be deleted. The
solution is to <emphasis role= "bold" > not specify the primary IP address
of an interface in the EXTERNAL column</emphasis> .</para>
</section>
2009-03-18 22:33:15 +01:00
<section id= "faq82" >
<title > (FAQ 82) When I enable USE_DEFAULT_RT, Shorewall won't
start</title>
<para > I get the following errors:</para>
<programlisting > RTNETLINK answers: Numerical result out of range
ERROR: Command "ip -4 rule add from all table 254 pref 999" Failed</programlisting>
<para > <emphasis role= "bold" > Answer:</emphasis> This is a known kernel
issue -- see <ulink
url="http://lkml.org/lkml/2007/3/30/253">http://lkml.org/lkml/2007/3/30/253</ulink> .</para>
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Start-Stop" >
2004-02-14 19:06:39 +01:00
<title > Starting and Stopping</title>
2005-06-01 15:57:52 +02:00
<section id= "faq7" >
2006-06-13 02:07:00 +02:00
<title > (FAQ 7) When I stop Shorewall using <quote > shorewall[-lite]
2004-08-17 00:17:09 +02:00
stop</quote> , I can't connect to anything. Why doesn't that command
work?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> The <quote >
2006-09-04 19:06:17 +02:00
<command > stop</command> </quote> command is intended to place your
firewall into a safe state whereby only those hosts listed in
2008-08-30 03:00:50 +02:00
<filename > /etc/shorewall/routestopped</filename> are activated. If you
2006-09-04 19:06:17 +02:00
want to totally open up your firewall, you must use the <quote >
2006-06-13 02:07:00 +02:00
<command > shorewall[-lite] clear</command> </quote> command.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq9" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 9) Why can't Shorewall detect my interfaces properly at
2004-02-14 19:06:39 +01:00
startup?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > I just installed Shorewall and when I issue the
<command > start</command> command, I see the following:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > Processing /etc/shorewall/params ...
Processing /etc/shorewall/shorewall.conf ...
Starting Shorewall...
Loading Modules...
Initializing...
Determining Zones...
Zones: net loc
Validating interfaces file...
Validating hosts file...
Determining Hosts in Zones...
2005-06-01 15:57:52 +02:00
<emphasis role= "bold" > Net Zone: eth0:0.0.0.0/0
2005-12-10 00:32:43 +01:00
</emphasis> <emphasis role= "bold" > Local Zone: eth1:0.0.0.0/0</emphasis>
2005-05-09 20:52:42 +02:00
Deleting user chains...
Creating input Chains...
...</programlisting>
2005-06-01 15:57:52 +02:00
2004-08-17 00:17:09 +02:00
<para > Why can't Shorewall detect my interfaces properly?</para>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> The above output is
2008-09-15 17:04:51 +02:00
perfectly normal. The Net zone is defined as all hosts that are
connected through <filename class= "devicefile" > eth0</filename> and the
local zone is defined as all hosts connected through <filename
2008-08-30 03:00:50 +02:00
class="devicefile">eth1</filename> . You can set the <emphasis
role="bold">routefilter</emphasis> option on an internal interface if
2008-09-15 17:04:51 +02:00
you wish to guard against '<firstterm > Martians</firstterm> ' (a Martian
is a packet with a source IP address that is not routed out of the
interface on which the packet was received). If you do that, it is a
good idea to also set the <emphasis role= "bold" > logmartians</emphasis>
option.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq22" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 22) I have some iptables commands that I want to run when
Shorewall starts. Which file do I put them in?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> You can place these
2006-09-04 19:06:17 +02:00
commands in one of the <ulink
2005-06-01 15:57:52 +02:00
url="shorewall_extension_scripts.htm">Shorewall Extension
2004-08-17 00:17:09 +02:00
Scripts</ulink> . Be sure that you look at the contents of the chain(s)
2008-08-30 03:00:50 +02:00
that you will be modifying with your commands so that the commands will
2008-09-15 17:04:51 +02:00
do what is intended. Many iptables commands published in HOWTOs and
other instructional material use the -A command which adds the rules to
the end of the chain. Most chains that Shorewall constructs end with an
2008-08-30 03:00:50 +02:00
unconditional DROP, ACCEPT or REJECT rule and any rules that you add
2008-09-15 17:04:51 +02:00
after that will be ignored. Check <quote > man iptables</quote> and look
at the -I (--insert) command.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq43" >
2004-12-27 16:39:58 +01:00
<title > (FAQ 43) I just installed the Shorewall RPM and Shorewall doesn't
start at boot time.</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> When you install using
2005-06-01 15:57:52 +02:00
the "rpm -U" command, Shorewall doesn't run your distribution's tool for
2004-12-27 16:39:58 +01:00
configuring Shorewall startup. You will need to run that tool (insserv,
chkconfig, run-level editor, …) to configure Shorewall to start in the
2008-08-30 03:00:50 +02:00
the default run-levels of your firewall system.</para>
2004-12-27 16:39:58 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq45" >
2006-06-13 02:07:00 +02:00
<title > (FAQ 45) Why does "shorewall[-lite] start" fail when trying to
set up SNAT/Masquerading?</title>
2005-06-01 15:57:52 +02:00
<para > <command > shorewall start</command> produces the following
2005-04-09 01:48:55 +02:00
output:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > …
Processing /etc/shorewall/policy...
Policy ACCEPT for fw to net using chain fw2net
Policy ACCEPT for loc0 to net using chain loc02net
Policy ACCEPT for loc1 to net using chain loc12net
Policy ACCEPT for wlan to net using chain wlan2net
Masqueraded Networks and Hosts:
iptables: Invalid argument
2005-06-01 15:57:52 +02:00
ERROR: Command "/sbin/iptables -t nat -A …" Failed</programlisting>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> 99.999% of the time, this
2005-04-09 01:48:55 +02:00
error is caused by a mismatch between your iptables and kernel.</para>
2005-06-01 15:57:52 +02:00
<orderedlist numeration= "loweralpha" >
2005-04-09 01:48:55 +02:00
<listitem >
<para > Your iptables must be compiled against a kernel source tree
that is Netfilter-compatible with the kernel that you are
running.</para>
</listitem>
2005-06-01 15:57:52 +02:00
2005-04-09 01:48:55 +02:00
<listitem >
<para > If you rebuild iptables using the defaults and install it, it
will be installed in /usr/local/sbin/iptables. As shown above, you
have the IPTABLES variable in shorewall.conf set to
2005-06-01 15:57:52 +02:00
"/sbin/iptables".</para>
2005-04-09 01:48:55 +02:00
</listitem>
</orderedlist>
</section>
2006-09-04 18:55:31 +02:00
<section id= "faq59" >
<title > (FAQ 59) After I start Shorewall, there are lots of unused
Netfilter modules loaded. How do I avoid that?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Copy
2006-12-05 19:25:40 +01:00
<filename > /usr/share/shorewall[-lite]/modules</filename> to
2006-09-04 18:55:31 +02:00
<filename > /etc/shorewall/modules </filename> and modify the copy to
include only the modules that you need.</para>
</section>
2006-10-04 16:44:12 +02:00
<section id= "faq61" >
<title > (FAQ 61) I just installed the latest Debian kernel and now
"shorewall start" fails with the message "ipt_policy: matchsize 116 !=
308". What's wrong?</title>
2006-12-05 18:43:03 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> Your iptables is
incompatible with your kernel. Either</para>
2006-10-04 16:44:12 +02:00
<itemizedlist >
<listitem >
<para > rebuild iptables using the kernel headers that match your new
kernel; or</para>
</listitem>
<listitem >
<para > if you don't need policy match support (you are not using the
2008-08-15 07:03:24 +02:00
IPSEC implementation builtinto the 2.6 kernel) then you can rename
2006-10-04 16:44:12 +02:00
<filename > /lib/iptables/libipt_policy.so</filename> .</para>
</listitem>
</itemizedlist>
2007-06-19 15:48:16 +02:00
<note >
2009-02-28 04:45:43 +01:00
<para > Shorewall does not attempt to use policy match if you have no
IPSEC zones and you have not specified the <option > ipsec</option>
option on any entry in <filename > /etc/shorewall/hosts</filename> . The
subject message will still appear in your kernel log each time that
Shorewall determines the capabilities of your kernel/iptables.</para>
2007-06-19 15:48:16 +02:00
</note>
2006-10-04 16:44:12 +02:00
</section>
2006-12-05 18:43:03 +01:00
2007-09-01 00:52:19 +02:00
<section id= "faq68" >
2007-09-01 02:22:01 +02:00
<title > (FAQ 68) I have a VM under an OpenVZ system. I can't get rid of
2007-09-01 00:52:19 +02:00
the following message:</title>
<para > ERROR: Command "/sbin/iptables -A FORWARD -m state --state
2007-09-18 20:38:27 +02:00
ESTABLISHED,RELATED -j ACCEPT" failed.</para>
2007-09-01 00:52:19 +02:00
2009-07-08 18:06:15 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See the <ulink
url="OpenVZ.html">Shorewall OpenVZ article</ulink> .</para>
2007-09-01 00:52:19 +02:00
</section>
2007-10-07 17:09:57 +02:00
<section id= "faq73" >
<title > (FAQ 73) When I stop Shorewall, the firewall is wide open. Isn't
that a security risk?</title>
<para > It is important to understand that the scripts in <filename
class="directory">/etc/init.d</filename> are generally provided by your
distribution and not by the Shorewall developers. These scripts must
meet the requirements of the distribution's packaging system which may
conflict with the requirements of a tight firewall. So when you say
"…when I stop Shorewall…" it is necessary to distinguish between the
commands <command > /sbin/shorewall stop</command> and
<command > /etc/init.d/shorewall stop</command> .</para>
<para > <command > /sbin/shorewall stop</command> places the firewall in a
<firstterm > safe state</firstterm> , the details of which depend on your
<filename > /etc/shorewall/routestopped</filename> file (<ulink
url="manpages/shorewall-routestopped.html">shorewall-routestopped</ulink> (8))
and on the setting of ADMINISABSENTMINDED in
<filename > /etc/shorewall/shorewall.conf</filename> (<ulink
url="manpages/shorewall.conf.html">shorewall.conf</ulink> (8)).</para>
<para > <command > /etc/init.d/shorewall stop</command> may or may not do
the same thing. In the case of <trademark > Debian</trademark> systems for
example, that command actually executes <command > /sbin/shorewall
clear</command> which opens the firewall completely. In other words, in
2008-08-15 02:12:01 +02:00
the init script's <command > stop</command> reverses the effect of
2007-10-07 17:09:57 +02:00
<command > start</command> .</para>
<para > One way to avoid these differences is to install Shorewall from
the tarballs available from shorewall.net. This places Shorewall outside
of the control of the packaging system and provides consistent behavior
between the init scripts and <filename > /sbin/shorewall</filename> (and
<filename > /sbin/shorewall-lite</filename> ). For more information on the
2008-08-15 03:26:15 +02:00
factors involved when deciding whether to use the Debian package, see
2007-10-08 17:02:05 +02:00
<ulink url= "http://wiki.shorewall.net/wiki/ShorewallOnDebian" > this
article</ulink> .</para>
2007-10-07 17:09:57 +02:00
</section>
2007-10-10 21:57:27 +02:00
<section id= "faq74" >
2008-08-30 03:00:50 +02:00
<title > (FAQ 74) When I "<command > shorewall start</command> " or
"<command > shorewall check</command> " on my SuSE 10.0 system, I get FATAL
ERROR messages and/or the system crashes"</title>
2007-10-10 21:57:27 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> These failures result
2007-10-10 21:57:27 +02:00
from trying to load a particular combination of kernel modules. To work
around the problem:</para>
<orderedlist >
<listitem >
<para > Copy /usr/share/shorewall/modules to
/etc/shorewall/modules</para>
</listitem>
<listitem >
<para > Edit /etc/shorewall/modules and remove all entries except for
those for the helper modules that you need.</para>
</listitem>
</orderedlist>
</section>
2008-09-19 16:56:40 +02:00
<section id= "faq78" >
<title > (FAQ 78) After restart and bootup of my Debian firewall, all
traffic is blocked for hosts behind the firewall trying to connect out
onto the net or through the vpn (although i can reach the internal
firewall interface and obtain dumps etc). Once I issue 'shorewall clear'
2009-05-26 16:19:49 +02:00
followed by 'shorewall start' it then works, despite the config not
2008-09-19 16:56:40 +02:00
changing</title>
<para > <emphasis role= "bold" > Answer:</emphasis> Set IP_FORWARDING=On in
<filename > <ulink
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink> </filename> .</para>
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "MultiISP" >
2006-09-04 16:45:19 +02:00
<title > Multiple ISPs</title>
<section id= "faq57" >
<title > (FAQ 57) I configured two ISPs in Shorewall but when I try to use
the second one, it doesn't work.</title>
<para > <emphasis role= "bold" > Answer:</emphasis> The Multi-ISP
2006-09-04 18:23:21 +02:00
Documentation strongly recommends that you use the <emphasis
role="bold">balance</emphasis> option on all providers even if you want
to manually specify which ISP to use. If you don't do that so that your
main routing table only has one default route, then you must disable
route filtering. Do not specify the <emphasis
role="bold">routefilter</emphasis> option on the other interface(s) in
2006-09-04 16:45:19 +02:00
<filename > /etc/shorewall/interfaces</filename> and disable any
<emphasis > IP Address Spoofing</emphasis> protection that your
distribution supplies.</para>
</section>
<section id= "faq58" >
<title > (FAQ 58) But if I specify 'balance' then won't Shorewall balance
the traffic between the interfaces? I don't want that!</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Suppose that you want all
2006-09-05 05:34:09 +02:00
traffic to go out through ISP1 (mark 1) unless you specify otherwise.
2006-09-04 16:45:19 +02:00
Then simply add these two rules as the first marking rules in your
<filename > /etc/shorewall/tcrules</filename> file:</para>
<programlisting > #MARK SOURCE DEST
2006-09-05 05:34:09 +02:00
1:P 0.0.0.0/0
2007-02-03 02:21:55 +01:00
1 $FW
2007-12-02 18:11:46 +01:00
<emphasis > other MARK rules</emphasis> </programlisting>
2006-09-04 16:45:19 +02:00
<para > Now any traffic that isn't marked by one of your other MARK rules
2006-09-04 18:23:21 +02:00
will have mark = 1 and will be sent via ISP1. That will work whether
<emphasis role= "bold" > balance</emphasis> is specified or not!</para>
2006-09-04 16:45:19 +02:00
</section>
</section>
2008-11-09 21:14:58 +01:00
<section >
<title > Using DNS Names</title>
<section id= "faq79" >
<title > (FAQ 79) Can I use DNS names in Shorewall configuration file
entries in place of IP addresses?</title>
<para > <emphasis role= "bold" > Answer</emphasis> : <ulink
url="configuration_file_basics.htm#dnsnames">Yes</ulink> , but we advise
strongly against it.</para>
</section>
</section>
2007-08-15 22:22:51 +02:00
<section id= "TC" >
2007-08-15 22:18:33 +02:00
<title > Traffic Shaping</title>
2007-08-15 22:22:51 +02:00
<section id= "faq67" >
2008-08-15 07:03:24 +02:00
<title > (FAQ 67) I just configured Shorewall's builtin traffic shaping
2007-08-15 22:18:33 +02:00
and now Shorewall fails to Start.</title>
<para > The error I receive is as follows:<programlisting > RTNETLINK answers: No such file or directory
We have an error talking to the kernel
ERROR: Command "tc filter add dev eth2 parent ffff: protocol ip prio
50 u32 match ip src 0.0.0.0/0 police rate 500kbit burst 10k drop flowid
:1" Failed</programlisting> <emphasis
2008-08-30 03:00:50 +02:00
role="bold">Answer:</emphasis> This message indicates that your kernel
2007-08-15 22:18:33 +02:00
doesn't have 'traffic policing' support. If your kernel is modularized,
you may be able to resolve the problem by loading the <emphasis
role="bold">act_police</emphasis> kernel module. Other kernel modules
that you will need include:<simplelist >
2009-05-26 16:19:49 +02:00
<member > cls_fw</member>
2007-08-15 22:29:46 +02:00
<member > cls_u32</member>
2007-08-15 22:22:51 +02:00
2007-08-15 22:18:33 +02:00
<member > sch_htb</member>
<member > sch_ingress</member>
<member > sch_sfq</member>
</simplelist> </para>
</section>
</section>
2007-06-28 17:40:13 +02:00
<section id= "About" >
2004-02-14 19:06:39 +01:00
<title > About Shorewall</title>
2005-06-01 15:57:52 +02:00
<section id= "faq10" >
2006-09-04 18:55:31 +02:00
<title > (FAQ 10) What Distributions does Shorewall work with?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Shorewall works with any
2006-09-04 19:06:17 +02:00
GNU/Linux distribution that includes the <ulink
url="shorewall_prerequisites.htm">proper prerequisites</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq11" >
2006-09-04 18:55:31 +02:00
<title > (FAQ 11) What Features does Shorewall have?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> See the <ulink
url="shorewall_features.htm">Shorewall Feature List</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq12" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 12) Is there a GUI?</title>
2005-06-01 15:57:52 +02:00
2009-02-28 04:45:43 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes! Shorewall support is
available in Webmin. See <ulink
2009-06-05 19:51:30 +02:00
url="http://www.webmin.com">http://www.webmin.com</ulink> . But beware of
the issue described in <link linkend= "faq36" > FAQ 36</link> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq13" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 13) Why do you call it <quote > Shorewall</quote> ?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Shorewall is a
concatenation of <quote > <emphasis > Shore</emphasis> line</quote> (<ulink
url="http://www.cityofshoreline.com">the city where I live</ulink> ) and
<quote > Fire<emphasis > wall</emphasis> </quote> . The full name of the
2004-02-14 19:06:39 +01:00
product is actually <quote > Shoreline Firewall</quote> but
2004-12-05 00:37:19 +01:00
<quote > Shorewall</quote> is much more commonly used.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq23" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 23) Why do you use such ugly fonts on your web site?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> The Shorewall web site is
2006-09-04 19:06:17 +02:00
almost font neutral (it doesn't explicitly specify fonts except on a few
pages) so the fonts you see are largely the default fonts configured in
your browser. If you don't like them then reconfigure your
browser.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq25" >
2006-09-04 18:55:31 +02:00
<title > (FAQ 25) How do I tell which version of Shorewall or Shorewall
2006-06-13 02:07:00 +02:00
Lite I am running?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> At the shell prompt,
2006-09-04 19:06:17 +02:00
type:</para>
2005-06-01 15:57:52 +02:00
2006-06-13 02:07:00 +02:00
<programlisting > <command > /sbin/shorewall[-lite] version</command> </programlisting>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq31" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 31) Does Shorewall provide protection against....</title>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<variablelist >
<varlistentry >
<term > IP Spoofing: Sending packets over the WAN interface using an
internal LAP IP address as the source address?</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
2004-08-17 00:17:09 +02:00
<term > Tear Drop: Sending packets that contain overlapping
fragments?</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> This is the
2006-09-04 19:06:17 +02:00
responsibility of the IP stack, not the Netfilter-based firewall
since fragment reassembly occurs before the stateful packet filter
ever touches each packet.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > Smurf and Fraggle: Sending packets that use the WAN or LAN
broadcast address as the source address?</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2009-05-26 16:19:49 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Shorwall filters
these packets under the <firstterm > nosmurfs</firstterm> interface
option in <ulink
2007-07-04 02:18:10 +02:00
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink> .</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > Land Attack: Sending packets that use the same address as the
source and destination address?</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes, if the <ulink
2007-07-04 02:18:10 +02:00
url="manpages/shorewall-interfaces.html">routefilter interface
2004-08-17 00:17:09 +02:00
option</ulink> is selected.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<varlistentry >
<term > DOS: - SYN Dos - ICMP Dos - Per-host Dos protection</term>
2005-06-01 15:57:52 +02:00
2004-02-14 19:06:39 +01:00
<listitem >
2009-05-26 16:19:49 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes.</para>
2004-02-14 19:06:39 +01:00
</listitem>
</varlistentry>
</variablelist>
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "faq65" >
<title > (FAQ 65) How do I accomplish failover with Shorewall?</title>
2007-05-04 18:17:44 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> <ulink
2007-05-04 18:17:44 +02:00
url="http://linuxman.wikispaces.com/Clustering+Shorewall">This article
by Paul Gear</ulink> should help you get started.</para>
</section>
2008-12-16 23:33:11 +01:00
<section id= "faq80" >
<title > (FAQ 80) Does Shorewall support IPV6?</title>
<para > Answer: <ulink url= "IPv6Support.html" > Shorewall IPv6
2009-01-27 23:22:40 +01:00
support</ulink> is currently available in Shorewall 4.2.4 and
later.</para>
<section id= "faq80a" >
2009-04-17 20:27:37 +02:00
<title > (FAQ 80a) Why does Shorewall lPv6 Support Require Kernel 2.6.24
2009-01-27 23:22:40 +01:00
or later?</title>
<para > <emphasis role= "bold" > Answer:</emphasis> Shorewall implements a
stateful firewall which requires connection tracking be present in
2009-06-05 19:51:30 +02:00
ip6tables and in the kernel. Linux kernel's before 2.6.20 didn't
support connection tracking for IPv6. So we could not even start to
develop Shorewall IPv6 support until 2.6.20 and there were significant
2009-01-28 21:50:25 +01:00
problems with the facility until at least kernel 2.6.23. When
distributions began offering IPv6 connection tracking support, it was
with kernel 2.6.25. So that is what we developed IPv6 support on and
2009-04-17 20:27:37 +02:00
that's all that we initially tested on. Subsequently, we have tested
Shorewall6 on Ubuntu Hardy with kernel 2.6.24. If you are running
2.6.20 or later, you can <emphasis role= "bold" > try</emphasis> to run
Shorewall6 by hacking<filename >
/usr/share/shorewall/prog.footer6</filename> and changing the kernel
version test to check for your kernel version rather than 2.6.24
(20624). But after that, you are on your own.</para>
2009-01-27 23:22:40 +01:00
<programlisting > kernel=$(printf "%2d%02d%02d\n" $(echo $(uname -r) 2> /dev/null | sed 's/-.*//' | tr '.' ' ' ) | head -n1)
2009-04-17 20:27:37 +02:00
if [ $kernel -lt <emphasis role= "bold" > 20624</emphasis> ]; then
error_message "ERROR: $PRODUCT requires Linux kernel <emphasis role= "bold" > 2.6.24</emphasis> or later"
2009-01-27 23:22:40 +01:00
status=2
else
</programlisting>
</section>
2008-12-16 23:33:11 +01:00
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "ALIASES" >
2004-02-14 19:06:39 +01:00
<title > Alias IP Addresses/Virtual Interfaces</title>
2005-06-01 15:57:52 +02:00
<section id= "faq18" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 18) Is there any way to use aliased ip addresses with
2008-08-15 03:26:15 +02:00
Shorewall, and maintain separate rule sets for different IPs?</title>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes. See <ulink
url="Shorewall_and_Aliased_Interfaces.html">Shorewall and Aliased
2004-02-14 19:06:39 +01:00
Interfaces</ulink> .</para>
</section>
2009-03-21 23:46:42 +01:00
<section id= "faq83" >
<title > (FAQ 83) Is there no way to nest the firewall zone or create
subzones? I've got a system with Linux-VServers, it's one interface
(eth0) with multiple IPs</title>
<para > <emphasis role= "bold" > Answer</emphasis> : There is no way to create
sub-zones of the firewall zone. But you can use shell variables to make
vservers easier to deal with.</para>
<para > <filename > /etc/shorewall/params</filename> :</para>
<programlisting > VS1=fw:192.168.2.12
VS2=fw:192.168.2.13
VS3=fw:192.168.2.14</programlisting>
<para > <filename > /etc/shorewall/rules</filename> :</para>
<programlisting > #ACTION SOURCE DEST PROTO DEST PORT(S)
ACCEPT $VS1 net tcp 25
DNAT net $VS1 tcp 25
etc...</programlisting>
</section>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
2007-06-28 17:40:13 +02:00
<section id= "Lite" >
2006-06-11 00:06:47 +02:00
<title > Shorewall Lite</title>
2006-06-11 01:13:39 +02:00
<section id= "faq53" >
2006-06-12 17:26:32 +02:00
<title > (FAQ 53) What is Shorewall Lite?</title>
2006-06-11 00:06:47 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Shorewall Lite is a
2006-06-12 18:30:25 +02:00
companion product to Shorewall and is designed to allow you to maintain
all Shorewall configuration information on a single system within your
network. See the <ulink url= "CompiledPrograms.html#Lite" > Compiled
Firewall script documentation</ulink> for details.</para>
2006-06-11 00:06:47 +02:00
</section>
2006-06-12 17:13:45 +02:00
2006-06-12 17:14:47 +02:00
<section id= "faq54" >
2006-06-12 17:13:45 +02:00
<title > (FAQ 54) If I want to use Shorewall Lite, do I also need to
install Shorewall on the same system?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> No. In fact, we recommend
2006-06-12 17:13:45 +02:00
that you do <emphasis role= "bold" > NOT</emphasis> install Shorewall on
systems where you wish to use Shorewall Lite. You must have Shorewall
installed on at least one system within your network in order to use
Shorewall Lite.</para>
</section>
2006-06-14 18:32:13 +02:00
<section id= "faq55" >
<title > (FAQ 55) How do I decide which product to use - Shorewall or
Shorewall Lite?</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> If you plan to have only
2006-06-14 18:32:13 +02:00
a single firewall system, then Shorewall is the logical choice. I also
think that Shorewall is the appropriate choice for laptop systems that
may need to have their firewall configuration changed while on the road.
In the remaining cases, Shorewall Lite will work very well. At
shorewall.net, the two laptop systems have the full Shorewall product
installed as does my personal Linux desktop system. All other Linux
systems that run a firewall use Shorewall Lite and have their
2006-09-04 18:55:31 +02:00
configuration directories on my desktop system.</para>
2006-06-14 18:32:13 +02:00
</section>
2006-09-06 22:12:41 +02:00
2006-09-06 22:38:45 +02:00
<section id= "faq60" >
2006-09-06 22:12:41 +02:00
<title > (FAQ 60) What are the compatibility restrictions between
Shorewall and Shorewall Lite</title>
2009-02-28 04:45:43 +01:00
<para > <emphasis role= "bold" > Answer:</emphasis> There are no
compatibility constraints between Shorewall and Shorewall-lite.</para>
2007-09-18 21:19:28 +02:00
</section>
</section>
2008-05-24 02:27:50 +02:00
<section id= "VOIP" >
<title > VOIP</title>
2008-05-29 05:07:06 +02:00
<section id= "faq77" >
2008-05-24 02:27:50 +02:00
<title > (FAQ 77) Shorewall is eating my Asterisk egress traffic!</title>
<para > Somehow, my firewall config is causing a one-way audio problem in
Asterisk. If a person calls into the PBX, they cannot hear me speaking,
but I can hear them. If I plug the Asterisk server directly into the
router, bypassing the firewall, the problem goes away.</para>
<para > <emphasis role= "bold" > Answer (requires Shorewall 4.0.6 or
later):</emphasis> If your kernel version is 2.6.20 or
earlier:<programlisting > rmmod ip_nat_sip
rmmod ip_conntrack_sip</programlisting> Then change the DONT_LOAD specification
in your shorewall.conf to:<programlisting > DONT_LOAD=ip_nat_sip,ip_conntrack_sip</programlisting> If
your kernel version is 2.6.21 or later:<programlisting > rmmod nf_nat_sip
rmmod nf_conntrack_sip</programlisting> Then change the DONT_LOAD specification
2008-05-24 05:03:37 +02:00
in your shorewall.conf to:<programlisting > DONT_LOAD=nf_nat_sip,nf_conntrack_sip</programlisting> If
you are running a version of Shorewall earlier than 4.0.6, you can avoid
loading the sip helper modules by following the suggestions in <link
linkend="faq59">FAQ 59</link> .</para>
2008-05-24 02:27:50 +02:00
</section>
</section>
2009-08-05 16:38:02 +02:00
<section id= "faq40" >
<title > IPv6</title>
<section >
<title > (FAQ 40) I have an interface that gets its IPv6 configuration
from radvd. When I start Shorewall6, I immediately loose my default
route. Why?</title>
<para > <emphasis role= "bold" > Answer</emphasis> : You have configured
forwarding on the interface which disables autoconfiguration of the
interface. To retain autoconfiguration on the interface when Shorewall6
starts, specify <emphasis role= "bold" > forwarding=0</emphasis> in the
OPTIONS column on the interface's entry in <ulink
url="manpages6/shorewall6-interfaces.html">shorewall6-interfaces</ulink>
(5).</para>
</section>
</section>
2007-06-28 17:40:13 +02:00
<section id= "Misc" >
2004-02-14 19:06:39 +01:00
<title > Miscellaneous</title>
2005-06-01 15:57:52 +02:00
<section id= "faq20" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 20) I have just set up a server. Do I have to change
2008-08-15 03:26:15 +02:00
Shorewall to allow access to my server from the Internet?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Yes. Consult the <ulink
2005-06-01 15:57:52 +02:00
url="shorewall_quickstart_guide.htm">QuickStart guide</ulink> that you
2004-08-17 00:17:09 +02:00
used during your initial setup for information about how to set up rules
for your server.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq24" >
2008-08-30 03:00:50 +02:00
<title > (FAQ 24) How can I allow connections to, let's say, the ssh port
2008-08-15 03:26:15 +02:00
only from specific IP Addresses on the Internet?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> In the SOURCE column of
2006-09-04 19:06:17 +02:00
the rule, follow <quote > net</quote> by a colon and a list of the
host/subnet addresses as a comma-separated list.</para>
2005-06-01 15:57:52 +02:00
<programlisting > net:< ip1> ,< ip2> ,...</programlisting>
2007-06-28 17:40:13 +02:00
<example id= "Example4" >
2004-02-14 19:06:39 +01:00
<title > Example:</title>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > ACCEPT net:192.0.2.16/28,192.0.2.44 fw tcp 22</programlisting>
2004-02-14 19:06:39 +01:00
</example>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq26" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 26) When I try to use any of the SYN options in nmap on or
behind the firewall, I get <quote > operation not permitted</quote> . How
2005-06-01 15:57:52 +02:00
can I use nmap with Shorewall?"</title>
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Temporarily remove and
2006-09-04 19:06:17 +02:00
rejNotSyn, dropNotSyn and dropInvalid rules from
<filename > /etc/shorewall/rules</filename> and restart Shorewall.</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq27" >
2004-08-17 00:17:09 +02:00
<title > (FAQ 27) I'm compiling a new kernel for my firewall. What should
I look out for?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> First take a look at the
2006-09-04 19:06:17 +02:00
<ulink url= "kernel.htm" > Shorewall kernel configuration page</ulink> . You
probably also want to be sure that you have selected the <quote >
<emphasis role= "bold" > NAT of local connections (READ HELP)</emphasis>
</quote> on the Netfilter Configuration menu. Otherwise, DNAT rules with
your firewall as the source zone won't work with your new kernel.</para>
2005-06-01 15:57:52 +02:00
<section id= "faq27a" >
2004-08-19 20:29:13 +02:00
<title > (FAQ 27a) I just built (or downloaded or otherwise acquired)
and installed a new kernel and now Shorewall won't start. I know that
my kernel options are correct.</title>
2005-06-01 15:57:52 +02:00
<para > The last few lines of <ulink url= "troubleshoot.htm" > a startup
2004-02-14 19:06:39 +01:00
trace</ulink> are these:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > + run_iptables2 -t nat -A eth0_masq -s 192.168.2.0/24 -d 0.0.0.0/0 -j
MASQUERADE
+ '[' 'x-t nat -A eth0_masq -s 192.168.2.0/24 -d 0.0.0.0/0 -j
MASQUERADE' = 'x-t nat -A eth0_masq -s 192.168.2.0/24 -d 0.0.0.
0/0 -j MASQUERADE' ']'
+ run_iptables -t nat -A eth0_masq -s 192.168.2.0/24 -d 0.0.0.0/0 -j
MASQUERADE
+ iptables -t nat -A eth0_masq -s 192.168.2.0/24 -d 0.0.0.0/0 -j
MASQUERADE
iptables: Invalid argument
+ '[' -z '' ']'
+ stop_firewall
+ set +x</programlisting>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Your new kernel
2004-02-14 19:06:39 +01:00
contains headers that are incompatible with the ones used to compile
your <command > iptables</command> utility. You need to rebuild
<command > iptables</command> using your new kernel source.</para>
</section>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq28" >
2004-02-14 19:06:39 +01:00
<title > (FAQ 28) How do I use Shorewall as a Bridging Firewall?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Shorewall Bridging
2007-06-24 01:33:17 +02:00
Firewall support is available — <ulink
url="bridge-Shorewall-perl.html">check here for details</ulink> .</para>
2004-02-14 19:06:39 +01:00
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq39" >
2004-10-02 16:49:34 +02:00
<title > (FAQ 39) How do I block connections to a particular domain
name?</title>
2005-06-01 15:57:52 +02:00
2004-10-02 16:49:34 +02:00
<para > I tried this rule to block Google's Adsense that you'll find on
everyone's site. Adsense is a Javascript that people add to their Web
pages. So I entered the rule:</para>
2005-06-01 15:57:52 +02:00
2005-05-09 20:52:42 +02:00
<programlisting > #ACTION SOURCE DEST PROTO
REJECT fw net:pagead2.googlesyndication.com all</programlisting>
2005-06-01 15:57:52 +02:00
<para > However, this also sometimes restricts access to "google.com". Why
2004-10-02 16:49:34 +02:00
is that? Using dig, I found these IPs for domain
googlesyndication.com:<programlisting > 216.239.37.99
2005-05-09 20:52:42 +02:00
216.239.39.99</programlisting> And this for google.com:<programlisting > 216.239.37.99
216.239.39.99
216.239.57.99</programlisting> So my guess is that you are not actually
2004-10-02 16:49:34 +02:00
blocking the domain, but rather the IP being called. So how in the world
do you block an actual domain name?</para>
2005-06-01 15:57:52 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Packet filters like
2004-10-02 16:49:34 +02:00
Netfilter base their decisions on the contents of the various protocol
headers at the front of each packet. Stateful packet filters (of which
Netfilter is an example) use a combination of header contents and state
created when the packet filter processed earlier packets. Netfilter (and
2008-08-15 03:26:15 +02:00
Shorewall's use of Netfilter) also consider the network interface(s)
2004-10-02 16:49:34 +02:00
where each packet entered and/or where the packet will leave the
firewall/router.</para>
2005-06-01 15:57:52 +02:00
<para > When you specify <ulink
url="configuration_file_basics.htm#dnsnames">a domain name in a
2004-10-02 16:49:34 +02:00
Shorewall rule</ulink> , the iptables program resolves that name to one
2008-08-15 03:26:15 +02:00
or more IP addresses and the actual Netfilter rules that are created are
2004-10-02 16:49:34 +02:00
expressed in terms of those IP addresses. So the rule that you entered
was equivalent to:</para>
2005-06-01 15:57:52 +02:00
<para > <programlisting > #ACTION SOURCE DEST PROTO
2005-05-09 20:52:42 +02:00
REJECT fw net:216.239.37.99 all
REJECT fw net:216.239.39.99 all</programlisting> Given that
name-based multiple hosting is a common practice (another example:
lists.shorewall.net and www1.shorewall.net are both hosted on the same
system with a single IP address), it is not possible to filter
2006-09-04 18:55:31 +02:00
connections to a particular name by examination of protocol headers
2005-06-01 15:57:52 +02:00
alone. While some protocols such as <ulink url= "FTP.html" > FTP</ulink>
2005-05-09 20:52:42 +02:00
require the firewall to examine and possibly modify packet payload,
parsing the payload of individual packets doesn't always work because
the application-level data stream can be split across packets in
arbitrary ways. This is one of the weaknesses of the 'string match'
2006-12-05 19:25:40 +01:00
Netfilter extension available in later Linux kernel releases. The only
sure way to filter on packet content is to proxy the connections in
question -- in the case of HTTP, this means running something like
<ulink url= "Shorewall_Squid_Usage.html" > Squid</ulink> . Proxying allows
the proxy process to assemble complete application-level messages which
can then be accurately parsed and decisions can be made based on the
2004-10-02 16:49:34 +02:00
result.</para>
</section>
2005-06-01 15:57:52 +02:00
<section id= "faq42" >
2004-11-19 18:58:59 +01:00
<title > (FAQ 42) How can I tell which features my kernel and iptables
support?</title>
2005-06-01 15:57:52 +02:00
2008-08-30 03:00:50 +02:00
<para > <emphasis role= "bold" > Answer:</emphasis> Use the
2006-06-13 02:07:00 +02:00
<command > shorewall[-lite] show capabilities</command> command at a root
2006-01-16 18:07:11 +01:00
prompt.</para>
2005-06-01 15:57:52 +02:00
2005-08-31 00:46:02 +02:00
<programlisting > gateway:~# shorewall show capabilities
2005-05-09 20:52:42 +02:00
Loading /usr/share/shorewall/functions...
Processing /etc/shorewall/params ...
Processing /etc/shorewall/shorewall.conf...
Loading Modules...
Shorewall has detected the following iptables/netfilter capabilities:
NAT: Available
Packet Mangling: Available
Multi-port Match: Available
2005-08-31 00:46:02 +02:00
Extended Multi-port Match: Available
2005-05-09 20:52:42 +02:00
Connection Tracking Match: Available
2005-08-31 00:46:02 +02:00
Packet Type Match: Available
2005-05-09 20:52:42 +02:00
Policy Match: Available
Physdev Match: Available
IP range Match: Available
2005-08-31 00:46:02 +02:00
Recent Match: Available
Owner Match: Available
Ipset Match: Available
ROUTE Target: Available
Extended MARK Target: Available
CONNMARK Target: Available
Connmark Match: Available
Raw Table: Available
gateway:~#</programlisting>
2004-11-19 18:58:59 +01:00
</section>
2006-03-12 17:38:54 +01:00
2006-03-12 18:16:59 +01:00
<section id= "faq19" >
<title > (FAQ 19) How do I open the firewall for all traffic to/from the
2006-03-12 17:38:54 +01:00
LAN?</title>
<para > <emphasis role= "bold" > Answer:</emphasis> Add these two
policies:</para>
<programlisting > #SOURCE DESTINATION POLICY LOG LIMIT:BURST
# LEVEL
$FW loc ACCEPT
loc $FW ACCEPT </programlisting>
2006-12-05 19:25:40 +01:00
<para > You should also delete any ACCEPT rules from $FW-> loc and
2006-03-12 17:38:54 +01:00
loc-> $FW since those rules are redundant with the above
policies.</para>
</section>
2004-02-14 19:06:39 +01:00
</section>
2008-11-09 21:14:58 +01:00
</article>