download the <ahref="/pub/shorewall/LATEST.samples/two-interfaces.tgz">two-interface sample</a>, un-tar it (tar -zxvf two-interfaces.tgz) and and copy the files to /etc/shorewall
<li>allow all connection requests from your local network to the internet</li>
<li>drop (ignore) all connection requests from the internet to your firewall
or local network</li>
<li>optionally accept all connection requests from the firewall to the
internet (if you uncomment the additional policy)</li>
<li>reject all other connection requests.</li>
</ol>
<p><imgborder="0"src="images/BD21298_.gif"width="13"height="13"> At this point, edit your /etc/shorewall/policy and make any changes that you
<palign="left">The firewall has two network interfaces. Where Internet
connectivity is through a cable or DSL "Modem", the <i>External Interface</i>
will be the ethernet adapter that is connected to that "Modem" (e.g., <b>eth0</b>)
<u>unless</u> you connect via <i><u>P</u>oint-to-<u>P</u>oint <u>P</u>rotocol
over <u>E</u>thernet</i> (PPPoE) or <i><u>P</u>oint-to-<u>P</u>oint <u>T</u>unneling
<u>P</u>rotocol </i>(PPTP) in which case the External Interface will be a ppp
interface (e.g., <b>ppp0</b>). If you connect via a regular modem, your External
Interface will also be <b>ppp0</b>. If you connect via ISDN, your external
interface will be <b>ippp0.</b></p>
<palign="left"><imgborder="0"src="images/BD21298_1.gif"width="13"height="13"> If your external interface is <b>ppp0</b>
or<b> ippp0</b> then you will want to
set CLAMPMSS=yes in <ahref="Documentation.htm#Conf">
/etc/shorewall/shorewall.conf.</a></p>
<palign="left">Your <i>Internal Interface</i> will be an ethernet adapter (eth1
or eth0) and will be connected to a hub or switch. Your other computers will be
connected to the same hub/switch (note: If you have only a single internal system,
you can connect the firewall directly to the computer using a <i>cross-over </i>
cable).</p>
<palign="left"><u><b>
<imgborder="0"src="images/j0213519.gif"width="60"height="60"></b></u>Do not connect the internal and external interface
to the same hub or switch (even for testing). It won't work the way that you think that it will and you will end up confused and
believing that Shorewall doesn't work at all.</p>
<palign="left"><imgborder="0"src="images/BD21298_.gif"align="left"width="13"height="13"> The Shorewall two-interface sample configuration assumes that
the external interface is <b>eth0</b> and the internal interface is <b>eth1</b>.
If your configuration is different, you will have to modify the sample
<ahref="Documentation.htm#Interfaces">/etc/shorewall/interfaces</a> file accordingly. While you are there, you may wish to
review the list of options that are specified for the interfaces. Some hints:</p>
<ul>
<li>
<palign="left">If your external interface is <b>ppp0</b> or <b>ippp0</b>, you can replace the
"detect" in the second column with "-".</li>
<li>
<palign="left">If your external interface is <b>ppp0</b> or <b>ippp0</b> or if you have a static IP
address, you can remove "dhcp" from the option list.</li>
</ul>
<h2align="left">IP Addresses</h2>
<palign="left">Before going further, we should say a few words about Internet
Protocol (IP) <i>addresses</i>. Normally, your ISP will assign you a single <i>
Public</i> IP address. This address may be assigned via the<i> Dynamic Host
Configuration Protocol</i> (DHCP) or as part of establishing your connection
when you dial in (standard modem) or establish your PPP connection. In rare
cases, your ISP may assign you a<i> static</i> IP address; that means that you
configure your firewall's external interface to use that address permanently.<i>
</i>However your external address is assigned, it will be shared by all of your systems when you access the
Internet. You will have to assign your own addresses in your
internal network (the Internal Interface on your firewall plus your other
computers). RFC 1918 reserves several <i>Private </i>IP address ranges for this
<palign="left">The default gateway for computer's 1 & 2 would be 10.10.10.254.</p>
<h2align="left">IP Masquerading (SNAT)</h2>
<palign="left">The addresses reserved by RFC 1918 are sometimes referred to as
<i>non-routable</i> because the Internet backbone routers don't forward packets
which have an RFC-1918 destination address. When one of your local systems
(let's assume computer 1) sends a connection request to an internet host, the
firewall must perform <i>Network Address Translation </i>(NAT). The firewall
rewrites the source address in the packet to be the address of the firewall's
external interface; in other words, the firewall makes it look as if the firewall
itself is initiating the connection. This is necessary so that the
destination host will be able to route return packets back to the firewall
(remember that packets whose destination address is reserved by RFC 1918 can't
be routed across the internet so the remote host can't address its response to
computer 1). When the firewall receives a return packet, it
rewrites the destination address back to 10.10.10.1 and
forwards the packet on to computer 1. </p>
<palign="left">On Linux systems, the above process is often referred to as<i>
IP Masquerading</i> but you will also see the term <i>Source Network Address
Translation </i>(SNAT) used. Shorewall follows the convention used with
Netfilter:</p>
<ul>
<li>
<palign="left"><i>Masquerade</i> describes the case where you let your
firewall system automatically detect the external interface address.</li>
<li>
<palign="left"><i>SNAT</i> refers to the case when you explicitly specify the
source address that you want outbound packets from your local network to use.
</li>
</ul>
<palign="left">In Shorewall, both Masquerading and SNAT are configured with
entries in the /etc/shorewall/masq file. You will normally use Masquerading if
your external IP is dynamic and SNAT if the IP is static.</p>
<palign="left"><imgborder="0"src="images/BD21298_.gif"width="13"height="13"> If your external firewall interface is <b>eth0</b>, you do not
need to modify the file provided with the sample. Otherwise, edit
/etc/shorewall/masq and change the first column to the name of your external
interface and the second column to the name of your internal interface.</p>
<palign="left"><imgborder="0"src="images/BD21298_.gif"width="13"height="13"> If your external IP is
static, you can enter it in the third column in the /etc/shorewall/masq entry if
you like although your firewall will work fine if you leave that column empty.
Entering your static IP in column 3 makes processing outgoing packets a little
more efficient. </p>
<h2align="left">Port Forwarding (DNAT)</h2>
<palign="left">One of your goals may be to run one or more servers on your
local computers. Because these computers have RFC-1918 addresses, it is not
possible for clients on the internet to connect directly to them. It is rather
necessary for those clients to address their connection requests to the firewall
who rewrites the destination address to the address of your server and forwards
the packet to that server. When your server responds, the firewall automatically
performs SNAT to rewrite the source address in the response.</p>
<palign="left">The above process is called<i> Port Forwarding</i> or <i>
Destination Network Address Translation</i> (DNAT). You configure port
forwarding using DNAT rules in the /etc/shorewall/rules file.</p>
<p>The general form of a simple port forwarding rule in
configures your system to start Shorewall at system boot.</div>
<divalign="left">
<palign="left">The firewall is started using the "shorewall start" command
and stopped using "shorewall stop". When the firewall is stopped, routing is
enabled on those hosts that have an entry in
<ahref="Documentation.htm#Routestopped">/etc/shorewall/routestopped</a>. A
running firewall may be restarted using the "shorewall restart" command. If
you want to totally remove any trace of Shorewall from your Netfilter
configuration, use "shorewall clear".</div>
<divalign="left">
<palign="left"><imgborder="0"src="images/BD21298_.gif"width="13"height="13"> The two-interface sample assumes that you want to enable
routing to/from <b>eth1 </b>(the local network) when Shorewall is stopped. If
your local network isn't connected to <b>eth1</b> or if you wish to enable
access to/from other hosts, change /etc/shorewall/routestopped accordingly.</div>
<divalign="left">
<palign="left"><b>WARNING: </b>If you are connected to your firewall from the
internet, do not issue a "shorewall stop" command unless you have added an
entry for the IP address that you are connected from to