Linux Step By Steps
 
PPP Speed / Setup
Andrew McRory - amacc@iron-bridge.net

Before you can create your pppd script there are several things you MUST check to ensure the best quality connection over analog lines.

1) What DTE baud (computer-to-modem) rate can the modem handle?

115200 or higher is recommended for maximum performance. Experiment to find the highest speed useable. Once you have established the maximum, set the modem with setserial (assuming com3, irq 5):

linux-2.0.x 115200 baud
======================
setserial -b /dev/ttyS2 port 0x3e8 irq 5 spd_vhi

linux-2.2.x 115200 baud
======================
setserial -b /dev/ttyS2 port 0x3e8 irq 5

linux-2.2.x 230400 baud
======================
setserial -b /dev/ttyS2 port 0x3e8 irq 5 \
spd_cust baud_base 921600 divisor 4

linux-2.2.x 460800 baud (with shsmod)
======================
setserial -b /dev/ttyS2 port 0x3e8 irq 5 \
uart 16650V2 spd_cust baud_base 921600 divisor 2

You'll only be able to get 230400+ baud with a special serial card of if you patch your kernel with shsmod and have a supported onbard serial controller. (I'll be releasing a kernel upgrade with shsmod next week if interested)

Only use the "uart" option when you are sure of the capabilities of your serial port. See setserial man page...

2) What speed can your phone line handle?

Depending on your location you lines may not be able to handle 56k.  Listen on your phone line for static - you should hear "electronic air" with no hum, pops or clicks. If you phone company offers ISDN or DSL see if your line qualifies for those services. If so, you have a better chance of getting a true 56k connection.

Initialize your modem so it reports the DCE (modem-to-modem) rate and not the DTE (computer-to-modem) rate. "ATW2" will force most modems to report the DCE rate - see the manual. Run minicom (or cu from the uucp package), type ATDT<isp_number> and note the connect rate. CONNECT rates of 26400, 31200 and 24000 are common V.34 rates. CONNECT rates higher than 33600 are either X2, K56Flex or V.90 connections. Be wary of connect rates of 38400, 57600 and 115200 because they are the DTE connection rate and not the modem-to-modem (DCE) rate we want to see.

3) What hardware does your ISP use?

If they support V.90 and you have a V.90 modem read your manual and be SURE to setup the modem to connect in V.90 mode. Several V.90 modems I've used default to K56Flex and connect slower than they do in V.90 mode! V.90 is in most cases the best protocol to use. Here are some init strings to help you see what to do.

(some) Rockwell chipsets
======================
AT&C1&D2&K3S11=55X4W2+MS=12,1

This init string sets the modem to do hardware handshaking, fast dial 55ms, verbose result codes, report DCE, default to V.90 protocol.

(some) Lucent chipsets
======================
AT&C1&D2S11=55X4W2S109=1

This Lucent init is basically the same as the Rockwell example above except the V.90 parameter is set by "S109=?" instead of "+MS=12,1". Some Lucent chipsets require S109=2 to connect in V.90 mode by default.

Most modern modems can be software upgraded. Check your manufacturers FTP site for Flash ROM upgrades; always try to run the latest code for your modem.

4) Are you running the stock kernel?

If you really want the best performance from your system you should bite the bullet and recompile your kernel to support your specific hardware. The kernel that ships with COL is FAT, FAT, FAT!!! Forget modules and install support for the features you need directly into the kernel. The only time you want modules is for devices you will rarely use AND your really worried about saving memory. (Of course you could be making a Linux distribution and you want out of the box support for all/most hardware configurations...  :-)

On the other hand, trying to do things too perfectly isn't good if you're not sure what options to choose. You could make a mess so maybe this step should be ommited. Beware.



Setup PPP

By now you should know whether have a solid foundation for which to build a high performance data connection.

Now we create the scripts to build our optimized connection. pppd is simple yet hard to understand for a beginner so I'm going to hand you the script(s) I've used since my first copy of slackware (before redhat ;).  They've worked with ppp-(old???) through ppp-2.3.11.

==== /usr/sbin/ppp-up ==================================================
#!/bin/sh
#
# This is an example ppp script to connect to your ISP
# add your user name and password to /etc/ppp/pap-secrets
pppd connect "chat -f /etc/chat" /dev/ttyS1 38400 modem crtscts \
        lock asyncmap 0 noipdefault defaultroute name <loginname>
========================================================================

The above script goes in any directory in your path, preferably in /usr/sbin. Substitute "<loginname>" with the login name you setup with
your ISP. This is the same name you'll use in the /etc/ppp/pap-secrets file described later in this document. NOTE: The kernel maps 38400 DTE
requests to the speed you set with setserial.

Next create the /etc/chat script. Chat scripts define the conversation the computer will have with the modem.

==== /etc/chat =========================================================
ABORT "BUSY"
ABORT "ERROR"
ABORT "VOICE"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "NO DIAL TONE"
""
ATZ
OK
ATDTxxxxxxx
CONNECT
========================================================================

For best performance, use your own init string in place of "ATZ". Replace "xxxxxxx" with the your ISP's phone number.

Now you need to put your name and password in/etc/ppp/pap-secrets
If your ISP requires CHAP authentication update/etc/ppp/chap-secrets.

Here's the example.

==== /etc/ppp/pap-secrets ==============================================
# Secrets for authentication using PAP
# client        server  secret                   IP addresses
loginname * "your-password"
========================================================================

That's all it takes! Now run /usr/sbin/ppp-up as root. To see what's happening run:

tail -f /var/log/messages

on another VT to see the connection results.


Further Optimization

If your ISP supports bsd_comp and ppp_deflate compression, you will want to disable modem-to-modem (DCE) compression (add "%c0" to the init string
for most Rockwell chip modems) and rely on the operating system to compress the link. The kernel compression routines kick butt on the compression routine built into modems. Make sure you have bsd_comp and ppp_deflate modules installed (insmod <modname>). NOTE: The higher the DTE rate the better the compression.

Using ppp_deflate I've gotten over 30Kbps on highly compressable text files - believe it or not. Of course I'm dialing from our office to the dialup located in our office - only 1000ft of copper to screw things up...anywhere else I get a lousy 15-20Kbps ;-). Using modem compression brings the same transfer down to ~10Kbps. Uncompressable data gets 5.5Kbps under optimum conditions and 4-5Kbps on good lines. Check you modems compression rate by downloading ftp://ftp.iron-bridge.net/pub/testing/500k - thats the file I get 30K with.

If you want to "set it and forget it", download the diald RPM from my FTP site ( ftp.iron-bridge.net/pub/Caldera/AfterSHoCK2.3/serial/diald...), update /etc/diald.chat, /etc/diald.options, /etc/ppp/pap-secrets following the instructions and get a trouble free, automated Internet connection that you'll never have to mess with again. If you install diald, be sure to install the network tap and slip modules.