shorewall_code/docs/FAQ.xml
2007-12-02 17:11:46 +00:00

2520 lines
107 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<article>
<!--$Id$-->
<articleinfo>
<title>Shorewall FAQs</title>
<authorgroup>
<corpauthor>Shorewall Community</corpauthor>
<author>
<firstname>Tom</firstname>
<surname>Eastep</surname>
</author>
</authorgroup>
<pubdate><?dbtimestamp format="Y/m/d"?></pubdate>
<copyright>
<year>2001-2007</year>
<holder>Thomas M. Eastep</holder>
</copyright>
<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
Texts. A copy of the license is included in the section entitled <quote>
<ulink url="GnuCopyright.htm">GNU Free Documentation License</ulink>
</quote>.</para>
</legalnotice>
</articleinfo>
<caution>
<para><emphasis role="bold">This article applies to Shorewall 3.0 and
later. If you are running a version of Shorewall earlier than Shorewall
3.0.0 then please see the documentation for that
release.</emphasis></para>
</caution>
<section id="Install">
<title>Installing Shorewall</title>
<section id="Howto">
<title>Where do I find Step by Step Installation and Configuration
Instructions?</title>
<para><emphasis role="bold">Answer:</emphasis> Check out the <ulink
url="shorewall_quickstart_guide.htm">QuickStart Guides</ulink>.</para>
</section>
<section id="faq37">
<title>(FAQ 37) I just installed Shorewall on Debian and the
/etc/shorewall directory is almost empty!!!</title>
<para><emphasis role="bold">Answer</emphasis>:</para>
<important>
<para>Once you have installed the .deb package and before you attempt
to configure Shorewall, please heed the advice of Lorenzo Martignoni,
the Shorewall Debian Maintainer:</para>
<para><quote>For more information about Shorewall usage on Debian
system please look at /usr/share/doc/shorewall/README.Debian provided
by [the] shorewall Debian package.</quote></para>
</important>
<para>If you install using the .deb, you will find that your <filename
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
class="directory">/usr/share/doc/shorewall/default-config</filename>.
Simply copy the files you need from that directory to <filename
class="directory">/etc/shorewall</filename> and modify the
copies.</para>
<section id="faq37a">
<title>(FAQ 37a) I just installed Shorewall on Debian and I can't find
the sample configurations.</title>
<para><emphasis role="bold">Answer</emphasis>: With Shorewall 3.x, the
samples are included in the shorewall-doc package and are installed in
<filename
class="directory">/usr/share/doc/shorewall/examples/</filename>.
Beginning with Shorewall 4.0, the samples are in <filename
class="directory">/usr/share/doc/shorewall-common/examples</filename>/.</para>
</section>
</section>
<section id="faq75">
<title>(FAQ 75) I can't find the Shorewall 4.x shorewall-common RPM.
Where is it?</title>
<para><emphasis role="bold">Answer</emphasis>: If you use Simon Matter's
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>
</section>
<section id="Upgrading">
<title>Upgrading Shorewall</title>
<section id="faq66">
<title>(FAQ 66) I'm trying to upgrade to Shorewall 4.0; where is the
'shorewall' package?</title>
<para><emphasis role="bold">Answer</emphasis>: Please see the <ulink
url="upgrade_issues.htm">upgrade issues.</ulink></para>
<section id="faq66a">
<title>(FAQ 66a) I'm trying to upgrade to Shorewall 4.0; do I have to
uninstall the 'shorewall' package?</title>
<para><emphasis role="bold">Answer</emphasis>: Please see the <ulink
url="upgrade_issues.htm">upgrade issues.</ulink></para>
</section>
<section id="faq66b">
<title>(FAQ 66b) I'm trying to upgrade to Shorewall 4.0: which of
these packages do I need to install?</title>
<para><emphasis role="bold">Answer</emphasis>: Please see the <ulink
url="upgrade_issues.htm">upgrade issues.</ulink></para>
</section>
</section>
<section id="faq76">
<title>(FAQ 76) I just upgraded my Debian system and now masquerading
doesn work? What happened?</title>
<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
default settings. Failure to forward traffic (such as during masqueraded
net access from a local network) usually means that <ulink
url="???">/etc/shorewall/shorewall.conf</ulink> contains the Debian
default setting IP_FORWARDING=Keep; it should be
IP_FORWARDING=On.</para>
<section id="faq76a">
<title>(FAQ 76a) I just upgraded my Ubuntu system and now masquerading
doesn work? What happened?</title>
<para><emphasis role="bold">Answer:</emphasis> See <link
linkend="faq76">above</link>.</para>
</section>
<section id="faq76b">
<title>(FAQ 76b) I just upgraded my Kubuntu system and now
masquerading doesn work? What happened?</title>
<para><emphasis role="bold">Answer:</emphasis> See <link
linkend="faq76">above</link>.</para>
</section>
</section>
</section>
<section id="PortForwarding">
<title>Port Forwarding (Port Redirection)</title>
<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
it.</title>
<para><emphasis role="bold">Answer:</emphasis> The format of a
port-forwarding rule to a local system is as follows:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT
DNAT net loc:<emphasis>local-IP-address</emphasis>[:<emphasis>local-port</emphasis>] <emphasis>protocol</emphasis> <emphasis>port-number</emphasis></programlisting>
<para>So to forward UDP port 7777 to internal system 192.168.1.5, the
rule is:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT
DNAT net loc:192.168.1.5 udp 7777</programlisting>
<para>If you want to forward requests directed to a particular address (
<emphasis>external-IP</emphasis> ) on your firewall to an internal
system:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT net loc:<emphasis>local-IP-address</emphasis>&gt;[:<emphasis>local-port</emphasis>] <emphasis>protocol</emphasis> <emphasis>port-number</emphasis> - <emphasis>external-IP</emphasis></programlisting>
<para>If you want to forward requests from a particular internet address
( <emphasis>address</emphasis> ):</para>
<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>
<para>Finally, if you need to forward a range of ports, in the DEST PORT
column specify the range as
<emphasis>low-port:high-port</emphasis>.</para>
<section id="faq1a">
<title>(FAQ 1a) Okay -- I followed those instructions but it doesn't
work</title>
<para><emphasis role="bold">Answer:</emphasis> That is usually the
result of one of four things:</para>
<itemizedlist>
<listitem>
<para>You are trying to test from inside your firewall (no, that
won't work -- see <xref linkend="faq2" />).</para>
</listitem>
<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
default gateway (it should be set to the IP address of your
firewall's internal interface).</para>
</listitem>
<listitem>
<para>Your ISP is blocking that particular port inbound or, for
TCP, your ISP is dropping the outbound SYN,ACK response.</para>
</listitem>
<listitem>
<para>You are running Mandriva Linux prior to 10.0 final and have
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>
</listitem>
</itemizedlist>
</section>
<section id="faq1b">
<title>(FAQ 1b) I'm still having problems with port forwarding</title>
<para><emphasis role="bold">Answer:</emphasis> To further diagnose
this problem:</para>
<itemizedlist>
<listitem>
<para>As root, type <quote> <command>shorewall reset</command>
</quote> ("<command>shorewall-lite reset</command>", if you are
running Shorewall Lite). This clears all NetFilter
counters.</para>
</listitem>
<listitem>
<para>Try to connect to the redirected port from an external
host.</para>
</listitem>
<listitem>
<para>As root type <quote> <command>shorewall show nat</command>
</quote> ("<command>shorewall-lite show nat</command>", if you are
running Shorewall Lite).</para>
</listitem>
<listitem>
<para>Locate the appropriate DNAT rule. It will be in a chain
called <emphasis>&lt;source zone&gt;</emphasis>_dnat
(<quote>net_dnat</quote> in the above examples).</para>
</listitem>
<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
should be the IP address of the firewall's interface to that
system).</para>
</listitem>
<listitem>
<para>If the packet count is zero:</para>
<itemizedlist>
<listitem>
<para>the connection request is not reaching your server
(possibly it is being blocked by your ISP); or</para>
</listitem>
<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
<quote>ORIG. DEST.</quote> column in your DNAT rule);
or</para>
</listitem>
<listitem>
<para>your DNAT rule doesn't match the connection request in
some other way. In that case, you may have to use a packet
sniffer such as tcpdump or ethereal to further diagnose the
problem.</para>
</listitem>
</itemizedlist>
</listitem>
<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
root promt, type "<command>shorewall show zones</command>"
("<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=&lt;dev&gt; and DEST= &lt;ip&gt;from the REJECT/DROP log
message.</para>
</listitem>
<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
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>
</listitem>
</itemizedlist>
</section>
<section id="faq1c">
<title>(FAQ 1c) From the internet, I want to connect to port 1022 on
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>
<para><emphasis role="bold">Answer</emphasis>:In
/<filename>etc/shorewall/rules</filename>:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT
DNAT net loc:192.168.1.3:22 tcp 1022</programlisting>
</section>
<section id="faq1d">
<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>
<para><emphasis role="bold">Answer</emphasis>: Let's assume the
following:</para>
<itemizedlist>
<listitem>
<para>External IP address is 206.124.146.176 on <filename
class="devicefile">eth0</filename>.</para>
</listitem>
<listitem>
<para>Server's IP address is 192.168.2.4</para>
</listitem>
</itemizedlist>
<para>You can enable access to the server from your local network
using the firewall's external IP address by adding this rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S) SOURCE ORIGINAL
# PORT DEST
DNAT loc dmz:192.168.2.4 tcp 80 - 206.124.146.176</programlisting>
<para>If your external IP address is dynamic, then you must do the
following:</para>
<para>In <filename>/etc/shorewall/params</filename>:</para>
<programlisting><command>ETH0_IP=`find_interface_address eth0`</command> </programlisting>
<para>For users of Shorewall 2.1.0 and later:</para>
<programlisting><command>ETH0_IP=`find_first_interface_address eth0`</command></programlisting>
<para>and make your DNAT rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT loc dmz:192.168.2.4 tcp 80 - $ETH0_IP</programlisting>
</section>
<section id="faq1e">
<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>
<para><emphasis role="bold">Answer </emphasis>courtesy of Ryan: Assume
that the IP address of your local firewall interface is 192.168.1.1.
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>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S)
DNAT net fw:192.168.1.1:22 tcp 4104</programlisting>
</section>
</section>
<section id="faq30">
<title>(FAQ 30) I'm confused about when to use DNAT rules and when to
use ACCEPT rules.</title>
<para><emphasis role="bold">Answer</emphasis>:It would be a good idea to
review the <ulink url="shorewall_quickstart_guide.htm">QuickStart
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
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
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>
</section>
<section id="faq38">
<title>(FAQ 38) Where can I find more information about DNAT?</title>
<para><emphasis role="bold">Answer</emphasis>:Ian Allen has written a
<ulink url="http://ian.idallen.ca/dnat.txt">Paper about DNAT and
Linux</ulink>.</para>
</section>
<section id="faq48">
<title>(FAQ 48) How do I Set up Transparent HTTP Proxy with
Shorewall?</title>
<para><emphasis role="bold">Answer</emphasis>: See <ulink
url="Shorewall_Squid_Usage.html">Shorewall_Squid_Usage.html</ulink>.</para>
</section>
</section>
<section id="DNS-DNAT">
<title id="DNS">DNS and Port Forwarding/NAT</title>
<section id="faq2">
<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
can't.</title>
<para><emphasis role="bold">Answer:</emphasis> I have two objections to
this setup.</para>
<itemizedlist>
<listitem>
<para>Having an internet-accessible server in your local network is
like raising foxes in the corner of your hen house. If the server is
compromised, there's nothing between that server and your other
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>
<listitem>
<para>The accessibility problem is best solved using <ulink
url="shorewall_setup_guide.htm#DNS">Bind Version 9
<quote>views</quote> </ulink> (or using a separate DNS server for
local clients) 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>
</listitem>
</itemizedlist>
<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>
<para>All traffic redirected through use of this hack will look to
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>
</warning></para>
<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>
<itemizedlist>
<listitem>
<para>In <filename>/etc/shorewall/interfaces</filename>:</para>
<programlisting>#ZONE INTERFACE BROADCAST OPTIONS
loc eth1 detect <emphasis role="bold">routeback</emphasis> </programlisting>
</listitem>
<listitem>
<para>In <filename>/etc/shorewall/masq</filename>:</para>
<programlisting>#INTERFACE SUBNET ADDRESS PROTO PORT(S)
<emphasis role="bold">eth1:192.168.1.5 eth1 192.168.1.254 tcp www</emphasis></programlisting>
</listitem>
<listitem>
<para>In <filename>/etc/shorewall/rules</filename>:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
<emphasis role="bold">DNAT loc loc:192.168.1.5 tcp www - 130.151.100.69</emphasis></programlisting>
<para>That rule only works of course if you have a static external
IP address. If you have a dynamic IP address then include this in
<filename>/etc/shorewall/params</filename> (or your
<filename>&lt;export directory&gt;/init</filename> file if you are
using Shorewall Lite on the firewall system):</para>
<programlisting><command>ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
<para>and make your DNAT rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT loc loc:192.168.1.5 tcp www - <emphasis
role="bold">$ETH0_IP</emphasis></programlisting>
<para>Using this technique, you will want to configure your
DHCP/PPPoE/PPTP/… client to automatically restart Shorewall each
time that you get a new IP address.</para>
</listitem>
</itemizedlist>
<section id="faq2a">
<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
(non-RFC1918 addresses) so they can't access each other using their
DNS names.</title>
<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
using the destination hosts's public address:</para>
<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
PROTO=TCP SPT=1494 DPT=1491 WINDOW=17472 RES=0x00 ACK SYN URGP=0</programlisting>
</note>
<para><emphasis role="bold">Answer:</emphasis> This is another problem
that is best solved using Bind Version 9 <quote>views</quote>. It
allows both external and internal clients to access a NATed host using
the host's DNS name.</para>
<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>
<para>If you don't like those solutions and prefer, incredibly, to
route all Z-&gt;Z traffic through your firewall then:</para>
<orderedlist>
<listitem>
<para>Set the routeback option on the interface to Z.</para>
</listitem>
<listitem>
<para>Set the ALL INTERFACES column in the nat file to
<quote>Yes</quote>.</para>
</listitem>
</orderedlist>
<example id="Example1">
<title>Example:</title>
<literallayout>Zone: dmz, Interface: eth2, Subnet: 192.168.2.0/24, Address: 192.168.2.254</literallayout>
<para>In <filename>/etc/shorewall/interfaces</filename>:</para>
<programlisting>#ZONE INTERFACE BROADCAST OPTIONS
dmz eth2 192.168.2.255 <emphasis role="bold">routeback</emphasis> </programlisting>
<para>In <filename>/etc/shorewall/na</filename>t, be sure that you
have <quote>Yes</quote> in the ALL INTERFACES column.</para>
<para>In /etc/shorewall/masq:</para>
<programlisting>#INTERFACE SUBNETS ADDRESS
<emphasis role="bold">eth2 eth2 192.168.2.254</emphasis></programlisting>
<para>Like the silly hack in FAQ 2 above, this will make all
dmz-&gt;dmz traffic appear to originate on the firewall.</para>
</example>
</section>
<section id="faq2b">
<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>
<para><emphasis role="bold">Answer</emphasis>: Let's assume the
following:</para>
<itemizedlist>
<listitem>
<para>External IP address is 206.124.146.176 on <filename
class="devicefile">eth0</filename> (www.mydomain.com).</para>
</listitem>
<listitem>
<para>Server's IP address is 192.168.2.4</para>
</listitem>
</itemizedlist>
<para>You can enable access to the server from your local network
using the firewall's external IP address by adding this rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S) SOURCE ORIGINAL
# PORT DEST
<emphasis role="bold">DNAT loc dmz:192.168.2.4 tcp 80 - 206.124.146.176</emphasis></programlisting>
<para>If your external IP address is dynamic, then you must do the
following:</para>
<para>In <filename>/etc/shorewall/params (or in your
<filename>export-directory/init</filename> file if you are using
Shorewall Lite on the firewall system)</filename>:</para>
<programlisting><command>ETH0_IP=`find_first_interface_address eth0`</command> </programlisting>
<para>and make your DNAT rule:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT SOURCE ORIGINAL
# PORT DEST.
DNAT loc dmz:192.168.2.4 tcp 80 - <emphasis
role="bold">$ETH0_IP</emphasis></programlisting>
<warning>
<para>With dynamic IP addresses, you probably don't want to use
<ulink
url="starting_and_stopping_shorewall.htm"><command>shorewall[-lite]
save</command> and <command>shorewall[-lite]
restore</command></ulink>.</para>
</warning>
</section>
<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>
<para><emphasis role="bold">Answer</emphasis>: Did you set <emphasis
role="bold">IP_FORWARDING=On</emphasis> in
<filename>shorewall.conf</filename>?</para>
</section>
</section>
</section>
<section id="Blacklisting">
<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>
<para><emphasis role="bold">Answer</emphasis>: Nothing.</para>
<para>Blacklisting an IP address blocks incoming traffic from that IP
address. And if you set BLACKLISTNEWONLY=Yes in shorewall.conf, 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>
</section>
</section>
<section id="MSN">
<title>Netmeeting/MSN</title>
<section id="faq3">
<title>(FAQ 3) I want to use Netmeeting or MSN Instant Messenger with
Shorewall. What do I do?</title>
<para><emphasis role="bold">Answer:</emphasis> There is an <ulink
url="http://www.kfki.hu/%7Ekadlec/sw/netfilter/newnat-suite/">H.323
connection tracking/NAT module</ulink> that helps with Netmeeting. Note
however that one of the Netfilter developers recently posted the
following:</para>
<blockquote>
<para><programlisting>&gt; I know PoM -ng is going to address this issue, but till it is ready, and
&gt; all the extras are ported to it, is there any way to use the h.323
&gt; contrack module kernel patch with a 2.6 kernel?
&gt; Running 2.6.1 - no 2.4 kernel stuff on the system, so downgrade is not
&gt; an option... The module is not ported yet to 2.6, sorry.
&gt; Do I have any options besides a gatekeeper app (does not work in my
&gt; network) or a proxy (would prefer to avoid them)?
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
to debug/develop the newnat interface.</programlisting></para>
</blockquote>
<para>Look <ulink url="UPnP.html">here</ulink> for a solution for MSN IM
but be aware that there are significant security risks involved with
this solution. Also check the Netfilter mailing list archives at <ulink
url="http://www.netfilter.org">http://www.netfilter.org</ulink>.</para>
</section>
</section>
<section id="Openports">
<title>Open Ports</title>
<section id="faq51">
<title>(FAQ 51) How do I Open Ports in Shorewall?</title>
<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>
<para>Regardless of which guide you used, all outbound communcation is
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
<ulink url="standalone.htm#Open">re-read this
section</ulink>.</para>
</listitem>
<listitem>
<para>If you installed using the Two-interface Guide, then please
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>
</listitem>
<listitem>
<para>If you installed using the Three-interface Guide, then please
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>
</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>
<section id="faq4">
<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>
<para><emphasis role="bold">Answer:</emphasis> The default Shorewall
setup invokes the <emphasis role="bold">Drop</emphasis> action prior to
enforcing a DROP policy and the default policy to all zone from the
internet is DROP. The Drop action is defined in
<filename>/usr/share/shorewall/action.Drop</filename> which in turn
invokes the <emphasis role="bold">Auth</emphasis> macro (defined in
<filename>/usr/share/shorewall/macro.Auth</filename>) specifying the
<emphasis role="bold">REJECT</emphasis> action (i.e., <emphasis
role="bold">Auth/REJECT</emphasis>). This is necessary to prevent
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>
<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
your firewall is responding to connection requests on those
ports.</para>
<section id="faq4a">
<title>(FAQ 4a) I just ran an nmap UDP scan of my firewall and it
showed 100s of ports as open!!!!</title>
<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
the port as open. If you want to see which UDP ports are really open,
temporarily change your net-&gt;all policy to REJECT, restart
Shorewall and do the nmap UDP scan again.</para>
</section>
<section id="faq4b">
<title>(FAQ 4b) I have a port that I can't close no matter how I
change my rules.</title>
<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>
<para><emphasis role="bold">Answer:</emphasis> Rules only govern the
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
establish a new session your firerwall will block that attempt.</para>
</section>
<section id="faq4c">
<title>(FAQ 4c) How do I use Shorewall with PortSentry?</title>
<para><ulink
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>
</section>
</section>
<section id="Connections">
<title>Connection Problems</title>
<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>
<section id="faq5">
<title>(FAQ 5) I've installed Shorewall and now I can't ping through the
firewall</title>
<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>
</section>
<section id="faq15">
<title>(FAQ 15) My local systems can't see out to the net</title>
<para><emphasis role="bold">Answer:</emphasis> Every time I read
<quote>systems can't see out to the net</quote>, I wonder where the
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>
<orderedlist>
<listitem>
<para>The default gateway on each local system isn't set to the IP
address of the local firewall interface.</para>
</listitem>
<listitem>
<para>The entry for the local network in the /etc/shorewall/masq
file is wrong or missing.</para>
</listitem>
<listitem>
<para>The DNS settings on the local systems are wrong or the user is
running a DNS server on the firewall and hasn't enabled UDP and TCP
port 53 from the local net to the firewall or from the firewall to
the internet.</para>
</listitem>
<listitem>
<para>Forwarding is not enabled (This is often the problem for
Debian users). Enter this command:</para>
<programlisting>cat /proc/sys/net/ipv4/ip_forward</programlisting>
<para>If the value displayed is 0 (zero) then set <emphasis
role="bold">IP_FORWARDING=On</emphasis> in
<filename>/etc/shorewall/shorewall.conf</filename> and restart
Shorewall.</para>
</listitem>
</orderedlist>
</section>
<section id="faq29">
<title>(FAQ 29) FTP Doesn't Work</title>
<para><emphasis role="bold">Answer</emphasis>:See the <ulink
url="FTP.html">Shorewall and FTP page</ulink>.</para>
</section>
<section id="faq33">
<title>(FAQ 33) From clients behind the firewall, connections to some
sites fail. Connections to the same sites from the firewall itself work
fine. What's wrong.</title>
<para><emphasis role="bold">Answer</emphasis>: Most likely, you need to
set CLAMPMSS=Yes in <ulink
url="manpages/shorewall.conf.html">/etc/shorewall/shorewall.conf</ulink>.</para>
</section>
<section id="faq35">
<title>(FAQ 35) I have two Ethernet interfaces to my local network which
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
local interface in /etc/shorewall/interfaces; the bridged Ethernet
interfaces are not defined to Shorewall. How do I tell Shorewall to
allow traffic through the bridge?</title>
<para><emphasis role="bold">Answer</emphasis>: Add the
<firstterm>routeback</firstterm> option to <filename
class="devicefile">br0</filename> in <ulink
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink>.</para>
<para>For more information on this type of configuration, see the <ulink
url="SimpleBridge.html">Shorewall Simple Bridge
documentation</ulink>.</para>
</section>
<section id="faq64">
<title>(FAQ 64) I just upgraded my kernel to 2.6.20 and my
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
may no longer be defined in terms of bridge ports. See <ulink
url="bridge-Shorewall-perl.html">the new bridging documentation</ulink>
for information about configuring a bridge/firewall under kernel 2.6.20
and later.<note>
<para>Following the instructions in the new bridging documentation
will not prevent the above message from being issued.</para>
</note></para>
</section>
</section>
<section id="Logging">
<title>Logging</title>
<section id="faq6">
<title>(FAQ 6) Where are the log messages written and how do I change
the destination?</title>
<para><emphasis role="bold">Answer:</emphasis> NetFilter uses the
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
<quote>man syslog</quote>) in your <ulink
url="manpages/shorewall-policy.html">policies</ulink> and <ulink
url="manpages/shorewall-rules.html">rules</ulink>. The destination for
messages logged by syslog is controlled by
<filename>/etc/syslog.conf</filename> (see <quote>man
syslog.conf</quote>). When you have changed /etc/syslog.conf, be sure to
restart syslogd (on a RedHat system, <quote>service syslog
restart</quote>).</para>
<para>By default, older versions of Shorewall rate-limited log messages
through <ulink url="manpages/shorewall.conf.html">settings</ulink> in
<filename>/etc/shorewall/shorewall.conf</filename> -- If you want to log
all messages, set:</para>
<programlisting>LOGLIMIT=""
LOGBURST=""</programlisting>
<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>
<section id="faq6a">
<title>(FAQ 6a) Are there any log parsers that work with
Shorewall?</title>
<para><emphasis role="bold">Answer:</emphasis> Here are several links
that may be helpful:</para>
<literallayout>
<ulink url="http://www.shorewall.net/pub/shorewall/parsefw/">http://www.shorewall.net/pub/shorewall/parsefw/</ulink>
<ulink url="http://www.fireparse.com">http://www.fireparse.com</ulink>
<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>
<ulink url="http://gege.org/iptables">http://gege.org/iptables</ulink>
<ulink url="http://home.regit.org/ulogd-php.html">http://home.regit.org/ulogd-php.html</ulink>
</literallayout>
<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>
</section>
<section id="faq6b">
<title>(FAQ 6b) DROP messages on port 10619 are flooding the logs with
their connect requests. Can i exclude these error messages for this
port temporarily from logging in Shorewall?</title>
<para><emphasis role="bold">Answer</emphasis>:Temporarily add the
following rule:</para>
<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>
</section>
<section id="faq6d">
<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>
<para><emphasis role="bold">Answer</emphasis>:What is labeled as the
MAC address in a Netfilter (Shorewall) log message is actually the
Ethernet frame header. It contains:</para>
<itemizedlist>
<listitem>
<para>the destination MAC address (6 bytes)</para>
</listitem>
<listitem>
<para>the source MAC address (6 bytes)</para>
</listitem>
<listitem>
<para>the ethernet frame type (2 bytes)</para>
</listitem>
</itemizedlist>
<para><example id="Example5">
<title id="Example2">Example</title>
<para><programlisting>MAC=00:04:4c:dc:e2:28:00:b0:8e:cf:3c:4c:08:00</programlisting>
<itemizedlist>
<listitem>
<para>Destination MAC address = 00:04:4c:dc:e2:28</para>
</listitem>
<listitem>
<para>Source MAC address = 00:b0:8e:cf:3c:4c</para>
</listitem>
<listitem>
<para>Ethernet Frame Type = 08:00 (IP Version 4)</para>
</listitem>
</itemizedlist></para>
</example></para>
</section>
</section>
<section id="faq16">
<title>(FAQ 16) Shorewall is writing log messages all over my console
making it unusable!</title>
<para><emphasis role="bold">Answer:</emphasis></para>
<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>
<itemizedlist>
<listitem>
<para>Find where klogd is being started (it will be from one of the
files in /etc/init.d -- sysklogd, klogd, ...). Modify that file or
the appropriate configuration file so that klogd is started with
<quote>-c <emphasis>&lt;n&gt;</emphasis> </quote> where
<emphasis>&lt;n&gt;</emphasis> is a log level of 5 or less;
and/or</para>
</listitem>
<listitem>
<para>See the <quote>dmesg</quote> man page (<quote>man
dmesg</quote>). You must add a suitable <quote>dmesg</quote> command
to your startup scripts or place it in /etc/shorewall/start.</para>
</listitem>
</itemizedlist>
<warning>
<para>The hints below are just that; they have been known to work with
at least one release in the past but are not guaranteed to continue to
work with all releases of a particular distribution. As described
above, you may have to dig around in your distribution's init scripts
in order to find the correct solution.</para>
</warning>
<tip>
<para>Under RedHat and Mandriva, the max <ulink
url="shorewall_logging.html">log level</ulink> that is sent to the
console is specified in /etc/sysconfig/init in the LOGLEVEL variable
and in /etc/sysconfig/syslog in the KLOGD_PARAMS variable:</para>
<itemizedlist>
<listitem>
<para>Set <quote>LOGLEVEL=5</quote> to suppress info (log level 6)
messages on the console during bootup.</para>
</listitem>
<listitem>
<para>Add "-c 5" to KLOGD_PARAMS to suppress info (log level 6)
messages on the console.</para>
</listitem>
</itemizedlist>
</tip>
<tip>
<para>Under Debian with syslog, you can set KLOGD=<quote>-c 5</quote>
in <filename>/etc/init.d/klogd</filename> to suppress info (log level
6) messages on the console.</para>
</tip>
<tip>
<para>Under Debian with syslog-ng, you can set "CONSOLE_LOG_LEVEL=5"
IN <filename>/etc/default/syslog-ng</filename> to suppress info (log
level 6) messages on the console.</para>
</tip>
<tip>
<para>Under SUSE, add <quote>-c 5</quote> to KLOGD_PARAMS in
/etc/sysconfig/syslog to suppress info (log level 6) messages on the
console.</para>
</tip>
<section id="faq16a">
<title>(FAQ 16a) Why can't I see any Shorewall messages in
/var/log/messages?</title>
<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>
<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
the log. Also, it is important to understand that a log level of
"debug" will generally cause Netfilter messages to be written to fewer
files in <filename class="directory">/var/log</filename> than a log
severity of "info". The log level does not control the number of log
messages or the content of the messages.</para>
<para>The actual log file where Netfilter messages are written is not
standardized and will vary by distribution and distribusion version.
But anytime you see no logging, it's time to look outside the
Shorewall configuration for the cause. As an example, recent
<trademark>SuSE</trademark> releases use syslog-ng by default and
write Shorewall messages to
<filename>/var/log/firewall</filename>.</para>
<para>Please see the <ulink url="shorewall_logging.html">Shorewall
logging documentation</ulink> for further information.</para>
</section>
</section>
<section id="faq17">
<title>(FAQ 17) Why are these packets being Dropped/Rejected? How do I
decode Shorewall log messages?</title>
<para><emphasis role="bold">Answer:</emphasis> Logging of
dropped/rejected packets occurs out of a number of chains (as indicated
in the log message) in Shorewall:</para>
<variablelist>
<varlistentry>
<term>man1918 or logdrop</term>
<listitem>
<para>The destination address is listed in
<filename>/usr/share/shorewall/rfc1918</filename> with a <emphasis
role="bold">logdrop</emphasis> target -- see <filename> <ulink
url="manpages/shorewall-rfc1918.html">/usr/share/shorewall/rfc1918</ulink>
</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>rfc1918 or logdrop</term>
<listitem>
<para>The source or destination address is listed in
<filename>/usr/share/shorewall/rfc1918</filename> with a <emphasis
role="bold">logdrop</emphasis> target -- see <filename> <ulink
url="manpages/shorewall-rfc1918.html">/usr/share/shorewall/rfc1918</ulink>
</filename>.</para>
<note>
<para>If you see packets being dropped in the rfc1918 chain and
neither the source nor the destination IP address is reserved by
RFC 1918, that usually means that you have a old
<filename>rfc1918</filename> file in <filename
class="directory">/etc/shorewall</filename> (this problem most
frequently occurs if you are running Debian or one if its
derivatives). The <filename>rfc1918</filename> file used to
include bogons as well as the three ranges reserved by RFC 1918
and it resided in <filename
class="directory">/etc/shorewall</filename>. The file now only
includes the three RFC 1918 ranges and it resides in <filename
class="directory">/usr/share/shorewall</filename>. Remove the
stale <filename>rfc1918</filename> file in <filename
class="directory">/etc/shorewall</filename>.</para>
</note>
</listitem>
</varlistentry>
<varlistentry id="all2all">
<term>all2<emphasis>zone</emphasis>, <emphasis>zone</emphasis>2all
or all2all</term>
<listitem>
<para>You have a <ulink
url="manpages/shorewall-policy.html">policy</ulink> 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
effect.</para>
<para>Beginning with Shorewall 3.3.3, 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>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>zone</emphasis>12<emphasis>zone2</emphasis></term>
<listitem>
<para>Either you have a <ulink
url="manpages/shorewall-policy.html">policy</ulink> for
<emphasis>zone1</emphasis> to<emphasis> zone2</emphasis> that
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>
</listitem>
</varlistentry>
<varlistentry>
<term>@<emphasis>source</emphasis>2<emphasis>dest</emphasis></term>
<listitem>
<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>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis>interface</emphasis>_mac</term>
<listitem>
<para>The packet is being logged under the <emphasis
role="bold">maclist</emphasis> <ulink
url="manpages/shorewall-interfaces.html">interface
option</ulink>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>blacklst</term>
<listitem>
<para>The packet is being logged because the source IP is
blacklisted in the <filename> <ulink
url="manpages/shorewall-blacklist.html">/etc/shorewall/blacklist</ulink>
</filename> file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>INPUT or FORWARD</term>
<listitem>
<para>The packet has a source IP address that isn't in any of your
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
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink>
</filename> or you need the <emphasis
role="bold">routeback</emphasis> option in the relevant entry in
<filename> <ulink
url="manpages/shorewall-hosts.html">/etc/shorewall/hosts</ulink>.</filename></para>
<para>In Shorewall 3.3.3 and later versions with OPTIMIZE=1 in
<ulink url="manpages/shorewall.conf.html">shorewall.conf</ulink>,
such packets may also be logged out of a &lt;zone&gt;2all chain or
the all2all chain.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>OUTPUT</term>
<listitem>
<para>The packet has a destination IP address that isn't in any of
your defined zones(<command>shorewall[-lite] show zones</command>
and look at the printed zone definitions).</para>
<para>In Shorewall 3.3.3 and later versions 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>
</listitem>
</varlistentry>
<varlistentry>
<term>logflags</term>
<listitem>
<para>The packet is being logged because it failed the checks
implemented by the <emphasis role="bold">tcpflags</emphasis>
<ulink url="manpages/shorewall-interfaces.html">interface
option</ulink>.</para>
</listitem>
</varlistentry>
</variablelist>
<example id="Example3">
<title>Here is an example:</title>
<programlisting>Jun 27 15:37:56 gateway kernel:
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>
<para>Let's look at the important parts of this message:</para>
<variablelist>
<varlistentry>
<term>all2all:REJECT</term>
<listitem>
<para>This packet was REJECTed out of the <emphasis
role="bold">all2all</emphasis> chain -- the packet was rejected
under the <quote>all</quote>-&gt;<quote>all</quote> REJECT
policy (<link linkend="all2all">all2all</link> above).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>IN=eth2</term>
<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>
<varlistentry>
<term>OUT=eth1</term>
<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
processed by the firewall itself.</para>
<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>
destination IP address and destination port number.</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term>SRC=192.168.2.2</term>
<listitem>
<para>the packet was sent by 192.168.2.2</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DST=192.168.1.3</term>
<listitem>
<para>the packet is destined for 192.168.1.3</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PROTO=UDP</term>
<listitem>
<para>UDP Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DPT=53</term>
<listitem>
<para>The destination port is 53 (DNS)</para>
</listitem>
</varlistentry>
</variablelist>
<para>For additional information about the log message, see <ulink
url="http://logi.cc/linux/netfilter-log-format.php3">http://logi.cc/linux/netfilter-log-format.php3</ulink>.</para>
<para>In this case, 192.168.2.2 was in the <quote>dmz</quote> zone and
192.168.1.3 is in the <quote>loc</quote> zone. I was missing the
rule:</para>
<programlisting>ACCEPT dmz loc udp 53</programlisting>
</example>
</section>
<section id="faq21">
<title>(FAQ 21) I see these strange log entries occasionally; what are
they?</title>
<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
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
TTL=47 ID=0 DF PROTO=UDP SPT=53 DPT=2857 LEN=108 ]</programlisting>
<para>192.0.2.3 is external on my firewall... 172.16.0.0/24 is my
internal LAN</para>
<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
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>
<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,
DNAT and Masquerade), there are a lot of broken implementations. That is
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
response.</para>
<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>
<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
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
chain. I have also seen cases where the source IP in the ICMP itself
isn't set back to the external IP of the remote NAT gateway; that causes
your firewall to log and drop the packet out of the rfc1918 chain
because the source IP is reserved by RFC 1918.</para>
</section>
<section id="faq52">
<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>
<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>
<para><emphasis role="bold">Answer</emphasis>: Please refer to the
<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>
<section id="faq56">
<title>(FAQ 56) When I start or restart Shorewall, I see these messages
in my log. Are they harmful?</title>
<blockquote>
<programlisting>modprobe: Can't locate module ipt_physdev
modprobe: Can't locate module iptable_raw</programlisting>
</blockquote>
<para><emphasis role="bold">Answer:</emphasis> No. These occur when
Shorewall probes your system to determine the features that it support.
They are completely harmless.</para>
</section>
</section>
<section id="Routing">
<title>Routing</title>
<section id="faq32">
<title>(FAQ 32) My firewall has two connections to the internet from two
different ISPs. How do I set this up in Shorewall?</title>
<para><emphasis role="bold">Answer</emphasis>: See <ulink
url="MultiISP.html">this article on Shorewall and Multiple
ISPs</ulink>.</para>
</section>
<section id="faq49">
<title>(FAQ 49) When I start Shorewall, my routing table gets blown
away. Why does Shorewall do that?</title>
<para><emphasis role="bold">Answer</emphasis>: This is usually the
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>
</section>
<section id="Start-Stop">
<title>Starting and Stopping</title>
<section id="faq7">
<title>(FAQ 7) When I stop Shorewall using <quote>shorewall[-lite]
stop</quote>, I can't connect to anything. Why doesn't that command
work?</title>
<para><emphasis role="bold">Answer</emphasis>:The <quote>
<command>stop</command> </quote> command is intended to place your
firewall into a safe state whereby only those hosts listed in
<filename>/etc/shorewall/routestopped</filename>' are activated. If you
want to totally open up your firewall, you must use the <quote>
<command>shorewall[-lite] clear</command> </quote> command.</para>
</section>
<section id="faq8">
<title>(FAQ 8) When I try to start Shorewall on RedHat, I get messages
about insmod failing -- what's wrong?</title>
<para><emphasis role="bold">Answer:</emphasis> The output you will see
looks something like this:</para>
<programlisting>/lib/modules/2.4.17/kernel/net/ipv4/netfilter/ip_tables.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
/lib/modules/2.4.17/kernel/net/ipv4/netfilter/ip_tables.o: insmod
/lib/modules/2.4.17/kernel/net/ipv4/netfilter/ip_tables.o failed
/lib/modules/2.4.17/kernel/net/ipv4/netfilter/ip_tables.o: insmod ip_tables failed
iptables v1.2.3: can't initialize iptables table `nat': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.</programlisting>
<para>This problem is usually corrected through the following sequence
of commands</para>
<programlisting><command>service ipchains stop
chkconfig --delete ipchains
rmmod ipchains</command></programlisting>
<section id="faq8a">
<title>(FAQ 8a) When I try to start Shorewall on RedHat I get a
message referring me to FAQ #8</title>
<para><emphasis role="bold">Answer:</emphasis> This is usually cured
by the sequence of commands shown above in <xref
linkend="faq8" />.</para>
</section>
</section>
<section id="faq9">
<title>(FAQ 9) Why can't Shorewall detect my interfaces properly at
startup?</title>
<para>I just installed Shorewall and when I issue the start command, I
see the following:</para>
<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...
<emphasis role="bold">Net Zone: eth0:0.0.0.0/0
</emphasis><emphasis role="bold">Local Zone: eth1:0.0.0.0/0</emphasis>
Deleting user chains...
Creating input Chains...
...</programlisting>
<para>Why can't Shorewall detect my interfaces properly?</para>
<para><emphasis role="bold">Answer:</emphasis> The above output is
perfectly normal. The Net zone is defined as all hosts that are
connected through eth0 and the local zone is defined as all hosts
connected through <filename class="devicefile">eth1</filename>. You can
set the <emphasis role="bold">routefilter</emphasis> option on an
internal interface if 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>
</section>
<section id="faq22">
<title>(FAQ 22) I have some iptables commands that I want to run when
Shorewall starts. Which file do I put them in?</title>
<para><emphasis role="bold">Answer</emphasis>:You can place these
commands in one of the <ulink
url="shorewall_extension_scripts.htm">Shorewall Extension
Scripts</ulink>. Be sure that you look at the contents of the chain(s)
that you will be modifying with your commands to be sure that the
commands will do what they are 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 unconditional DROP, ACCEPT or REJECT rule and any
rules that you add after that will be ignored. Check <quote>man
iptables</quote> and look at the -I (--insert) command.</para>
</section>
<section id="faq34">
<title>(FAQ 34) How can I speed up Shorewall start (restart)?</title>
<para><emphasis role="bold">Answer</emphasis>: Switch to using <ulink
url="Shorewall-perl.html">Shorewall-perl</ulink>.</para>
</section>
<section id="faq69">
<title>(FAQ 69) When I restart Shorewall, new connections are blocked
for a long time. Is there a way to avoid that?</title>
<para><emphasis role="bold">Answer</emphasis>: Switch to using <ulink
url="Shorewall-perl.html">Shorewall-perl</ulink>.</para>
</section>
<section id="faq43">
<title>(FAQ 43) I just installed the Shorewall RPM and Shorewall doesn't
start at boot time.</title>
<para><emphasis role="bold">Answer</emphasis>: When you install using
the "rpm -U" command, Shorewall doesn't run your distribution's tool for
configuring Shorewall startup. You will need to run that tool (insserv,
chkconfig, run-level editor, …) to configure Shorewall to start in the
run-levels that you run your firewall system at.</para>
</section>
<section id="faq45">
<title>(FAQ 45) Why does "shorewall[-lite] start" fail when trying to
set up SNAT/Masquerading?</title>
<para><command>shorewall start</command> produces the following
output:</para>
<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
ERROR: Command "/sbin/iptables -t nat -A …" Failed</programlisting>
<para><emphasis role="bold">Answer</emphasis>: 99.999% of the time, this
error is caused by a mismatch between your iptables and kernel.</para>
<orderedlist numeration="loweralpha">
<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>
<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
"/sbin/iptables".</para>
</listitem>
</orderedlist>
</section>
<section id="faq59">
<title>(FAQ 59) After I start Shorewall, there are lots of unused
Netfilter modules loaded. How do I avoid that?</title>
<para><emphasis role="bold">Answer</emphasis>: Copy
<filename>/usr/share/shorewall[-lite]/modules</filename> to
<filename>/etc/shorewall/modules </filename>and modify the copy to
include only the modules that you need.</para>
</section>
<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>
<para><emphasis role="bold">Answer:</emphasis> Your iptables is
incompatible with your kernel. Either</para>
<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
IPSEC implementation built into the 2.6 kernel) then you can rename
<filename>/lib/iptables/libipt_policy.so</filename>.</para>
</listitem>
</itemizedlist>
<note>
<para>Beginning with Shorewall 3.4.0, Shorewall no longer attempts 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>
</note>
</section>
<section id="faq62">
<title>(FAQ 62) I have unexplained 30-second pauses during "shorewall
[re]start". What causes that?</title>
<para><emphasis role="bold">Answer:</emphasis> This usually happens when
the firewall uses LDAP Authentication. The solution is to list your LDAP
server(s) as <emphasis role="bold">critical</emphasis> in <ulink
url="manpages/shorewall-routestopped.html">/etc/shorewall/routestopped</ulink>.</para>
</section>
<section id="faq68">
<title>(FAQ 68) I have a VM under an OpenVZ system. I can't get rid of
the following message:</title>
<para>ERROR: Command "/sbin/iptables -A FORWARD -m state --state
ESTABLISHED,RELATED -j ACCEPT" failed.</para>
<para><emphasis role="bold">Answer</emphasis>: At a root shell prompt,
type the iptables command shown in the error message. If the command
fails, you OpenVZ Netfilter/iptables configuration is incorrect. Until
that command can run without error, no stateful iptables firewall will
be able to run in your VM.</para>
</section>
<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
the init scripts <command>stop</command> undoes the effect of
<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
tradeoffs involved when deciding whether to use the Debian package, see
<ulink url="http://wiki.shorewall.net/wiki/ShorewallOnDebian">this
article</ulink>.</para>
</section>
<section id="faq74">
<title>(FAQ 74) When I "shorewall start" or "shorewall check" on my SuSE
10.0 system, I get FATAL ERROR messages and/or the system
crashes"</title>
<para><emphasis role="bold">Answer</emphasis>: These failures result
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>
</section>
<section id="MultiISP">
<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
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
<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>
<para><emphasis role="bold">Answer</emphasis>: Suppose that you want all
traffic to go out through ISP1 (mark 1) unless you specify otherwise.
Then simply add these two rules as the first marking rules in your
<filename>/etc/shorewall/tcrules</filename> file:</para>
<programlisting>#MARK SOURCE DEST
1:P 0.0.0.0/0
1 $FW
<emphasis>other MARK rules</emphasis></programlisting>
<para>Now any traffic that isn't marked by one of your other MARK rules
will have mark = 1 and will be sent via ISP1. That will work whether
<emphasis role="bold">balance</emphasis> is specified or not!</para>
</section>
</section>
<section id="TC">
<title>Traffic Shaping</title>
<section id="faq67">
<title>(FAQ 67) I just configured Shorewall's builtin traffic shaping
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
role="bold">Answer</emphasis>: This message indicates that your kernel
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>
<member>cls_u32</member>
<member>sch_htb</member>
<member>sch_ingress</member>
<member>sch_sfq</member>
</simplelist></para>
</section>
</section>
<section id="About">
<title>About Shorewall</title>
<section id="faq10">
<title>(FAQ 10) What Distributions does Shorewall work with?</title>
<para><emphasis role="bold">Answer</emphasis>: Shorewall works with any
GNU/Linux distribution that includes the <ulink
url="shorewall_prerequisites.htm">proper prerequisites</ulink>.</para>
</section>
<section id="faq11">
<title>(FAQ 11) What Features does Shorewall have?</title>
<para><emphasis role="bold">Answer:</emphasis> See the <ulink
url="shorewall_features.htm">Shorewall Feature List</ulink>.</para>
</section>
<section id="faq12">
<title>(FAQ 12) Is there a GUI?</title>
<para><emphasis role="bold">Answer:</emphasis> Yes! Shorewall 3.x
support is available in Webmin 1.300. See <ulink
url="http://www.webmin.com">http://www.webmin.com</ulink></para>
</section>
<section id="faq13">
<title>(FAQ 13) Why do you call it <quote>Shorewall</quote>?</title>
<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
product is actually <quote>Shoreline Firewall</quote> but
<quote>Shorewall</quote> is much more commonly used.</para>
</section>
<section id="faq23">
<title>(FAQ 23) Why do you use such ugly fonts on your web site?</title>
<para><emphasis role="bold">Answer</emphasis>: The Shorewall web site is
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>
</section>
<section id="faq25">
<title>(FAQ 25) How do I tell which version of Shorewall or Shorewall
Lite I am running?</title>
<para><emphasis role="bold">Answer</emphasis>: At the shell prompt,
type:</para>
<programlisting><command>/sbin/shorewall[-lite] version</command> </programlisting>
<section id="faq25a">
<title>(FAQ 25a) How do I tell which version of Shorewall-perl and
Shorewall-shell that I have intalled?</title>
<para><emphasis role="bold">Answer</emphasis>: At the shell prompt,
type:</para>
<programlisting><command>/sbin/shorewall version -a</command> </programlisting>
</section>
</section>
<section id="faq31">
<title>(FAQ 31) Does Shorewall provide protection against....</title>
<variablelist>
<varlistentry>
<term>IP Spoofing: Sending packets over the WAN interface using an
internal LAP IP address as the source address?</term>
<listitem>
<para><emphasis role="bold">Answer</emphasis>: Yes.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Tear Drop: Sending packets that contain overlapping
fragments?</term>
<listitem>
<para><emphasis role="bold">Answer</emphasis>: This is the
responsibility of the IP stack, not the Netfilter-based firewall
since fragment reassembly occurs before the stateful packet filter
ever touches each packet.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Smurf and Fraggle: Sending packets that use the WAN or LAN
broadcast address as the source address?</term>
<listitem>
<para><emphasis role="bold">Answer</emphasis>: Shorewall can be
configured to do that using the <ulink
url="blacklisting_support.htm">blacklisting</ulink> facility.
Shorewall versions 2.0.0 and later filter these packets under the
<firstterm>nosmurfs</firstterm> interface option in <ulink
url="manpages/shorewall-interfaces.html">/etc/shorewall/interfaces</ulink>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Land Attack: Sending packets that use the same address as the
source and destination address?</term>
<listitem>
<para><emphasis role="bold">Answer</emphasis>: Yes, if the <ulink
url="manpages/shorewall-interfaces.html">routefilter interface
option</ulink> is selected.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>DOS: - SYN Dos - ICMP Dos - Per-host Dos protection</term>
<listitem>
<para><emphasis role="bold">Answer</emphasis>: Shorewall has
facilities for limiting SYN and ICMP packets. Netfilter as
included in standard Linux kernels doesn't support per-remote-host
limiting except by explicit rule that specifies the host IP
address; that form of limiting is supported by Shorewall.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section id="faq65">
<title>(FAQ 65) How do I accomplish failover with Shorewall?</title>
<para><emphasis role="bold">Answer</emphasis>: <ulink
url="http://linuxman.wikispaces.com/Clustering+Shorewall">This article
by Paul Gear</ulink> should help you get started.</para>
</section>
</section>
<section id="RFC1918">
<title>RFC 1918</title>
<section id="faq14">
<title>(FAQ 14) I'm connected via a cable modem and it has an internal
web server that allows me to configure/monitor it but as expected if I
enable rfc1918 blocking for my eth0 interface (the internet one), it
also blocks the cable modems web server.</title>
<para>Is there any way it can add a rule before the rfc1918 blocking
that will let all traffic to and from the 192.168.100.1 address of the
modem in/out but still block all other rfc1918 addresses?</para>
<para><emphasis role="bold">Answer:</emphasis> Add the following to
<ulink
url="manpages/shorewall-rfc1918.html">/etc/shorewall/rfc1918</ulink>
(Note: If you are running Shorewall 2.0.0 or later, you may need to
first copy <filename>/usr/share/shorewall/rfc1918</filename> to
<filename>/etc/shorewall/rfc1918</filename>):</para>
<para>Be sure that you add the entry ABOVE the entry for
192.168.0.0/16.</para>
<programlisting>#SUBNET TARGET
192.168.100.1 RETURN</programlisting>
<note>
<para>If you add a second IP address to your external firewall
interface to correspond to the modem address, you must also make an
entry in /etc/shorewall/rfc1918 for that address. For example, if you
configure the address 192.168.100.2 on your firewall, then you would
add two entries to /etc/shorewall/rfc1918:</para>
<programlisting>#SUBNET TARGET
192.168.100.1 RETURN
192.168.100.2 RETURN</programlisting>
</note>
<section id="faq14a">
<title>(FAQ 14a) Even though it assigns public IP addresses, my ISP's
DHCP server has an RFC 1918 address. If I enable RFC 1918 filtering on
my external interface, my DHCP client cannot renew its lease.</title>
<para><emphasis role="bold">Answer</emphasis>: The solution is the
same as <xref linkend="faq14" /> above. Simply substitute the IP
address of your ISPs DHCP server.</para>
</section>
<section id="faq14b">
<title>(FAQ 14b) I connect to the internet with PPPoE. When I try to
access the built-in web server in my DSL Modem, I get connection
Refused.</title>
<para>I see the following in my log:</para>
<programlisting>Mar 1 18:20:07 Mail kernel: Shorewall:OUTPUT:REJECT:IN= OUT=eth0 SRC=192.168.1.2 DST=192.168.1.1 LEN=60
TOS=0x00 PREC=0x00 TTL=64 ID=26774 DF PROTO=TCP SPT=32797 DPT=80 WINDOW=5840 RES=0x00 SYN URGP=0 </programlisting>
<para><emphasis role="bold">Answer</emphasis>: The fact that the
message is being logged from the OUTPUT chain means that the
destination IP address is not in any defined zone (see <link
linkend="faq17">FAQ 17</link>). You need to:</para>
<orderedlist>
<listitem>
<para>Add a zone for the modem in
<filename>/etc/shorewall/zones</filename>:</para>
<programlisting>#ZONE TYPE OPTIONS
modem ipv4</programlisting>
</listitem>
<listitem>
<para>Define the zone to be associated with <filename
class="devicefile">eth0</filename> (or whatever interface connects
to your modem) in
<filename>/etc/shorewall/interfaces</filename>:</para>
<programlisting>#ZONE INTERFACE BROADCAST OPTIONS
modem eth0 detect</programlisting>
</listitem>
<listitem>
<para>Allow web traffic to the modem in
<filename>/etc/shorewall/rules</filename>:</para>
<programlisting>#ACTION SOURCE DEST PROTO DEST PORT(S)
ACCEPT fw modem tcp 80
ACCEPT loc modem tcp 80</programlisting>
</listitem>
</orderedlist>
<para>Note that many of these ADSL/Cable Modems have no default
gateway or their default gateway is at a fixed IP address that is
different from the IP address you have assigned to your external
interface. In either case, you may have problems browsing the modem
from your local network even if you have the correct routes
established on your firewall. This is usually solved by masquerading
traffic from your local network to the modem.</para>
<para><filename>/etc/shorewall/masq</filename>:</para>
<programlisting>#INTERFACE SUBNET ADDRESS
eth0 eth1 # eth1 = interface to local network</programlisting>
<para>For an example of this when the ADSL/Cable modem is bridged, see
<ulink url="XenMyWay-Routed.html">my configuration</ulink>. In that
case, I masquerade using the IP address of my local interface!</para>
</section>
</section>
</section>
<section id="ALIASES">
<title>Alias IP Addresses/Virtual Interfaces</title>
<section id="faq18">
<title>(FAQ 18) Is there any way to use aliased ip addresses with
Shorewall, and maintain separate rulesets for different IPs?</title>
<para><emphasis role="bold">Answer:</emphasis> Yes. See <ulink
url="Shorewall_and_Aliased_Interfaces.html">Shorewall and Aliased
Interfaces</ulink>.</para>
</section>
</section>
<section id="Lite">
<title>Shorewall Lite</title>
<section id="faq53">
<title>(FAQ 53) What is Shorewall Lite?</title>
<para><emphasis role="bold">Answer</emphasis>: Shorewall Lite is a
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>
</section>
<section id="faq54">
<title>(FAQ 54) If I want to use Shorewall Lite, do I also need to
install Shorewall on the same system?</title>
<para><emphasis role="bold">Answer</emphasis>: No. In fact, we recommend
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>
<section id="faq55">
<title>(FAQ 55) How do I decide which product to use - Shorewall or
Shorewall Lite?</title>
<para><emphasis role="bold">Answer</emphasis>: If you plan to have only
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
configuration directories on my desktop system.</para>
</section>
<section id="faq60">
<title>(FAQ 60) What are the compatibility restrictions between
Shorewall and Shorewall Lite</title>
<para><emphasis role="bold">Answer</emphasis>: Beginning with version
3.2.3, there are no compatibility constraints between Shorewall and
Shorewall-lite.</para>
</section>
</section>
<section id="Perl">
<title>Shorewall-Perl</title>
<section id="faq70">
<title>(FAQ 70) What is Shorewall-Perl?</title>
<para><emphasis role="bold">Answer</emphasis>: Shorewall-perl is a
re-implementation of the Shorewall configuration compiler written in
Perl.</para>
</section>
<section id="faq71">
<title>(FAQ 71) What are the advantages of using Shorewall-perl?</title>
<para><emphasis role="bold">Answer</emphasis>:</para>
<itemizedlist>
<listitem>
<para>The Shorewall-perl compiler is much faster than the
Shorewall-shell compiler.</para>
</listitem>
<listitem>
<para>The script generated by the Shorewall-perl compiler uses
<command>iptables-restore</command> to instantiate the Netfilter
configuration. So it runs much faster than the script generated by
the Shorewall-shell compiler and doesn't disable new connections
during ruleset installation.</para>
</listitem>
<listitem>
<para>The Shorewall-perl compiler does more thorough checking of the
configuration than the Shorewall-shell compiler does.</para>
</listitem>
<listitem>
<para>The error messages produced by the Shorewall-perl compiler are
better, more consistent and always include the file name and line
number where the error was detected.</para>
</listitem>
<listitem>
<para>Going forward, the Shorewall-perl compiler will get all
enhancements; the Shorewall-shell compiler will only get those
enhancements that are easy to retrofit.</para>
</listitem>
</itemizedlist>
</section>
<section id="faq72">
<title>(FAQ 72) Can I switch to using Shorewall-perl without changing my
Shorewall configuration?</title>
<para><emphasis role="bold">Answer</emphasis>: Probably not. See the
<ulink url="???">Shorewall Perl article</ulink> for a list of the
incompatibilities between Shorewall-shell and Shorewall-perl.</para>
</section>
</section>
<section id="Misc">
<title>Miscellaneous</title>
<section id="faq20">
<title>(FAQ 20) I have just set up a server. Do I have to change
Shorewall to allow access to my server from the internet?</title>
<para><emphasis role="bold">Answer</emphasis>: Yes. Consult the <ulink
url="shorewall_quickstart_guide.htm">QuickStart guide</ulink> that you
used during your initial setup for information about how to set up rules
for your server.</para>
</section>
<section id="faq24">
<title>(FAQ 24) How can I allow conections to let's say the ssh port
only from specific IP Addresses on the internet?</title>
<para><emphasis role="bold">Answer</emphasis>: In the SOURCE column of
the rule, follow <quote>net</quote> by a colon and a list of the
host/subnet addresses as a comma-separated list.</para>
<programlisting>net:&lt;ip1&gt;,&lt;ip2&gt;,...</programlisting>
<example id="Example4">
<title>Example:</title>
<programlisting>ACCEPT net:192.0.2.16/28,192.0.2.44 fw tcp 22</programlisting>
</example>
</section>
<section id="faq26">
<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
can I use nmap with Shorewall?"</title>
<para><emphasis role="bold">Answer</emphasis>: Temporarily remove and
rejNotSyn, dropNotSyn and dropInvalid rules from
<filename>/etc/shorewall/rules</filename> and restart Shorewall.</para>
</section>
<section id="faq27">
<title>(FAQ 27) I'm compiling a new kernel for my firewall. What should
I look out for?</title>
<para><emphasis role="bold">Answer</emphasis>: First take a look at the
<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>
<section id="faq27a">
<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>
<para>The last few lines of <ulink url="troubleshoot.htm">a startup
trace</ulink> are these:</para>
<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>
<para><emphasis role="bold">Answer:</emphasis> Your new kernel
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>
<section id="faq28">
<title>(FAQ 28) How do I use Shorewall as a Bridging Firewall?</title>
<para><emphasis role="bold">Answer</emphasis>: Shorewall Bridging
Firewall support is available — <ulink
url="bridge-Shorewall-perl.html">check here for details</ulink>.</para>
</section>
<section id="faq39">
<title>(FAQ 39) How do I block connections to a particular domain
name?</title>
<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>
<programlisting>#ACTION SOURCE DEST PROTO
REJECT fw net:pagead2.googlesyndication.com all</programlisting>
<para>However, this also sometimes restricts access to "google.com". Why
is that? Using dig, I found these IPs for domain
googlesyndication.com:<programlisting>216.239.37.99
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
blocking the domain, but rather the IP being called. So how in the world
do you block an actual domain name?</para>
<para><emphasis role="bold">Answer:</emphasis> Packet filters like
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
Shorewall's use of netfilter) also consider the network interface(s)
where each packet entered and/or where the packet will leave the
firewall/router.</para>
<para>When you specify <ulink
url="configuration_file_basics.htm#dnsnames">a domain name in a
Shorewall rule</ulink>, the iptables program resolves that name to one
or more IP addresses and the actual netfilter rules that are created are
expressed in terms of those IP addresses. So the rule that you entered
was equivalent to:</para>
<para><programlisting>#ACTION SOURCE DEST PROTO
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
connections to a particular name by examination of protocol headers
alone. While some protocols such as <ulink url="FTP.html">FTP</ulink>
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'
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
result.</para>
</section>
<section id="faq42">
<title>(FAQ 42) How can I tell which features my kernel and iptables
support?</title>
<para><emphasis role="bold">Answer</emphasis>: Use the
<command>shorewall[-lite] show capabilities</command> command at a root
prompt.</para>
<programlisting>gateway:~# shorewall show capabilities
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
Extended Multi-port Match: Available
Connection Tracking Match: Available
Packet Type Match: Available
Policy Match: Available
Physdev Match: Available
IP range Match: Available
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>
</section>
<section id="faq19">
<title>(FAQ 19) How do I open the firewall for all traffic to/from the
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>
<para>You should also delete any ACCEPT rules from $FW-&gt;loc and
loc-&gt;$FW since those rules are redundant with the above
policies.</para>
</section>
</section>
</article>