		WANPIPE Router Configuration	
		----------------------------
		      Wan Ver. 2.1.1


1. Introduction
   ------------

	WANPIPE WAN routers are combination of intelligent adaptor
card, linux drivers and configuration and startup applications.
WANPIPE provides a wan protocol and a network interface to the 
Linux kernel which the kernel uses to route packets to and 
from remote locations.  Thus, actual routing is performed by
the Linux kernel.  

2. Before Configuration
   --------------------

WANPIPE wanrouter configuration consists of three files:
   i) meta configuration file (wanrouter.rc)
  ii) device configuration files (wanpipe1.conf)
 iii) interface files (eg: wp1_chdlc, wp1_fr16)	

Before starting WANPIPE configuration, decide which
protocol will be used, PPP, Frame Relay, etc.  

Note how many WANPIPE cards you have in your machine.

For each PHYSICAL LINK there is a separate configuration file!
(ex: for first wanpipe card,  link 1: wanpipe1.conf
     for second wanpipe card, link 2: wanpipe2.conf )
Where each configuration file can be setup for an
arbitrary protocol.

Note some WANPIPE configurations have multiple physical
lines coming into a single card, 
(ex CHDLC Primary and Secondary port).  In this case, 
there would be two configuration files for such card !!!

For example Quad Port S514 PCI card can connect to maximum
4 physical lines running CISCO HDLC.  In this case each 
physical line is treated as a separate wanrouter; thus, 
each will have its own configuration file 
(wanpipe1,2,3 and 4).

The SETUP script has already placed a wanpipe1.conf file
in the /etc directory for the protocol you of your choice.

If you have more than one physical line coming into your
machine over WANPIPE, or you changed your mind about the
protocol you'll be running: 
	all sample configuration files are located in 
	/usr/lib/wanrouter/samples directory. 

(ie. wanpipe1.cpri : CHDLC primary port
     wanpipe2.csec : CHDLC secondary port 
     wanpipe1.fr   : Frame Relay protocol
     wanpipe1.ppp  : PPP protocol )

Thus, to setup more than one physical link, copy one or 
more of these files into your /etc directory and rename 
each file to wanpipe#.conf (where # is 1,2,3 ...).


3) WANPIPE Configuration
   ---------------------

Step1: Check the number of physical links leading into your
       WANPIPE card(s).  Make sure you have that many 
       wanpipe#.conf (# = 1,2,3...) files in your /etc 
       directory.
  
Step2: Make sure that you selected a correct protocol for each
       wanpipe#.conf file. 
       NOTE: * 514PCI cards can run different protocols on each
               CPU. (Note: 514 cards can come with dual or
                           single CPU's)
             * On 514PCI cards each CPU has 2 ports which have
               to run SAME protocol (currently only CHDLC 
				     supports this feature).
	     * 508ISA cards have only a single CPU, thus can 
               only run a SINGLE protocol each ports.
	       (currently only CHDLC supports this feature)


WANROUTER.RC Setup
------------------
          
First file that should be edited is /etc/wanrouter.rc.
This file has been already placed in the /etc directory
by the SETUP program.

It contains the paths of the wanpipe configuration
files, lock and log files. Furthermore, it contains
device names which to load during wanrouter startup. 
	
   ROUTER_BOOT=YES        # Boot flag must be set to YES 

   WANPIPE_CONF_DIR=/etc  # Location of wanpipe config files

   ROUTER_LOG=/var/log/wanrouter # Location of log files

   ROUTER_LOCK=/var/lock/subsys/wanrouter #Location of lock file

   WAN_DEVICES="wanpipe1" # Device(s) to load on startup

To load more than one device during 'wanrouter start'
set WAN_DEVICES="wanpipe1 wanpipe2 ... wanpipeN'
	Note: that device name is also the name of the 
              configuration file.


WANPIPE#.CONF Setup
-------------------

Before editing the wanpipe#.conf file make sure that 
wanrouter.rc is pointing to the right location: default /etc
directory.

For each physical link there should be a wanpipe#.conf file !!

!!! IMPORTANT !!!!
If you renamed a file from wanpipe1.conf to wanpipe2.conf 
make sure you also rename the device names in the file
itself.  

Thus, if configuration file name is wanpipe3.conf,
that that file must contain wanpipe3 as its device name,
NOT wanpipe1 !!!

Repeat the following for each wanpipe configuration file:

Step1:  Open a file /etc/wanpipe#.conf

Step2:  [device] area:
             Make sure that the wanpipe device name 
	    (ex: wanpipe1 is the same as the file name 
		 wanpipe1.conf )
             Frame Relay: 
			device# = WAN_FR, comment
	     Chdlc:
			device# = WAN_CHDLC, comment
             PPP: 
			device# = WAN_PPP, comment

Step3:  [interface] area:
	     Make sure that the wanpipe device name 
	    (ex: wanpipe3 is the same as the file name 
		 wanpipe3.conf )

	     At this point an Interface name must be chosen.

	     INTERFACE NAME:	
             ---------------

             Recommended interface name nomenclature is:
        	 *** wp#_{protocol}{media_address} ***
		where: wp# - wp1,wp2,wp3 ... 
		       {protocol} = fr, chdlc, ppp
                       {medi_address} = * DLCI number 
 					  for frame relay 
	        	                * Nothing for rest
		ex: wp1_fr16 : fr with dlci 16 on wanpipe1
		ex: wp2_chdlc: chdlc on wanpipe2 
	    	ex: wp3_ppp  : ppp on wanpipe3

	     Once the interface name is selected
		

	     SETUP INTERFACE
	     ---------------	
  
	     Frame Relay:
		wp1_fr16 = wanpipe1, 16, WANPIPE, comment	
       	
		Bind interface name wp1_fr16 to wanpipe1 
		device (first card), with DLCI num. of 16. 
	
	     CHDLC
		wp1_chdlc = wanpipe1, , WANPIPE, comment

		Bind interface wp1_chldc to wanpipe1 device
		(first card).  

             PPP
		wp1_ppp  = wanpipe1, , WANPIPE, comment

		Bind interface wp1_ppp to wanpipe1 device
		(first card).
				
             WANPIPE : indicates that all packets should
                       be routed.

	     Make sure that the device name is the same as
             the configuration file name (ex. wanpipe1.conf)


	     RAW API MODE:
             ------------- 
             NOTE: Frame Relay and CHDLC can run in RAW API mode,
            	
		Frame Relay: 
			wp2_fr20 = wanpipe2, 20,API, comment
		CHDLC:
			wp2_chdlc = wanpipe2, ,API, comment

	    	API: Indicates that all received packets should
                     be sent up the user defined stack.
	

Step4: [wanpipe#] area: 
		(# = 1,2.. must be the same as above,
                    and as the file name wanpipe#.conf)

	     The fist 4 fields indicate to the driver
             whether the card is S514PCI or S508ISA.

	     For S514PCI card set:
		 S514CPU = A or B
		 PCISLOT = #      (# = 0 -autodetect
					  a SINGLE board.
                                       1,2,...)
		 Please read the WANPIPE_USER_MANUAL of
                 how to obtain pci slot numbers for 
                 multiple boards.
	     
		 Also, comment out IO_PORT and IRQ options !!!

	     For S508 ISA card set:
		 IO_PORT = 0x360 (Check to board jumpers)
		 IRQ     = 7     (Check for free irq's with
                                    'cat /proc/interrupts' cmd.)
		 
		 Also, comment out S514CPU and PCISLOT options !!


	     The rest of the options are self explanatory in
             the wanpipe#.conf file


Step5:  [wp#_{protocol}{media_addrss}] interface area:
		
	Frame relay:
		[wp1_fr16]
	CHDLC:
		[wp1_chdlc]
	PPP:
		[wp1_ppp]

	Interface options are self explanatory


Step6: Save the newly configured file.


INTERFACE FILE Setup
--------------------

1. Go the the /usr/lib/wanrouter directory.

2. For configuration file, interface:
 	Run the Configure script:  './Configure' to
	setup and interface file.

3. Choose option to add an interface file.

4. 
   !!!! IMPORTANT !!!
	The name of the interface file MUST be the same
	as the interface name specified in wanpipe#.conf.
	ex: wp1_fr16, or wp1_chdlc

5. Ask your ISP for LOCAL and POINTOPOINT IP addresses.


Check that you have an interface file in:
	/usr/lib/wanrouter/interfaces directory.


NOW REPEAT THE ABOVE STEPS FOR ALL OTHER DEVICES !!!!




CONFIGURING DUAL PORT CHDLC:  PIGGYBACKING 
-------------------------------------------

Chdlc is currently the only protocol which can
make use of both physical ports, controlled by
a single CPU,  on both S508 and S514 card. 

Note, that two physical links
will be attached to one card.  This means
that there will be two configuration files.

The second port will use the resources of the
first port:
       In case of S514 PCI card:
		Resources are S514CPU and PCISLOT
       In case of S508 ISA card:
		Resources are IO_PORT and IRQ


!!! IMPORTANT !!!
Thus for both wanpipe#.conf files depending
which card its being used, the above options
must be the same.


In order to use a SECONDARY port along with
the PRIMARY:
                 
     1. Copy the CHDLC primary port config file
        form /usr/lib/wanrouter/samples to /etc directory
        and rename it to wanpipe#.conf.
	(ex. If only one card in the system call it
             wanpipe1.conf (first physical link) )	
       	
     2. Copy the CHDLC secondary port config file
        form /usr/lib/wanrouter/samples to /etc directory
        and rename it to wanpipe#.conf.
	(ex. If only one card in the system call it
             wanpipe2.conf (second physical link) )

     3. Use the above procedure to configure both files.

     4. Make sure that the 
	 for S514 PCI card:
		S514CPU and PCISLOT are the same !!
	 for S508 ISA card:
		IO_PORT and IRQ are the same !!

     5. The only difference between primary and secondary
        configuration files should be the:
	 	1. device name
		2. interface name
		3. comm_port option
	
	Everything else should be the SAME !!!!
     













 

