Sophie

Sophie

distrib > Mandriva > mes5 > x86_64 > by-pkgid > 45723c51178a73df679c2a8284d8eeff > files > 10

shorewall-doc-4.0.15-0.2mdvmes5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Shorewall FAQs</title><link rel="stylesheet" href="html.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="article" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id257523"></a>Shorewall FAQs</h2></div><div><div class="authorgroup"><h3 class="corpauthor">Shorewall Community</h3><div class="author"><h3 class="author"><span class="firstname">Tom</span> <span class="surname">Eastep</span></h3></div></div></div><div><p class="copyright">Copyright © 2001-2008 Thomas M. Eastep</p></div><div><div class="legalnotice"><a id="id292638"></a><p>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 “<span class="quote">
      <a class="ulink" href="GnuCopyright.htm" target="_self">GNU Free Documentation License</a>
      </span>”.</p></div></div><div><p class="pubdate">2008/12/15</p></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#Install">Installing Shorewall</a></span></dt><dd><dl><dt><span class="section"><a href="#Howto">Where do I find Step by Step Installation and Configuration
      Instructions?</a></span></dt><dt><span class="section"><a href="#faq37">(FAQ 37) I just installed Shorewall on Debian and the
      /etc/shorewall directory is almost empty!!!</a></span></dt><dd><dl><dt><span class="section"><a href="#faq37a">(FAQ 37a) I just installed Shorewall on Debian and I can't find
        the sample configurations.</a></span></dt></dl></dd><dt><span class="section"><a href="#faq75">(FAQ 75) I can't find the Shorewall 4.x shorewall-common RPM.
      Where is it?</a></span></dt></dl></dd><dt><span class="section"><a href="#Upgrading">Upgrading Shorewall</a></span></dt><dd><dl><dt><span class="section"><a href="#faq66">(FAQ 66) I'm trying to upgrade to Shorewall 4.x; where is the
      'shorewall' package?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq66a">(FAQ 66a) I'm trying to upgrade to Shorewall 4.x; do I have to
        uninstall the 'shorewall' package?</a></span></dt><dt><span class="section"><a href="#faq66b">(FAQ 66b) I'm trying to upgrade to Shorewall 4.x: which of
        these packages do I need to install?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq76">(FAQ 76) I just upgraded my Debian (Ubuntu, Kubuntu, ...) system
      and now masquerading doesn't work? What happened?</a></span></dt></dl></dd><dt><span class="section"><a href="#PortForwarding">Port Forwarding (Port Redirection)</a></span></dt><dd><dl><dt><span class="section"><a href="#faq1">(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.</a></span></dt><dd><dl><dt><span class="section"><a href="#faq1a">(FAQ 1a) Okay -- I followed those instructions but it doesn't
        work</a></span></dt><dt><span class="section"><a href="#faq1b">(FAQ 1b) I'm still having problems with port forwarding</a></span></dt><dt><span class="section"><a href="#faq1c">(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?</a></span></dt><dt><span class="section"><a href="#faq1d">(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.</a></span></dt><dt><span class="section"><a href="#faq1e">(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?</a></span></dt><dt><span class="section"><a href="#faq1f">(FAQ 1f) Why must the server that I port forward to have it's
        default gateway set to my Shorewall system's IP address?</a></span></dt><dt><span class="section"><a href="#faq1g">(FAQ 1g) I would like to redirect port 80 on my public IP
        address (206.124.146.176) to port 993 on Internet host
        66.249.93.111</a></span></dt></dl></dd><dt><span class="section"><a href="#faq30">(FAQ 30) I'm confused about when to use DNAT rules and when to
      use ACCEPT rules.</a></span></dt><dt><span class="section"><a href="#faq38">(FAQ 38) Where can I find more information about DNAT?</a></span></dt><dt><span class="section"><a href="#faq48">(FAQ 48) How do I Set up Transparent HTTP Proxy with
      Shorewall?</a></span></dt></dl></dd><dt><span class="section"><a href="#DNS-DNAT">DNS and Port Forwarding/NAT</a></span></dt><dd><dl><dt><span class="section"><a href="#faq2">(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.</a></span></dt><dd><dl><dt><span class="section"><a href="#faq2a">(FAQ 2a) I have a zone “<span class="quote">Z</span>” 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.</a></span></dt><dt><span class="section"><a href="#faq2b">(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.</a></span></dt><dt><span class="section"><a href="#faq2c">(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?</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#Blacklisting">Blacklisting</a></span></dt><dd><dl><dt><span class="section"><a href="#faq63">(FAQ 63) I just blacklisted IP address 206.124.146.176 and I can
      still ping it. What did I do wrong?</a></span></dt></dl></dd><dt><span class="section"><a href="#MSN">Netmeeting/MSN</a></span></dt><dd><dl><dt><span class="section"><a href="#faq3">(FAQ 3) I want to use Netmeeting or MSN Instant Messenger with
      Shorewall. What do I do?</a></span></dt></dl></dd><dt><span class="section"><a href="#Openports">Open Ports</a></span></dt><dd><dl><dt><span class="section"><a href="#faq51">(FAQ 51) How do I Open Ports in Shorewall?</a></span></dt><dt><span class="section"><a href="#faq4">(FAQ 4) I just used an online port scanner to check my firewall
      and it shows some ports as “<span class="quote">closed</span>” rather than
      “<span class="quote">blocked</span>”. Why?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq4a">(FAQ 4a) I just ran an nmap UDP scan of my firewall and it
        showed 100s of ports as open!!!!</a></span></dt><dt><span class="section"><a href="#faq4b">(FAQ 4b) I have a port that I can't close no matter how I
        change my rules.</a></span></dt><dt><span class="section"><a href="#faq4c">(FAQ 4c) How do I use Shorewall with PortSentry?</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#Connections">Connection Problems</a></span></dt><dd><dl><dt><span class="section"><a href="#pseudofaq17">Why are these packets being Dropped/Rejected? How do I decode
      Shorewall log messages?</a></span></dt><dt><span class="section"><a href="#faq5">(FAQ 5) I've installed Shorewall and now I can't ping through the
      firewall</a></span></dt><dt><span class="section"><a href="#faq15">(FAQ 15) My local systems can't see out to the net</a></span></dt><dt><span class="section"><a href="#faq29">(FAQ 29) FTP Doesn't Work</a></span></dt><dt><span class="section"><a href="#faq33">(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.</a></span></dt><dt><span class="section"><a href="#faq35">(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 <code class="filename">/etc/shorewall/interfaces</code>; the
      bridged Ethernet interfaces are not defined to Shorewall. How do I tell
      Shorewall to allow traffic through the bridge?</a></span></dt><dt><span class="section"><a href="#faq64">(FAQ 64) I just upgraded my kernel to 2.6.20 and my
      bridge/firewall stopped working. What is wrong?</a></span></dt></dl></dd><dt><span class="section"><a href="#Logging">Logging</a></span></dt><dd><dl><dt><span class="section"><a href="#faq6">(FAQ 6) Where are the log messages written and how do I change
      the destination?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq6a">(FAQ 6a) Are there any log parsers that work with
        Shorewall?</a></span></dt><dt><span class="section"><a href="#faq6b">(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?</a></span></dt><dt><span class="section"><a href="#faq6d">(FAQ 6d) Why is the MAC address in Shorewall log messages so
        long? I thought MAC addresses were only 6 bytes in length.</a></span></dt></dl></dd><dt><span class="section"><a href="#faq16">(FAQ 16) Shorewall is writing log messages all over my console
      making it unusable!</a></span></dt><dd><dl><dt><span class="section"><a href="#faq16a">(FAQ 16a) Why can't I see any Shorewall messages in
        /var/log/messages?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq17">(FAQ 17) Why are these packets being Dropped/Rejected? How do I
      decode Shorewall log messages?</a></span></dt><dt><span class="section"><a href="#faq21">(FAQ 21) I see these strange log entries occasionally; what are
      they?</a></span></dt><dt><span class="section"><a href="#faq52">(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?</a></span></dt><dt><span class="section"><a href="#faq56">(FAQ 56) When I start or restart Shorewall, I see these messages
      in my log. Are they harmful?</a></span></dt></dl></dd><dt><span class="section"><a href="#Routing">Routing</a></span></dt><dd><dl><dt><span class="section"><a href="#faq32">(FAQ 32) My firewall has two connections to the Internet from two
      different ISPs. How do I set this up in Shorewall?</a></span></dt><dt><span class="section"><a href="#faq49">(FAQ 49) When I start Shorewall, my routing table gets blown
      away. Why does Shorewall do that?</a></span></dt></dl></dd><dt><span class="section"><a href="#Start-Stop">Starting and Stopping</a></span></dt><dd><dl><dt><span class="section"><a href="#faq7">(FAQ 7) When I stop Shorewall using “<span class="quote">shorewall[-lite]
      stop</span>”, I can't connect to anything. Why doesn't that command
      work?</a></span></dt><dt><span class="section"><a href="#faq8">(FAQ 8) When I try to start Shorewall on RedHat, I get messages
      about insmod failing -- what's wrong?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq8a">(FAQ 8a) When I try to start Shorewall on RedHat I get a
        message referring me to FAQ #8</a></span></dt></dl></dd><dt><span class="section"><a href="#faq9">(FAQ 9) Why can't Shorewall detect my interfaces properly at
      startup?</a></span></dt><dt><span class="section"><a href="#faq22">(FAQ 22) I have some iptables commands that I want to run when
      Shorewall starts. Which file do I put them in?</a></span></dt><dt><span class="section"><a href="#faq34">(FAQ 34) How can I speed up Shorewall start (restart)?</a></span></dt><dt><span class="section"><a href="#faq69">(FAQ 69) When I restart Shorewall, new connections are blocked
      for a long time. Is there a way to avoid that?</a></span></dt><dt><span class="section"><a href="#faq43">(FAQ 43) I just installed the Shorewall RPM and Shorewall doesn't
      start at boot time.</a></span></dt><dt><span class="section"><a href="#faq45">(FAQ 45) Why does "shorewall[-lite] start" fail when trying to
      set up SNAT/Masquerading?</a></span></dt><dt><span class="section"><a href="#faq59">(FAQ 59) After I start Shorewall, there are lots of unused
      Netfilter modules loaded. How do I avoid that?</a></span></dt><dt><span class="section"><a href="#faq61">(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?</a></span></dt><dt><span class="section"><a href="#faq62">(FAQ 62) I have unexplained 30-second pauses during "shorewall
      [re]start". What causes that?</a></span></dt><dt><span class="section"><a href="#faq68">(FAQ 68) I have a VM under an OpenVZ system. I can't get rid of
      the following message:</a></span></dt><dt><span class="section"><a href="#faq73">(FAQ 73) When I stop Shorewall, the firewall is wide open. Isn't
      that a security risk?</a></span></dt><dt><span class="section"><a href="#faq74">(FAQ 74) When I "<span class="command"><strong>shorewall start</strong></span>" or
      "<span class="command"><strong>shorewall check</strong></span>" on my SuSE 10.0 system, I get FATAL
      ERROR messages and/or the system crashes"</a></span></dt><dt><span class="section"><a href="#faq78">(FAQ 78) After restart and bootup of my Debian firewall, all
      traffic is blocked for hosts behind the firewall trying to connect out
      onto the net or through the vpn (although i can reach the internal
      firewall interface and obtain dumps etc). Once I issue 'shorewall clear'
      followed by 'shorewall restart' it then works, despite the config not
      changing</a></span></dt></dl></dd><dt><span class="section"><a href="#MultiISP">Multiple ISPs</a></span></dt><dd><dl><dt><span class="section"><a href="#faq57">(FAQ 57) I configured two ISPs in Shorewall but when I try to use
      the second one, it doesn't work.</a></span></dt><dt><span class="section"><a href="#faq58">(FAQ 58) But if I specify 'balance' then won't Shorewall balance
      the traffic between the interfaces? I don't want that!</a></span></dt></dl></dd><dt><span class="section"><a href="#id306019">Using DNS Names</a></span></dt><dd><dl><dt><span class="section"><a href="#faq79">(FAQ 79) Can I use DNS names in Shorewall configuration file
      entries in place of IP addresses?</a></span></dt></dl></dd><dt><span class="section"><a href="#TC">Traffic Shaping</a></span></dt><dd><dl><dt><span class="section"><a href="#faq67">(FAQ 67) I just configured Shorewall's builtin traffic shaping
      and now Shorewall fails to Start.</a></span></dt></dl></dd><dt><span class="section"><a href="#About">About Shorewall</a></span></dt><dd><dl><dt><span class="section"><a href="#faq10">(FAQ 10) What Distributions does Shorewall work with?</a></span></dt><dt><span class="section"><a href="#faq11">(FAQ 11) What Features does Shorewall have?</a></span></dt><dt><span class="section"><a href="#faq12">(FAQ 12) Is there a GUI?</a></span></dt><dt><span class="section"><a href="#faq13">(FAQ 13) Why do you call it “<span class="quote">Shorewall</span>”?</a></span></dt><dt><span class="section"><a href="#faq23">(FAQ 23) Why do you use such ugly fonts on your web site?</a></span></dt><dt><span class="section"><a href="#faq25">(FAQ 25) How do I tell which version of Shorewall or Shorewall
      Lite I am running?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq25a">(FAQ 25a) How do I tell which version of Shorewall-perl and
        Shorewall-shell that I have installed?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq31">(FAQ 31) Does Shorewall provide protection against....</a></span></dt><dt><span class="section"><a href="#faq65">(FAQ 65) How do I accomplish failover with Shorewall?</a></span></dt></dl></dd><dt><span class="section"><a href="#RFC1918">RFC 1918</a></span></dt><dd><dl><dt><span class="section"><a href="#faq14">(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.</a></span></dt><dd><dl><dt><span class="section"><a href="#faq14a">(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.</a></span></dt><dt><span class="section"><a href="#faq14b">(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.</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#ALIASES">Alias IP Addresses/Virtual Interfaces</a></span></dt><dd><dl><dt><span class="section"><a href="#faq18">(FAQ 18) Is there any way to use aliased ip addresses with
      Shorewall, and maintain separate rule sets for different IPs?</a></span></dt></dl></dd><dt><span class="section"><a href="#Lite">Shorewall Lite</a></span></dt><dd><dl><dt><span class="section"><a href="#faq53">(FAQ 53) What is Shorewall Lite?</a></span></dt><dt><span class="section"><a href="#faq54">(FAQ 54) If I want to use Shorewall Lite, do I also need to
      install Shorewall on the same system?</a></span></dt><dt><span class="section"><a href="#faq55">(FAQ 55) How do I decide which product to use - Shorewall or
      Shorewall Lite?</a></span></dt><dt><span class="section"><a href="#faq60">(FAQ 60) What are the compatibility restrictions between
      Shorewall and Shorewall Lite</a></span></dt></dl></dd><dt><span class="section"><a href="#Perl">Shorewall-Perl</a></span></dt><dd><dl><dt><span class="section"><a href="#faq70">(FAQ 70) What is Shorewall-Perl?</a></span></dt><dt><span class="section"><a href="#faq71">(FAQ 71) What are the advantages of using Shorewall-perl?</a></span></dt><dt><span class="section"><a href="#faq72">(FAQ 72) Can I switch to using Shorewall-perl without changing my
      Shorewall configuration?</a></span></dt></dl></dd><dt><span class="section"><a href="#VOIP">VOIP</a></span></dt><dd><dl><dt><span class="section"><a href="#faq77">(FAQ 77) Shorewall is eating my Asterisk egress traffic!</a></span></dt></dl></dd><dt><span class="section"><a href="#Misc">Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#faq20">(FAQ 20) I have just set up a server. Do I have to change
      Shorewall to allow access to my server from the Internet?</a></span></dt><dt><span class="section"><a href="#faq24">(FAQ 24) How can I allow connections to, let's say, the ssh port
      only from specific IP Addresses on the Internet?</a></span></dt><dt><span class="section"><a href="#faq26">(FAQ 26) When I try to use any of the SYN options in nmap on or
      behind the firewall, I get “<span class="quote">operation not permitted</span>”. How
      can I use nmap with Shorewall?"</a></span></dt><dt><span class="section"><a href="#faq27">(FAQ 27) I'm compiling a new kernel for my firewall. What should
      I look out for?</a></span></dt><dd><dl><dt><span class="section"><a href="#faq27a">(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.</a></span></dt></dl></dd><dt><span class="section"><a href="#faq28">(FAQ 28) How do I use Shorewall as a Bridging Firewall?</a></span></dt><dt><span class="section"><a href="#faq39">(FAQ 39) How do I block connections to a particular domain
      name?</a></span></dt><dt><span class="section"><a href="#faq42">(FAQ 42) How can I tell which features my kernel and iptables
      support?</a></span></dt><dt><span class="section"><a href="#faq19">(FAQ 19) How do I open the firewall for all traffic to/from the
      LAN?</a></span></dt></dl></dd></dl></div><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p><span class="bold"><strong>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.</strong></span></p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Install"></a>Installing Shorewall</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="Howto"></a>Where do I find Step by Step Installation and Configuration
      Instructions?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Check out the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">QuickStart Guides</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq37"></a>(FAQ 37) I just installed Shorewall on Debian and the
      /etc/shorewall directory is almost empty!!!</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span></p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Once you have installed the .deb package and before you attempt
        to configure Shorewall, please heed the advice of Lorenzo Martignoni,
        former Shorewall Debian Maintainer:</p><p>“<span class="quote">For more information about Shorewall usage on Debian
        system please look at /usr/share/doc/shorewall-common/README.Debian
        provided by [the] shorewall-common Debian package.</span>”</p></div><p>If you install using the .deb, you will find that your <code class="filename">/etc/shorewall</code> directory is almost empty.
      This is intentional. The released configuration file skeletons may be
      found on your system in the directory <code class="filename">/usr/share/doc/shorewall-common/default-config</code>.
      Simply copy the files you need from that directory to <code class="filename">/etc/shorewall</code> and modify the
      copies.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq37a"></a>(FAQ 37a) I just installed Shorewall on Debian and I can't find
        the sample configurations.</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> With Shorewall 3.x, the
        samples are included in the shorewall documentation package and are
        installed in <code class="filename">/usr/share/doc/shorewall/examples/</code>.
        Beginning with Shorewall 4.0, the samples are in the shorewall-common
        package and are installed in <code class="filename">/usr/share/doc/shorewall-common/examples/</code>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq75"></a>(FAQ 75) I can't find the Shorewall 4.x shorewall-common RPM.
      Where is it?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> If you use Simon Matter's
      Redhat/Fedora/CentOS rpms, be aware that Simon calls the
      <span class="emphasis"><em>shorewall-common</em></span> RPM
      <span class="emphasis"><em>shorewall</em></span>. So you should download and install the
      appropriate <span class="emphasis"><em>shorewall-4.x.y</em></span> RPM from his
      site.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Upgrading"></a>Upgrading Shorewall</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq66"></a>(FAQ 66) I'm trying to upgrade to Shorewall 4.x; where is the
      'shorewall' package?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Please see the <a class="ulink" href="upgrade_issues.htm" target="_self">upgrade issues.</a></p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq66a"></a>(FAQ 66a) I'm trying to upgrade to Shorewall 4.x; do I have to
        uninstall the 'shorewall' package?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Please see the <a class="ulink" href="upgrade_issues.htm" target="_self">upgrade issues.</a></p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq66b"></a>(FAQ 66b) I'm trying to upgrade to Shorewall 4.x: which of
        these packages do I need to install?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Please see the <a class="ulink" href="upgrade_issues.htm" target="_self">upgrade issues.</a></p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq76"></a>(FAQ 76) I just upgraded my Debian (Ubuntu, Kubuntu, ...) system
      and now masquerading doesn't work? What happened?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> This happens to people
      who ignore <a class="ulink" href="Install.htm#Upgrade_Deb" target="_self">our advice</a> and
      allow the installer to replace their working
      <code class="filename">/etc/shorewall/shorewall.conf</code> with one that has
      default settings. Failure to forward traffic (such as during masqueraded
      net access from a local network) usually means that <code class="filename"><a class="ulink" href="manpages/shorewall.conf.html" target="_self">/etc/shorewall/shorewall.conf</a></code>
      contains the Debian default setting IP_FORWARDING=Keep; it should be
      IP_FORWARDING=On.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="PortForwarding"></a>Port Forwarding (Port Redirection)</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq1"></a>(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.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The format of a
      port-forwarding rule to a local system is as follows:</p><pre class="programlisting">#ACTION    SOURCE      DEST                                   PROTO        DEST PORT
DNAT       net         loc:<span class="emphasis"><em>local-IP-address</em></span>[:<span class="emphasis"><em>local-port</em></span>]      <span class="emphasis"><em>protocol</em></span>     <span class="emphasis"><em>port-number</em></span></pre><p>So to forward UDP port 7777 to internal system 192.168.1.5, the
      rule is:</p><pre class="programlisting">#ACTION    SOURCE   DEST             PROTO    DEST PORT
DNAT       net      loc:192.168.1.5  udp      7777</pre><p>If you want to forward requests directed to a particular address (
      <span class="emphasis"><em>external-IP</em></span> ) on your firewall to an internal
      system:</p><pre class="programlisting">#ACTION SOURCE DEST                                   PROTO       DEST PORT     SOURCE  ORIGINAL
#                                                                               PORT    DEST.
DNAT    net    loc:<span class="emphasis"><em>local-IP-address</em></span>&gt;[:<span class="emphasis"><em>local-port</em></span>]     <span class="emphasis"><em>protocol</em></span>    <span class="emphasis"><em>port-number</em></span>   -       <span class="emphasis"><em>external-IP</em></span></pre><p>If you want to forward requests from a particular Internet address
      ( <span class="emphasis"><em>address</em></span> ):</p><pre class="programlisting">#ACTION SOURCE        DEST                                   PROTO       DEST PORT     SOURCE  ORIGINAL
#                                                                                      PORT    DEST.
DNAT    net:<span class="emphasis"><em>address</em></span>   loc:<span class="emphasis"><em>local-IP-address</em></span>[:<span class="emphasis"><em>local-port</em></span>]  <span class="emphasis"><em>    protocol</em></span>    <span class="emphasis"><em>port-number</em></span>   -</pre><p>Finally, if you need to forward a range of ports, in the DEST PORT
      column specify the range as
      <span class="emphasis"><em>low-port:high-port</em></span>.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1a"></a>(FAQ 1a) Okay -- I followed those instructions but it doesn't
        work</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> That is usually the
        result of one of four things:</p><div class="itemizedlist"><ul type="disc"><li><p>You are trying to test from inside your firewall (no, that
            won't work -- see <a class="xref" href="#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.">the section called “(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.”</a>).</p></li><li><p>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 must be set to the IP address of your
            firewall's internal interface; if that isn't possible for some
            reason, see <a class="link" href="#faq1f" title="(FAQ 1f) Why must the server that I port forward to have it's default gateway set to my Shorewall system's IP address?">FAQ 1f</a>).</p></li><li><p>Your ISP is blocking that particular port inbound or, for
            TCP, your ISP is dropping the outbound SYN,ACK response.</p></li><li><p>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 <a class="ulink" href="two-interface.htm" target="_self">two-interface QuickStart Guide</a> for
            details.</p></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1b"></a>(FAQ 1b) I'm still having problems with port forwarding</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> To further diagnose
        this problem:</p><div class="itemizedlist"><ul type="disc"><li><p>As root, type “<span class="quote"> <span class="command"><strong>shorewall reset</strong></span>
            </span>” ("<span class="command"><strong>shorewall-lite reset</strong></span>", if you are
            running Shorewall Lite). This clears all Netfilter
            counters.</p></li><li><p>Try to connect to the redirected port from an external
            host.</p></li><li><p>As root type “<span class="quote"> <span class="command"><strong>shorewall show nat</strong></span>
            </span>” ("<span class="command"><strong>shorewall-lite show nat</strong></span>", if you are
            running Shorewall Lite).</p></li><li><p>Locate the appropriate DNAT rule. It will be in a chain
            called <span class="emphasis"><em>&lt;source zone&gt;</em></span>_dnat
            (“<span class="quote">net_dnat</span>” in the above examples).</p></li><li><p>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).</p></li><li><p>If the packet count is zero:</p><div class="itemizedlist"><ul type="circle"><li><p>the connection request is not reaching your server
                (possibly it is being blocked by your ISP); or</p></li><li><p>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
                “<span class="quote">ORIG. DEST.</span>” column in your DNAT rule);
                or</p></li><li><p>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.</p></li></ul></div></li><li><p>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 prompt, type "<span class="command"><strong>shorewall show zones</strong></span>"
            ("<span class="command"><strong>shorewall-lite show zones</strong></span>") then be sure that
            in the DEST column you have specified the <span class="bold"><strong>first</strong></span> zone in the list that matches
            OUT=&lt;dev&gt; and DEST= &lt;ip&gt;from the REJECT/DROP log
            message.</p></li><li><p>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.</p></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1c"></a>(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?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span>In
        /<code class="filename">etc/shorewall/rules</code>:</p><pre class="programlisting">#ACTION    SOURCE   DEST                PROTO    DEST PORT
DNAT       net      loc:192.168.1.3:22  tcp      1022</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1d"></a>(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.</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> See <a class="link" href="#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.">FAQ 2b</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1e"></a>(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?</h4></div></div></div><p><span class="bold"><strong>Answer </strong></span>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.</p><pre class="programlisting">#ACTION SOURCE  DEST                    PROTO   DEST PORT(S)
DNAT    net     fw:192.168.1.1:22       tcp     4104</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1f"></a>(FAQ 1f) Why must the server that I port forward to have it's
        default gateway set to my Shorewall system's IP address?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Let's take an example.
        Suppose that</p><div class="itemizedlist"><ul type="disc"><li><p>Your Shorewall firewall's external IP address is
            206.124.146.176 (eth0) and its internal IP address is 192.168.1.1
            (eth1).</p></li><li><p>You have another gateway router with external IP address
            130.252.100.109 and internal IP address 192.168.1.254.</p></li><li><p>You have an FTP server behind both routers with IP address
            192.168.1.4</p></li><li><p>The FTP server's default gateway is through the second
            router (192.168.1.254).</p></li><li><p>You have this rule on the Shorewall system:</p><pre class="programlisting">#ACTION    SOURCE        DEST               PROTO    DEST PORT   SOURCE    ORIGINAL
#                                                                PORT      DEST.
DNAT       net           loc:192.168.1.4    tcp      21          -         206.124.146.176</pre></li><li><p>Internet host 16.105.221.4 issues the command <span class="command"><strong>ftp
            206.124.146.176</strong></span></p></li></ul></div><p>This results in the following set of events:</p><div class="orderedlist"><ol type="1"><li><p>16.105.221.4 sends a TCP SYN packet to 206.124.146.176
            specifying destination port 21.</p></li><li><p>The Shorewall box rewrites the destination IP address to
            192.168.1.4 and forwards the packet.</p></li><li><p>The FTP server receives the packet and accepts the
            connection, generating a SYN,ACK packet back to 16.105.221.4.
            Because the server's default gateway is through the second router,
            it sends the packet to that router.</p></li></ol></div><p>At this point, one of two things can happen. Either the second
        router discards or rejects the packet; or, it rewrites the source IP
        address to 130.252.100.109 and forwards the packet back to
        16.105.221.4. Regardless of which happens, the connection is doomed.
        Clearly if the packet is rejected or dropped, the connection will not
        be successful. But even if the packet reaches 16.105.221.4, that host
        will reject it since it's SOURCE IP address (130.252.100.109) doesn't
        match the DESTINATION IP ADDRESS (206.124.146.176) of the original SYN
        packet.</p><p>The best way to work around this problem is to change the
        default gateway on the FTP server to the Shorewall system's internal
        IP address (192.168.1.1). But if that isn't possible, you can work
        around the problem with the following ugly hack in
        <code class="filename">/etc/shorewall/masq</code>:</p><pre class="programlisting">#INTERFACE              SOURCE             ADDRESS            PROTO         PORT
eth1:192.168.1.4        0.0.0.0/0          192.168.1.1        tcp           21</pre><p>This rule has the undesirable side effect that it makes all FTP
        connections from the net appear to the FTP server as if they
        originated on the Shorewall system. But it will force the FTP server
        to reply back through the Shorewall system who can then rewrite the
        SOURCE IP address in the responses properly.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq1g"></a>(FAQ 1g) I would like to redirect port 80 on my public IP
        address (206.124.146.176) to port 993 on Internet host
        66.249.93.111</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> This requires a vile
        hack similar to the one in <a class="link" href="#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.">FAQ 2</a>. Assuming
        that your Internet zone is named <span class="emphasis"><em>net</em></span> and connects
        on interface <code class="filename">eth0</code>:</p><p>In <code class="filename">/etc/shorewall/rules</code>:</p><pre class="programlisting">#ACTION    SOURCE        DEST                   PROTO    DEST PORT   SOURCE    ORIGINAL
#                                                                    PORT      DEST.
DNAT       net           net:66.249.93.111:993  tcp      80          -         206.124.146.176</pre><p>In <code class="filename">/etc/shorewall/interfaces</code>, specify the
        <span class="bold"><strong>routeback</strong></span> option on
        eth0:</p><pre class="programlisting">#ZONE      INTERFACE     BROADCAST            OPTIONS
net        eth0          detect               <span class="bold"><strong>routeback</strong></span></pre><p>And in <code class="filename">/etc/shorewall/masq</code>;</p><pre class="programlisting">#INTERFACE          SOURCE      ADDRESS          PROTO        PORT
eth0:66.249.93.111  0.0.0.0/0   206.124.146.176  tcp          993</pre><p>Like the hack in FAQ 2, this one results in all forwarded
        connections looking to the server (66.249.93.11) as if they originated
        on your firewall (206.124.146.176).</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq30"></a>(FAQ 30) I'm confused about when to use DNAT rules and when to
      use ACCEPT rules.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> It would be a good idea
      to review the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">QuickStart
      Guide</a> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq38"></a>(FAQ 38) Where can I find more information about DNAT?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Ian Allen has written a
      <a class="ulink" href="http://ian.idallen.ca/dnat.txt" target="_self">Paper about DNAT and
      Linux</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq48"></a>(FAQ 48) How do I Set up Transparent HTTP Proxy with
      Shorewall?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> See <a class="ulink" href="Shorewall_Squid_Usage.html" target="_self">Shorewall_Squid_Usage.html</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="DNS-DNAT"></a>DNS and Port Forwarding/NAT</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq2"></a>(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.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> I have two objections to
      this setup.</p><div class="itemizedlist"><ul type="disc"><li><p>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 :-)</p></li><li><p>The accessibility problem is best solved using
          <em class="firstterm">Split DNS</em> (either <a class="ulink" href="SplitDNS.html" target="_self">use a separate DNS server</a> for local
          clients or use <a class="ulink" href="shorewall_setup_guide.htm#DNS" target="_self">Bind
          Version 9 “<span class="quote">views</span>”</a> on your main name server)
          such that www.mydomain.com resolves to 130.141.100.69 externally and
          192.168.1.5 internally. That's what I do here at shorewall.net for
          my local systems that use one-to-one NAT.</p></li></ul></div><p>So the best and most secure way to solve this problem is to move
      your Internet-accessible server(s) to a separate LAN segment with it's
      own interface to your firewall and follow <a class="link" href="#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.">FAQ
      2b</a>. That way, your local systems are still safe if your server
      gets hacked and you don't have to run a split DNS configuration
      (separate server or Bind 9 views).</p><p>If physical limitations make it impractical to segregate your
      servers on a separate LAN, the next best solution it to use Split DNS.
      Before you complain "It's too hard to set up split DNS!", <a class="ulink" href="SplitDNS.html" target="_self"><span class="bold"><strong>check
      here</strong></span></a>.</p><p>But if you are the type of person who prefers quick and dirty
      hacks to "doing it right", then proceed as described below.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>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.</p></div><p>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:</p><div class="itemizedlist"><ul type="disc"><li><p>In <code class="filename">/etc/shorewall/interfaces</code>:</p><pre class="programlisting">#ZONE    INTERFACE    BROADCAST    OPTIONS
loc      eth1         detect       <span class="bold"><strong>routeback</strong></span>    </pre></li><li><p>In <code class="filename">/etc/shorewall/masq</code>:</p><pre class="programlisting">#INTERFACE              SOURCE          ADDRESS         PROTO   PORT(S)
<span class="bold"><strong>eth1:192.168.1.5        eth1            192.168.1.254   tcp     www</strong></span></pre></li><li><p>In <code class="filename">/etc/shorewall/rules</code>:</p><pre class="programlisting">#ACTION    SOURCE       DEST               PROTO    DEST PORT   SOURCE    ORIGINAL
#                                                               PORT      DEST.
<span class="bold"><strong>DNAT       loc          loc:192.168.1.5    tcp      www         -         130.151.100.69</strong></span></pre><p>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
          <code class="filename">/etc/shorewall/params</code> (or your
          <code class="filename">&lt;export directory&gt;/init</code> file if you are
          using Shorewall Lite on the firewall system):</p><pre class="programlisting"><span class="command"><strong>ETH0_IP=`find_first_interface_address eth0`</strong></span>        </pre><p>and make your DNAT rule:</p><pre class="programlisting">#ACTION    SOURCE        DEST               PROTO    DEST PORT   SOURCE    ORIGINAL
#                                                                PORT      DEST.
DNAT       loc           loc:192.168.1.5    tcp      www         -         <span class="bold"><strong>$ETH0_IP</strong></span></pre><p>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.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you are running Shorewall 3.2.6 on a Debian-based
              system, the call to
              <span class="command"><strong>find_first_interface_address</strong></span> in
              <code class="filename">/etc/shorewall/params</code> must be preceded with
              a load of the Shorewall function library:</p><pre class="programlisting"><span class="command"><strong>. /usr/share/shorewall/functions</strong></span>
<span class="command"><strong>ETH0_IP=`find_first_interface_address eth0`</strong></span></pre></div></li></ul></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq2a"></a>(FAQ 2a) I have a zone “<span class="quote">Z</span>” 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.</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the ALL INTERFACES column in /etc/shorewall/nat is empty or
          contains “<span class="quote">Yes</span>”, 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 host's public address:</p><pre class="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</pre></div><p><span class="bold"><strong>Answer:</strong></span> This is another problem
        that is best solved using split DNS. It allows both external and
        internal clients to access a NATed host using the host's DNS
        name.</p><p>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.</p><p>If you don't like those solutions and prefer, incredibly, to
        route all Z-&gt;Z traffic through your firewall then:</p><div class="orderedlist"><ol type="1"><li><p>Set the routeback option on the interface to Z.</p></li><li><p>Set the ALL INTERFACES column in the nat file to
            “<span class="quote">Yes</span>”.</p></li></ol></div><div class="example"><a id="Example1"></a><p class="title"><b>Example 1. Example:</b></p><div class="example-contents"><div class="literallayout"><p>Zone: dmz, Interface: eth2, Subnet: 192.168.2.0/24, Address: 192.168.2.254</p></div><p>In <code class="filename">/etc/shorewall/interfaces</code>:</p><pre class="programlisting">#ZONE    INTERFACE    BROADCAST       OPTIONS
dmz      eth2         192.168.2.255   <span class="bold"><strong>routeback</strong></span> </pre><p>In <code class="filename">/etc/shorewall/nat</code>, be sure that you
          have “<span class="quote">Yes</span>” in the ALL INTERFACES column.</p><p>In /etc/shorewall/masq:</p><pre class="programlisting">#INTERFACE    SOURCE      ADDRESS
<span class="bold"><strong>eth2          eth2        192.168.2.254</strong></span></pre><p>Like the silly hack in FAQ 2 above, this will make all
          dmz-&gt;dmz traffic appear to originate on the firewall.</p></div></div><br class="example-break" /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq2b"></a>(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.</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Let's assume the
        following:</p><div class="itemizedlist"><ul type="disc"><li><p>External IP address is 206.124.146.176 on <code class="filename">eth0</code> (www.mydomain.com).</p></li><li><p>Server's IP address is 192.168.2.4</p></li></ul></div><p>You can enable access to the server from your local network
        using the firewall's external IP address by adding this rule:</p><pre class="programlisting">#ACTION    SOURCE   DEST                PROTO    DEST PORT(S)    SOURCE      ORIGINAL
#                                                                PORT        DEST                 
<span class="bold"><strong>DNAT       loc      dmz:192.168.2.4     tcp      80              -           206.124.146.176</strong></span></pre><p>If your external IP address is dynamic, then you must do the
        following:</p><p>In <code class="filename">/etc/shorewall/params</code> (or in your
        <code class="filename">&lt;export directory&gt;/init</code> file if you are
        using Shorewall Lite on the firewall system):</p><pre class="programlisting"><span class="command"><strong>ETH0_IP=`find_first_interface_address eth0`</strong></span>  </pre><p>and make your DNAT rule:</p><pre class="programlisting">#ACTION    SOURCE        DEST               PROTO    DEST PORT   SOURCE    ORIGINAL
#                                                                PORT      DEST.
DNAT       loc           dmz:192.168.2.4    tcp      80          -         <span class="bold"><strong>$ETH0_IP</strong></span></pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>With dynamic IP addresses, you probably don't want to use
          <a class="ulink" href="starting_and_stopping_shorewall.htm" target="_self"><span class="command"><strong>shorewall[-lite]
          save</strong></span> and <span class="command"><strong>shorewall[-lite]
          restore</strong></span></a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you are running Shorewall 3.2.6 on a Debian-based system,
          the call to <span class="command"><strong>find_first_interface_address</strong></span> in
          <code class="filename">/etc/shorewall/params</code> must be preceded with a
          load of the Shorewall function library:</p><pre class="programlisting"><span class="command"><strong>. /usr/share/shorewall/functions</strong></span>
<span class="command"><strong>ETH0_IP=`find_first_interface_address eth0`</strong></span></pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq2c"></a>(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?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Did you set <span class="bold"><strong>IP_FORWARDING=On</strong></span> in
        <code class="filename">shorewall.conf</code>?</p></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Blacklisting"></a>Blacklisting</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq63"></a>(FAQ 63) I just blacklisted IP address 206.124.146.176 and I can
      still ping it. What did I do wrong?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Nothing.</p><p>Blacklisting an IP address blocks incoming traffic from that IP
      address. And if you set BLACKLISTNEWONLY=Yes in
      <code class="filename">shorewall.conf</code>, then only new connections <span class="bold"><strong>from</strong></span> that address are disallowed; traffic from
      that address that is part of an established connection (such as ping
      replies) is allowed.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="MSN"></a>Netmeeting/MSN</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq3"></a>(FAQ 3) I want to use Netmeeting or MSN Instant Messenger with
      Shorewall. What do I do?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> There is an <a class="ulink" href="http://www.kfki.hu/~kadlec/sw/netfilter/newnat-suite/" target="_self">H.323
      connection tracking/NAT module</a> that helps with Netmeeting. Note
      however that one of the Netfilter developers recently posted the
      following:</p><div class="blockquote"><blockquote class="blockquote"><pre class="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; conntrack 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.</pre></blockquote></div><p>Look <a class="ulink" href="UPnP.html" target="_self">here</a> 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 <a class="ulink" href="http://www.netfilter.org" target="_self">http://www.netfilter.org</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Openports"></a>Open Ports</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq51"></a>(FAQ 51) How do I Open Ports in Shorewall?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> No one who has installed
      Shorewall using one of the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">Quick Start Guides</a> should
      have to ask this question.</p><p>Regardless of which guide you used, all outbound communication is
      open by default. So you do not need to 'open ports' for output.</p><p>For input:</p><div class="itemizedlist"><ul type="disc"><li><p>If you installed using the Standalone Guide, then please
          <a class="ulink" href="standalone.htm#Open" target="_self">re-read this
          section</a>.</p></li><li><p>If you installed using the Two-interface Guide, then please
          re-read these sections: <a class="ulink" href="two-interface.htm#DNAT" target="_self">Port
          Forwarding (DNAT)</a>, and <a class="ulink" href="two-interface.htm#Open" target="_self">Other Connections</a></p></li><li><p>If you installed using the Three-interface Guide, then please
          re-read these sections: <a class="ulink" href="three-interface.htm#DNAT" target="_self">Port
          Forwarding (DNAT)</a> and <a class="ulink" href="three-interface.htm#Open" target="_self">Other Connections</a></p></li><li><p>If you installed using the <a class="ulink" href="shorewall_setup_guide.htm" target="_self">Shorewall Setup Guide</a> then
          you had better read the guide again -- you clearly missed a
          lot.</p></li></ul></div><p>Also please see the <a class="link" href="#PortForwarding" title="Port Forwarding (Port Redirection)">Port Forwarding
      section of this FAQ</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq4"></a>(FAQ 4) I just used an online port scanner to check my firewall
      and it shows some ports as “<span class="quote">closed</span>” rather than
      “<span class="quote">blocked</span>”. Why?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The default Shorewall
      setup invokes the <span class="bold"><strong>Drop</strong></span> action prior to
      enforcing a DROP policy and the default policy to all zones from the
      Internet is DROP. The Drop action is defined in
      <code class="filename">/usr/share/shorewall/action.Drop</code> which in turn
      invokes the <span class="bold"><strong>Auth</strong></span> macro (defined in
      <code class="filename">/usr/share/shorewall/macro.Auth</code>) specifying the
      <span class="bold"><strong>REJECT</strong></span> action (i.e., <span class="bold"><strong>Auth/REJECT</strong></span>). This is necessary to prevent
      outgoing connection problems to services that use the
      “<span class="quote">Auth</span>” mechanism for identifying requesting users. That is
      the only service which the default setup rejects.</p><p>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.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq4a"></a>(FAQ 4a) I just ran an nmap UDP scan of my firewall and it
        showed 100s of ports as open!!!!</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Take a deep breath and
        read the nmap man page section about UDP scans. If nmap gets <span class="bold"><strong>nothing</strong></span> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq4b"></a>(FAQ 4b) I have a port that I can't close no matter how I
        change my rules.</h4></div></div></div><p>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!!!</p><p><span class="bold"><strong>Answer:</strong></span> 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 firewall will block that attempt.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq4c"></a>(FAQ 4c) How do I use Shorewall with PortSentry?</h4></div></div></div><p><a class="ulink" href="http://www.shorewall.net/pub/shorewall/contrib/PortsentryHOWTO.txt" target="_self"><span class="bold"><strong>Answer:</strong></span> Here's a writeup</a> describing a
        nice integration of Shorewall and PortSentry.</p></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Connections"></a>Connection Problems</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="pseudofaq17"></a>Why are these packets being Dropped/Rejected? How do I decode
      Shorewall log messages?</h3></div></div></div><p>Please see <a class="link" href="#faq17" title="(FAQ 17) Why are these packets being Dropped/Rejected? How do I decode Shorewall log messages?">FAQ 17</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq5"></a>(FAQ 5) I've installed Shorewall and now I can't ping through the
      firewall</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> For a complete
      description of Shorewall “<span class="quote">ping</span>” management, see <a class="ulink" href="ping.html" target="_self">this page</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq15"></a>(FAQ 15) My local systems can't see out to the net</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Every time I read
      “<span class="quote">systems can't see out to the net</span>”, I wonder where the
      poster bought computers with eyes and what those computers will
      “<span class="quote">see</span>” when things are working properly. That aside, the
      most common causes of this problem are:</p><div class="orderedlist"><ol type="1"><li><p>The default gateway on each local system isn't set to the IP
          address of the local firewall interface.</p></li><li><p>The entry for the local network in the
          <code class="filename">/etc/shorewall/masq</code> file is wrong or
          missing.</p></li><li><p>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.</p></li><li><p>Forwarding is not enabled (This is often the problem for
          Debian users). Enter this command:</p><pre class="programlisting">cat /proc/sys/net/ipv4/ip_forward</pre><p>If the value displayed is 0 (zero) then set <span class="bold"><strong>IP_FORWARDING=On</strong></span> in
          <code class="filename">/etc/shorewall/shorewall.conf</code> and restart
          Shorewall.</p></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq29"></a>(FAQ 29) FTP Doesn't Work</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> See the <a class="ulink" href="FTP.html" target="_self">Shorewall and FTP page</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq33"></a>(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.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Most likely, you need to
      set CLAMPMSS=Yes in <code class="filename"><a class="ulink" href="manpages/shorewall.conf.html" target="_self">/etc/shorewall/shorewall.conf</a></code>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq35"></a>(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 <code class="filename">/etc/shorewall/interfaces</code>; the
      bridged Ethernet interfaces are not defined to Shorewall. How do I tell
      Shorewall to allow traffic through the bridge?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Add the
      <em class="firstterm">routeback</em> option to <code class="filename">br0</code> in <code class="filename"><a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">/etc/shorewall/interfaces</a></code>.</p><p>For more information on this type of configuration, see the <a class="ulink" href="SimpleBridge.html" target="_self">Shorewall Simple Bridge
      documentation</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq64"></a>(FAQ 64) I just upgraded my kernel to 2.6.20 and my
      bridge/firewall stopped working. What is wrong?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> In kernel 2.6.20, the
      Netfilter <em class="firstterm">physdev match</em> 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:</p><pre class="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.</pre><p>This kernel change, while necessary, means that Shorewall zones
      may no longer be defined in terms of bridge ports. See <a class="ulink" href="bridge-Shorewall-perl.html" target="_self">the new Shorewall-shell bridging
      documentation</a> for information about configuring a
      bridge/firewall under kernel 2.6.20 and later with Shorewall shell or
      the<a class="ulink" href="bridge-Shorewall-perl.html" target="_self"> Shorewall-perl bridging
      documentation</a> if you use Shorewall-perl
      (highly-recommended).</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Following the instructions in the new bridging documentation
          will not prevent the above message from being issued.</p></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Logging"></a>Logging</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq6"></a>(FAQ 6) Where are the log messages written and how do I change
      the destination?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> NetFilter uses the
      kernel's equivalent of syslog (see “<span class="quote">man syslog</span>”) to log
      messages. It always uses the LOG_KERN (kern) facility (see “<span class="quote">man
      openlog</span>”) and you get to choose the log level (again, see
      “<span class="quote">man syslog</span>”) in your <code class="filename"><a class="ulink" href="manpages/shorewall-policy.html" target="_self">policies</a></code> and
      <code class="filename"><a class="ulink" href="manpages/shorewall-rules.html" target="_self">rules</a></code>. The
      destination for messages logged by syslog is controlled by
      <code class="filename">/etc/syslog.conf</code> (see “<span class="quote">man
      syslog.conf</span>”). When you have changed
      <code class="filename">/etc/syslog.conf</code>, be sure to restart syslogd (on a
      RedHat system, “<span class="quote">service syslog restart</span>”).</p><p>By default, older versions of Shorewall rate-limited log messages
      through <a class="ulink" href="manpages/shorewall.conf.html" target="_self">settings</a> in
      <code class="filename">/etc/shorewall/shorewall.conf</code> -- If you want to log
      all messages, set:</p><pre class="programlisting">LOGLIMIT=""
LOGBURST=""</pre><p>It is also possible to <a class="ulink" href="shorewall_logging.html" target="_self">set up
      Shorewall to log all of its messages to a separate file</a>.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq6a"></a>(FAQ 6a) Are there any log parsers that work with
        Shorewall?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Here are several links
        that may be helpful:</p><div class="literallayout"><p><br />
          <a class="ulink" href="http://www.shorewall.net/pub/shorewall/parsefw/" target="_self">http://www.shorewall.net/pub/shorewall/parsefw/</a><br />
          <a class="ulink" href="http://aaron.marasco.com/linux.html" target="_self">http://aaron.marasco.com/linux.html</a><br />
          <a class="ulink" href="http://cert.uni-stuttgart.de/projects/fwlogwatch" target="_self">http://cert.uni-stuttgart.de/projects/fwlogwatch</a><br />
          <a class="ulink" href="http://www.logwatch.org" target="_self">http://www.logwatch.org</a><br />
        </p></div><p>I personally use <a class="ulink" href="http://www.logwatch.org" target="_self">Logwatch</a>. 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:</p><div class="blockquote"><blockquote class="blockquote"><pre class="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 -------------------------</pre></blockquote></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq6b"></a>(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?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Temporarily add the
        following rule:</p><pre class="programlisting">#ACTION   SOURCE    DEST    PROTO    DEST PORT(S)
DROP      net       fw      udp      10619</pre><p>Alternatively, if you do not set BLACKLIST_LOGLEVEL and you have
        specifed the 'blacklist' option on your external interface in
        <code class="filename">/etc/shorewall/interfaces</code>, then you can blacklist
        the port. In <code class="filename">/etc/shorewall/blacklist</code>:</p><pre class="programlisting">#ADDRESS/SUBNET         PROTOCOL        PORT
-                       udp             10619</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq6d"></a>(FAQ 6d) Why is the MAC address in Shorewall log messages so
        long? I thought MAC addresses were only 6 bytes in length.</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> What is labeled as the
        MAC address in a Netfilter (Shorewall) log message is actually the
        Ethernet frame header. It contains:</p><div class="itemizedlist"><ul type="disc"><li><p>the destination MAC address (6 bytes)</p></li><li><p>the source MAC address (6 bytes)</p></li><li><p>the Ethernet frame type (2 bytes)</p></li></ul></div><div class="example"><a id="Example5"></a><p class="title"><b>Example 2. Example</b></p><div class="example-contents"><pre class="programlisting">MAC=00:04:4c:dc:e2:28:00:b0:8e:cf:3c:4c:08:00</pre><p>
            </p><div class="itemizedlist"><ul type="disc"><li><p>Destination MAC address = 00:04:4c:dc:e2:28</p></li><li><p>Source MAC address = 00:b0:8e:cf:3c:4c</p></li><li><p>Ethernet Frame Type = 08:00 (IP Version 4)</p></li></ul></div></div></div><p><br class="example-break" /></p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq16"></a>(FAQ 16) Shorewall is writing log messages all over my console
      making it unusable!</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span></p><p>Just to be clear, it is not Shorewall that is writing all over
      your console. Shorewall issues a single log message during each
      <span class="command"><strong>start</strong></span>, <span class="command"><strong>restart</strong></span>,
      <span class="command"><strong>stop</strong></span>, 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 <a class="ulink" href="shorewall_logging.html" target="_self">Shorewall logging
      documentation</a>.</p><p>The max log level to be sent to the console is available in
      /proc/sys/kernel/printk:</p><pre class="programlisting">teastep@ursa:~$ <span class="bold"><strong>cat /proc/sys/kernel/printk</strong></span>
6      6       1       7
teastep@ursa:~$ </pre><p>The first number determines the maximum log
      level (syslog priority) sent to the console. Messages with priority
      <span class="bold"><strong>less than</strong></span> this number are sent to the
      console. On the system shown in the example above, priorities 0-5 are
      sent to the console. Since Shorewall defaults to using 'info' (6), the
      Shorewall-generated Netfilter rule set will generate log messages that
      <span class="bold"><strong>will not appear on the console.</strong></span></p><p>The second number is the default log level for kernel printk()
      calls that do not specify a log level.</p><p>The third number specifies the minimum console log level while the
      fourth gives the default console log level.</p><p>If, on your system, the first number is 7 or greater, then the
      default Shorewall configurations will cause messages to be written to
      your console. The simplest solution is to add this to your
      <code class="filename">/etc/sysctl.conf</code> file:</p><pre class="programlisting">kernel.printk = 4 4 1 7</pre><p>then</p><pre class="programlisting"><span class="command"><strong>sysctl -p /etc/sysctl.conf</strong></span></pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq16a"></a>(FAQ 16a) Why can't I see any Shorewall messages in
        /var/log/messages?</h4></div></div></div><p>Some people who ask this question report that the only Shorewall
        messages that they see in <code class="filename">/var/log/messages</code> are
        'started', 'restarted' and 'stopped' messages.</p><p><span class="bold"><strong>Answer:</strong></span> First of all, it is
        important to understand that Shorewall itself does not control where
        Netfilter log messages are written. The LOGFILE setting in
        <code class="filename">shorewall.conf</code> simply tells the
        <code class="filename">/sbin/shorewall[-lite]</code> 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 <code class="filename">/var/log</code> than a log
        level of "info". The log level does not control the number of log
        messages or the content of the messages.</p><p>The actual log file where Netfilter messages are written is not
        standardized and will vary by distribution and distribution version.
        But anytime you see no logging, it's time to look outside the
        Shorewall configuration for the cause. As an example, recent
        <span class="trademark">SUSE</span>™ releases use syslog-ng by default and
        write Shorewall messages to
        <code class="filename">/var/log/firewall</code>.</p><p>Please see the <a class="ulink" href="shorewall_logging.html" target="_self">Shorewall
        logging documentation</a> for further information.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq17"></a>(FAQ 17) Why are these packets being Dropped/Rejected? How do I
      decode Shorewall log messages?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Logging of
      dropped/rejected packets occurs out of a number of chains (as indicated
      in the log message) in Shorewall:</p><div class="variablelist"><dl><dt><span class="term">man1918 or logdrop</span></dt><dd><p>The destination address is listed in
            <code class="filename">/usr/share/shorewall/rfc1918</code> with a <span class="bold"><strong>logdrop</strong></span> target -- see <code class="filename"> <a class="ulink" href="manpages/shorewall-rfc1918.html" target="_self">/usr/share/shorewall/rfc1918</a>
            </code>.</p></dd><dt><span class="term">rfc1918 or logdrop</span></dt><dd><p>The source or destination address is listed in
            <code class="filename">/usr/share/shorewall/rfc1918</code> with a <span class="bold"><strong>logdrop</strong></span> target -- see <code class="filename"> <a class="ulink" href="manpages/shorewall-rfc1918.html" target="_self">/usr/share/shorewall/rfc1918</a>
            </code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>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
              <code class="filename">rfc1918</code> file in <code class="filename">/etc/shorewall</code> (this problem most
              frequently occurs if you are running Debian or one if its
              derivatives). The <code class="filename">rfc1918</code> file used to
              include bogons as well as the three ranges reserved by RFC 1918
              and it resided in <code class="filename">/etc/shorewall</code>. The file now only
              includes the three RFC 1918 ranges and it resides in <code class="filename">/usr/share/shorewall</code>. Remove the
              stale <code class="filename">rfc1918</code> file in <code class="filename">/etc/shorewall</code>.</p></div></dd><dt><a id="all2all"></a><span class="term">all2<span class="emphasis"><em>zone</em></span>, <span class="emphasis"><em>zone</em></span>2all
          or all2all</span></dt><dd><p>You have a <code class="filename"><a class="ulink" href="manpages/shorewall-policy.html" target="_self">policy</a></code>
            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
            <a class="ulink" href="manpages/shorewall-rules.html" target="_self">rule</a> to that
            effect.</p><p>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 <span class="command"><strong>shorewall[-lite] show
            zones</strong></span>). Remember that zone membership involves both a
            firewall interface and an ip address.</p></dd><dt><span class="term"><span class="emphasis"><em>zone</em></span>12<span class="emphasis"><em>zone2</em></span></span></dt><dd><p>Either you have a <a class="ulink" href="manpages/shorewall-policy.html" target="_self">policy</a> for
            <span class="emphasis"><em>zone1</em></span> to <span class="emphasis"><em>zone2</em></span> that
            specifies a log level and this packet is being logged under that
            policy or this packet matches a <a class="ulink" href="manpages/shorewall-rules.html" target="_self">rule</a> that includes a
            log level.</p></dd><dt><span class="term">@<span class="emphasis"><em>source</em></span>2<span class="emphasis"><em>dest</em></span></span></dt><dd><p>You have a policy for traffic from
            <span class="emphasis"><em>source</em></span> to <span class="emphasis"><em>dest</em></span> 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.</p></dd><dt><span class="term"><span class="emphasis"><em>interface</em></span>_mac or
          <span class="emphasis"><em>interface</em></span>_rec</span></dt><dd><p>The packet is being logged under the <span class="bold"><strong>maclist</strong></span> <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">interface
            option</a>.</p></dd><dt><span class="term">blacklist</span></dt><dd><p>The packet is being logged because the source IP is
            blacklisted in the <code class="filename"> <a class="ulink" href="manpages/shorewall-blacklist.html" target="_self">/etc/shorewall/blacklist</a>
            </code> file.</p></dd><dt><span class="term">INPUT or FORWARD</span></dt><dd><p>The packet has a source IP address that isn't in any of your
            defined zones (“<span class="quote"><span class="command"><strong>shorewall[-lite] show
            zones</strong></span></span>” 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 <span class="bold"><strong>routeback</strong></span> option on that interface in
            <code class="filename"> <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">/etc/shorewall/interfaces</a>
            </code>, you need the <span class="bold"><strong>routeback</strong></span> option in the relevant entry in
            <code class="filename"> <a class="ulink" href="manpages/shorewall-hosts.html" target="_self">/etc/shorewall/hosts</a>
            or you've done something silly like define a default route out of
            an internal interface.</code></p><p>In Shorewall 3.3.3 and later versions with OPTIMIZE=1 in
            <a class="ulink" href="manpages/shorewall.conf.html" target="_self">shorewall.conf</a>,
            such packets may also be logged out of a &lt;zone&gt;2all chain or
            the all2all chain.</p></dd><dt><span class="term">OUTPUT</span></dt><dd><p>The packet has a destination IP address that isn't in any of
            your defined zones(<span class="command"><strong>shorewall[-lite] show zones</strong></span>
            and look at the printed zone definitions).</p><p>In Shorewall 3.3.3 and later versions with OPTIMIZE=1 in
            <a class="ulink" href="manpages/shorewall.conf.html" target="_self">shorewall.conf</a>,
            such packets may also be logged out of the fw2all chain or the
            all2all chain.</p></dd><dt><span class="term">logflags</span></dt><dd><p>The packet is being logged because it failed the checks
            implemented by the <span class="bold"><strong>tcpflags</strong></span>
            <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">interface
            option</a>.</p></dd></dl></div><div class="example"><a id="Example3"></a><p class="title"><b>Example 3. Here is an example:</b></p><div class="example-contents"><pre class="programlisting">Jun 27 15:37:56 gateway kernel:
        Shorewall:<span class="bold"><strong>all2all:REJECT</strong></span>:<span class="bold"><strong>IN=eth2</strong></span>
          <span class="bold"><strong>OUT=eth1</strong></span>
          <span class="bold"><strong>SRC=192.168.2.2</strong></span>
          <span class="bold"><strong>DST=192.168.1.3 </strong></span>LEN=67 TOS=0x00 PREC=0x00 TTL=63 ID=5805 DF <span class="bold"><strong>PROTO=UDP</strong></span>
        SPT=1803 <span class="bold"><strong>DPT=53</strong></span> LEN=47</pre><p>Let's look at the important parts of this message:</p><div class="variablelist"><dl><dt><span class="term">all2all:REJECT</span></dt><dd><p>This packet was REJECTed out of the <span class="bold"><strong>all2all</strong></span> chain -- the packet was rejected
              under the “<span class="quote">all</span>”-&gt;“<span class="quote">all</span>” REJECT
              policy (<a class="link" href="#all2all">all2all</a> above).</p></dd><dt><span class="term">IN=eth2</span></dt><dd><p>the packet entered the firewall via eth2. If you see
              “<span class="quote">IN=</span>” with no interface name, the packet originated
              on the firewall itself.</p></dd><dt><span class="term">OUT=eth1</span></dt><dd><p>if accepted, the packet would be sent on eth1. If you see
              “<span class="quote">OUT=</span>” with no interface name, the packet would be
              processed by the firewall itself.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>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 <span class="emphasis"><em>original</em></span>
                destination IP address and destination port number. When a
                REDIRECT rule is logged, the message will also show the
                original destination IP address and port number.</p></div></dd><dt><span class="term">SRC=192.168.2.2</span></dt><dd><p>the packet was sent by 192.168.2.2</p></dd><dt><span class="term">DST=192.168.1.3</span></dt><dd><p>the packet is destined for 192.168.1.3</p></dd><dt><span class="term">PROTO=UDP</span></dt><dd><p>UDP Protocol</p></dd><dt><span class="term">DPT=53</span></dt><dd><p>The destination port is 53 (DNS)</p></dd></dl></div><p>In this case, 192.168.2.2 was in the “<span class="quote">dmz</span>” zone and
        192.168.1.3 is in the “<span class="quote">loc</span>” zone. I was missing the
        rule:</p><pre class="programlisting">ACCEPT dmz loc udp 53</pre></div></div><br class="example-break" /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq21"></a>(FAQ 21) I see these strange log entries occasionally; what are
      they?</h3></div></div></div><pre class="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 <span class="bold"><strong>PROTO=ICMP</strong></span>
      <span class="bold"><strong>TYPE=3 CODE=3</strong></span> [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 ]</pre><p>192.0.2.3 is external on my firewall... 172.16.0.0/24 is my
      internal LAN</p><p><span class="bold"><strong>Answer:</strong></span> 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 <a class="link" href="#faq17" title="(FAQ 17) Why are these packets being Dropped/Rejected? How do I decode Shorewall log messages?">FAQ 17</a>).</p><p>While most people associate the Internet Control Message Protocol
      (ICMP) with “<span class="quote">ping</span>”, 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 many 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.</p><p>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.</p><p>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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq52"></a>(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?</h3></div></div></div><p>I blacklisted the address 130.252.100.59 using <span class="command"><strong>shorewall
      drop 130.252.100.59</strong></span> but I am still seeing these log
      messages:</p><pre class="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</pre><p><span class="bold"><strong>Answer:</strong></span> Please refer to the
      <a class="ulink" href="NetfilterOverview.html" target="_self">Shorewall Netfilter
      Documentation</a>. 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq56"></a>(FAQ 56) When I start or restart Shorewall, I see these messages
      in my log. Are they harmful?</h3></div></div></div><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">modprobe: Can't locate module ipt_physdev
modprobe: Can't locate module iptable_raw</pre></blockquote></div><p><span class="bold"><strong>Answer:</strong></span> No. These occur when
      Shorewall probes your system to determine the features that it support.
      They are completely harmless.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Routing"></a>Routing</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq32"></a>(FAQ 32) My firewall has two connections to the Internet from two
      different ISPs. How do I set this up in Shorewall?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> See <a class="ulink" href="MultiISP.html" target="_self">this article on Shorewall and Multiple
      ISPs</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq49"></a>(FAQ 49) When I start Shorewall, my routing table gets blown
      away. Why does Shorewall do that?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> This is usually the
      consequence of a one-to-one nat configuration blunder:</p><div class="orderedlist"><ol type="1"><li><p>Specifying the primary IP address for an interface in the
          EXTERNAL column of <code class="filename">/etc/shorewall/nat</code> even
          though the documentation (and the comments in the file) warn you not
          to do that.</p></li><li><p>Specifying ADD_IP_ALIASES=Yes and RETAIN_ALIASES=No in
          /etc/shorewall/shorewall.conf.</p></li></ol></div><p>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 <span class="bold"><strong>not specify the primary IP address
      of an interface in the EXTERNAL column</strong></span>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Start-Stop"></a>Starting and Stopping</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq7"></a>(FAQ 7) When I stop Shorewall using “<span class="quote">shorewall[-lite]
      stop</span>”, I can't connect to anything. Why doesn't that command
      work?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The “<span class="quote">
      <span class="command"><strong>stop</strong></span> </span>” command is intended to place your
      firewall into a safe state whereby only those hosts listed in
      <code class="filename">/etc/shorewall/routestopped</code> are activated. If you
      want to totally open up your firewall, you must use the “<span class="quote">
      <span class="command"><strong>shorewall[-lite] clear</strong></span> </span>” command.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq8"></a>(FAQ 8) When I try to start Shorewall on RedHat, I get messages
      about insmod failing -- what's wrong?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The output you will see
      looks something like this:</p><pre class="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.</pre><p>This problem is usually corrected through the following sequence
      of commands</p><pre class="programlisting"><span class="command"><strong>service ipchains stop
chkconfig --delete ipchains
rmmod ipchains</strong></span></pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq8a"></a>(FAQ 8a) When I try to start Shorewall on RedHat I get a
        message referring me to FAQ #8</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> This is usually cured
        by the sequence of commands shown above in <a class="xref" href="#faq8" title="(FAQ 8) When I try to start Shorewall on RedHat, I get messages about insmod failing -- what's wrong?">the section called “(FAQ 8) When I try to start Shorewall on RedHat, I get messages
      about insmod failing -- what's wrong?”</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq9"></a>(FAQ 9) Why can't Shorewall detect my interfaces properly at
      startup?</h3></div></div></div><p>I just installed Shorewall and when I issue the
      <span class="command"><strong>start</strong></span> command, I see the following:</p><pre class="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...
    <span class="bold"><strong>Net Zone: eth0:0.0.0.0/0
    </strong></span><span class="bold"><strong>Local Zone: eth1:0.0.0.0/0</strong></span>
Deleting user chains...
Creating input Chains...
...</pre><p>Why can't Shorewall detect my interfaces properly?</p><p><span class="bold"><strong>Answer:</strong></span> The above output is
      perfectly normal. The Net zone is defined as all hosts that are
      connected through <code class="filename">eth0</code> and the
      local zone is defined as all hosts connected through <code class="filename">eth1</code>. You can set the <span class="bold"><strong>routefilter</strong></span> option on an internal interface if
      you wish to guard against '<em class="firstterm">Martians</em>' (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 <span class="bold"><strong>logmartians</strong></span>
      option.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq22"></a>(FAQ 22) I have some iptables commands that I want to run when
      Shorewall starts. Which file do I put them in?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span>You can place these
      commands in one of the <a class="ulink" href="shorewall_extension_scripts.htm" target="_self">Shorewall Extension
      Scripts</a>. Be sure that you look at the contents of the chain(s)
      that you will be modifying with your commands so that the commands will
      do what is intended. Many iptables commands published in HOWTOs and
      other instructional material use the -A command which adds the rules to
      the end of the chain. Most chains that Shorewall constructs end with an
      unconditional DROP, ACCEPT or REJECT rule and any rules that you add
      after that will be ignored. Check “<span class="quote">man iptables</span>” and look
      at the -I (--insert) command.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq34"></a>(FAQ 34) How can I speed up Shorewall start (restart)?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Switch to using <a class="ulink" href="Shorewall-perl.html" target="_self">Shorewall-perl</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq69"></a>(FAQ 69) When I restart Shorewall, new connections are blocked
      for a long time. Is there a way to avoid that?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Switch to using <a class="ulink" href="Shorewall-perl.html" target="_self">Shorewall-perl</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq43"></a>(FAQ 43) I just installed the Shorewall RPM and Shorewall doesn't
      start at boot time.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> 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
      the default run-levels of your firewall system.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq45"></a>(FAQ 45) Why does "shorewall[-lite] start" fail when trying to
      set up SNAT/Masquerading?</h3></div></div></div><p><span class="command"><strong>shorewall start</strong></span> produces the following
      output:</p><pre class="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</pre><p><span class="bold"><strong>Answer:</strong></span> 99.999% of the time, this
      error is caused by a mismatch between your iptables and kernel.</p><div class="orderedlist"><ol type="a"><li><p>Your iptables must be compiled against a kernel source tree
          that is Netfilter-compatible with the kernel that you are
          running.</p></li><li><p>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".</p></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq59"></a>(FAQ 59) After I start Shorewall, there are lots of unused
      Netfilter modules loaded. How do I avoid that?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Copy
      <code class="filename">/usr/share/shorewall[-lite]/modules</code> to
      <code class="filename">/etc/shorewall/modules </code>and modify the copy to
      include only the modules that you need.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq61"></a>(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?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Your iptables is
      incompatible with your kernel. Either</p><div class="itemizedlist"><ul type="disc"><li><p>rebuild iptables using the kernel headers that match your new
          kernel; or</p></li><li><p>if you don't need policy match support (you are not using the
          IPSEC implementation builtinto the 2.6 kernel) then you can rename
          <code class="filename">/lib/iptables/libipt_policy.so</code>.</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>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 <code class="option">ipsec</code> option on any entry in
        <code class="filename">/etc/shorewall/hosts</code>. The subject message will
        still appear in your kernel log each time that Shorewall determines
        the capabilities of your kernel/iptables.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq62"></a>(FAQ 62) I have unexplained 30-second pauses during "shorewall
      [re]start". What causes that?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> This usually happens when
      the firewall uses LDAP Authentication. The solution is to list your LDAP
      server(s) as <span class="bold"><strong>critical</strong></span> in <a class="ulink" href="manpages/shorewall-routestopped.html" target="_self">/etc/shorewall/routestopped</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq68"></a>(FAQ 68) I have a VM under an OpenVZ system. I can't get rid of
      the following message:</h3></div></div></div><p>ERROR: Command "/sbin/iptables -A FORWARD -m state --state
      ESTABLISHED,RELATED -j ACCEPT" failed.</p><p><span class="bold"><strong>Answer:</strong></span> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq73"></a>(FAQ 73) When I stop Shorewall, the firewall is wide open. Isn't
      that a security risk?</h3></div></div></div><p>It is important to understand that the scripts in <code class="filename">/etc/init.d</code> 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 <span class="command"><strong>/sbin/shorewall stop</strong></span> and
      <span class="command"><strong>/etc/init.d/shorewall stop</strong></span>.</p><p><span class="command"><strong>/sbin/shorewall stop</strong></span> places the firewall in a
      <em class="firstterm">safe state</em>, the details of which depend on your
      <code class="filename">/etc/shorewall/routestopped</code> file (<a class="ulink" href="manpages/shorewall-routestopped.html" target="_self">shorewall-routestopped</a>(8))
      and on the setting of ADMINISABSENTMINDED in
      <code class="filename">/etc/shorewall/shorewall.conf</code> (<a class="ulink" href="manpages/shorewall.conf.html" target="_self">shorewall.conf</a>(8)).</p><p><span class="command"><strong>/etc/init.d/shorewall stop</strong></span> may or may not do
      the same thing. In the case of <span class="trademark">Debian</span>™ systems for
      example, that command actually executes <span class="command"><strong>/sbin/shorewall
      clear</strong></span> which opens the firewall completely. In other words, in
      the init script's <span class="command"><strong>stop</strong></span> reverses the effect of
      <span class="command"><strong>start</strong></span>.</p><p>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 <code class="filename">/sbin/shorewall</code> (and
      <code class="filename">/sbin/shorewall-lite</code>). For more information on the
      factors involved when deciding whether to use the Debian package, see
      <a class="ulink" href="http://wiki.shorewall.net/wiki/ShorewallOnDebian" target="_self">this
      article</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq74"></a>(FAQ 74) When I "<span class="command"><strong>shorewall start</strong></span>" or
      "<span class="command"><strong>shorewall check</strong></span>" on my SuSE 10.0 system, I get FATAL
      ERROR messages and/or the system crashes"</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> These failures result
      from trying to load a particular combination of kernel modules. To work
      around the problem:</p><div class="orderedlist"><ol type="1"><li><p>Copy /usr/share/shorewall/modules to
          /etc/shorewall/modules</p></li><li><p>Edit /etc/shorewall/modules and remove all entries except for
          those for the helper modules that you need.</p></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq78"></a>(FAQ 78) After restart and bootup of my Debian firewall, all
      traffic is blocked for hosts behind the firewall trying to connect out
      onto the net or through the vpn (although i can reach the internal
      firewall interface and obtain dumps etc). Once I issue 'shorewall clear'
      followed by 'shorewall restart' it then works, despite the config not
      changing</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Set IP_FORWARDING=On in
      <code class="filename"><a class="ulink" href="manpages/shorewall.conf.html" target="_self">/etc/shorewall/shorewall.conf</a></code>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="MultiISP"></a>Multiple ISPs</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq57"></a>(FAQ 57) I configured two ISPs in Shorewall but when I try to use
      the second one, it doesn't work.</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The Multi-ISP
      Documentation strongly recommends that you use the <span class="bold"><strong>balance</strong></span> 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 <span class="bold"><strong>routefilter</strong></span> option on the other interface(s) in
      <code class="filename">/etc/shorewall/interfaces</code> and disable any
      <span class="emphasis"><em>IP Address Spoofing</em></span> protection that your
      distribution supplies.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq58"></a>(FAQ 58) But if I specify 'balance' then won't Shorewall balance
      the traffic between the interfaces? I don't want that!</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> 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
      <code class="filename">/etc/shorewall/tcrules</code> file:</p><pre class="programlisting">#MARK         SOURCE           DEST
1:P           0.0.0.0/0
1             $FW
<span class="emphasis"><em>other MARK rules</em></span></pre><p>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
      <span class="bold"><strong>balance</strong></span> is specified or not!</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id306019"></a>Using DNS Names</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq79"></a>(FAQ 79) Can I use DNS names in Shorewall configuration file
      entries in place of IP addresses?</h3></div></div></div><p><span class="bold"><strong>Answer</strong></span>: <a class="ulink" href="configuration_file_basics.htm#dnsnames" target="_self">Yes</a>, but we advise
      strongly against it.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="TC"></a>Traffic Shaping</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq67"></a>(FAQ 67) I just configured Shorewall's builtin traffic shaping
      and now Shorewall fails to Start.</h3></div></div></div><p>The error I receive is as follows:</p><pre class="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</pre><p><span class="bold"><strong>Answer:</strong></span> 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 <span class="bold"><strong>act_police</strong></span> kernel module. Other kernel modules
      that you will need include:</p><table class="simplelist" border="0" summary="Simple list"><tr><td>cls_u32</td></tr><tr><td>sch_htb</td></tr><tr><td>sch_ingress</td></tr><tr><td>sch_sfq</td></tr></table></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="About"></a>About Shorewall</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq10"></a>(FAQ 10) What Distributions does Shorewall work with?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Shorewall works with any
      GNU/Linux distribution that includes the <a class="ulink" href="shorewall_prerequisites.htm" target="_self">proper prerequisites</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq11"></a>(FAQ 11) What Features does Shorewall have?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> See the <a class="ulink" href="shorewall_features.htm" target="_self">Shorewall Feature List</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq12"></a>(FAQ 12) Is there a GUI?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Yes! Shorewall 3.x
      support is available in Webmin 1.300. See <a class="ulink" href="http://www.webmin.com" target="_self">http://www.webmin.com</a></p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq13"></a>(FAQ 13) Why do you call it “<span class="quote">Shorewall</span>”?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Shorewall is a
      concatenation of “<span class="quote"> <span class="emphasis"><em>Shore</em></span>line</span>” (<a class="ulink" href="http://www.cityofshoreline.com" target="_self">the city where I live</a>) and
      “<span class="quote">Fire<span class="emphasis"><em>wall</em></span> </span>”. The full name of the
      product is actually “<span class="quote">Shoreline Firewall</span>” but
      “<span class="quote">Shorewall</span>” is much more commonly used.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq23"></a>(FAQ 23) Why do you use such ugly fonts on your web site?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq25"></a>(FAQ 25) How do I tell which version of Shorewall or Shorewall
      Lite I am running?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> At the shell prompt,
      type:</p><pre class="programlisting"><span class="command"><strong>/sbin/shorewall[-lite] version</strong></span>      </pre><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq25a"></a>(FAQ 25a) How do I tell which version of Shorewall-perl and
        Shorewall-shell that I have installed?</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> At the shell prompt,
        type:</p><pre class="programlisting"><span class="command"><strong>/sbin/shorewall version -a</strong></span>    </pre></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq31"></a>(FAQ 31) Does Shorewall provide protection against....</h3></div></div></div><div class="variablelist"><dl><dt><span class="term">IP Spoofing: Sending packets over the WAN interface using an
          internal LAP IP address as the source address?</span></dt><dd><p><span class="bold"><strong>Answer:</strong></span> Yes.</p></dd><dt><span class="term">Tear Drop: Sending packets that contain overlapping
          fragments?</span></dt><dd><p><span class="bold"><strong>Answer:</strong></span> 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.</p></dd><dt><span class="term">Smurf and Fraggle: Sending packets that use the WAN or LAN
          broadcast address as the source address?</span></dt><dd><p><span class="bold"><strong>Answer:</strong></span> Shorewall can be
            configured to do that using the <a class="ulink" href="blacklisting_support.htm" target="_self">blacklisting</a> facility.
            Shorewall versions 2.0.0 and later filter these packets under the
            <em class="firstterm">nosmurfs</em> interface option in <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">/etc/shorewall/interfaces</a>.</p></dd><dt><span class="term">Land Attack: Sending packets that use the same address as the
          source and destination address?</span></dt><dd><p><span class="bold"><strong>Answer:</strong></span> Yes, if the <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">routefilter interface
            option</a> is selected.</p></dd><dt><span class="term">DOS: - SYN Dos - ICMP Dos - Per-host Dos protection</span></dt><dd><p><span class="bold"><strong>Answer:</strong></span> 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.</p></dd></dl></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq65"></a>(FAQ 65) How do I accomplish failover with Shorewall?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> <a class="ulink" href="http://linuxman.wikispaces.com/Clustering+Shorewall" target="_self">This article
      by Paul Gear</a> should help you get started.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="RFC1918"></a>RFC 1918</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq14"></a>(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.</h3></div></div></div><p>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?</p><p><span class="bold"><strong>Answer:</strong></span> Use of the norfc1918
      interface is currently deprecated and support for the option will be
      removed entirely in a future version. So deleting the option from <a class="ulink" href="manpages/shorewall-interfaces.html" target="_self">shorewall-interfaces</a>
      (5) is the preferred solution.</p><p>Otherwise, add the following to <code class="filename"><a class="ulink" href="manpages/shorewall-rfc1918.html" target="_self">/etc/shorewall/rfc1918</a></code>
      (Note: If you are running Shorewall 2.0.0 or later, you may need to
      first copy <code class="filename">/usr/share/shorewall/rfc1918</code> to
      <code class="filename">/etc/shorewall/rfc1918</code>):</p><p>Be sure that you add the entry ABOVE the entry for
      192.168.0.0/16.</p><pre class="programlisting">#SUBNET        TARGET
192.168.100.1  RETURN</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>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 <code class="filename">/etc/shorewall/rfc1918</code> for that address.
        For example, if you configure the address 192.168.100.2 on your
        firewall, then you would add two entries to
        <code class="filename">/etc/shorewall/rfc1918</code>:</p><pre class="programlisting">#SUBNET        TARGET
192.168.100.1  RETURN
192.168.100.2  RETURN</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq14a"></a>(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.</h4></div></div></div><p><span class="bold"><strong>Answer:</strong></span> The solution is the
        same as <a class="xref" href="#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.">the section called “(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.”</a> above.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq14b"></a>(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.</h4></div></div></div><p>I see the following in my log:</p><pre class="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 </pre><p><span class="bold"><strong>Answer:</strong></span> 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 <a class="link" href="#faq17" title="(FAQ 17) Why are these packets being Dropped/Rejected? How do I decode Shorewall log messages?">FAQ 17</a>). You need to:</p><div class="orderedlist"><ol type="1"><li><p>Add a zone for the modem in
            <code class="filename">/etc/shorewall/zones</code>:</p><pre class="programlisting">#ZONE    TYPE          OPTIONS
modem    ipv4</pre></li><li><p>Define the zone to be associated with <code class="filename">eth0</code> (or whatever interface connects
            to your modem) in
            <code class="filename">/etc/shorewall/interfaces</code>:</p><pre class="programlisting">#ZONE      INTERFACE   BROADCAST    OPTIONS
modem      eth0        detect</pre></li><li><p>Allow web traffic to the modem in
            <code class="filename">/etc/shorewall/rules</code>:</p><pre class="programlisting">#ACTION    SOURCE      DEST      PROTO     DEST PORT(S)
ACCEPT     fw          modem     tcp       80
ACCEPT     loc         modem     tcp       80</pre></li></ol></div><p>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.</p><p><code class="filename">/etc/shorewall/masq</code>:</p><pre class="programlisting">#INTERFACE         SOURCE          ADDRESS
eth0               eth1                        # eth1 = interface to local network</pre><p>For an example of this when the ADSL/Cable modem is bridged, see
        <a class="ulink" href="XenMyWay-Routed.html" target="_self">my configuration</a>. In that
        case, I masquerade using the IP address of my local interface!</p></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ALIASES"></a>Alias IP Addresses/Virtual Interfaces</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq18"></a>(FAQ 18) Is there any way to use aliased ip addresses with
      Shorewall, and maintain separate rule sets for different IPs?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Yes. See <a class="ulink" href="Shorewall_and_Aliased_Interfaces.html" target="_self">Shorewall and Aliased
      Interfaces</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Lite"></a>Shorewall Lite</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq53"></a>(FAQ 53) What is Shorewall Lite?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> 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 <a class="ulink" href="CompiledPrograms.html#Lite" target="_self">Compiled
      Firewall script documentation</a> for details.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq54"></a>(FAQ 54) If I want to use Shorewall Lite, do I also need to
      install Shorewall on the same system?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> No. In fact, we recommend
      that you do <span class="bold"><strong>NOT</strong></span> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq55"></a>(FAQ 55) How do I decide which product to use - Shorewall or
      Shorewall Lite?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq60"></a>(FAQ 60) What are the compatibility restrictions between
      Shorewall and Shorewall Lite</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Beginning with version
      3.2.3, there are no compatibility constraints between Shorewall and
      Shorewall-lite.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Perl"></a>Shorewall-Perl</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq70"></a>(FAQ 70) What is Shorewall-Perl?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Shorewall-perl is a
      re-implementation of the Shorewall configuration compiler written in
      Perl.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq71"></a>(FAQ 71) What are the advantages of using Shorewall-perl?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span></p><div class="itemizedlist"><ul type="disc"><li><p>The Shorewall-perl compiler is much faster than the
          Shorewall-shell compiler.</p></li><li><p>The script generated by the Shorewall-perl compiler uses
          <span class="command"><strong>iptables-restore</strong></span> 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 rule set installation.</p></li><li><p>The Shorewall-perl compiler does more thorough checking of the
          configuration than the Shorewall-shell compiler does.</p></li><li><p>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.</p></li><li><p>Going forward, the Shorewall-perl compiler will get all
          enhancements; the Shorewall-shell compiler will only get those
          enhancements that are easy to retrofit.</p></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq72"></a>(FAQ 72) Can I switch to using Shorewall-perl without changing my
      Shorewall configuration?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Maybe yes, maybe no. See
      the <a class="ulink" href="Shorewall-perl.html" target="_self">Shorewall Perl article</a> for
      a list of the incompatibilities between Shorewall-shell and
      Shorewall-perl.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="VOIP"></a>VOIP</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq77"></a>(FAQ 77) Shorewall is eating my Asterisk egress traffic!</h3></div></div></div><p>Somehow, my firewall config is causing a one-way audio problem in
      Asterisk. If a person calls into the PBX, they cannot hear me speaking,
      but I can hear them. If I plug the Asterisk server directly into the
      router, bypassing the firewall, the problem goes away.</p><p><span class="bold"><strong>Answer (requires Shorewall 4.0.6 or
      later):</strong></span> If your kernel version is 2.6.20 or
      earlier:</p><pre class="programlisting">rmmod ip_nat_sip
rmmod ip_conntrack_sip</pre><p>Then change the DONT_LOAD specification
      in your shorewall.conf to:</p><pre class="programlisting">DONT_LOAD=ip_nat_sip,ip_conntrack_sip</pre><p>If
      your kernel version is 2.6.21 or later:</p><pre class="programlisting">rmmod nf_nat_sip
rmmod nf_conntrack_sip</pre><p>Then change the DONT_LOAD specification
      in your shorewall.conf to:</p><pre class="programlisting">DONT_LOAD=nf_nat_sip,nf_conntrack_sip</pre><p>If
      you are running a version of Shorewall earlier than 4.0.6, you can avoid
      loading the sip helper modules by following the suggestions in <a class="link" href="#faq59" title="(FAQ 59) After I start Shorewall, there are lots of unused Netfilter modules loaded. How do I avoid that?">FAQ 59</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Misc"></a>Miscellaneous</h2></div></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq20"></a>(FAQ 20) I have just set up a server. Do I have to change
      Shorewall to allow access to my server from the Internet?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Yes. Consult the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">QuickStart guide</a> that you
      used during your initial setup for information about how to set up rules
      for your server.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq24"></a>(FAQ 24) How can I allow connections to, let's say, the ssh port
      only from specific IP Addresses on the Internet?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> In the SOURCE column of
      the rule, follow “<span class="quote">net</span>” by a colon and a list of the
      host/subnet addresses as a comma-separated list.</p><pre class="programlisting">net:&lt;ip1&gt;,&lt;ip2&gt;,...</pre><div class="example"><a id="Example4"></a><p class="title"><b>Example 4. Example:</b></p><div class="example-contents"><pre class="programlisting">ACCEPT net:192.0.2.16/28,192.0.2.44 fw tcp 22</pre></div></div><br class="example-break" /></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq26"></a>(FAQ 26) When I try to use any of the SYN options in nmap on or
      behind the firewall, I get “<span class="quote">operation not permitted</span>”. How
      can I use nmap with Shorewall?"</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Temporarily remove and
      rejNotSyn, dropNotSyn and dropInvalid rules from
      <code class="filename">/etc/shorewall/rules</code> and restart Shorewall.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq27"></a>(FAQ 27) I'm compiling a new kernel for my firewall. What should
      I look out for?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> First take a look at the
      <a class="ulink" href="kernel.htm" target="_self">Shorewall kernel configuration page</a>. You
      probably also want to be sure that you have selected the “<span class="quote">
      <span class="bold"><strong>NAT of local connections (READ HELP)</strong></span>
      </span>” on the Netfilter Configuration menu. Otherwise, DNAT rules with
      your firewall as the source zone won't work with your new kernel.</p><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="faq27a"></a>(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.</h4></div></div></div><p>The last few lines of <a class="ulink" href="troubleshoot.htm" target="_self">a startup
        trace</a> are these:</p><pre class="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</pre><p><span class="bold"><strong>Answer:</strong></span> Your new kernel
        contains headers that are incompatible with the ones used to compile
        your <span class="command"><strong>iptables</strong></span> utility. You need to rebuild
        <span class="command"><strong>iptables</strong></span> using your new kernel source.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq28"></a>(FAQ 28) How do I use Shorewall as a Bridging Firewall?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Shorewall Bridging
      Firewall support is available — <a class="ulink" href="bridge-Shorewall-perl.html" target="_self">check here for details</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq39"></a>(FAQ 39) How do I block connections to a particular domain
      name?</h3></div></div></div><p>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:</p><pre class="programlisting">#ACTION   SOURCE        DEST                                 PROTO
REJECT    fw            net:pagead2.googlesyndication.com    all</pre><p>However, this also sometimes restricts access to "google.com". Why
      is that? Using dig, I found these IPs for domain
      googlesyndication.com:</p><pre class="programlisting">216.239.37.99
216.239.39.99</pre><p>And this for google.com:</p><pre class="programlisting">216.239.37.99
216.239.39.99
216.239.57.99</pre><p>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?</p><p><span class="bold"><strong>Answer:</strong></span> 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.</p><p>When you specify <a class="ulink" href="configuration_file_basics.htm#dnsnames" target="_self">a domain name in a
      Shorewall rule</a>, 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:</p><pre class="programlisting">#ACTION   SOURCE        DEST                 PROTO
REJECT    fw            net:216.239.37.99    all
REJECT    fw            net:216.239.39.99    all</pre><p>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 <a class="ulink" href="FTP.html" target="_self">FTP</a>
      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
      <a class="ulink" href="Shorewall_Squid_Usage.html" target="_self">Squid</a>. 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.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq42"></a>(FAQ 42) How can I tell which features my kernel and iptables
      support?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Use the
      <span class="command"><strong>shorewall[-lite] show capabilities</strong></span> command at a root
      prompt.</p><pre class="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:~#</pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="faq19"></a>(FAQ 19) How do I open the firewall for all traffic to/from the
      LAN?</h3></div></div></div><p><span class="bold"><strong>Answer:</strong></span> Add these two
      policies:</p><pre class="programlisting">#SOURCE            DESTINATION             POLICY            LOG              LIMIT:BURST
#                                                            LEVEL
$FW                loc                     ACCEPT
loc                $FW                     ACCEPT           </pre><p>You should also delete any ACCEPT rules from $FW-&gt;loc and
      loc-&gt;$FW since those rules are redundant with the above
      policies.</p></div></div></div></body></html>