home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / IP-Masquerade < prev    next >
Text File  |  1998-10-14  |  55KB  |  1,434 lines

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