Modem compatibility

Packages

There are two main packages - pppd [to get online using
ppp] and ipchains [to 'firewall' your connection]. Two of the many optional
packages are crond [to schedule when your connection is available] and
minicom [to test your modem]

Preparation

You will need to be the 'root' user to follow these instructions. Please note - these
instructions apply in general to using a 'real' modem, (e.g. a modem
which doesn't need a software driver to run as many winmodems).

1 . Connecting the modem
The communications ports in Linux are named differently to those in Windows.
The correct communications port to use is the one with devices listed in the /dev
directory which begin 'ttyS'.

In this example
the modem is connected to Com2. You may also want to make sure that your
com port is operating at an appropriate speed. You can use the setserial
command to check and change the settings for the com port.

Most distributions provide a rc.serial or serial script in the init directories.
These set the com port flags at boot time for each com port. If you cannot
locate these, or have reasons for setting com speeds differently then you
might create the following shell script, not forgetting to chmod +x the
script before running it.

You may want to make sure that this value is set every time that the ppp
connection is requested. Later in this guide we give an example of how to place this in a shell script before starting pppd.

3. Making sure your machine is secure
To create a firewall and protect your machine from unwanted access you
should use an ipchains rule set to control access and stop unwanted
visitors. Simply download the ipchains files,
unpack them and place the file firewall.sh in /usr/sbin making sure the file firewall.sh is executable. You can enable the firewall by specifying
the
name of the external ppp device, usually zero and in the internal networking
device.

[root@ashaman]firewall.sh ppp0 eth0

Note eth0 is necessary where you are using Linux as a gateway between
the Internet and a local area network, otherwise the following command
will protect your machine.

[root@ashaman]firewall.sh ppp0

4. Resolving names on the Internet
You will need to let Linux know how and where to locate Internet sites.
This guide assumes that you are not using Domain Name Server local to
your box. You will need to amend at least 2 files. By default your Linux
distribution will have configured the other host files correctly.

5. Configuring PPP
Distributions of Linux vary, but in general the configuration files for
PPP will be stored in /etc/ppp . In the example a simple ppp options file
will be created along with a chat script (which will dial the modem).
PPP connections will vary depending on the service you are dialing. You
will need to amend the chat script accordingly and this is shown
below. PPP Connections come in two parts: the chat script and the pppd
options.

From here ppp should become enabled once a request has been made to access
the Internet. Once PPP is running it will automatically start the chat
script to dial the modem and access the Internet . If you want to stop
the pppd process you will need to locate its process ID and stop it. This
can be done with the following command:

[root@ashaman] ps -ax | grep pppd
29064 ttyS1 S 0:00 pppd

The value 29064 is the process id of the running pppd application. You
can also find this value by typing the following command:

[root@ashaman] cat /var/run/ppp0.pid 29064

In either situation you can stop the process by issuing the 'kill' command

[root@ashaman] kill 29064

Or you could type:

[root@ashaman] kill `cat /var/run/ppp0.pid`

6. Making life simpler
Some example scripts to automate stopping and starting ppp

7. Automating the pppd process
You could add an entry to the cron deamon process that would call these
scripts. In this example the pppd process is started at 6am each day and
stopped at 11pm each day.