  








WANPIPE?


Multi-protocol WANPIPE Driver for Linux(r)


OPERATIONAL M A N U A L



Author: Nenad Corbic  






Copyright (c) 1995-2001 Sangoma Technologies Inc.













Starting And Stopping WAN Router

	Before starting a WANPIPE device, make sure that the configuration file has been created using wancfg utility, and that a Sangoma "S" series card is present.  In case of a failure please refer to the Troubleshooting section of this document.

Start WANPIPE: 

      		run 'wanrouter start' at the command prompt. 
WANPIPE devices, defined in /etc/wanpipe//wanrouter.rc, WAN_DEVICES list will be started.  If multiple devices have been configured, updated the wanrouter.rc file accordingly.
 		 
Stop WANPIPE:  
      		run 'wanrouter stop'  at the command prompt.
WANPIPE devices defined in /etc/wanpipe/wanrouter.rc, WAN_DEVICES list will be shutdown. 

Start a particular WANPIPE device:
run 'wanrouter start wanpipe#' at the command prompt
(where # = 1 to 16).
A single WANPIPE Device will be started regardless of the /etc/wanpipe//wanrouter.rc file.

Stop a particular WANPIPE device:
run 'wanrouter stop wanpipe#' at the command prompt
(where # = 1 to 16.)
A single WANPIPE device will be stopped regardless of the /etc/wanpipe//wanrouter.rc file.

List all active WANPIPE devices:
run 'wanrouter list' at the command prompt.


Check the WANPIPE version:
		run 'wanrouter version' at the command prompt







WANPIPE Protocol Monitors/Debuggers

Included with the Wanpipe drivers are UDP management monitors for each of the supported protocols.

* fpipemon : 	for Frame Relay protocol.
* cpipemon : 	for CHDLC protocol.
* ppipemon : 	for PPP protocol.
* xpipemon :	for X25 protocol.
* wpkbdmon:	for keyboard led statistics/debugging

You must be superuser (root) to run these monitors. 

Command line Usage:  invoke command on prompt (ex 'fpipemon')

Note: 
The UDP management port is configured using the UDPPORT option in the wanpipe#.conf configuration file.

The monitor communicates with the driver via UDP protocol, analogous to an intelligent ping.   The debugging utility constructs the UDP packet with a valid WANPIPE command that is sent via UDP socket down to the driver.  The user defined UDP port, in the Wanpipe configuration file, is used to send the packet down to the driver.   Therefore, the user can run the monitor from any machine that is network connected to the Sangoma host.

There are two parameters needed to access the link information using these monitors:

 The UDP Port set in the wanpipe#.conf configuration file.  The Default is UDP port 9000. Setting the UDP port to 0 disables the monitor. You can change the UPD port to distinguish between different Sangoma cards on a network

 An IP address that forces the stack to try to send the UDP packet through the wanpipe driver. For instance, on the host machine that has the card installed, use the IP address of the remote end of the link.  Note that if the local IP address us used as a destination address, the packet will be received by the loopback device, not Wanpipe device.

If wanpipe is the default gateway, then any address not on the local network will do. The address does not have to exist, as the UDP packets are intercepted in the driver before they are transmitted, and are replied to in the form of a UDP response. 

The name of the interface can also be used instead of an IP address to reach the Wanpipe device driver.   The monitor will automatically resolve the interface name to a correct Point to point IP address of the WANPIPE device.

In this example the Wanpipe card is directly connected to a T1 line coming from Telco, to provide the frame relay WAN connection to a corporate LAN.  The Telco in this case is using a Cisco router.











The Wanpipe monitor utilities can be located on Server B, or on Work Station C.  In most cases 
all the utilities reside on the same box as the wanpipe devices.  The Administrator would SSH into the Server B and use the pipemon debuggers to access driver and line statistics as follows:

Monitor Usage:   
(X)pipemon -i  <interface name/p-to-p IP>  -u  <udp port>  -c <command>


Examples assuming Admin SSH'd into Server B:

Modem Status:  Determine if the leased line is turned on.  (is there electricity on the line)
fpipemon -i wp1_fr16 -u 9000  -c xm

Communication Error Statistics: Check for CRC errors, indicates a bad line or 
       misconfigured CSU/DSU.
	fpipemon -i 201.1.1.1 -u 9000 -c sc

Line Trace:  Display incoming and outgoing packets
	fpipemon -i wp1_fr16 -u 9000 -c tr
	
Display onboard CSU/DSU status:  Check for T1 alarms, inservice, Tx/Rx lights.
	fpipemon -i wp1_fr16 -u 9000 -c Tv




Examples assuming Admin is on Workstation B:

	fpipemon -i 201.1.1.1 -u 9000 -c tr

Note: The interface name cannot be used.  Furthermore the IP address must be the pointopoint address of the Wanpipe device.  





Security

Security considerations for the monitors is handled as follows:

* You can simply turn them off by setting the UDP PORT to 0 in wanpipe#.conf.
* Certain operations are only allowed from "above". For instance, you can only run the traces from above the stack. Any commands that can change the state of the link (such as testing the DSU/CSU) are only allowed from above the stack.

* You can set the TTL for the replies to the UDP packets in wanpipe#.conf. So for instance, if TTL is set to 1, only users that are logged in will be able to execute configuration and debugging commands.

For further information view the debugger help files by executing: ./(f,c,x,p)pipemon
























Trouble Shooting and Diagnostics

If you encounter errors during installation and/or start-up, try to determine which command, utility or process causes the error.  Carefully record and examine all warnings and error messages. Read appropriate section of this manual again and make sure you have not missed anything important. 

Consult the FAQ on Sangoma Web Page www.sangoma.com.

Router Initialization Problems

When the WAN Router start-up is complete, all WAN devices defined in the [devices]  section of /etc/wanpipe/wanpipe#.conf file should appear in the /proc/net/router directory.  

Similarly, all network interfaces defined in the [interfaces] section should appear in the /proc/net/dev directory (provided that corresponding WAN device was successfully configured).  

If some of the devices and/or interfaces are missing, then verify configuration file and check '/var/log/wanrouter' and '/var/log/messages' files for error messages and/or warnings.  

WANPIPE Driver logs extensive diagnostics during its initialization into the system log file.  To monitor logged system messages use the following command:

        tail -f /var/log/messages

You can watch for any errors and/or warnings during WANPIPE loading and initialization.

Router Configuration Problems

To verify the WAN device configuration, use Config and Status pseudo-files found in /proc/net/wanrouter directory.  Doing 'cat' on these files reveals current device state and configuration.  The sample output is shown below:

        	cat /proc/net/wanrouter/Config

 Device name | port |IRQ|DMA|mem.addr|mem.size|option1|option2|option3|option4
 wanpipe2    |0x364 | 05|0  |0xEC000 |0x2000  |   5030|   7200|   65536|   6200
 wanpipe1    |0x300 | 12| 0 |0xEE000 |0x2000  |   5080|  16000| 131072 |   5800

        	cat /proc/net/wanrouter/Status

 Device name |station|interface|clocking 	|baud rate| MTU |ndev|link state
 wanpipe2    | DCE   | RS-232  |external |  56000  | 1600 |  2   |connected
 wanpipe1    | DTE   | RS-232  |external |  56000  |  256 |  2   |connecting
To obtain device statistics, do 'cat' on WAN device entry in /proc/net/wanrouter directory as follows:

       	cat /proc/net/wanrouter/{device}

Router Interface Problem

To verify TCP/IP configuration of WAN interfaces, use Linux' ifconfig and route utilities.  Interface status and statistics can be viewed with

'ifconfig {interface}' command.  The output should look similar to this:

wan0 Link encap:UNSPEC       HWaddr (whatever)
     inet addr:<local_ip_addr> P-t-p:<remote_ip_addr>Mask:<netmask>
                UP POINTOPOINT RUNNING  MTU:1500  Metric:1
                Rx packets:0 errors:0 dropped:0 overruns:0
                Tx packets:0 errors:0 dropped:0 overruns:0
                Interrupt:9 Base address:0x360 Memory ee000-effff

The interface name will be the one that was defined in /etc/wanpipe#.conf [interfaces] section.  If this interface doesn't show up, after wanrouter start (check using ifconfig) a mistake was made while configuring the wanrouter.

Make sure that interface name in wanpipe#.conf [interfaces] section is the same as the file name in /etc/wanpipe/interfaces/{name}

    		ex. /etc/wanpipe/wanpipe#.conf

[interfaces]
wp1_ppp = wanpipe1, ,WANPIPE
          
/etc/wanpipe/wp1_ppp

Make sure all fields are correct in /etc/wanpipe/interfaces/{name} file.  Refer to section 2.2. 










Router Table Problem (Cannot PING)

View routing table by typing 'route -n' at the command prompt and make sure that routes to all remote networks and hosts exist.  The output should look similar to this:

        Destination     Gateway Genmask         Flags   Window  Use     Iface
        <remote_ip_addr> *       255.255.255.0   UH      0       0       wan0

Also make sure your ip_forwarding is turned on:
cat /proc/sys/net/ipv4/ip_forward   should be set to 1.

If you are running a firewall check your policy table make sure you have
no typos.


If all the above looks ok, you should be able to ping remote host.  If pings are not getting through, try to determine which part of the connection fails. There can be at least four possibilities:

* pings are not being transmitted by the local machine
* pings are not being received by the remote machine
* pings are not being replied to by the remote machine
* replies are not being received by the local machine

Quite often you can tell which part of the connection is not functioning by simply looking at the interface statistics output by the ifconfig utility at both local and remote machines.






















Sdla Dump Utility

A debugging utility, sdladump, is also included with the distribution which allows viewing adapter local memory in hexadecimal dump format during run-time. Its command line syntax is:

        sdladump {device} [{offset} [{length}]]

where: {device} name of the WANPIPE adapter, as it appears in the /proc/net/wanrouter/directory, e.g. wanpipe1

{offset}	adapter local memory address.  Default is 0

 		{length}	size of the adapter memory area to be dumped.  
Default is 256 bytes (0x100)

Note that adapter must be configured before you can use sdladump utility.



Proc File System Statistics

Another useful debugging utility is the proc file system. You can use the following command :

cat /proc/net/dev

to get the information about your interface. 


In this case ppp0 is the interface built using WANPIPE.  This information gives you how the driver for your device is behaving.  Following is the explanation of the heading used:

packets : 	States the number of TX/RX packets
errs:		States the number of TX/RX retries. The packet was not sent and will be retried. Please note that this is not an error count, in spite of the name.

       	drop:   	States the number of TX/RX dropped packets.  This occurs when the link (interface) is down and application is trying to transmit.  
       	fifo:  		Not used by WANPIPE
       	colls:  		States the number of TX/RX collisions.  This means that the device was busy and the packet will be retried.
       	carrier: 	Not used by WANPIPE


Line Problems  (T1) 

See www.sangoma.com/linedebug.htm.



Technical Support

If you are unable to diagnose and/or fix a problem yourself, you can ask Sangoma Technologies Inc. for technical support via fax or e-mail:

FAX:    (905)474-9223
E-mail: ncorbic@sangoma.com or dm@sangoma.com

When sending your request, please provide us with the following information:
* Detailed description of the problem
* System type (CPU, speed, RAM size)
* Linux kernel version number
* WANPIPE driver version number
* Adapter type
* Communications link type and parameters (e.g. line speed)
* Interface type (RS-232/V.35), DSU/CSU type (if any), etc.
* Contents of the following files:
                	/etc/wanpipe/wanrouter.rc
                	/etc/wanpipe/wanpipe#.conf
                	/var/log/wanrouter
                	/var/log/messages
                	/etc/wanpipe/interfaces/*
* Output of the following commands
                	cat /proc/interrupts
                	cat /proc/ioports
                	cat /proc/net/dev
                	cat /proc/net/wanrouter/Config
                	cat /proc/net/wanrouter/Status
                	cat /proc/net/wanrouter/{device}
                	ifconfig {interface}
                	route -n

All requests for technical support are normally replied to within 24 hours (excluding weekends and holidays).






Appendix A

Multiple PCI cards

The WANPIPE modules perform a hardware probe during an initial load.  Probe information found is written into the /proc/net/wanrouter/hwprobe.  Thus, if there are multiple cards in the system, load the WANPIPE modules using the modprobe command and view the proc file to determine the slot numbers of each card.
modprobe wanpipe 	: to load WANPIPE modules into the kernel.
cat /proc/net/wanrouter/hwprobe :hw probe results
modprobe -r wanpipe	: to unload WANPIPE modules. 

	



Appendix B


	The /usr/sbin/cfgft1 utility supports the advanced CSU/DSU configuration option.  The advanced configuration is text based and the following commands can be used to configure the on board CSU/DSU.


Advanced CSU/DSU Options

The Sangoma S508/FT-1 DSU has three memory banks:
* The factory default.
* The user configured bank.
* The scratch pad (working memory).

To check the current settings (bank settings), type D0 <ENTER>.  

Configuration changes are made as follows:

* Type C <ENTER> to  open  the  configuration mode.
* Change the required settings.
* After making these changes, type D1 <ENTER> to see the temporary  configuration bank.
* If these changes are correct, then type W<ENTER> to write the configuration to the non-volatile memory.
* Type Q <ENTER> to exit the configuration mode.



COMMANDS

+n 	Add channel n (where  n is 1-24) to the active list
-n      Delete channel n (where n is 1-24) from the active list
 			M0  	Set  framing  mode  to  ESF (ExtendedsuperFrame)
 			M1	Set framing mode to D4
     			K0 	Set encoding mode to B8ZS
     			K1	Set encoding mode to AMI
     			L0	Set line build out to CSU (0db) or DSX-1 (0-133ft)
     			L1	Set line build out to DSX-1 (133 - 266ft)
     			L2	Set line build out to DSX-1 (266 - 399ft)
     			L3	Set line build out to DSX-1 (399 - 533ft)
     			L4	Set line build out to DSX-1 (533 - 655ft)
     			L5	Set line build out to CSU (-7.5 db)
 			L6	Set line build out to CSU (-15 db)
 			L7	Set line build out to CSU (-22.5 db)
 			P0	Set clock mode to normal (SLAVE)
  			P1	Set clock mode to master (LDM mode only)
W	Write configuration to non-volatile memory
F	Get factory default configuration
     			Q	Exit configuration mode and move temporary
    		(scratch pad) configuration to  default  configuration
     			D0	Display actual configuration
     			D1	Display configuration in temporary memory
     			E0	Unit does not echo commands sent to it
     			E1	Unit echos back commands sent to it
     			T0	User test modes enabled
     			T1	User test modes disabled


NB:  Whenever  you  have finished your changes, you MUST do a WQ in order for them  to  "take".   After that do a D0 to check that the changes have, indeed been written to permanent memory.

Advanced Configuration S514-S508/FT-1 example

Required configuration:  
Channels  1-3  disabled, 
Channels 22 and 23 enabled 
Line build set to  DSX-1 (399 - 533ft) ESF 
framing mode Clock mode to normal 
     
Type: C-1-2-3+21+22K0L3M0P0D1WQ<ENTER>

OR

C<ENTER>		Open configuration mode
-1-2-3<ENTER>	Remove channels 1, 2 and 3 from the active list
+21+22 <ENTER> Add channels 21 and 22 to the active list
K0<ENTER>	Set the encoding mode to B8ZS
L3<ENTER>	Set the line build out to DSX-1 (399 - 533ft)
M0<ENTER>	Set the framing to ESF
P0<ENTER>	Set the clock mode to normal
D1<ENTER>	Display the temporary configuration before saving
W<ENTER>	Update the user memory
Q<ENTER>	Close the configuration mode

If you are adding or removing many D0 channels, break up the command into 2 or more commands, as the command line buffer has limited length.  For instance, to drop the line speed to 128kbps you need to remove  channels 3 to 24.
              
Do:

C<ENTER>
 	-3-4-5-6-7-8-9-10-11<ENTER>
         	-12-13-14-15-16-17-18-19-20-21-22-23-24<ENTER>
     WQ<ENTER>
     D0<ENTER>
       	and the  correct  configuration  should  be  shown.  


















WANPIPE? FOR LINUX(r)			September 24, 2001		        1 of 3


WANPIPE? FOR LINUX(r)			September 24, 2001		        3 of 3

