dev logo

Internet dial-up:
how it works



Puppy version 2.17 introduces a whole new ball game for those who access the Internet by conventional analog dialup modem. This is a very neglected area, but we cannot get around the fact that most modern modems are not supported by Linux. For modems that can be made to work however, Puppy is aiming to make it totally automatic, out-of-the-box bootup and use.

Introduction

The Puppy live-CD has internal HOWTO documents, and I have extracted part of the "HOWTO connect to the Internet" related to dialup:

Traditionally, Linux only really worked with what we call "hardware" serial modems -- whereas most modems these days are what is called "soft" modems and most of them only work with Microsoft Windows. If your PC has an internal modem, or a external modem attached via a USB cable, it is most likely a soft-modem.
Please note that I am describing analog modems here, for dialing-up an ISP (Internet Service Provider) -- these are different from ADSL and cable modems that are used for broadband Internet access.
What is a soft-modem? Basically, it is a cheaper modem that does less processing within itself and makes the CPU do some of the processing work. This means that it places an ovehead on the CPU, that you won't notice with modern fast CPUs, but it is a factor for old PCs. My personal experience also is that hardware modems tend to have higher transfer speed even with modern PCs.
The real down-side of a soft-modem however, is that to make the CPU do some of the processing work requires a special driver for that particular modem, and most manufacturers have only bothered to write drivers for Windows. However, some manufacturers have become more "Linux aware" and also some Linux enthusiasts have developed drivers.

Be warned, if you have a soft modem, it probably won't work with Puppy. Puppy-enthusiast 'ezeze5000' (forum name) sent me half-a-dozen old PCI soft-modem cards to test and I got one to work -- so that is about the ratio!

Note, if a soft-modem does work in Linux, there is a jargon name used for it -- it is called a "linmodem".

How to dialup

Puppy version 2.17 has introduced a whole new ball-game for dialup. In a nutshell, Puppy will auto-detect your analog modem, and if it is a supported type then everything will be automatially setup and you will be ready to connect. For serial modems this is straightforward, however Puppy now supports many soft-modems. If it's supported, it will be autodetected.

Warning: make sure your modem is plugged in and turned on when you boot Puppy, as Puppy autodetects at bootup only. This only has to happen once and on subsequent boots the modem does not have to be turned on at bootup -- only just before you want to use it.

To dialup, all you have to do is click the 'connect' icon on the desktop. This will bring up the "Internet Connection Wizard" in which you will see a a button labelled "Connect to Internet by dialup analog modem" -- just click that and you're in business -- a program I developed called PupDial runs, and it will tell you whether or not your modem is detected.

Note, in the Internet Connection Wizard you will see some radio-buttons at the bottom. These enable you to configure the desktop 'connect' icon to immediately launch PupDial, not the Wizard -- one less click to get online!

Note, you can also run PupDial from the "Network" menu.

How autodetection works

To understand this, you need to know something about the scripts that execute at bootup. There is a directory, /etc/rc.d, that has these scripts:


The 'README.txt' file in /etc/rc.d has information about the order in which these scipts execute.

rc.modules

Scripts 'rc.modules' and 'rc.module2' are responsible for loading the kernel driver modules for your hardware. Most kernel modules have information built-in to them about what hardware they are intended for and these scripts use that information to find the correct modules to load. For example, if you have a PCI modem, the modem chip is identified by unique numbers, what we call the Vendor:Product IDs -- you can see these for yourself by running PupScan (in the System menu). If a module is found to have a matching Vendor:Product ID, then it is loaded.

However, Puppy does a lot more than just load a module. The actual program that is used to load a module is 'modprobe', and to load say the 'esscom' module (the driver for ESS modems), Puppy will execute 'modprobe esscom'. Unlike any other distro, the 'modprobe' executable has been re-written by me to fetch the module from a module-archive file called 'zdrv_xxx.sfs' (where 'xxx' is the Puppy version number), which also contains any support firmware and executables required by that module. Therefore, a module doesn't just get loaded, but the entire infrastructure to make it work is also "fetched".

rc.modem

This is a post-setup script, after the modem module has been loaded. The main job of this script is to create '/etc/wvdial.conf', a configuration script used by the executable '/usr/sbin/wvdial' which does the actual dial-out operation.

The rc.modem script interrogates the modem by calling another program, '/usr/sbin/gen_modem_init_string', which attempts to determine an acceptable Hayes initialisation string for the modem.

The script may also set the modem to the correct country, although how this is done varies greatly, and it may be done by a script specific to a modem, not in rc.modem.

The 'zdrv' modules archive

The 'modprobe' program, if a module is not present locally, will "fetch" it from this file. The idea behind this is that Puppy runs as much as possible in RAM, for speed. There is no point in loading a whole heap of drivers and supporting files for hardware that you do not have, so it is kept out on the zdrv file. In the case of a live-CD, that's where this file is, but after you have created a "pup_save" file (a file for storage of your personal data) on a hard drive or other media, if Puppy determines this to be a fast internal media then Puppy will copy the 'zdrv' file there for easier access.

The firmware/executables package files may also include an installation script, that executes just once.

An example: Lucent modem

Let's use an example to follow through how it all works: say you have a Lucent PCI soft-modem. At bootup, the 'rc.modules' script will see a match between the 'ltserial.ko' kernel driver and the PCI ID of your modem interface. Therefore, rc.modules will execute 'modprobe ltserial'.

The 'modprobe' script will load 'ltserial' module, and if this is the first time will fetch it from the 'zdrv' file. The modprobe script will also check to see if there is any associated firmware and executables associated with that module -- it does this by looking in /lib/modules/firmware.dep.2.6.21.5 (or whatever is the kernel version being currently used by Puppy). This file is a lookup table that has all the extra files to be loaded, and these files are also fetched from the 'zdrv' file.

The Lucent modem has an installation script, 'pinstall.ltmodem-2.6-alk-8-patched2.sh'. Here it is:
#!/bin/sh
#this is called by /sbin/modprobe script, when ltserial.ko is fetched from
#zdrv module, but before the module is loaded.

cat /etc/modprobe.conf | grep "ltserial" > /dev/null 2>&1
if [ ! $? -eq 0 ];then #=0 found.
echo "alias char-major-62 ltserial" >> /etc/modprobe.conf
echo "alias /dev/ttyLT0 ltserial" >> /etc/modprobe.conf
echo "alias /dev/modem ltserial" >> /etc/modprobe.conf
touch -t 0512010101 /etc/modprobe.conf #set modify date back before modules.dep.
fi
This installation script does any one-off setup required, in this case some stuff has to be added to /etc/modprobe.conf.

As with most of the modem modules, the Lucent firmware/executables files also includes a script that executes every time Puppy boots. This script is /etc/init.d/ltmodem, and this is what is in it:
#!/bin/sh
#Barry Kauler, LGPL 2007
#called from rc.local0. note, rc.local0 calls rc.modem beforehand which
#sets /dev/modem if a hardware modem found (otherwise /dev/modem deleted).

#if a modem found, quit...
[ -e /dev/modem ] && exit

[ ! $1 ] && exit
[ "$1" != "start" ] && exit

if [ "`lsmod | grep '^ltserial'`" != "" ];then
ln -snf ttyLT0 /dev/modem
fi

#the module doesn't seem to support any country setting, so...
if [ -f /etc/countryinfo ];then
SPATTERN="s/^MODEM_COUNTRY_STRING.*/MODEM_COUNTRY_STRING=''/"
cat /etc/countryinfo | sed -e "$SPATTERN" > /tmp/countryinfo
sync
mv -f /tmp/countryinfo /etc/countryinfo
fi
#.../usr/sbin/gen_modem_init_string reads this variable (called from second
#entry to /etc/rc.d/rc.modem, in rc.local0).
The main thing that this script does is set the symlink /dev/modem to /dev/ttyLT0, if it has not already been set.

The second thing it does is determine how to setup the modem for the correct country. Possibly a modem does not need anything done to it in this regard, also the way in which country setting is done differs greatly between modems. You will need to study /etc/rc.d/rc.modem to learn more about this -- also study the setup scripts for the other modems, and it is best to have Unleashed to do this.

The script rc.modem will then execute and create the dialup configuration file, /etc/wvdial.conf.

To actually dialup, you will run one of the GUIs, such as PupDial or Gkdial (Puppy v4.00 and later does not have Gkdial, only PupDial). The former is a frontend for the commandline application 'wvdial', which in turn uses the 'wvdial.conf' configuration file. PupDial displays the contents of wvdial.conf in little boxes that you can edit, so you don't have to edit the wvdial.conf file directly.

Puppy Unleashed

If you are interested in the development side of Puppy, download Unleashed. This has the tools for creating a live-CD from individual packages. It also has the tools for creating the 'zdrv' file, and you can see how it gets put together, including the modem stuff.

Find out more about Unleashed here: Puppy Unleashed



(c) copyright 2006,2007,2008 Barry Kauler http://www.puppylinux.com/
No part of this page is to be reproduced anywhere else. I have found that there is a problem where parts of my web pages are being inserted at other sites, then not updated, whereas I am updating my pages regularly. This is not a desirable situation, so please just link to my pages.