home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / IP_MASQU < prev    next >
Encoding:
Text File  |  1996-08-18  |  48.4 KB  |  1,268 lines

  1.   Linux IP Masquerade mini HOWTO
  2.   Ambrose Au, achau@wwonline.com
  3.   v0.80, August 17, 1996
  4.  
  5.   This document describes how to enable IP masquerade feature on a Linux
  6.   host, allowing connected computers that do not have registered Inter¡
  7.   net IP addresses to connect to the Internet through your Linux box.
  8.  
  9.   1.  Introduction
  10.  
  11.   1.1.  Introduction
  12.  
  13.   This document describes how to enable IP masquerade feature on a Linux
  14.   host, allowing connected computers that do not have registered
  15.   Internet IP addresses to connect to the Internet through your Linux
  16.   box.  It is possible to connect your machines to the Linux host with
  17.   ethernet, as well as other kinds of connection such as a dialup ppp
  18.   link. This document will emphasize on ethernet connection, since it
  19.   should be the most likely case.
  20.  
  21.        This document is intended for users using kernel 2.x, which
  22.        should also apply to later 1.3.x kernels.
  23.  
  24.   1.2.  Foreword, Feedback & Credits
  25.  
  26.   First of all, I would like to let you know that I am *NOT* a
  27.   knowledgeable nor an experienced user of IP masquerade.
  28.  
  29.   I find it very confusing as a new user setting up IP masquerade on a
  30.   newer kernel, i.e. 2.x kernel.  Although there is a FAQ and a mailing
  31.   list, there is no document dedicates on that; and there are some
  32.   requests on the mailing list for such a HOWTO. So, I decided to write
  33.   this up as a starting point for new users, and possibly a building
  34.   block for knowledgeable users to build on for documentation. If you
  35.   think I'm not doing a good job, feel free to tell me so that I can
  36.   make it better.
  37.  
  38.   This document is heavily based on the original FAQ by Ken Eves , and
  39.   numerous helpful messages in the ip_masq mailing list. And a special
  40.   thanks to Mr. Matthew Driver whose mailing list message inspired me to
  41.   set up ip_masq and eventually writing this.
  42.  
  43.   Please feel free to send any feedback or comments to
  44.   achau@wwonline.com if I'm mistaken on any information, or if any
  45.   information is missing. Your invaluable feedback will certainly be
  46.   influencing the future of this HOWTO!
  47.  
  48.   If you have any technical questions on IP Masquerade, please join the
  49.   IP Masquerade Mailing List instead of sending email to me since I have
  50.   limited time, and the developers of IP_Masq are more capable of
  51.   answering your questions.
  52.  
  53.   The latest version of this document can be found at the IP Masquerade
  54.   Resource, which also contains the HTML and postscript version:
  55.  
  56.   ╖  http://www.hwy401.com/achau/ipmasq/
  57.  
  58.   ╖  http://www.undergrad.math.uwaterloo.ca/~ach2au
  59.  
  60.   1.3.  Copyright & Disclaimer
  61.  
  62.   This document is copyright(c) 1996 Ambrose Au, and it's a free
  63.   document. You can redistribute it under the terms of the GNU General
  64.   Public License.
  65.  
  66.   The information and other contents in this document are to the best of
  67.   my knowledge. However, ip_masq is experimental, and there is chance
  68.   that I make mistakes as well; so you should determine if you want to
  69.   follow the information in this document.
  70.  
  71.   Nobody is responsible for any damage on your computers and any other
  72.   losses by using the information on this document. i.e.
  73.  
  74.        THE AUTHOR IS NOT RESPONSIBLE FOR ANY DAMAGES INCURRED DUE
  75.        TO ACTIONS TAKEN BASED ON THE INFORMATION IN THIS DOCUMENT.
  76.  
  77.   2.  Background Knowledge
  78.  
  79.   2.1.  What is IP Masquerade?
  80.  
  81.   IP Masquerade is a developing networking function in Linux. If a Linux
  82.   host is connected to the Internet with IP Masquerade enabled, then
  83.   computers connecting to it (either on the same LAN or connected with
  84.   modems) can reach the Internet as well, even though they have no
  85.   official assigned IP addresses.
  86.  
  87.   This allows a set of machines to invisibly access the Internet hidden
  88.   behind a gateway system, which appears to be the only system using the
  89.   Internet.  Breaking the security of a well set-up masquerading system
  90.   should be considerably more difficult than breaking a good packet
  91.   filter based firewall (assuming there are no bugs in either).
  92.  
  93.   2.2.  Current Status
  94.  
  95.   IP Masquerade is still at its experimental stages. However, kernels
  96.   since 1.3.x had built-in support already. Browsing web pages and
  97.   telnet are reported to work well over ip_masq. FTP, IRC and listening
  98.   to Real Audio are working with certain modules loaded. Other network
  99.   streaming audio such as True Speech and Internet Wave work too. Some
  100.   fellow users on the mailing list even tried video conferencing
  101.   software.
  102.  
  103.   Ping is not fully working yet, it normally only works for TCP and UDP
  104.   (masquerading needs port numbers). It will work for ICMP packets that
  105.   contain information about an original TCP or UDP packet, masquerading
  106.   will not work for ICMP packets that do not contain port data. For
  107.   example, traceroute should work, ping will not.
  108.  
  109.   Please refer to section 4.3 for a more complete listing of software
  110.   supported.
  111.  
  112.   IP Masquerade works well with 'client machines' on several different
  113.   OS and platforms. There are successful cases with systems using Unix,
  114.   Windows 95, Windows NT, Windows for Workgroup(with TCP/IP package),
  115.   OS/2, Macintosh System's OS with Mac TCP, Mac Open Transport, DOS with
  116.   NCSA Telnet package, VAX, Alpha with Linux, and even Amiga with AmiTCP
  117.   or AS225-stack.
  118.  
  119.   2.3.  Who Can Benefit From IP Masquerade?
  120.  
  121.   ╖  If you have a Linux host connected to the Internet, and
  122.  
  123.   ╖  if you have some computers running TCP/IP connected to that Linux
  124.      box on a local subnet, and/or
  125.  
  126.   ╖  if your Linux host has more than one modem and acts as a PPP or
  127.      SLIP server connecting to others, which
  128.  
  129.   ╖  those OTHER machines do not have official assigned IP addresses.
  130.      (these machines are represented by OTHER machines hereby)
  131.  
  132.   ╖  And of course, if you want those OTHER machines to make it onto the
  133.      Internet without spending extra bucks :)
  134.  
  135.   2.4.  Who Doesn't Need IP Masquerade?
  136.  
  137.   ╖  If your machine is a stand-alone Linux host connected to the
  138.      Internet, then it is pointless to have ip_masq running, or
  139.  
  140.   ╖  if you already have assigned addresses for your OTHER machines,
  141.      then you don't need IP Masquerade to have a firewall,
  142.  
  143.   ╖  and of course, if you don't like the idea of a 'free ride'.
  144.  
  145.   2.5.  How IP Masquerade Works?
  146.  
  147.   From IP Masquerade FAQ by Ken Eves:
  148.  
  149.     Here is a drawing of the most simple setup:
  150.  
  151.        SLIP/PPP         +------------+                         +-------------+
  152.        to provider      |  Linux     |       SLIP/PPP          | Anybox      |
  153.       <---------- modem1|            |modem2 ----------- modem |             |
  154.         111.222.333.444 |            |           192.168.1.100 |             |
  155.                         +------------+                         +-------------+
  156.  
  157.       In the above drawing a Linux box with ip_masquerading installed and
  158.     running is connected to the Internet via SLIP/or/PPP using modem1.  It has
  159.     an assigned IP address of 111.222.333.444.  It is setup that modem2 allows
  160.     callers to login and start a SLIP/or/PPP connection.
  161.  
  162.       The second system (which doesn't have to be running Linux) calls into the
  163.     Linux box and starts a SLIP/or/PPP connection.  It does NOT have an assigned
  164.     IP address on the Internet so it uses 192.168.1.100. (see below)
  165.  
  166.       With ip_masquerade and the routing configured properly the machine
  167.     Anybox can interact with the Internet as if it was really connected (with a
  168.     few exceptions).
  169.  
  170.   Quoting Pauline Middelink:
  171.     Do not forget to mention the ANYBOX should have the Linux box
  172.     as its gateway (whether is be the default route or just a subnet
  173.     is no matter). If the ANYBOX can not do this, the Linux machine
  174.     should do a proxy arp for all routed address, but the setup of
  175.     proxy arp is beyond the scope of the document.
  176.  
  177.   The following is an excerpt from a post on comp.os.linux.networking which
  178.   has been edited to match the names used in the above example:
  179.      o I tell machine ANYBOX that my slipped linux box is its gateway.
  180.      o When a packet comes into the linux box from ANYBOX, it will assign it
  181.        new source port number, and slap its own ip address in the packet
  182.        header, saving the originals.  It will then send the modified packet
  183.        out over the SLIP/or/PPP interface to the Internet.
  184.      o When a packet comes from the Internet to the linux box, if the port
  185.        number is one of those assigned above, it will get the original
  186.        port and ip address, put them back in the packet header, and send the
  187.        packet to ANYBOX.
  188.      o The host that sent the packet will never know the difference.
  189.  
  190.   An IP Masquerading Example
  191.  
  192.   typical example is given in the diagram below:-
  193.  
  194.       +----------+
  195.       |          |  Ethernet
  196.       | abox     |::::::
  197.       |          |2    :192.168.1.x
  198.       +----------+     :
  199.                        :   +----------+   PPP
  200.       +----------+     :  1|  Linux   |   link
  201.       |          |     ::::| masq-gate|:::::::::// Internet
  202.       | bbox     |::::::   |          |
  203.       |          |3    :   +----------+
  204.       +----------+     :
  205.                        :
  206.       +----------+     :
  207.       |          |     :
  208.       | cbox     |::::::
  209.       |          |4
  210.       +----------+
  211.  
  212.       <-Internal Network->
  213.  
  214.   In this example there are 4 computer systems that we are concerned
  215.   about (there is presumably also something on the far right that your
  216.   IP connection to the internet comes through, and there is something
  217.   (far off the page) on the internet that you are interested in exchang¡
  218.   ing information with).  The Linux system masq-gate is the masquerading
  219.   gateway for the internal network of machines abox, bbox and cbox to
  220.   get to the internet.  The internal network uses one of the assigned
  221.   private network addresses, in this case the class C network
  222.   192.168.1.0, with the linux box having address 192.168.1.1 and the
  223.   other systems having addresses on that network.
  224.  
  225.   The three machines abox, bbox and cbox (which can, by the way, be
  226.   running any operating system as long as they can speak IP - such as
  227.   Windows 95, Macintosh MacTCP or even another linux box) can connect to
  228.   other machines on the internet, however the masquerading system masq-
  229.   gate converts all of their connections so that they appear to
  230.   originate from masq-gate, and arranges that data coming back in to a
  231.   masqueraded connection is relayed back to the originating system - so
  232.   the systems on the internal network see a direct route to the internet
  233.   and are unaware that their data is being masqueraded.
  234.  
  235.   2.6.  Requirements for Using IP Masquerade on Linux 2.x
  236.  
  237.   ╖  Kernel 2.x source available from
  238.      ftp://ftp.funet.fi/pub/Linux/kernel/src/v2.0/
  239.      (Yes, you'll have to compile your kernel with certain supports....)
  240.  
  241.   ╖  Loadable kernel modules, preferably 2.0.0 available from
  242.      http://www.pi.se/blox/modules/modules-2.0.0.tar.gz
  243.      (modules-1.3.57 is the minimal requirement)
  244.  
  245.   ╖  A well set up TCP/IP network
  246.      covered in Linux NET-2 HOWTO
  247.      <http://www.caldera.com/LDP/HOWTO/NET-2-HOWTO.html> and the Network
  248.      Administrator's Guide <http://linuxwww.db.erau.edu/NAG/>
  249.  
  250.   ╖  Connectivity to Internet for your Linux host
  251.      covered in Linux ISP Hookup HOWTO
  252.      <http://www.caldera.com/LDP/HOWTO/ISP-Hookup-HOWTO.html> and Linux
  253.      PPP-over-ISDN mini-HOWTO
  254.      <http://www.caldera.com/LDP/HOWTO/mini/PPP-over-ISDN>
  255.   ╖  Ipfwadm 2.3 available from
  256.      ftp://ftp.xos.nl/pub/linux/ipfwadm/ipfwadm-2.3.tar.gz
  257.      more information on version requirement is on the Linux Ipfwadm
  258.      page <http://www.xos.nl/linux/ipfwadm/>
  259.  
  260.   ╖  IP Masquerade ftp patch for kernel 2.0.0
  261.      <http://www.hwy401.com/achau/ipmasq/ip_masq_app.c.gz> writen by
  262.      Miquel van Smoorenburg  (NOT necessary for kernel 2.0.1 and above)
  263.  
  264.   ╖  Keep Alive Support patch
  265.      <http://www.hwy401.com/achau/ipmasq/ip_masq_ftpalive.patch.gz>
  266.      writen by Keith Owens  (this patch will not be included in the
  267.      kernel distribution till 2.1.x development kernels)
  268.  
  269.   3.  Setting Up IP Masquerade
  270.  
  271.        If your private network contains any vital information,
  272.        think twice before using IP Masquerade.  This may be a GATE¡
  273.        WAY for you to get to the Internet, and vice versa for some¡
  274.        one on the other side of the world to get into your network.
  275.  
  276.   3.1.  Compiling the Kernel for IP Masquerade Support
  277.  
  278.   ╖  First of all, you need the kernel source (preferably stable kernel
  279.      version 2.0.0 or above)
  280.  
  281.   ╖  If this is your first time compiling the kernel, don't be scared.
  282.      In fact, it's rather easy and it's covered in Linux Kernel HOWTO
  283.      <http://www.caldera.com/LDP/HOWTO/Kernel-HOWTO.html>.
  284.  
  285.   ╖  Unpack the kernel source to /usr/src/ with a command: tar xvzf
  286.      linux-2.0.x.tar.gz -C /usr/src, where x is the patch level beyond
  287.      2.0
  288.      (make sure there is a directory or symbolic link called linux )
  289.  
  290.   ╖  Apply the ftp patch for kernel 2.0.0
  291.      <http://www.hwy401.com/achau/ipmasq/ip_masq_app.c.gz>:
  292.  
  293.        ╖  You don't need this patch with kernel 2.0.1 and above
  294.  
  295.        ╖  this is not an usual diff patch.  You should copy this
  296.           file to yourLinuxSourceDirectory/net/ipv4/ip_masq_app.c
  297.  
  298.   ╖  Apply the Keep Alive Support patch
  299.      <http://www.hwy401.com/achau/ipmasq/ip_masq_ftpalive.patch.gz> (not
  300.      in kernel 2.0.4 yet...):
  301.  
  302.        ╖  copy the patch file to /usr/src/, then gunzip
  303.           ip_masq_ftpalive.patch.gz
  304.  
  305.   ╖  apply the patch by typing patch < ip_masq_ftpalive.patch
  306.  
  307.   ╖  CU-Seeme user may also want to apply the CU-Seeme patch
  308.      <http://www.hwy401.com/achau/ipmasq/ip_masq_cuseeme.c.gz> :
  309.  
  310.        ╖  In order to get ip_masq_cuseeme to compile with "make
  311.           modules", you have to add ip_masq_cuseeme.o to the M_OBJS
  312.           line in the net/ipv4/Makefile that also has
  313.           ip_masq_ftp.o, ip_masq_irc.o, etc.
  314.  
  315.   ╖  Refer to the Kernel HOWTO and the README file in the kernel source
  316.      directory for further instructions on compiling a kernel
  317.  
  318.   ╖  Here are the options that you need to compile in:
  319.  
  320.      Say YES to the following,
  321.  
  322.          * Prompt for development and/or incomplete code/drivers
  323.            CONFIG_EXPERIMENTAL
  324.            - this will allow you to select experimental ip_masq code compiled
  325.              into the kernel
  326.  
  327.          * Enable loadable module support
  328.            CONFIG_MODULES
  329.            - allows you to load modules
  330.  
  331.          * Networking support
  332.            CONFIG_NET
  333.  
  334.          * Network firewalls
  335.            CONFIG_FIREWALL
  336.  
  337.          * TCP/IP networking
  338.            CONFIG_INET
  339.  
  340.          * IP: forwarding/gatewaying
  341.            CONFIG_IP_FORWARD
  342.  
  343.          * IP: firewalling
  344.            CONFIG_IP_FIREWALL
  345.  
  346.          * IP: masquerading (EXPERIMENTAL)
  347.            CONFIG_IP_MASQUERADE
  348.            - although it is experimental, it is a *MUST*
  349.  
  350.          * IP: always defragment
  351.            CONFIG_IP_ALWAYS_DEFRAG
  352.            - highly recommended
  353.  
  354.          * Dummy net driver support
  355.            CONFIG_DUMMY
  356.            - recommended
  357.  
  358.   NOTE: These are just the component you need for ip_masq, select
  359.   whatever other options you need for your specific setup.
  360.  
  361.   ╖  After compiling the kernel, you should compile and install the
  362.      modules:
  363.  
  364.        make modules; make modules_install
  365.  
  366.   ╖  Then you should add a few lines into your /etc/rc.d/rc.local file
  367.      (or any file you think is appropriate) to load the required modules
  368.      reside in /lib/modules/2.0.x/ipv4/ automatically during each
  369.      reboot:
  370.  
  371.                .
  372.                .
  373.                .
  374.        /sbin/depmod -a
  375.        /sbin/modprobe ip_masq_ftp.o
  376.        /sbin/modprobe ip_masq_raudio.o
  377.        /sbin/modprobe ip_masq_irc.o
  378.                .
  379.                .
  380.                .
  381.  
  382.   Note: You can also load it manually before using ip_masq, but DON'T
  383.   use kerneld for this!
  384.   If your modules are not loading, you may want to take out the '.o'
  385.   extension
  386.  
  387.   3.2.  Assigning Private Network IP Address
  388.  
  389.   Since all OTHER machines do not have official assigned addressees,
  390.   there must be a right way to allocate address to those machines.
  391.  
  392.   From IP Masquerade FAQ:
  393.  
  394.   There is an RFC (#1597) on which IP addresses are to be used on a non-
  395.   connected network.  There are 3 blocks of numbers set aside
  396.   specifically for this purpose. One which I use is 255 Class-C subnets
  397.   at 192.168.1.n to 192.168.255.n .
  398.  
  399.   From RCF 1597:
  400.  
  401.   Section 3: Private Address Space
  402.  
  403.   The Internet Assigned Numbers Authority (IANA) has reserved the
  404.   following three blocks of the IP address space for private networks:
  405.  
  406.                 10.0.0.0        -   10.255.255.255
  407.                 172.16.0.0      -   172.31.255.255
  408.                 192.168.0.0     -   192.168.255.255
  409.  
  410.   We will refer to the first block as "24-bit block", the second as
  411.   "20-bit block", and to the third as "16-bit" block".  Note that the
  412.   first block is nothing but a single class A network number, while the
  413.   second block is a set of 16 contiguous class B network numbers, and
  414.   third block is a set of 255 contiguous class C network numbers.
  415.  
  416.   So, if you're using a class C network, you should name your machines
  417.   as 192.168.1.1, 1.92.168.1.2, 1.92.168.1.3, ..., 192.168.1.x
  418.  
  419.   192.168.1.1 is usually the gateway machine, which is your Linux host
  420.   connecting to the Internet. Notice that 192.168.1.0 and 192.168.1.255
  421.   are the Network and Broadcast address respectively, which are
  422.   reserved. Avoid using these addresses on your machines.
  423.  
  424.   3.3.  Configuring the OTHER machines
  425.  
  426.   Besides setting the appropriate IP address for each machine, you
  427.   should also set the appropriate gateway. In general, it is rather
  428.   straight forward. You simply enter the address of your Linux host
  429.   (usually 192.168.1.1) as the gateway address.
  430.  
  431.   For the Domain Name Service, you can add in any DNS available. The
  432.   most apparent one should be the one that your Linux is using. You can
  433.   optionally add any domain search suffix as well.
  434.  
  435.   After you have reconfigured those IP addresses, remember to restart
  436.   the appropriate services or reboot your systems.
  437.  
  438.   The following configuration instructions assume that you are using a
  439.   Class C network with 192.168.1.1 as your Linux host's address. Please
  440.   note that 192.168.1.0 and 192.168.1.255 are reserved.
  441.  
  442.   3.3.1.  Configuring Windows 95
  443.  
  444.   1. If you haven't installed your network card and adapter driver, do
  445.      so now.
  446.  
  447.   2. Go to 'Control Panel'/'Network'.
  448.  
  449.   3. Add 'TCP/IP protocol' if you don't already have it.
  450.  
  451.   4. In 'TCP/IP properties', goto 'IP Address' and set IP Address to
  452.      192.168.1.x, (1 < x < 255), and then set Subnet Mask to
  453.      255.255.255.0
  454.  
  455.   5. Add 192.168.1.1 as your gateway under 'Gateway'.
  456.  
  457.   6. Under 'DNS Configuration'/'DNS Server search order' add your the
  458.      DNS that your Linux host uses (usually find in /etc/resolv.conf).
  459.      Optionally, you can add the appropriate domain search suffix.
  460.  
  461.   7. Leave all the other settings as they are unless you know what
  462.      you're doing.
  463.  
  464.   8. Click 'OK' on all dialog boxes and restart system.
  465.  
  466.   9. Ping the linux box to test the network connection: 'Start/Run',
  467.      type: ping 192.168.1.1
  468.      (This is only a LAN connection testing, you can't ping the outside
  469.      world yet.)
  470.  
  471.   10.
  472.      You can optionally create a HOSTS file in the windows directory so
  473.      that you can use hostname of the machines on your LAN.  There is an
  474.      example called HOSTS.SAM in the windows directory.
  475.  
  476.   3.3.2.  Configuring Windows for Workgroup 3.11
  477.  
  478.   1. If you haven't installed your network card and adapter driver, do
  479.      so now.
  480.  
  481.   2. Install the TCP/IP 32b package if you don't have it already.
  482.  
  483.   3. In 'Main'/'Windows Setup'/'Network Setup', click on 'Drivers'.
  484.  
  485.   4. Highlight 'Microsoft TCP/IP-32 3.11b' in the 'Network Drivers'
  486.      section, click 'Setup'.
  487.  
  488.   5. Set IP Address to 192.168.1.x (1 < x < 255), then set Subnet Mask
  489.      to 255.255.255.0 and Default Gateway to 192.168.1.1
  490.  
  491.   6. Do not enable 'Automatic DHCP Configuration' and put anything in
  492.      those 'WINS Server' input areas unless you're in a Windows NT
  493.      domain and you know what you're doing.
  494.  
  495.   7. Click 'DNS', fill in the appropriate information mentioned in STEP
  496.      6 of section 3.3.1, then click 'OK' when you're done with it.
  497.  
  498.   8. Click 'Advanced', check 'Enable DNS for Windows Name Resolution'
  499.      and 'Enable LMHOSTS lookup' if you're using a look up host file,
  500.      similar to the one mentioned in STEP 10 of section 3.3.1
  501.  
  502.   9. Click 'OK' on all dialog boxes and restart system.
  503.  
  504.   10.
  505.      Ping the linux box to test the network connection: 'File/Run',
  506.      type: ping 192.168.1.1
  507.      (This is only a LAN connection testing, you can't ping the outside
  508.      world yet.)
  509.  
  510.   3.3.3.  Configuring Windows NT 3.51
  511.  
  512.   1. If you haven't installed your network card and adapter driver, do
  513.      so now.
  514.  
  515.   2. Go to 'Main'/'Control Panel'/'Network'
  516.  
  517.   3. Add the TCP/IP Protocol and Related Component from the 'Add
  518.      Software' menu if you don't have TCP/IP service installed already.
  519.   4. Under 'Network Software and Adapter Cards' section, highlight
  520.      'TCP/IP Protocol' in the 'Installed Network Software' selection
  521.      box.
  522.  
  523.   5. In 'TCP/IP Configuration', select the appropriate adapter, e.g.
  524.      [1]Novell NE2000 Adapter.  Then set the IP Address to 192.168.1.x
  525.      (1 < x < 255), then set Subnet Mask to 255.255.255.0 and Default
  526.      Gateway to 192.168.1.1
  527.  
  528.   6. Do not enable 'Automatic DHCP Configuration' and put anything in
  529.      those 'WINS Server' input areas unless you're in a Windows NT
  530.      domain and you know what you're doing.
  531.  
  532.   7. Click 'DNS', fill in the appropriate information mentioned in STEP
  533.      6 of section 3.3.1, then click 'OK' when you're done with it.
  534.  
  535.   8. Click 'Advanced', check 'Enable DNS for Windows Name Resolution'
  536.      and 'Enable LMHOSTS lookup' if you're using a look up host file,
  537.      similar to the one mentioned in STEP 10 of section 3.3.1
  538.  
  539.   9. Click 'OK' on all dialog boxes and restart system.
  540.  
  541.   10.
  542.      Ping the linux box to test the network connection: 'File/Run',
  543.      type: ping 192.168.1.1
  544.      (This is only a LAN connection testing, you can't ping the outside
  545.      world yet.)
  546.  
  547.   3.3.4.  Configuring UNIX Based Systems
  548.  
  549.   1. If you haven't installed your network card and recompile your
  550.      kernel with the appropriate adapter driver, do so now.
  551.  
  552.   2. Install TCP/IP networking, such as the nettools package, if you
  553.      don't have it already.
  554.  
  555.   3. Set IPADDR to 192.168.1.x (1 < x < 255), then set NETMASK to
  556.      255.255.255.0, GATEWAY to 192.168.1.1, and BROADCAST to
  557.      192.168.1.255
  558.      For example, you can edit the /etc/sysconfig/network-scripts/ifcfg-
  559.      eth0 file on a Red Hat Linux system, or simply do it through the
  560.      Control Panel.
  561.      (it's different in SunOS, BSDi, Slackware Linux, etc...)
  562.  
  563.   4. Add your domain name service (DNS) and domain search suffix in
  564.      /etc/resolv.conf
  565.  
  566.   5. You may want to update your /etc/networks file depending on your
  567.      settings.
  568.  
  569.   6. Restart the appropriate services, or simply restart your system.
  570.  
  571.   7. Issue a ping command: ping 192.168.1.1  to test the connection to
  572.      your gateway machine.
  573.      (This is only a LAN connection testing, you can't ping the outside
  574.      world yet.)
  575.  
  576.   3.3.5.  Configuring DOS using NCSA Telnet package
  577.  
  578.   1. If you haven't installed your network card, do so now.
  579.  
  580.   2. Load the appropriate packet driver. For an NE2000 card, issue nwpd
  581.      0x60 10 0x300, with your network card set to IRQ 10 and hardware
  582.      address at 0x300
  583.  
  584.   3. Make a new directory, and then unpack the NCSA Telnet package:
  585.      pkunzip tel2308b.zip
  586.  
  587.   4. Use a text editor to open the config.tel file
  588.  
  589.   5. Set myip=192.168.1.x (1 < x < 255), and netmask=255.255.255.0
  590.  
  591.   6. In this example, you should set hardware=packet, interrupt=10,
  592.      ioaddr=60
  593.  
  594.   7. You should have at least one individual machine specification set
  595.      as the gateway, i.e. the Linux host:
  596.  
  597.        name=default
  598.        host=yourlinuxhostname
  599.        hostip=192.168.1.1
  600.        gateway=1
  601.  
  602.   8. Have another specification for a domain name service:
  603.  
  604.        name=dns.domain.com ; hostip=123.123.123.123; nameserver=1
  605.  
  606.   Note: substitute the appropriate information about the DNS that your
  607.   Linux host uses
  608.  
  609.   9. Save your config.tel file
  610.  
  611.   10.
  612.      Telnet to the linux box to test the network connection: telnet
  613.      192.168.1.1
  614.  
  615.   3.3.6.  Configuring MacOS Based System Running MacTCP
  616.  
  617.   1. If you haven't installed the appropriate driver software for your
  618.      Ethernet adapter, now would be a very good time to do so.
  619.  
  620.   2. Open the MacTCP control panel.  Select the appropriate network
  621.      driver (Ethernet, NOT EtherTalk) and click on the 'More...' button.
  622.  
  623.   3. Under 'Obtain Address:', click 'Manually'.
  624.  
  625.   4. Under 'IP Address:', select class C from the popup menu. Ignore the
  626.      rest of this section of the dialog box.
  627.  
  628.   5. Fill in the appropriate information under 'Domain Name Server
  629.      Information:'.
  630.  
  631.   6. Under 'Gateway Address:', enter 192.168.1.1
  632.  
  633.   7. Click 'OK' to save the settings.  In the main window of the MacTCP
  634.      control panel, enter the IP address of your Mac (192.168.1.x, 1 < x
  635.      < 255) in the 'IP Address:' box.
  636.  
  637.   8. Close the MacTCP control panel.  If a dialog box pops up notifying
  638.      you to do so, restart the system.
  639.  
  640.   9. You may optionally ping the Linux box to test the network
  641.      connection.  If you have the freeware program MacTCP Watcher, click
  642.      on the 'Ping' button, and enter the address of your Linux box
  643.      (192.168.1.1) in the dialog box that pops up.  (This is only a LAN
  644.      connection testing, you can't ping the outside world yet.)
  645.  
  646.   10.
  647.      You can optionally create a Hosts file in your System Folder so
  648.      that you can use the hostnames of the machines on your LAN.  The
  649.      file should already exist in your System Folder, and should contain
  650.      some (commented-out) sample entries which you can modify according
  651.      to your needs.
  652.  
  653.   3.3.7.  Configuring MacOS Based System Running Open Transport
  654.  
  655.   1. If you haven't installed the appropriate driver software for your
  656.      Ethernet adapter, now would be a very good time to do so.
  657.  
  658.   2. Open the TCP/IP Control Panel and choose 'User Mode ...' from the
  659.      Edit menu. Make sure the user mode is set to at least 'Advanced'
  660.      and click the 'OK' button.
  661.  
  662.   3. Choose 'Configurations...' from the File menu.  Select your
  663.      'Default' configuration and click the 'Duplicate...' button.  Enter
  664.      'IP Masq' (or something to let you know that this is a special
  665.      configuration) in the 'Duplicate Configuration' dialog, it will
  666.      probably say something like 'Deafault copy'.  Then click the 'OK'
  667.      button, and the 'Make Active' button
  668.  
  669.   4. Select 'Ethernet' from the 'Connect via:' pop-up.
  670.  
  671.   5. Select the appropriate item from the 'Configure:' pop-up.  If you
  672.      don't know which option to choose, you probably should re-select
  673.      your 'Default' configuration and quit.  I use 'Manually'.
  674.  
  675.   6. Enter the IP address of your Mac (192.168.1.x, 1 < x < 255) in the
  676.      'IP Address:' box.
  677.  
  678.   7. Enter 255.255.255.0 in the 'Subnet mask:' box.
  679.  
  680.   8. Enter 192.168.1.1 in the 'Router address:' box.
  681.  
  682.   9. Enter the IP addresses of your domain name servers in the 'Name
  683.      server addr.:' box.
  684.  
  685.   10.
  686.      Enter the name of your Internet domain (e.g. 'microsoft.com') in
  687.      the 'Starting domain name' box under 'Implicit Search Path:'.
  688.  
  689.   11.
  690.      The following procedures are optional.  Incorrect values may cause
  691.      erratic behavior.  If your not sure, it's probably better to leave
  692.      them blank, unchecked and/or un- selected.  Remove any information
  693.      from those fields, if necessary.  As far as I know there is no way
  694.      through the TCP/IP dialogs, to tell the system not to use a
  695.      previously select alternate "Hosts" file.  If you know, I would be
  696.      interested.
  697.      Check the '802.3' if your network requires 802.3 frame types.
  698.   12.
  699.      Click the 'Options...' button to make sure that the TCP/IP is
  700.      active.  I use the 'Load only when needed' option.  If you run and
  701.      quit TCP/IP applications many times without rebooting your machine,
  702.      you may find that unchecking the 'Load only when needed' option
  703.      will prevent/reduce the effects on your machines memory management.
  704.      With the item unchecked the TCP/IP protocol stacks are always
  705.      loaded and available for use.  If checked, the TCP/IP stacks are
  706.      automatically loaded when needed and un- loaded when not.  It's the
  707.      loading and unloading process that can cause your machines memory
  708.      to become fragmented.
  709.  
  710.   13.
  711.      You may ping the Linux box to test the network connection.  If you
  712.      have the freeware program MacTCP Watcher, click on the 'Ping'
  713.      button, and enter the address of your Linux box (192.168.1.1) in
  714.      the dialog box that pops up.  (This is only a LAN connection
  715.      testing, you can't ping the outside world yet.)
  716.  
  717.   14.
  718.      You can create a Hosts file in your System Folder so that you can
  719.      use the hostnames of the machines on your LAN.  The file may or may
  720.      not already exist in your System Folder.  If so, it should contain
  721.      some (commented-out) sample entries which you can modify according
  722.      to your needs.  If not, you can get a copy of the file from a
  723.      system running MacTCP, or just create your own (it follows a subset
  724.      of the Unix /etc/hosts file format, described on page 33 of RFC
  725.      1035).  Once you've created the file, open the TCP/IP control
  726.      panel, click on the 'Select Hosts File...' button, and open the
  727.      Hosts file.
  728.  
  729.   15.
  730.      Click the close box or choose 'Close' or 'Quit' from the File menu,
  731.      and then click the 'Save' button to save the changes you have made.
  732.  
  733.   16.
  734.      The changes take effect immediately, but rebooting the system won't
  735.      hurt.
  736.  
  737.   3.3.8.  Configuring Other Systems such as OS/2
  738.  
  739.   They should be following the same theory for setup.  Check the
  740.   sections above.  If you're interested in writing about any of these
  741.   systems such as OS/2, or any variations of UNIX based system, please
  742.   send a detail setup instruction to achau@wwonline.com.
  743.  
  744.   3.4.  Configuring IP Forwarding Policies
  745.  
  746.   At this point, you should have your kernel and other required packages
  747.   installed, as well as your modules loaded. Also, the IP addresses,
  748.   gateway, and DNS should be all set on the OTHER machines.
  749.  
  750.   Now, the only thing left to do is to use ipfwadm to forward
  751.   appropriate packets to the appropriate machine:
  752.  
  753.        ipfwadm -F -p deny
  754.        ipfwadm -F -a m -S yyy.yyy.yyy.yyy/x -D 0.0.0.0/0
  755.  
  756.   where x is one of the following numbers according to the class of your
  757.   subnet, and yyy.yyy.yyy.yyy is your network address.
  758.  
  759.        netmask         | x  | Subnet
  760.        ~~~~~~~~~~~~~~~~|~~~~|~~~~~~~~~~~~~~~
  761.        255.0.0.0       | 8  | Class A
  762.        255.255.0.0     | 16 | Class B
  763.        255.255.255.0   | 24 | Class C
  764.        255.255.255.255 | 32 | Point-to-point
  765.  
  766.   For example, if I'm on a class C subnet, I would have entered:
  767.  
  768.        ipfwadm -F -p deny
  769.        ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0
  770.  
  771.   The second command could have either -V 192.168.1.1 or -W eth0 added
  772.   to it to ensure that the masqueraded packets came in through the
  773.   appropriate interface of the system - if you are at all security
  774.   concious (otherwise known as justifiably paranoid) then you will want
  775.   to do this.
  776.  
  777.   You can also do it on a per machine basis.  For example, if I want
  778.   192.168.1.2 and 192.168.1.8 to have access to the Internet, but not
  779.   the other machines, I would have entered:
  780.  
  781.        ipfwadm -F -p deny
  782.        ipfwadm -F -a m -S 192.168.1.2/32 -D 0.0.0.0/0
  783.        ipfwadm -F -a m -S 192.168.1.8/32 -D 0.0.0.0/0
  784.  
  785.   Alternately, you can type the netmask instead of the value, e.g.
  786.   192.168.1.0/255.255.255.0
  787.  
  788.   What appears to be a common mistake is to make the first command be
  789.   this
  790.  
  791.   ipfwadm -F -p masquerade
  792.  
  793.   Do not make your default policy be masquerading - otherwise someone
  794.   who can manipulate their routing will be able to tunnel straight back
  795.   through your gateway, using it to masquerade their identity!
  796.  
  797.   Again, you can add these lines to the /etc/rc.local files, one of the
  798.   rc files you prefer, or do it manually every time you need ip_masq.
  799.  
  800.   Please read section 4.4 for a detail guide on Ipfwadm
  801.  
  802.   3.5.  Testing IP Masquerade
  803.  
  804.   It's time to give it a try, after all these hard work. Make sure the
  805.   connection of your Linux hosts to the Internet is okay.
  806.  
  807.   You can try browsing some 'INTERNET!!!' web sites on your OTHER
  808.   machines, and see if you get it. I recommend using an IP address
  809.   rather than a hostname on your first try, because your DNS setup may
  810.   not be correct.
  811.  
  812.   For example, you can access Netscape's site http://home.netscape.com
  813.   with an entry of http://198.95.249.78
  814.  
  815.   If you see that nice sailboat, then congratulations! It's working! You
  816.   may then try one with hostname entry, and then telnet, ftp, Real
  817.   Audio, True Speech, whatever..... but *not* PING yet, remember!!!
  818.  
  819.   So far, I have no trouble with the above settings, and it's full
  820.   credit to the people who spend their time making this wonderful
  821.   feature working.
  822.  
  823.   4.  Other IP Masquerade Issues and Software Support
  824.  
  825.   4.1.  Problems with IP Masquerade
  826.  
  827.   Firstly masquerading can only work with ported protocols - such as TCP
  828.   or UDP.  It specifically will not work with ICMP, so ping and
  829.   traceroute will not work (unless your ping and/or traceroute have been
  830.   modified to use a different method of working).
  831.  
  832.   Some protocols will not currently work with masquerading because they
  833.   either assume things about port numbers, or encode data in their data
  834.   stream about addresses and ports - these latter protocols need
  835.   specific proxies built into the masquerading code to make them work.
  836.  
  837.   4.2.  Incoming services
  838.  
  839.   Masquerading cannot handle incoming services at all.  There are a few
  840.   ways of allowing them, but they are completely separate from
  841.   masquerading, and are really part of standard firewall practice.
  842.  
  843.   If you do not require high levels of security then you can simply
  844.   redirect ports.  There are various ways of doing this - I use a
  845.   modified redir program (which I hope will be available from sunsite
  846.   and mirrors soon). If you wish to have some level of authorisation on
  847.   incoming connections then you can either use TCP wrappers or Xinetd on
  848.   top of redir (0.7 or above) to allow only specific IP addresses
  849.   through, or use some other tools.  The TIS Firewall Toolkit is a good
  850.   place to look for tools and information.
  851.  
  852.   4.3.  Supported Client Software and Other Setup Note
  853.  
  854.   Generally, application that uses TCP and UDP should work.  However,
  855.   ICMP based applications are not supported.  If you have any suggestion
  856.   about applications that are not compatible with IP Masquerade, please
  857.   email to me with the name of client and a brief description.
  858.  
  859.   4.3.1.  Clients that Work
  860.  
  861.   General Clients
  862.  
  863.      HTTP
  864.         all supported platforms, surfing the web
  865.  
  866.      POP & SMTP
  867.         all supported platforms, email client
  868.  
  869.      Telnet
  870.         all supported platforms, remote session
  871.  
  872.      FTP
  873.         all supported platforms, with ip_masq_ftp.o module (not all
  874.         sites work with certain clients; e.g. some sites cannot be
  875.         reached using ws_ftp32 but works with netscape)
  876.  
  877.      Archie
  878.         all supported platforms, file searching client (not all archie
  879.         clients are supported)
  880.  
  881.      NNTP (USENET)
  882.         all supported platforms, USENET news client
  883.  
  884.      VRML
  885.         Windows(possibly all supported platforms), virtual reality
  886.         surfing
  887.  
  888.      traceroute
  889.         mainly UNIX based platforms, some variations may not work
  890.  
  891.      anything based on IRC
  892.         all supported platforms, with ip_masq_irc.o modules
  893.  
  894.      Gopher client
  895.         all supported platforms
  896.  
  897.      WAIS client
  898.         all supported platforms
  899.  
  900.   Multimedia Clients
  901.  
  902.      Real Audio Player 2.0
  903.         Windows, network streaming audio, with ip_masq_raudio module
  904.         loaded
  905.  
  906.      True Speech Player 1.1b
  907.         Windows, network streaming audio
  908.  
  909.      Internet Wave Player
  910.         Windows, network streaming audio
  911.  
  912.      Worlds Chat 0.9a
  913.         Windows, Client-Server 3D chat program
  914.  
  915.      Alpha Worlds
  916.         Windows, Client-Server 3D chat program
  917.  
  918.      Internet Phone 3.2
  919.         Windows, Peer-to-peer audio communications, people can reach you
  920.         only if you initiate the call, but people cannot call you
  921.  
  922.      Powwow
  923.         Windows, Peer-to-peer Text audio whiteboard communications,
  924.         people can reach you only if you initiate the call, but people
  925.         cannot call you
  926.  
  927.      CU-SeeMe
  928.         all supported platforms, with cuseeme modules loaded, please see
  929.         IP Masquerade Resource <http://www.hwy401.com/achau/ipmasq/> for
  930.         detail
  931.  
  932.   Note: Some clients such as IPhone and Powwow may work even if you're
  933.   not the one who initiate the call by using ipautofw package (there
  934.   will be a section on this soon)
  935.  
  936.   Other Clients
  937.  
  938.      NCSA Telnet 2.3.08
  939.         DOS, a suite containing telnet, ftp, ping, etc.
  940.  
  941.      PC-anywhere for windows 2.0
  942.         MS-Windows, Remotely controls a PC over TCP/IP, only work if it
  943.         is a client but not a host
  944.  
  945.      Socket Watch
  946.         uses ntp - network time protocol
  947.  
  948.      Linux net-acct package
  949.         Linux, network administration-account package
  950.  
  951.   4.3.2.  Clients that do not Work
  952.  
  953.      Ping
  954.         with exceptions to ICMP packets that contain information about
  955.         an original TCP or UDP packet, such as traceroute
  956.  
  957.      talk,ntalk
  958.         will not work - requires a kernel proxy to be written.
  959.  
  960.      WebPhone
  961.         Cannot work at present (it makes invalid assumptions about
  962.         addresses).
  963.  
  964.      X  Untested, but I think it cannot work unless someone builds an X
  965.         proxy, which is probably an external program to the masquerading
  966.         code.  One way of making this work is to use ssh as the link and
  967.         use the internal X proxy of that to make things work!
  968.  
  969.   4.3.3.  Platforms/OS Tested as on OTHER machines
  970.  
  971.   ╖  Linux
  972.  
  973.   ╖  Solaris
  974.  
  975.   ╖  Windows 95
  976.  
  977.   ╖  Windows NT (both workstation and server)
  978.  
  979.   ╖  Windows For Workgroup 3.11 (with TCP/IP package)
  980.  
  981.   ╖  Windows 3.1 (with Chameleon package)
  982.  
  983.   ╖  Novel 4.01 Server
  984.  
  985.   ╖  OS/2 (including Warp v3)
  986.  
  987.   ╖  Macintosh OS (with MacTCP or Open Transport)
  988.  
  989.   ╖  DOS (with NCSA Telnet package, DOS Trumpet works partially)
  990.  
  991.   ╖  Amiga (with AmiTCP or AS225-stack)
  992.  
  993.   ╖  VAX Stations 3520 and 3100 with UCX (TCP/IP stack for VMS)
  994.  
  995.   ╖  Alpha/AXP with Linux/Redhat
  996.  
  997.   ╖  (Anyone tried other platforms?)
  998.  
  999.   4.4.  IP Firewall Administration (ipfwadm)
  1000.  
  1001.   This section provides a more in-depth guide on using ipfwadm.
  1002.  
  1003.   This is a setup for a firewall/masquerade system behind a PPP link
  1004.   with a static PPP address follows. Trusted interface is 192.168.255.1,
  1005.   PPP interface has been changed to protect the guilty :).  I listed
  1006.   each incoming and outgoing interface individually to catch IP spoofing
  1007.   as well as stuffed routing and/or masquerading. Also anything not
  1008.   explicitly allowed is forbidden!
  1009.  
  1010.   #!/bin/sh
  1011.   #
  1012.   # /etc/rc.d/rc.firewall, define the firewall configuration, invoked from
  1013.   # rc.local.
  1014.   #
  1015.  
  1016.   PATH=/sbin:/bin:/usr/sbin:/usr/bin
  1017.  
  1018.   # testing, wait a bit then clear all firewall rules.
  1019.   # uncomment following lines if you want the firewall to automatically
  1020.   # disable after 10 minutes.
  1021.   # (sleep 600; \
  1022.   # ipfwadm -I -f; \
  1023.   # ipfwadm -I -p accept; \
  1024.   # ipfwadm -O -f; \
  1025.   # ipfwadm -O -p accept; \
  1026.   # ipfwadm -F -f; \
  1027.   # ipfwadm -F -p accept; \
  1028.   # ) &
  1029.  
  1030.   # Incoming, flush and set default policy of deny. Actually the default policy
  1031.   # is irrelevant because there is a catch all rule with deny and log.
  1032.   ipfwadm -I -f
  1033.   ipfwadm -I -p deny
  1034.   # local interface, local machines, going anywhere is valid
  1035.   ipfwadm -I -a accept -V 192.168.255.1 -S 192.168.0.0/16 -D 0.0.0.0/0
  1036.   # remote interface, claiming to be local machines, IP spoofing, get lost
  1037.   ipfwadm -I -a deny -V your.static.PPP.address -S 192.168.0.0/16 -D 0.0.0.0/0 -o
  1038.   # remote interface, any source, going to permanent PPP address is valid
  1039.   ipfwadm -I -a accept -V your.static.PPP.address -S 0.0.0.0/0 -D
  1040.   your.static.PPP.address/32
  1041.   # loopback interface is valid.
  1042.   ipfwadm -I -a accept -V 127.0.0.1 -S 0.0.0.0/0 -D 0.0.0.0/0
  1043.   # catch all rule, all other incoming is denied and logged. pity there is no
  1044.   # log option on the policy but this does the job instead.
  1045.   ipfwadm -I -a deny -S 0.0.0.0/0 -D 0.0.0.0/0 -o
  1046.  
  1047.   # Outgoing, flush and set default policy of deny. Actually the default policy
  1048.   # is irrelevant because there is a catch all rule with deny and log.
  1049.   ipfwadm -O -f
  1050.   ipfwadm -O -p deny
  1051.   # local interface, any source going to local net is valid
  1052.   ipfwadm -O -a accept -V 192.168.255.1 -S 0.0.0.0/0 -D 192.168.0.0/16
  1053.   # outgoing to local net on remote interface, stuffed routing, deny
  1054.   ipfwadm -O -a deny -V your.static.PPP.address -S 0.0.0.0/0 -D 192.168.0.0/16 -o
  1055.   # outgoing from local net on remote interface, stuffed masquerading, deny
  1056.   ipfwadm -O -a deny -V your.static.PPP.address -S 192.168.0.0/16 -D 0.0.0.0/0 -o
  1057.   # outgoing from local net on remote interface, stuffed masquerading, deny
  1058.   ipfwadm -O -a deny -V your.static.PPP.address -S 0.0.0.0/0 -D 192.168.0.0/16 -o
  1059.   # anything else outgoing on remote interface is valid
  1060.   ipfwadm -O -a accept -V your.static.PPP.address -S your.static.PPP.address/32 -D
  1061.   0.0.0.0/0
  1062.   # loopback interface is valid.
  1063.   ipfwadm -O -a accept -V 127.0.0.1 -S 0.0.0.0/0 -D 0.0.0.0/0
  1064.   # catch all rule, all other outgoing is denied and logged. pity there is no
  1065.   # log option on the policy but this does the job instead.
  1066.   ipfwadm -O -a deny -S 0.0.0.0/0 -D 0.0.0.0/0 -o
  1067.  
  1068.   # Forwarding, flush and set default policy of deny. Actually the default policy
  1069.   # is irrelevant because there is a catch all rule with deny and log.
  1070.   ipfwadm -F -f
  1071.   ipfwadm -F -p deny
  1072.   # Masquerade from local net on local interface to anywhere.
  1073.   ipfwadm -F -a masquerade -W ppp0 -S 192.168.0.0/16 -D 0.0.0.0/0
  1074.   # catch all rule, all other forwarding is denied and logged. pity there is no
  1075.   # log option on the policy but this does the job instead.
  1076.   ipfwadm -F -a deny -S 0.0.0.0/0 -D 0.0.0.0/0 -o
  1077.  
  1078.   You can block traffic to a particular site using the -I, -O or -F.
  1079.   Remember that the set of rules are scanned top to bottom and -a means
  1080.   "append" to the existing set of rules so any restrictions need to come
  1081.   before global rules. For example (and untested) :-
  1082.  
  1083.   Using -I rules. Probably the fastest but it only stops the local
  1084.   machines, the firewall itself can still access the "forbidden" site.
  1085.   Of course you might want to allow that combination.
  1086.  
  1087.   # reject and log local interface, local machines going to 204.50.10.13
  1088.   ipfwadm -I -a reject -V 192.168.255.1 -S 192.168.0.0/16 -D 204.50.10.13/32 -o
  1089.   # local interface, local machines, going anywhere is valid
  1090.   ipfwadm -I -a accept -V 192.168.255.1 -S 192.168.0.0/16 -D 0.0.0.0/0
  1091.  
  1092.   Using -O rules. Slowest because the packets go through masquerading
  1093.   first but this rule even stops the firewall accessing the forbidden
  1094.   site.
  1095.  
  1096.   # reject and log outgoing to 204.50.10.13
  1097.   ipfwadm -O -a reject -V your.static.PPP.address -S your.static.PPP.address/32 -D
  1098.   204.50.10.13/32 -o
  1099.   # anything else outgoing on remote interface is valid
  1100.   ipfwadm -O -a accept -V your.static.PPP.address -S your.static.PPP.address/32 -D
  1101.   0.0.0.0/0
  1102.  
  1103.   Using -F rules. Probably slower than -I and this still only stops
  1104.   masqueraded machines (i.e. internal), firewall can still get to
  1105.   forbidden site.
  1106.  
  1107.   # Reject and log from local net on PPP interface to 204.50.10.13.
  1108.   ipfwadm -F -a reject -W ppp0 -S 192.168.0.0/16 -D 204.50.10.13/32 -o
  1109.   # Masquerade from local net on local interface to anywhere.
  1110.   ipfwadm -F -a masquerade -W ppp0 -S 192.168.0.0/16 -D 0.0.0.0/0
  1111.  
  1112.   No need for a special rule to allow 192.168.0.0/16 to go to
  1113.   204.50.11.0, it is covered by the global rules.
  1114.  
  1115.   There is more than one way of coding the interfaces in the above
  1116.   rules.  For example instead of -V 192.168.255.1 you can code -W eth0,
  1117.   instead of -V your.static.PPP.address you can use -W ppp0. Personal
  1118.   choice and documentation more than anything.
  1119.  
  1120.   4.5.  IP Masquerade and Demand-Dial-Up
  1121.  
  1122.   1. If you would like to setup your network to automatically dial up
  1123.      the Internet, the diald demand dial-up package will be of great
  1124.      utility.
  1125.  
  1126.   2. To setup the diald, please check out the Setting Up Diald for Linux
  1127.      Page <http://home.pacific.net.sg/~harish/diald.config.html>
  1128.  
  1129.   3. Once diald and IP masq have been setup, you can go to any of the
  1130.      client machines and initiate a web, telnet or ftp session.
  1131.  
  1132.   4. Diald will detect the incoming request, then dial up your ISP and
  1133.      establish the connection.
  1134.  
  1135.   5. There is a timeout that will occur with the first connection.  This
  1136.      is inevitable if you are using analog modems.  The time taken to
  1137.      establish the modem link and the PPP connections will cause your
  1138.      client program to timeout.  This can be avoided if you are using an
  1139.      ISDN connection.  All you need to do is to terminate the current
  1140.      process on the client and restart it.
  1141.  
  1142.   5.  Miscellaneous
  1143.  
  1144.   5.1.  Getting Help
  1145.  
  1146.   ╖  IP Masquerade Resource page <http://www.hwy401.com/achau/ipmasq/>
  1147.      should have enough information for setting up IP Masquerade
  1148.      An alternative <http://www.undergrad.math.uwaterloo.ca/~ach2au>
  1149.      site for this page
  1150.  
  1151.   ╖  Joining IP masquerade mailing list (recommended)
  1152.      To subscribe, send a mail with subject "subscribe" (no quote) to
  1153.      masq-request@indyramp.com
  1154.      To unsubscribe, send a mail with subject "unsubscribe" (no quote)
  1155.      to masq-request@indyramp.com
  1156.      To get help on using the mailing list, send a mail with subject
  1157.      "archive help" or "archive dir" (no quote) to masq-
  1158.      request@indyramp.com
  1159.  
  1160.   ╖  IP masquerade mailing list archive
  1161.      <http://www.indyramp.com/masq/list/> contains all the past messages
  1162.      sent to the mailing list.
  1163.  
  1164.   ╖  This Linux IP Masquerade mini HOWTO
  1165.      <http://www.hwy401.com/achau/ipmasq/ipmasq-HOWTO.html> for kernel
  1166.      2.x (if you're using a 1.3.x or 2.x kernel)
  1167.  
  1168.   ╖  IP Masquerade HOWTO for kernel 1.2.x
  1169.      <http://www.hwy401.com/achau/ipmasq/ipmasq-HOWTO-1.2.x.txt> if
  1170.      you're using an older kernel
  1171.  
  1172.   ╖  IP masquerade FAQ <http://www.indyramp.com/masq/ip_masquerade.txt>
  1173.      has some general information
  1174.  
  1175.   ╖  X/OS Ipfwadm page <http://www.xos.nl/linux/ipfwadm/> contains
  1176.      sources, binaries, documentation, and other information about the
  1177.      ipfwadm package
  1178.  
  1179.   ╖  LDP Network Administrator's Guide
  1180.      <http://linuxwww.db.erau.edu/NAG/> is a must for beginners trying
  1181.      to set up a network
  1182.  
  1183.   ╖  Linux NET-2 HOWTO
  1184.      <http://www.caldera.com/LDP/HOWTO/NET-2-HOWTO.html> also has lots
  1185.      of useful information about Linux networking
  1186.  
  1187.   ╖  Linux ISP Hookup HOWTO <http://www.caldera.com/LDP/HOWTO/ISP-
  1188.      Hookup-HOWTO.html> gives you information on how to connect your
  1189.      Linux host to the Internet
  1190.  
  1191.   ╖  Linux Ethernet-Howto <http://www.caldera.com/LDP/HOWTO/Ethernet-
  1192.      HOWTO.html> is a good source of information about setting up a LAN
  1193.      running ethernet
  1194.  
  1195.   ╖  You may also be interested in Linux Firewalling and Proxy Server
  1196.      HOWTO <http://www.caldera.com/LDP/HOWTO/Firewall-HOWTO.html>
  1197.  
  1198.   ╖  Linux Kernel HOWTO <http://www.caldera.com/LDP/HOWTO/Kernel-
  1199.      HOWTO.html> will guide you through the kernel compilation process
  1200.  
  1201.   ╖  Other Linux HOWTOs <http://www.caldera.com/LDP/HOWTO/HOWTO-
  1202.      INDEX-3.html> such as PPP HOWTO and Kerneld mini HOWTO
  1203.  
  1204.   ╖  Posting to the USENET newsgroup: comp.os.linux.networking
  1205.  
  1206.   5.2.  Thanks to
  1207.  
  1208.   ╖  Ed Doolittle, dolittle@math.toronto.edu
  1209.      on suggestion to -V option in ipfwadm command for improved security
  1210.  
  1211.   ╖  Matthew Driver, mdriver@cfmeu.asn.au
  1212.      on helping extensively on this HOWTO, and providing section 3.3.1
  1213.      (setting up Windows 95)
  1214.  
  1215.   ╖  Ken Eves, ken@eves.com
  1216.      on the FAQ that provides invaluable information for this HOWTO
  1217.  
  1218.   ╖  Ed. Lott, edlott@neosoft.com
  1219.      for a long list of tested system and software
  1220.  
  1221.   ╖  Nigel Metheringham, Nigel.Metheringham@theplanet.net
  1222.      on contributing his version of IP Packet Filtering and IP
  1223.      Masquerading HOWTO, which make this HOWTO a better and technical
  1224.      in-depth document
  1225.      section 4.1, 4.2, and others
  1226.  
  1227.   ╖  Keith Owens, kaos@audio.apana.org.au
  1228.      on providing an excellent guide on ipfwadm section 4.2
  1229.      on correction to ipfwadm -deny option which avoids a security hole,
  1230.      and clarified the status of ping over ip_masq
  1231.  
  1232.   ╖  Rob Pelkey, rpelkey@abacus.bates.edu
  1233.      on providing section 3.3.6 and 3.3.7 (setting up MacTCP and Open
  1234.      Transport)
  1235.  
  1236.   ╖  Harish Pillay, h.pillay@ieee.org
  1237.      on providing section 4.5 (dial-on-demand using diald)
  1238.  
  1239.   ╖  John B. (Brent) Williams, forerunner@mercury.net
  1240.      on providing section 3.3.7 (setting up Open Transport)
  1241.  
  1242.   ╖  developers of IP Masquerade for this great feature
  1243.  
  1244.        ╖  Nigel Metheringham, Nigel.Metheringham@theplanet.net
  1245.  
  1246.        ╖  Keith Owens, kaos@audio.apana.org.au
  1247.  
  1248.   ╖  Jeanette Pauline Middelink, middelin@polyware.iaf.nl
  1249.  
  1250.   ╖  Miquel van Smoorenburg, miquels@q.cistron.nl
  1251.  
  1252.   ╖  Jos Vos, jos@xos.nl
  1253.  
  1254.   ╖  all users sending feedback and suggestion to the mailing list,
  1255.      especially the ones who reported errors in the document and the
  1256.      clients that are supported and not supported
  1257.  
  1258.   5.3.  Reference
  1259.  
  1260.   ╖  IP masquerade FAQ by Ken Eves
  1261.  
  1262.   ╖  IP masquerade mailing list archive by Indyramp Consulting
  1263.  
  1264.   ╖  Ipfwadm page by X/OS
  1265.  
  1266.   ╖  Various networking related Linux HOWTOs
  1267.  
  1268.