home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / doc / HOWTO / mini / IP-Masquerade < prev    next >
Text File  |  1997-03-01  |  52KB  |  1,369 lines

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