Linux Users

Setting up an ISDN link

This page describes setting up the Eicon Diva 2.01 internal PCI card with RedHat 6.2. These cards use the hisax driver. If you are using a different card, you may need a different driver. Once you have got the driver for your card installed, then the scripts below should be useful for any card.

NOTE: More recent version of 'isdn4k-utils' now provide some extra features for the 'active' Diva cards. These Pages are for the 'dumb' Diva card so be aware of what you buy. The Diva-Pro card (semi-Intelligent) is not supported. The Diva-Server (PCI Version) is supported - but works quite differently.

The Eicon Diva 2.01 (and other Diva products) can be purchased through Posix Systems. Windows drivers are included with the card - but setting up Linux to use the card is not so easy - hence the reason for this page. We also hope that you will be using Posix as your dialup ISP so all ISP references are to Posix.

Included code examples has been specifically designed so that you can cut'n'paste them easily for use in your own system.

Kernel versions 2.2.12 and up have ISDN driver support built in. On earlier versions you have to download some mods and patch the kernel - all good fun. These pre-compiled kernels load ISDN as a module. You will also need the isdn4k-utils package. These are available as RPM's.

The target is to get a system that will do 'dial on demand' - allow automatic dial out to POSIX or your own ISP for any system on the network. This also needs IP Masquerading. This is included that as part of the Firewall script.

We also show how to set-up a dial in link via ISDN. This requires the option files to be set-up in a particular way.

The advantage of using `dial-on-demand' is that any user can browse when they wish, without someone having to access the Linux machine to bring up the link. However, if you do not set up your Windows machines or Samba correctly then you may find lots of calls being made when you don't expect it. Mail clients like Outlook and Netscape have settings to check for new mail every so often. If you don't have a local e-mail server, then this will cause the link to come up. Disable this feature or set the time to a very long period. When Netscape is closed this may also cause a dial-out. Using a local cache (Squid) on your server, and pointing Netscape at that for its Internet connection can stop this.
Another cause of unwanted dial-outs is Windows browsing. See the Samba configuration page for a suggested set up.

We assume that you have installed the card, and have RedHat 6.2 installed. (Posix Systems also can supply the downloaded ISO images of Redhat 6.2 on CD)

Make sure you have installed isdn4k-utils. To check do

rpm -q isdn4k-utils

Expect something like ...isdn4k-utils-3.0-5
It is provided on the RedHat CDROM. It is usually necessary to be logged in as root to install an rpm package.
The other assumptions are that the Linux box is set to forward IP packets. Check that

cat /etc/sysconfig/network

has the line

FORWARD_IPV4=true

You can set this by editing this file directly, or using the X-Windows tool netcfg. Also any Windows machine must have the Gateway value in Network Neighbourhood - TCP/IP set to the IP address of your Linux machine. NOTE: These two steps are not necessary if you are only connecting a single Linux machine to the Internet.

To load the hisax driver module, use the following info and create a script called

vi /etc/rc.d/rc.isdn
# !/bin/sh export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin 
# /etc/rc.d/rc.isdn - script to load the hisax module for ISDN.
# The hisax module is given an id - HiSax.
# This is required as we need to use the hisaxctrl command.
# Use type=11 for the Eicon card
# Protocol=2 is the Euro ISDN protocol used in South Africa. modprobe hisax id=HiSax
type=11 protocol=2

HiSax types are:-

  1. Teles 16.0
  2. Teles 8.0
  3. Teles 16.3
  4. Creatix PNP
  5. AVM A1 (Fritz)
  6. ELSA PC
  7. ELSA Quickstep
  8. Teles PCMCIA
  9. ITK ix1-micro
  10. ELSA PCMCIA
  11. Eicon.Diehl Diva
  12. Asuscom ISDNLink
  13. Teleint
  14. Teles 16.3c
  15. Sedlbauer speed
  16. Sedlbauer PC/104
  17. Sedlbauer speed pci
  18. USR Sportster internal
  19. MIC card
  20. ELSA Quickstep 1000PCI
  21. Compaq ISDN S0 ISA card
  22. Travers Technologies NETjet PCI card
  23. TELES PCI
  24. Sedlbauer Speed Star
  25. reserved
  26. Dr Neuhaus Niccy PnP/PCI
  27. Teles S0Box
  28. AVM A1 PCMCIA (Fritz)
  29. AVM PnP/PCI
  30. Sedlbauer Speed Fax+
  31. Siemens I-Surf
  32. ACER P10
  33. HST Saphir
  34. Telekom A4T
  35. Scitel Quadro
  36. Gazel ISDN cards
  37. HFC 2BDS0 PCI
  38. Winbond 6692 PCI

Make this script executable by -

chmod 755 /etc/rc.d/rc.isdn

Run this script to load the hisax driver -

/etc/rc.d/rc.isdn

Look in the syslog to see if it has loaded correctly -

tail -30 /var/log/messages

You should see in the syslog a number of lines regarding the hisax driver. The last few should look similarish to...
......
Dec 19 14:47:43 weber kernel: HiSax: 2 channels added
Dec 19 14:47:43 weber kernel: HiSax: MAX_WAITING_CALLS added

The driver has been loaded!

If you use 'lsmod' you can see the modules that are loaded. There should be 'hisax', 'isdn' and 'slhc' amongst others.
If you don't see 'slhc' - then add (and run) the command

modprobe slhc

into the script '/etc/rc.d/rc.isdn'.

 

vi /etc/isdn/isdn.conf

and check your local settings. This file is part of the isdn4k-utils.
Enter the country code - South Africa is 27...
the area prefix should be 0,
and enter your own area code without the leading 0.

I live in Pretoria - so have

COUNTRYCODE = 27 AREAPREFIX  = 0 AREACODE    = 12 

Now set-up the pap-secrets file. Edit /etc/ppp/pap-secrets.
Add a line -

vi /etc/ppp/pap-secrets  'client'    'server'     'secret' 

where
'client' is your account or login name with your ISP
'server' - just use *
'secret' is the password for your ISP account. Don't include the quote marks.

eg

mark      *         VerySecretPassword

If you intend to use 'chap' then set up /etc/ppp/chap-secrets in exactly the same way.

 

Isdnctrl

The general set-up utility provided with isdn4k-utils (or isdn4linux) is `isdnctrl'. This command is used in the following scripts.

The first script is used with Posix Systems. Whether you have Static or Dynamic IP's - the IPs are allocated from the Posix side - so act as though all IP's are Dynamic.

 

vi /usr/local/sbin/isdnup
# !/bin/sh 
# /usr/local/sbin/isdnup
# Set-up ippp0 to dial out to Posix export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin
# PHONE=4189680
# Cape Town PHONE=8420800
# Pretoria
# PHONE=4053000
# Johannesburg isdnctrl addif ippp0 isdnctrl addphone ippp0 out $PHONE isdnctrl secure
ippp0 on isdnctrl huptimeout ippp0 180
# Shut down after 180 seconds of inactivity isdnctrl l2_prot ippp0
hdlc isdnctrl l3_prot ippp0 trans isdnctrl encap ippp0 syncppp
isdnctrl pppbind ippp0 0 hisaxctrl HiSax 1 4
# Enable isdnlog isdnlog /dev/isdnctrl0 -D
# Start isdnlog echo 1 > /proc/sys/net/ipv4/ip_dynaddr
# Required for use with dynamic IP's ifconfig ippp0 192.168.1.5 pointopoint 192.168.1.10
# These are dummy numbers. They are replaced later. ipppd file /etc/ppp/ioptions.ippp0
isdnctrl dialmode ippp0 auto
# or manual sleep 2 route add default ippp0

More details for these commands are available by typing `man isdnctrl'.
Make this script executable -

chmod 755 /usr/local/sbin/isdnup

Do not run this script yet as the option files have not been defined.

NOTE: You may find ipppd in /sbin or /usr/sbin depending on your version of isdn4linux etc. Use 'whereis ipppd' to find out.

 

Setting up the `ioptions' files

The daemon that links to the ISDN card is 'ipppd', and it communicates via interfaces 'ippp0', 'ippp1' etc. just like 'eth0' communicates with the Network adaptor. Several instances of ipppd can be running at the same time. The file /etc/ppp/ioptions is read by ipppd whenever it is loaded. To be able to dialout to an ISP, and allow external access to this host, or even dialout to a different host or ISP, you must run an ipppd for each interface you want active. As ipppd (see 'man ipppd') always reads /etc/ppp/ioptions, then only common values must be present in /etc/ppp/ioption. The values specific to an interface will be stored in /etc/ppp/ioption.ippp0, and /etc/ppp/ioptions.ippp1 etc.

The `ippp0' interface is added in the script above. Type `ifconfig' and you should see the interface details.
We will concentrate on the option files necessary to bring up the link to Posix Systems.

Create `/etc/ppp/ioptions'. It should contain -

 

vi /etc/ppp/ioptions
# /etc/ppp/ioptions. 
# Options file with common parameters. debug lock -vj -vjccomp -bsdcomp noccp -ac -pc

Now create the /etc/ppp/ioptions.ippp0 file with details for Posix Systems.

 

vi /etc/ppp/ioptions.ippp0
# /etc/ppp/ioptions.ippp0 /dev/ippp0 noauth -chap 
# Not using CHAP authentication user xxxx
# Replace xxx with your account or login name ipcp-accept-local
# Accept local IP from ISP. ipcp-accept-remote
# Accept remote IP from ISP. netmask 255.255.255.255 mtu 1500

More details for these options are available in the ipppd man page (`man ipppd').

NOTE: The lines -vj, -ac -pc, etc disable various compression options. Using no compression has given the most reliable connection with some versions of isdn4k-utils, but it is worth checking with newer versions to see if compression options are now available.

Now create a script to remove the ISDN set-up.

 

vi /usr/local/sbin/isdndown
# !/bin/sh 
# /usr/local/sbin/isdndown export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin
# Script to remove the ISDN setup kill `cat /var/run/ipppd.pid` ifconfig ippp0 down
isdnctrl delif ippp0 kill `cat /var/run/isdnlog.isdnctrl0.pid`
# modprobe -r hisax

The last line removes the hisax driver, and is currently commented out. Note that the quote marks around the `cat` command on the kill lines are both open quote marks

Make this executable....

chmod 755 /usr/local/sbin/isdndown

We have now created -

  1. a script to load the hisax driver - `rc.isdn'
  2. a script to setup the ippp0 interface and isdnctrl parameters for ippp0 - `isdnup'
  3. the option files to be used by `ipppd' - `/etc/ppp/ioptions' and `/etc/ppp/ioptions.ippp0'
  4. and a script to remove this set-up - `isdndown'

 

Fiddly bits

It seems that some part of the system does not create routes correctly. On a RedHat 5.2 system with a 2.0.36 kernel and ISDN patches applied there are less problems with spurious routes being created than with the 2.2.12 & 2.2.13 kernels and ISDN4linux.

The routes direct the IP traffic to the correct place. For `dial-on-demand' you must have the default route set to ippp0 before the link comes up or nothing happens. We have added a default route as the last line of the `isdnup' script. However, once the link is up, this route goes away and other routes are added!!. Make sure you have only one default route. You can see this problem being discussed frequently on the isdn4linux newsgroup `de.alt.comp.isdn4linux', and in the FAQ that comes with isdn4linux.

A solution is to use /etc/ppp/ip-up.local, and /etc/ppp/ip-down.local. The ip-up.local script should be called from ip-up after the link to your ISP is brought up, whereas the ip-down.local script is called by ip-down when the link dies.

These files don't always exist, so create them. Edit /etc/ppp/ip-up.local to include -

vi /etc/ppp/ip-up.local
# !/bin/bash INTERFACE_NAME=$1 if [ "$INTERFACE_NAME" = "ippp0" ] ;
then /sbin/route add default ippp0 fi

Make this file executable....

chmod 755 /etc/ppp/ip-up.local

Because this script is run whenever the link is brought up using any of the interfaces, it is important to only add the default route for the interface that requires it. The ip-up.local and ip-down.local scripts are passed certain parameters when they are called. The first parameter is the interface. This script tests for ippp0 and only adds a default route if that is true. Make sure there are spaces either side of the square brackets and the = sign. These scripts do not have any knowledge of your path, so include the full path to the command. See `man ipppd' for more details.

When the link is disconnected you must remove the routes that were added when the link came up, otherwise the system will not be in the correct state to initiate the link again.

Edit /etc/ppp/ip-down.local to include -

vi /etc/ppp/ip-down.local
# !/bin/bash INTERFACE_NAME=$1 
# Try to fix the routes for ISDN if [ "$INTERFACE_NAME" = "ippp0" ] ;
then /sbin/ifconfig ippp0 down /sbin/ifconfig ippp0 up
/sbin/route add default ippp0 fi

Make this file executable...

chmod 755 /etc/ppp/ip-down.local

NOTE: Do make sure that when the link comes up you have only one default route.

 

To initiate the link

To start the link - load the driver with `/etc/rc.d/rc.isdn'. Once this is loaded it is not usually necessary to unload it.
Set-up the ippp0 interface by running `isdnup'. The ippp0 interface will be added, and if you have 'isdnctrl dialmode ippp0' set to auto, then opening a browser and selecting a webpage should cause the link to be created.

If `isdnctrl dialmode ippp0' is set to manual, type `isdnctrl dial ippp0', and the system will dial the number defined in the `isdnctrl addphone' statement.
To bring the link down use `isdnctrl hangup ippp0'.

Do make sure you have the correct IP numbers in /etc/resolv.conf.

For Posix - these are automatically sent to the Linux machine from the router that you dial in from but you can manually set /etc/resolv.conf to...

search posix.co.za nameserver 160.124.48.1 nameserver 160.124.112.11 

NOTE: If you wish to use a firewall with a dynamic IP, add the firewall rules to the ip-up.local file. See the Firewall page for more details
Also if you need to use CHAP authentication, in the file '/etc/ppp/ioptions.ippp0' change the 'user xxx' to 'name xxx' and fill in /etc/ppp/chap-secrets using the same format as in /etc/ppp/pap-secrets. eg as with SAIX

 

Dial in configuration

The dial in configuration allows for remote users to access a server via ISDN. One could use this set-up to provide remote support to customers systems. It can be used to provide e-mail and file access for remote users etc.
The dial-out channel will continue to work.

Set up ippp1 on the system that will answer the dial-in request. In this set-up the server allocates the IP number to be used by the remote user, so use a 'dynamic-IP' configuration on the remote system.

Create a file /usr/local/sbin/isdndialin.up -

# !/bin/sh 
# /usr/local/sbin/isdndialin.up
# Script to set up ippp1 to answer incoming calls. export
PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin
isdnctrl addif ippp1 isdnctrl eaz ippp1 xxxxxx
# Replace xxx with your MSN. See below isdnctrl secure ippp1 off isdnctrl l2_prot
ippp1 hdlc isdnctrl l3_prot ippp1 trans isdnctrl encap ippp1
syncppp isdnctrl dialmode ippp1 manual isdnctrl huptimeout
ippp1 300 isdnctrl pppbind ippp1 1 ifconfig ippp1
192.168.1.1 pointopoint 192.168.1.5
# These are dummy numbers
# The IP numbers in the ioptions.ippp1 file allocate the numbers to be used ipppd
pidfile /var/run/ipppd.ippp1 file /etc/ppp/ioptions.ippp1
# This line runs ipppd, and defines the pid and options files to use

Make this script executable

The isdnctrl eaz option is interesting. For EAZ read MSN (Multi Subscriber Numbering). This is your local digital number. Its usually the last four digits of your number. It is due to the checks carried out by isdn4linux. If you have problems try other options, unless you know the real MSN when use that. If you haven't set-up /etc/isdn/isdn.conf correctly then this will not work
The /etc/ppp/ioptions file containing the common values will be read when ippp0 comes up for dial out to Posix, and when ippp1 comes up for dial-in, so options specific to ippp1 are put in /etc/ppp/ioptions.ippp1.

# /etc/ppp/ioptions.ippp1 
# To answer incoming dial-in request on ISDN line /dev/ippp1 auth
# Requires remote system to authenticate using PAP
+pap -ac -pc mru 1500 mtu 1500 192.168.1.1:192.168.1.3
# Use the servers local IP and allocate
# the remote IP netmask 255.255.255.255 proxyarp
# Enables remote computer to become part of network

Now to remove the set-up to allow restart etc.

# !/bin/sh export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin 
# /usr/local/sbin/isdndialin.down ifconfig ippp1 down isdnctrl delif ippp1
kill `cat /var/run/ipppd.ippp1`

Make this script executable. Type 'isdndialin.up' start, and 'isdndialin-down' to disable.

NOTE: It is important to add some additional lines to /etc/ppp/ip-down.local to sort out the routes after the script has been run.
Add :

# !/bin/sh export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin 
INTERFACE_NAME = $1 if [ "$INTERFACE_NAME" = "ippp1" ] ;
then /sbin/ifconfig $INTERFACE_NAME down /sbin/ifconfig $INTERFACE_NAME up fi

 

Loading ISDN on boot-up

Having created the scripts above, it is now a simple matter to automate the loading of your ISDN configuration on booting. For a RedHat system edit the /etc/rc.d/rc.isdn file and add the last two lines:

# !/bin/sh export PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin 
# /etc/rc.d/rc.isdn - script to load the hisax module for ISDN.
# The hisax module is given an id - HiSax.
# This is required as we need to use the hisaxctrl command.
# Use type=11 for the Eicon card
# Protocol=2 is the Euro ISDN protocol used in South Africa.
modprobe hisax id=HiSax type=11 protocol=2
# bring up the ISDN System /usr/local/sbin/isdnup

to the end of the file.

For other Linux distributions, add the same lines to the relevant start-up file.

 

MPPP - Multi PPP or Channel Bundling.

This allows you to achieve 128 kbps with the two channels of an ISDN card, or greater with more cards in the same PC!.

Both the options file and the script containing all the isdnctrl commands need changing. Changes are shown in BLUE

The original 'isdndown' file removes the interface.

# !/bin/sh 
# /usr/local/sbin/isdnup
# Set-up ippp0 to dial out to Posix export
PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin
# PHONE=4189680
# Cape Town PHONE=8420800
# Pretoria
# PHONE=4053000
# Johannesburg isdnctrl addif ippp0 isdnctrl addphone ippp0 out
$PHONE isdnctrl secure ippp0 on isdnctrl huptimeout ippp0 180
# Shut down after 180 seconds of inactivity isdnctrl l2_prot ippp0
hdlc isdnctrl l3_prot ippp0 trans isdnctrl encap ippp0
syncppp isdnctrl pppbind ippp0 0 echo 1 > /proc/sys/net/ipv4/ip_dynaddr
# Required for use with dynamic IP's isdnctrl addslave ippp0 ippp1 isdnctrl
addphone ippp1 out $PHONE isdnctrl secure ippp1 on isdnctrl huptimeout
ippp1 180 isdnctrl l2_prot ippp1 hdlc isdnctrl l3_prot ippp1
trans isdnctrl encap ippp1 syncppp isdnctrl pppbind ippp1 1
ifconfig ippp0 192.168.1.5 pointopoint 192.168.1.10

# These are dummy numbers. They are replaced later.
ipppd file /etc/ppp/ioptions.ipppM pidfile /var/run/ipppd.pid
isdnctrl dialmode ippp0 auto sleep 2 route add default ippp0 isdnlog /dev/
isdnctrl0 -D

# Start isdnlog

The options file '/etc/ppp/ioptions.ipppM' is as follows:

# /etc/ppp/ioptions.ipppM /dev/ippp0 /dev/ippp1 noauth user xxxx -chap 
# For MPPP +mp ipcp-accept-local ipcp-accept-remote netmask 255.255.255.255

Start the first channel with isdnctrl dial ippp0, then add the second channel with isdnctrl dial ippp1
It is possible to add/remove the additional channel in the middle of a transfer.
The 'auto' bonding option does not work with the version of isdn4k-utils that was being used - hence the manual dial.

PLEASE NOTE. MPPP works with Posix - as long as you asked for this service. If you have problems, it may not have been enabled for your account.

Happy browsing!