<palign="left">The firewall has three 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 using ISDN, you 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>Local Interface</i> will be an ethernet adapter (eth0,
eth1 or eth2) and will be connected to a hub or switch. Your local computers
will be connected to the same switch (note: If you have only a single local system,
you can connect the firewall directly to the computer using a <i>cross-over </i>
cable).</p>
<palign="left">Your <i>DMZ Interface</i> will also be an ethernet adapter (eth0,
eth1 or eth2) and will be connected to a hub or switch. Your DMZ computers will
be connected to the same switch (note: If you have only a single DMZ 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 more than one interface
to the same hub or switch (even for testing). It won't work the way that you
expect it to and you will end up confused and
believing that Shorewall doesn't work at all.</p>
<palign="left"><imgborder="0"src="images/BD21298_2.gif"width="13"height="13"> The Shorewall three-interface sample configuration assumes that
the external interface is <b>eth0, </b>the local interface is <b>eth1 </b>and
the DMZ interface is <b>
eth2</b>.
If your configuration is different, you will have to modify the sample
/etc/shorewall/interfaces 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>Regardless of how the 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
for your internal network (the local and DMZ Interfaces 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 the DMZ computers would be 10.10.10.254
and the default gateway for the Local computers 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 local 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 accross the internet). When the firewall receives a return packet, it
rewrites the destination address back to 10.10.10.1 and
forwards the packet on to local computer 1. </p>
<palign="left">On Linux systems, the above process is often referred to as<i>
IP Masquerading</i> and 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.</p>
<palign="left"><imgborder="0"src="images/BD21298_2.gif"width="13"height="13"> If your external firewall interface is <b>eth0</b>, your local
interface <b>eth1 </b>and your DMZ interface is <b>eth2</b> then you do not
need to modify the file provided with the sample. Otherwise, edit
/etc/shorewall/masq and change it to match your configuration.</p>
<palign="left"><imgborder="0"src="images/BD21298_2.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 will be to run one or more servers on your DMZ 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 your 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_2.gif"width="13"height="13"> The three-interface sample assumes that you want to enable
routing to/from <b>eth1 (</b>your local network) and<b> eth2 </b>(DMZ) when Shorewall is stopped.
If these two interfaces don't connect to your local network and DMZ or if you
want to enable a different set of hosts, modify /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