<!doctype linuxdoc system>

<article>

<title>Firewalling and Proxy Server HOWTO</title>
<author>David Rudder, <tt>drig@execpc.com</tt>
<date>v0.2, 17 July 1995
<abstract>
This document is designed to teach the basics of setting up a firewall on 
a Linux based PC.  Also covered is the installation and use of Proxy 
Servers to allow greater access to the Internet from behind a firewall.
</abstract>

<toc>

<sect>Introduction

<p>
Firewalls have gained great fame recently as the ultimate in Internet 
Security.  Like most things that gain fame, with that fame has come 
misunderstanding.  This <bf>HOWTO</bf> will go over the basics of what a 
<bf>firewall</bf> is, how to set one up, what <bf>proxy servers</bf> are, 
how to set up proxy servers, and the applications of this technology 
outside of the security realm. 

<sect1>Feedback

<p>
Any feedback is very welcome.  I am particularly looking for feedback 
from people who use Macintosh computers, as the information I have on 
them is scanty.  <bf>PLEASE PLEASE PLEASE REPORT ANY INACCURACIES IN THIS 
PAPER!!!</bf>  I am human, and prone to making mistakes.  If you find 
any, fixing them is of my highest interest.  I will try to answer all 
e-mail, but I am busy, so don't get insulted if I don't.

<p>
My email address is drig@execpc.com.

<sect1>Disclaimer

<p>
This document is meant as an introduction to how Firewalls and Proxy 
Servers work.  I am not, not do I pretend to be, a security expert.  I am 
just some guy who has read to much and likes computers more than people.  
I AM NOT RESPONSIBLE FOR ANY DAMAGES INCURRED DUE TO ACTIONS TAKEN BASED 
ON THIS DOCUMENT.   Please, I am writing this to help get people 
acquainted with this subject, and I am not ready to stake my life on the 
accuracy of what is in here.

<sect1>Copyright

<p>
Unless otherwise stated, Linux HOWTO documents are copyrighted by their
respective authors. Linux HOWTO documents may be reproduced and distributed 
in whole or in part, in any medium physical or electronic, as long as
this copyright notice is retained on all copies. Commercial redistribution 
is allowed and encouraged; however, the author would like to be notified of 
any such distributions. 

All translations, derivative works, or aggregate works incorporating 
any Linux HOWTO documents must be covered under this copyright notice. 
That is, you may not produce a derivative work from a HOWTO and impose
additional restrictions on its distribution. Exceptions to these rules
may be granted under certain conditions; please contact the Linux HOWTO
coordinator at the address given below.

In short, we wish to promote dissemination of this information through as
many channels as possible. However, we do wish to retain copyright on the
HOWTO documents, and would like to be notified of any plans to redistribute
the HOWTOs. 

If you have any questions, please contact David Rudder 
&lt;drig@execpc.com&gt;.
<p>
<sect1>My Reasons for Writing This

<p>
There were a lot of discussions on comp.os.linux.* over the past year or 
so asking for Firewalling help.  It seemed as if no one was going to 
answer these.  I assumed that the reason was that no one knew how.  So, I 
set aside some time to play with Firewalling and teach myself it.  This 
document is in response to those requests.

<sect1>TODO

<p>
<itemize>
<item>Learn how to do this on a Macintosh
<item>Learn different Windows TCP/IP packages
<item>Find a good UDP proxy server that works with Linux
</itemize>

<sect1>Further Readings

<p>
<itemize>
<item>The Documentation for the TIS Firewall Toolkit
<item>The NET-2 HOWTO
<item>The PPP HOWTO
<item>The Ethernet HOWTO
<item>The Multiple Ethernet Mini HOWTO
<item>Networking with Linux
<item>TCP/IP Network Administrator's Guide by O'Reilly and Associates
</itemize>
<p>
<em>The Firewall Toolkit by TIS</em> has a collection of the best 
documentation I have found on firewalls and related constructs.  For more 
on the <tt>Firewall Toolkit</tt>, look for the section <em>Firewalling 
Software</em>.

<sect>Understanding Firewalls

<p>
A <bf>Firewall</bf> is a term used for a part of a car.  In 
cars, Firewalls are physical objects that separate the engine block from the 
passenger compartment.  They are meant to protect the passenger in case 
the car explodes.

A <bf>Firewall</bf> in computers is a logical device that protects a 
private network from the public part.  How they work is:

<enum>
<item>You take a computer that has routing capabilities (such as a linux box)
<item>Put in 2 interfaces (ie Serial ports, Ethernet, Token Ring, etc)
<item>Turn <em>off</em> IP forwarding
<item>Connect the internet to one interface
<item>Connect the protected network to the other interface
</enum>

<p>
Now, you have two distinct networks, which share a computer.  The 
firewall computer, from now on named <tt>"firewall"</tt>, can reach both 
the protected network and the internet.  The protected network can not 
reach the internet, and the internet can not reach the protected 
network. 

<p>
For someone to reach the internet from inside the protected network, one 
must telnet to <tt>firewall</tt>, and use the internet from there.  
Accordingly, in order to get into the protected network, one must go 
through the firewall first.

<p>
This provides excellent security against attacks from the internet.  If 
someone wants to make a concerted attack against the protected network, 
they must go through the firewall first, making it a two-step, and thus 
much harder, attack.  If someone wants to attack the protected network 
via a more common method, such as mail bombing, or the infamous 
<tt>"Internet Worm"</tt>, they will not be able to reach the protected 
network.  This makes for excellent protection.

<sect1>Drawbacks with Firewalls

<p>
The biggest problem with firewalls is that they greatly inhibit the 
access to the internet from the inside.  Basically, they reduce the usage 
of the internet to that which one would have via a dial-up shell 
account.  Having to login to <tt>firewall</tt> and then do all internet 
access is a severe restriction.  Programs like <em>Netscape</em>, which 
require a direct internet connection, will not work from behind a 
firewall.  The answer to these problems is having a <bf>Proxy Server</bf>.

<sect1>Proxy Servers

<p>
Proxy servers are constructs that allow direct internet access from 
behind a firewall.  How they work is they open a socket on the server, 
and allow communication via that socket to the internet.  For example, if 
my computer, <tt>drig</tt> is inside the protected network, and I want to 
browse the Web using <em>Netscape</em>, I would set up a proxy server on 
<tt>firewall</tt>.  The proxy server would be configured to allow 
requests from my computer, trying for port 80, to connect to its port 
1080, and it would then redirect all requests to the proper places.  

<p>
Anyone that has used <em>TIA</em> or <em>TERM</em> has seen this concept 
before.  Using these two programs, you can redirect a port.  A friend had 
TIA setup to allow anyone using 192.251.139.21 port 4024 to connect to 
his Web Server.  The proxy server works like this, but backwards.  To 
connect to anyone else's port 80, you must use port 1080 (or whichever 
port you set it for).

<p>
The great thing about proxy servers is that they are completely secure, 
when configured correctly.  They <em>will not</em> allow someone in 
through them.

<sect>Setting This All Up

<p>
<sect1> Hardware requirements

<p>
For our example, the computer is a 486-DX66, 8 megs of memory, 500 megs 
Linux partition, with a PPP connection to it internet provider over a 
14.4 modem.  This setup is your basic Linux box.  To make it a firewall, 
we add one NE2000 Ethernet card.  It is then connected to 3 PC's running 
Windows 3.1 with Trumpet Winsock and 2 Suns running SunOS 4.1.  This setup 
was chosen because it is a fairly common and they are both platforms that 
I am familiar with.  I imagine much of the same stuff that I am talking 
about here is doable with Macs, but since I don't use Macs frequently 
enough, I don't really know.

<sect1>Setting up the Software

<p>
So, you have one Linux box connected to the net via a 14.4 PPP line.  You 
then have a Ethernet network connected to the Linux box and all the other 
computers.  First, you must recompile the Linux kernel with the 
appropriate options.  At this point, I would look at the 
<bf>Kernel HOWTO</bf>, the <bf>Ethernet HOWTO</bf>, and the 
<bf>NET-2 HOWTO</bf>.  Then, do a <tt>"make config"</tt>:

<enum>
<item>Turn on Networking Support
<item>Turn on TCP/IP Networking
<item>Turn off IP Forwarding (CONFIG_IP_FORWARD).
<item>Turn on IP Firewalling
<item>Probably turn on IP accounting.  Seems prudent since we are setting 
up a security measure
<item>Turn on Networking Device Support
<item>We turn on PPP and Ethernet support, but that depends on your 
interfaces
</enum>

Then, we recompile, reinstall the kernel and reboot.  The interfaces 
should show up in the boot-up sequence, and we should be fine.  If not, go 
over the other HOWTOs again until it is working.

<sect1>Configuring the Network Addresses

<p>
This is the real interesting part.  Since we do not want the internet to 
have access, we do not need to use real addresses.  One good C Class to 
use is 192.168.2.xxx, which was set aside as a dummy test domain.  Thus, no 
one uses it, and it will not conflict with any requests for the outside.  
So, in this configuration, only one real IP address is needed. The others 
are free for the taking and will not affect the network at all.

Assign the real IP to the serial port used for the PPP.  Assign 192.168.2.1 
to the Ethernet card on <tt>firewall</tt>.  Assign all the other machines 
in the protected network some number in that domain.

<sect1>Testing it out

<p>
First, try to ping the internet from <tt>firewall</tt>.  I used to use 
<tt>nic.ddn.mil</tt> as my test point.  It's still a good test, but has 
proven to be less reliable than I had hoped.  If it doesn't work at 
first, try pinging a couple other places that are not connected to your 
LAN.  If this doesn't work, then your PPP is incorrectly setup.  Reread 
the <bf>Net-2 HOWTO</bf>, and try again.
<p>
Now, try pinging between hosts within the protected network.  All the 
computers should be able to ping each other.  If not, go over the <bf>NET-2 
HOWTO</bf> again and work on the network some more.
<p>
Then, every machine in the protected network should be able to ping 
<tt>firewall</tt>.  If not, go back again.  Remember, they should be able 
to ping 192.168.2.1, not the PPP address.  
<p>
Then, try to ping the PPP address of <tt>firewall</tt> from inside the 
protected network.  If you can, then you have not turned off <em>IP 
Forwarding</em> and you will have to recompile the kernel.  Having 
assigned the protected network the 192.168.2.1 domain means that no packets 
will be routed to this network anyway, but it is safer to have IP 
Forwarding turned off anyway.  This leaves the control in your hands, not 
in the hands of your PPP provider.

<p>
Finally, ping each machine within the protected network from 
<tt>firewall</tt>.  By this time, there should be no problems.

<p>
Now, you have your basic firewall setup.

<sect1>Securing the Firewall

<p>
The firewall is no good if it is left wide open to attacks.  First, look 
at /etc/inetd.conf.  This file is what is called a "super server".  It 
runs a bunch of the server daemons as they are requested.  Examples are:

<itemize>
<item>Telnet
<item>Talk
<item>FTP
<item>Daytime
</itemize>

Turn off everything that is not needed.  Definitely turn off netstat, 
systat, tftp, bootp, and finger.  You might also want to turn off telnet, 
and only allow rlogin, or vica-versa.  To turn a service off, merely put 
a &num; in front of it.  Then, send a SIG-HUP to the process by typing kill 
-HUP &lt;pid&gt;, where pid is the process number of inetd.  This will make 
inetd re-read its configuration file (inetd.conf) and restart.  Test it 
out by telneting to port 15 on <tt>firewall</tt>, the netstat port.  If 
you get an output of netstat, you have not restarted it correctly.

<sect> Firewalling Software

<sect1>Available packages

<p>
Strict firewalling does not need any software except the Linux kernel and 
the base networking packages (inetd, telnetd and telnet, ftpd and ftp).  
But, a firewall like this is extremely restrictive and not very useful. 

<p>
So, software packages have been made to make a firewall more useful.  The 
one that I would like to examine in most detail is a package called 
"<em>socks</em>" which is a <tt>proxy server</tt>.  But, there are two 
other programs that you might want to keep in mind.  I would like to give 
you a short review of them now.

<sect1>The TIS Firewall Toolkit

<p>
<em>TIS</em> has put out a collection of programs designed to facilitate 
firewalling.  The programs do basically the same thing as the 
<em>Socks</em> package, but with a different design strategy.  Where 
<tt>Socks</tt> has one program that covers all Internet transactions, 
<tt>TIS</tt> has provided one program for each utility that wishes to use 
the firewall.

To better contrast the two, lets take the example of <em>World Wide 
Web</em> and <em>Telnet</em> access.  With <tt>Socks</tt>, you set up one 
configuration file and one daemon.  Through this file and daemon, both 
<tt>Telnet</tt> and <tt>WWW</tt> are enabled, as well as any other 
service that you have not disabled.

With the <tt>TIS toolkit</tt>, you set up one daemon for each 
<tt>WWW</tt> and <tt>Telnet</tt>, as well as configuration files for 
each.  After you have done this, other Internet access is still 
prohibited until explicitly set up.  If a daemon for a specific utility 
has not been provided (like talk), there is a <em>"plug-in"</em> daemon, 
but it is neither as flexible, nor as easy to set up, as the other tools.

This might seem a minor difference, but it makes a major difference.  
<tt>Socks</tt> allows you to be sloppy.  With a poorly set up 
<tt>Socks</tt> server, someone from the inside could gain more access to the 
Internet than was originally intended.  With the <tt>TIS toolkit</tt>, 
the people on the inside have only the access the system administrator 
wants them to have.

<tt>Socks</tt> is easier to set up, easier to compile and allows for 
greater flexibility.  The <tt>TIS toolkit</tt> is more secure if you want 
to regulate the users <em>inside</em> the protected network.  <bf>Both 
provide absolute protection from the outside</bf>.

<sect1>TCP Wrapper

<p>
TCP wrapper is not a firewalling utility, but it allows for many of the 
same effects.  Using TCP wrapper, you can control who has access to your 
machine and to what services as well as keep logs of the connections.  It 
does basic forgery detection also.

TCP wrapper is not covered more extensively here because of a couple of 
reasons.

<itemize>
<item>It is not a real firewall.
<item>To use it, you have to be connected to the Internet, thus you have 
to have an IP address.
<item>It only controls the machine it is installed on, and is thus not 
good for a network.  Firewalls can protect every machine of every 
architecture.  TCP wrapper won't work on Macintoshes and MS Windows machines.
</itemize>

<sect1>Ipfw and Ipfw Admin

<p>

<sect> The Proxy Server

<sect1>Setting up the Proxy Server

<p>
The proxy server requires additional software.  You can get this software 
from 
<tt>ftp://sunsite.unc.edu/pub/Linux/system/Network/misc/socks-linux-src.tgz</tt>.
There is also an example config file in that directory called 
<tt>"socks-conf"</tt>.  Uncompress and untar the files into a directory 
on your system, and follow the instructions on how to make it.  I had a 
couple problems in making it.  Make sure that the Makefiles are correct.  
Some are, some are not.
<p>
One important thing to note is that the proxy server needs to be added to 
/etc/inetd.conf.  You must add a line:

socks	stream	tcp	nowait	nobody	/usr/local/etc/sockd	sockd

to tell the server to run when requested.

<sect1>Configuring the Proxy Server

<p>
The socks program needs two separate configuration files.  One to tell 
the access allowed, and one to route the requests to the appropriate 
proxy server.  The access file should be housed on the server.  The 
routing file should be housed on every Un*x machine.  The DOS and, 
presumably, Macintosh computers will do their own routing.

<sect2>The Access File

<p>
With socks4.2 Beta, the access file is called <tt>"sockd.conf"</tt>.  It 
should contain 2 lines, a permit and a deny line.   Each line will have 
three entries:
<itemize>
<item>The Identifier (permit/deny)
<item>The IP address
<item>The address modifier
</itemize>

The identifier is either permit or deny.  You should have both a permit and 
a deny line.

The IP address holds a four byte address in typical IP dot notation.  Ie 
192.168.2.0.  

The address modifier is also a typical IP address four byte number.  It 
works like a netmask.  Envision this number to be 32 bits (1s or 0s).  If 
the bit is a 1, the corresponding bit of the address that it is checking 
must match the corresponding bit in the IP address field.  For instance, 
if the line is:

<tt>permit 192.168.2.23 255.255.255.255</tt>

then, it will permit only the IP address that matches every bit in 
192.168.2.23, eg, only 192.168.2.3.  The line:

<tt>permit 192.168.2.0 255.255.255.0</tt>

will permit every number within group 192.168.2.0 through 192.168.2.255, the 
whole C Class domain.   One should not have the line:

<tt>permit 192.168.2.0 0.0.0.0</tt>

as this will permit every address, regardless.

So, first permit every address you want to permit, and then deny the 
rest.  To allow everyone in the domain 192.168.2.xxx, the lines:

<tt>permit 192.168.2.0 255.255.255.0</tt><p>
<tt>deny 0.0.0.0 0.0.0.0</tt>

will work nicely.  Notice the first <tt>"0.0.0.0"</tt> in the deny line.  
With a modifier of 0.0.0.0, the IP address field does not matter.  All 
0's is the norm because it is easy to type.

More than one entry of each is allowed.

Specific users can also be granted or denied access.  This is done via 
<em>ident</em> authentication.  Not all systems support <em>ident</em>, 
including Trumpet Winsock, so I will not go into it here.  The 
documentation with socks is quite adequate on this subject.

<sect2>The Routing File

<p>
The routing file in socks is poorly named <bf>"socks.conf"</bf>.  I say 
"poorly named" because it is so close to the name of the access file that 
it is easy to get the two confused.  

<p>
The routing file is there to tell the socks clients when to use socks and 
when not to.  For instance, in our network, 192.168.2.3 will not need to 
use socks to talk with 192.168.2.1, <tt>firewall</tt>.  It has a direct 
connection in via Ethernet.  It defines 127.0.0.1, the loopback, 
automatically.  Of course you do not need socks to talk to yourself.  
There are three entries:
<itemize>
<item>deny
<item>direct
<item>sockd
</itemize>

Deny tells socks when to reject a request.  This entry has the 
same three fields as in <tt>sockd.conf</tt>, identifier, address and 
modifier.  Generally, since this is also handled by <tt>sockd.conf</tt>, 
the access file, the modifier field is set to 0.0.0.0.  If you want to 
preclude yourself from calling any place, you can do it here.

<p>
The direct entry tells which addresses to <em>not</em> use socks for.  
These are all the addresses that can be reached without the proxy 
server.  Again we have the three fields, identifier, address and 
modifier.  Our example would have

direct 192.168.2.0 255.255.255.0

Thus going direct for any on our protected network.

<p>
The sockd entry tells the computer which host has the socks server daemon 
on it.  The syntax is:

<tt>sockd @=&lt;serverlist&gt; &lt;IP address&gt; &lt;modifier&gt;</tt>

Notice the @= entry.  This allows you to set the IP addresses of a list 
of proxy servers.  In our example, we only use one proxy server.  But, 
you can have many to allow a greater load and for redundancy in case of 
failure.

<p>
The IP address and modifier fields work just like in the other examples.  
You specify which addresses go where through these.

<sect2>DNS from behind a Firewall

<p>
Setting up Domain Name service from behind a firewall is a relatively 
simple task.  You need merely to set up the DNS on the firewalling 
machine.  Then, set each machine behind the firewall to use this DNS.

<sect1>Working With a Proxy Server

<p>
<sect2>Unix

<p>
To have your applications work with the proxy server, they need to be 
"sockified".  You will need two different telnets, one for direct 
communication, one for communication via the proxy server.  Socks comes 
with instructions on how to sockify a program, as well as a couple 
pre-sockified programs.  If you use the sockified version to go somewhere 
direct, socks will automatically switch over to the direct version for 
you.  Because of this, we want to rename all the programs on our 
protected network and replace them with the sockified programs.  "Finger" 
becomes "finger.orig", "telnet" becomes "telnet.orig", etc.  You must 
tell socks about each of these via the include/socks.h file.  

<p>
Certain programs will handle routing and sockifying itself.  
<em>Netscape</em> is one of these.  You can use a proxy server under 
<em>Netscape</em> by entering the server's address (192.168.2.1 in our 
case) in the <bf>SOCKs</bf> field under <bf>Proxies</bf>.  Each 
application will need at least a little messing with, regardless of how 
it handles a proxy server.

<sect2>MS Windows with Trumpet Winsock

<p>
Trumpet Winsock comes with built in proxy server capabilities.  In the 
"setup" menu, enter the IP address of the server, and the addresses of 
all the computers reachable directly.  Trumpet will then handle all 
outgoing packets.

<sect1>Getting the Proxy Server to work with UDP Packets

<p>
The socks package works only with <em>TCP</em> packets, not 
<em>UDP</em>.  This makes it quite a bit less useful.  Many useful 
programs, such as talk and Archie, use UDP.  There is a 
package designed to be used as a proxy server for UDP 
packets called UDPrelay, by Tom Fitzgerald &lt;fitz@wang.com&gt;. 
Unfortunately, at the time of this writing, it is not compatible with Linux.

<sect1>Drawbacks with Proxy Servers

<p>
The proxy server is, above all, a <em>security device</em>.  Using it to 
increase internet access with limited IP addresses will have many 
drawbacks.  A proxy server will allow greater access from inside the 
protected network to the outside, but will keep the inside completely 
unaccessible from the outside.  This means no servers, talk or 
Archie connections, or direct mailing to the inside computers.  These 
drawbacks might seem slight, but think of it this way:
<itemize>
<item>You have left a report you are doing on your computer inside a 
firewall protected network.  You are at home, and decide that you would 
like to go over it.  You can not.  You can not reach your computer 
because it is behind the firewall.  You try to log into <tt>firewall</tt> 
first, but since everyone has proxy server access, no one has set up an 
account for you on it.
<item>Your daughter goes to college.  You want to email her.  You have 
some private things to talk about, and would rather have your mail sent 
directly to your machine.  You trust your systems administrator 
completely, but still, this is private mail.  
<item>The inability to use UDP packets represents a big drawback with the 
proxy servers.  I imagine UDP capabilities will be coming shortly.
</itemize>
<p>
FTP causes another problem with a proxy server.  When <tt>get</tt>ing or 
doing an <tt>ls</tt>, the FTP server opens a socket on the client machine 
and sends the information through it.  A proxy server will not allow 
this, so FTP doesn't particularly work.
<p>
And, proxy servers run slow.  Because of the greater overhead, almost any 
other means of getting this access will be faster.
<p>
Basically, if you have the IP addresses, and you are not worried about 
security, do not use a firewall and/or proxy servers.  If you do not have 
the IP addresses, but you are also not worried about security, you might 
also want to look into using an IP emulator, like Term, Slirp or TIA.  
Term is available from <tt>ftp://sunsite.unc.edu</tt>, Slirp is available 
from ftp://blitzen.canberra.edu.au/pub/slirp, and TIA is available from 
<tt>marketplace.com</tt>.  These packages will run faster, allow better 
connections, and provide a greater level of access to the inside 
network from the internet.  Proxy servers are good for those networks 
which have a lot of hosts that will want to connect to the internet on 
the fly, with one setup and little work after that.  

<sect>Advanced Configurations

<p>
There is one configuration I would like to go over before wrapping this 
document up.  The one I have just outlined will probably suffice for most 
people.  However, I think the next outline will show a more advanced 
configuration that can clear up some questions.  If you have questions 
beyond what I have just covered, or are just interested in the 
versatility of proxy servers and firewalls, read on.

<sect1>A large network with emphasis on security

<p>
Say, for instance, you are the leader of the <em>Milwaukee 23rd Discordian 
Cabal</em>.  You wish to network your site.  You have 50 computers and a 
subnet of 32 (5 bits) IP numbers.  You have various levels of access.  You 
tell your disciples different things according to each level.  Obviously, 
you would want to protect certain parts of the network from the 
disciples that are not in that level.  

<p>
<em>Disclaimer:</em>
I am not a member of the Discordians.  I do not know their terminology, 
nor do I really care.  I am using them as an example only.  Please send 
all flames to 

The levels are:
<enum>
<item><bf>The external level</bf>.  This is the level that gets shown to 
everybody.  Basically, this is the ranting and raving about Eris, Goddess 
of Discord, and all the rest of the drivel.
<item><bf>Sage</bf>  This is the level of people who have gotten beyond 
the external level.  Here is where you tell them that discord and 
structure are really one, and that Eris is also Jehovah.
<item><bf>Adept</bf>  Here is where the <em>real</em> plan is.  In this 
level is stored all the information on how the Discordian Society is 
going to take over the world through a devious, yet humorous, plan 
involving Newt Gingrich, Wheaties Cereal, O.J. Simpson, and five hundred 
crystals, all erroneously marked "6.5 MHz".
</enum>

<sect2>The Network Setup

<p>
The IP numbers are arranged as:
<itemize>
<item>1 number is 192.168.2.255, which is the broadcast address and is not 
usable.
<item>23 of the 32 IP addresses are allocated to 23 machines that will be 
accessible to the internet.
<item>1 extra IP goes to a linux box on that network
<item>1 extra goes to a different linux box on that network.
<item>2 IP &num;'s go to the router
<item>4 are left over, but given domain names paul, ringo, john, and george, 
just to confuse things a bit.
<item>The protected networks both have the addresses 192.168.2.xxx
</itemize>

Then, two separate networks are built, each in different rooms.  They are 
routed via Infrared Ethernet so that they are completely invisible to the 
outside room.  Luckily, infrared Ethernet works just like normal Ethernet 
(or so i think), so we can just think of them like normal.

These networks are each connected to one of the linux boxes with an extra 
IP address.

There is a file server connecting the two protected networks.  This is 
because the plans for taking over the world involves some of the higher 
sages.  The file server holds the address <tt>192.168.2.17</tt> for the sage 
network and <tt>192.168.2.23</tt> for the adept network.  It has to have 
different IP addresses because it has to have different Ethernet cards.  
IP Forwarding on it is <bf>turned off</bf>.

IP Forwarding on both Linux boxes is also turned off.  The router will 
not forward packets destined for 192.168.2.xxx unless explicitly told to do 
so, so the internet will not be able to get in.  The reason for turning 
off IP Forwarding here is so that packets from the sage network will not 
be able to reach the adept network, and vica versa.

The NFS server can also be set to offer different files to the different 
networks.  This can come in handy, and a little trickery with symbolic 
links can make it so that the common files can be shared with all.  Using 
this setup and another Ethernet card can offer this one file server for 
all three networks.

<sect2>The Proxy Setup

<p>
Now, since all three levels want to be able to monitor the network for 
their own devious purposes, all three need to have net access.  The 
external network is connected directly into the internet, so we don't 
have to mess with proxy servers here.  The adept and sage networks are 
behind firewalls, so it is necessary to set up proxy servers here.

Both networks will be setup very similarly.  They both have the same IP 
addresses assigned to them.  I will throw in a couple of parameters, just 
to make things more interesting though.

<enum>
<item>No one can use the file server for internet access.  This exposes 
the file server to viruses and other nasty things, and it is rather 
important, so its off limits.
<item>We will not allow Sage access to the World Wide Web.  They are in 
training, and this kind of information retrieval power might prove to be 
damaging.
</enum>

So, the sockd.conf file on the sage linux box will have this line:

<tt>deny 192.168.2.17 255.255.255.255</tt>

and on the adept machine:

<tt>deny 192.168.2.23 255.255.255.255</tt>

And, the sage linux box will have this line

<tt>deny 0.0.0.0 0.0.0.0 eq 80</tt>

This says to deny access to all machines trying to access the port equal 
(<em>eq</em>) to 80, the http port.  This will still allow all other 
services, just deny Web access.

Then, both files will have:

<tt>permit 192.168.2.0 255.255.255.0</tt>

to allow all the computers on the 192.168.2.xxx network to use this proxy  
server except for those that have already been denied (ie. the file 
server and Web access from the sage network).

<p>
The sage sockd.conf file will look like:

<tt>deny 192.168.2.17 255.255.255.255</tt><p>
<tt>deny 0.0.0.0 0.0.0.0 eq 80</tt><p>
<tt>permit 192.168.2.0 255.255.255.0</tt>

and the adept file will look like:

<tt>deny 192.168.2.23 255.255.255.255</tt><p>
<tt>permit 192.168.2.0 255.255.255.0</tt>

<p>
This should configure everything correctly.  Each network is isolated 
accordingly, with the proper amount of interaction.  Everyone should be 
happy.  Now, <em>look out for your 6.5 MHz crystals</em>
</article>
