13.3. PPP over ISDN
ISDN has offered convenient, high-speed data communicationsat a pricefor many years; it is particularly popular in Europe, where rates and marketing have been more favorable to its use than in the U.S. ISDN, which integrates data and regular voice transmission over a single line, offers both a faster connection setup and much better throughput than traditional modems.
ISDN lines can transfer 64 kbits per second. And unlike analog lines, they can achieve this speed all the time because their transmission does not depend on the vagaries of analog transmission with interference by various kinds of noise. A newer protocol called ADSL (Asynchronous Digital Subscriber Line) is upping the ante for fast data access over phone lines and is taking over from ISDN in many regions of the world.
In this section, we describe how to configure dial-up access to your Internet provider over an ISDN line. We cover only the most common style of connection, synchronous PPP, not the special mode called raw IP. Furthermore, this section discusses just internal ISDN boards, which require a kind of setup that's different from the dial-up access covered in the previous section. To set up external ISDN devices, or the so-called ISDN modems (a term that is an oxymoron because there is no modulation and demodulation), you can use commands similar to those in the previous section because these devices present themselves to the computer and the operating system like a normal modem, albeit one that offers some additional commands, faster connection setup, and higher throughput.
If you want more information beyond what we present here, the source for all ISDN-related information for Linux is http://www.isdn4linux.de (despite this domain being registered in Germany, all the information here is in English).
In a way, setting up ISDN connections is much easier than setting up analog connections because many of the problems (bad lines, long connection setup times, and so on) simply cannot occur with digital lines. Once you dial the number, the connection is set up within milliseconds. But this can lead to problems. Because the connections are set up and shut down so fast, a misconfigured system that dials out again and again can cost you a fortune. This is even more problematic because with internal ISDN cards, you hear no clicking and whistling as you do with modems, and there are no lights that inform you that a connection has been made. You can check the status of your ISDN line with some simple programs, though.
Follow these two steps to set up dial-up PPP over ISDN:
We cover those steps in the next sections.
13.3.1. Configuring Your ISDN Hardware
The first step involves making your ISDN board accessible to the kernel. As with any other hardware board, you need a device driver that is configured with the correct parameters for your board.
Linux supports a large number of ISDN hardware boards. We cannot cover every single board here, but the procedure is more or less the same for each one. Reading the documentation for your specific card in the directory Documentation/isdn in the Linux kernel sources will help you a lot if your board is not covered here.
We will concentrate here on boards that use the so-called HiSax driver. This device driver works with almost all cards that use the Siemens HSCX chipset (and thus with most passive cards available on the market today). That includes, for instance, the USR Sportster internal TA and the well-known Teles, ELSA, and Fritz boards. Other boards are similarly configured. Even some active cards are supported by Linux, including the well-known AVM B1 and the IBM Active 2000 ISDN card.
The first thing you need to do is configure the kernel so that it includes ISDN support. We advise you to compile everything ISDN-related as modules, especially while you are experimenting with setting it up. You will need the following modules:
Compile and install the modules as described in Chapter 18. Now you are ready to configure your ISDN hardware. Some distributions, such as SUSE, make setting up ISDN lines very easy and comfortable. We cover the hard way here in case your distribution is not so user-friendly, the automatic configuration does not work, or you simply want to know what is going on behind the scenes.
Now you need to load the device driver module using modprobe. This will automatically load the other modules as well. All the device driver modules accept a number of module parameters; the hisax module accepts, among others, the following:
For example, the following command loads the HiSax driver for use with a Teles 16.3 board, Euro ISDN, IO address 0x280, and IRQ line 10 (a very common case):
tigger # modprobe hisax type=3 protocol=2 io=0x280 irq=10
Please see Documentation/isdn/README.HiSax or the equivalent file for your hardware for more information.
This module is not much of a talker; if there is no output from the modprobe command, it is likely that everything went well. You might also want to check your system log at /var/log/messages. You should see a few lines starting with HiSax: (or the name of the driver you are using); the final line should be
HiSax: module installed
If the module did not load, you will most likely also find the answer in /var/log/messages. The most common problem is that the IRQ or I/O address was wrong or that you selected the wrong card type. If all else fails, and you have Windows installed on the same machine, boot up Windows and check what it reports for the IRQ and I/O address lines. Sometimes, it helps to take a look in /proc/ioports and in /proc/interrupts to see if the HiSax chipset has the right I/O port and the right interrupt assigned.
You should do one more check before you jump to the next section, and this check involves calling yourself. This can work because, with ISDN, you always have two phone lines at your disposal. Thus, one line will be used for the outgoing "phone call," and the other line will be used for the incoming one.
In order to have the ISDN subsystem report what is going on with your phone lines, you will need to configure it to be more verbose than it is by default. You do this by means of three utility programs that are all part of the isdn4k-utils package that you can find at your friendly Linux FTP server around the corner.
The isdn4k-utils package contains, among other things, the three utilities hisaxctrl for configuring the device driver, isdnctrl for configuring the higher levels of the ISDN subsystem, and isdnlog, a very useful tool that logs everything happening on your ISDN lines. Although you can use hisactrl and isdnctrl without any configuration, you will need to provide a small configuration file for isdnlog. For now, we will content ourselves with a quick solution, but once your ISDN connection is up and running, you will want to configure isdnlog to see where your money is going. So for now, copy one of the sample configuration files contained in the isdnlog package to /etc/isdn/isdn.conf. You will need to edit at least the following lines:
Once you have set this up, execute the following commands to make your ISDN system more verbose:
tigger # /sbin/hisaxctrl boardid 1 4 tigger # /sbin/isdnctrl verbose 3 tigger # /sbin/lsdnlog /dev/isdnctrl0 &
If you are using a driver other than HiSax, you might need to use a different command. For example, for the PCBit driver, the command pcbitctl is available in the isdn4k-utils package.
Now you can go ahead and phone yourself. You should try all your MSNs (multiple subscriber numbers, which are your ISDN phone numbers) to see that the board can detect all of them. During or after each call, check /var/log/messages. You should see lines like the following:
Mar 16 18:34:22 tigger kernel: isdn_net: call from 4107123455,1,0 -> 123456 Mar 16 18:34:33 tigger kernel: isdn_net: Service-Indicator not 7, ignored
This shows that the kernel has detected a voice call (the service indicator is 0) from the phone number 123455 in the area with the area code (0)4107 to the MSN 123456.
Note how the number called is specified, because you will need this information later. The number is sent with the area code in some phone networks, but without the area code in others. Anyway, congratulations if you have come this far. Your ISDN hardware is now correctly configured.
13.3.2. Setting Up Synchronous PPP
Setting up the PPP daemon again involves several substeps. On Linux, the ISDN board is treated like a network interface that you have to configure with special commands. In addition, you need to specify the username and password that your ISP has assigned you. When everything is configured, you start up the ipppd daemon, which lurks in the background until a connection request is made.
First, let's configure the "network interface." This involves a number of commands that most system administrators simply put into a script that they store in a file, such as /sbin/pppon. Here is a sample file that you can modify to your needs:
/sbin/isdnctrl addif ippp0 /sbin/isdnctrl addphone ippp0 out 0123456789 /sbin/isdnctrl dialmax ippp0 2 /sbin/isdnctrl eaz ippp0 123456 /sbin/isdnctrl huptimeout ippp0 100 /sbin/isdnctrl l2_prot ippp0 hdlc /sbin/isdnctrl l3_prot ippp0 trans /sbin/isdnctrl encap ippp0 syncppp /sbin/ifconfig ippp0 188.8.131.52 pointopoint 184.108.40.206 metric 1
Let's go through these commands one by one.
If you want, you can also reverse the setup by creating a script that shuts down the interfaces and so on. For example, it would use the isdnctrl delif command. But such a script is not strictly necessary, unless you want to disable all dialing at runtime.
Phew! But we are not finished yet. Next, you need to configure the ipppd daemon, which you do in the file /etc/ppp/ioptions. You can also have a configuration file specific to each ipppd daemon, but that is necessary only if you want to be able to use different ISDN connectionsthat is, if you have multiple dial-up accounts.
The following is an ioptions file that is generic enough to work with most providers. It does not give maximum throughput but is quite stable. If you want to optimize it, ask your provider about the possible settings and read the manual page for ipppd(8):
debug /dev/ippp0 user yourusername name yourusername mru 1500 mtu 1500 ipcp-accept-local ipcp-accept-remote noipdefault -vj -vjccomp -ac -pc -bsdcomp defaultroute
You have to change only two things here: change yourusername in the third and fourth lines to the username that your provider has assigned you for connecting to its system. We won't go through all the options here; see the manual page when in doubt.
ISDN access requires the same security as an analog modem. See "PAP and CHAP," earlier in this chapter, for directions on setting up your pap-secrets or chap-secrets file as required by your service provider.
Now we have got our things together and can start having fun! First run the ipppd daemon:
tigger # /sbin/ipppd pidfile /var/run/ipppd.ippp0.pid file /etc/ppp/ioptions &
The ipppd daemon will now wait for connection requests. Since we have not configured it yet to automatically make a connection, we have to manually trigger the connection. You do this with the following command:
tigger # isdnctrl dial ippp0
You should now check /var/log/messages. There should be lots of messages that start with ipppd. The last of those messages should contain the words local IP address and remote IP address together with the IP addresses. Once you find those messages, you are done. Because we have used the defaultroute option previously, the kernel has set up the default route to use the ISDN connection, and you should now be able to access the wide, wide world of the Internet. Start by pinging your provider's IP address. Once you are done and want to shut down the connection, enter
tigger # isdnctrl hangup ippp0
If you have a flat rate with your ISP, then you can set the huptimeout to 0, and you will stay online all the time without ever hanging up. Of course, this is nice to have, but remember that most ISPs reset the connection after 24 hours, and if you have a dynamic IP address, you will possibly be assigned another IP address every 24 hours.
13.3.3. And If It Does Not Work?
If you have no connection even though your hardware was successfully recognized and you have set up everything as described here, /var/log/messages is again your friend. It is very likely that you will find the cause of the error there, even though it might be buried a bit.
The most common error is specifying the password or the username incorrectly. You know that you have a problem with the authentication if you see a line such as:
PAP authentication failed
CHAP authentication failed
in the logfile. Check your chap-secrects or pap-secrets file very carefully. Your provider might also be able to see from its logfiles where exactly the authentication went wrong.
Of course, your provider might not support synchronous PPP as described here, even though most providers do nowadays. If this is the case, ask your provider for exact settings.
If it still does not work, ask your provider. A good ISP has a phone support line and can help you connect your Linux box. If your provider tells you that it "only supports Windows," it's time to switch. Many Linux-friendly providers are out there. Often the support staff is using Linux and can help you even though the provider's official policy is not to support Linux.
If for some reason you are stuck with an uncooperative provider, try finding other customers of this provider who also use Linux. Setting up your connection in nonstandard cases means fiddling with the options and parameters of the ISDN subsystem in the kernel and the ipppd daemon, and if somebody else has already found out what to do, you don't have to.
13.3.4. Where to Go from Here?
Once your ISDN connection works and you can access the Internet, you might want to set up some conveniences or other customizations. Here are some suggestions: