| Erik's linux page: Linux information for beginners and advanced users | ||
|---|---|---|
| Prev | Chapter 2. Some general words about Linux, mostly for new users. | Next |
Setting up a PPP connection to your ISP
A lot of the useful information about Linux is on the net, I think I've said that before :) Most of the people I know (including myself) don't have a high speed internet connection at home, but rather a dialup connection to some Internet Service Provider. The most common way to connect to the net via a ISP is by PPP (Point to Point Procotol). PPP support is included in most common distributions.
Here I'll try to describe a ppp setup that should work for almost all distributions. If you're from Sweden, you might want to check out http://www.lysator.liu.se/~forsberg/ instead, since there you can find this information in Swedish, together with examples for most of the ISP's in Sweden. The original scripts were created by Simon Josefsson jas@pdc.kth.se.
Basic setup.
As a start, your kernel must have ppp support, and you must have a pppd that isn't too old. Try to execute the command 'pppd' at a root prompt, you should get a lot of funny characters, not the message "This kernel lacks kernel support". I you get the message, something is wrong ! =)
By the way, the funny characters stops after a short while, just be patient.
Files.
Start by creating an empty file named /etc/ppp/options. This can be done by executing :> /etc/ppp/options at a root prompt. Make a symlink named /dev/modem to the com port your modem is placed at, that is /dev/ttyS0 if your modem sits on COM1, /dev/ttyS1 if it's connected to COM2.. Do this by executing # ln -s /dev/ttyS0 /dev/modem . First, make sure the link doesn't exist, your distribution may have done that work at installation.
/etc/ppp/on
Save this as /etc/ppp/on (If read this online, you may retrieve the script by clicking here
#!/bin/sh
# PPP-script made by Simon Josefsson <jas@pdc.kth.se>.
tmpfile=/tmp/ppp.script.$$
source /etc/ppp/provider
export TELEPHONE LOGIN LOGINSTR PASSWORD PASSWORDSTR PPPCOMMANDSTR PPPCOMMAND
if test -n "$USEPAP"; then
PAP="name $PAPLOGIN remotename $USEPAP"
fi
umask 0177
cat<<EOF>$tmpfile
TIMEOUT 5
ABORT BUSY
ABORT "NO DIAL TONE"
ABORT \nRINGING\r\n\r\nRINGING\r
ABORT "NO CARRIER"
"" \r\rATZ
OK-+++\c-OK ATH0
TIMEOUT 60
OK ATDT$TELEPHONE
CONNECT \n
TIMEOUT 40
$LOGINSTR $LOGIN
$PASSWORDSTR $PASSWORD
$PPPCOMMANDSTR $PPPCOMMAND
EOF
exec /usr/sbin/pppd -detach debug lock modem crtscts /dev/modem 57600 \
noipdefault netmask 255.255.255.0 defaultroute $PAP \
connect "/usr/sbin/chat -v -f $tmpfile" disconnect "rm -f $tmpfile" & |
/etc/ppp/off
Save this as /etc/ppp/off (Or, get it by clicking here)
#!/bin/sh
if [ "$1" = "" ]; then
DEVICE=ppp0
else
DEVICE=$1
fi
if [ -r /var/run/$DEVICE.pid ]; then
kill -INT `cat /var/run/$DEVICE.pid`
if [ ! "$?" = "0" ]; then
rm -f /var/run/$DEVICE.pid
echo "ERROR: Removed stale pid file"
exit 1
fi
echo "PPP link to $DEVICE terminated."
exit 0
fi
echo "ERROR: PPP link is not active on $DEVICE"
exit 1 |
Nameservers, /etc/resolv.conf
If you want to be able to use the internet by typing names (like http://www.lysator.liu.se/~forsberg/) instead of numbers (like 10.38.0.18) you have to tell the linux resolver library how to get the information what number correspond to which names. This is done by writing nameserver statements to the file /etc/resolv.conf. Get ip adress of your nameserver from the information your ISP sent you, and write something like this in /etc/resolv.conf
nameserver 10.38.0.18 |
ISP Specific settings
Here comes the hard part :-) Now you must give pppd ISP specific settings, writing some words in /etc/ppp/provider and, if the ISP uses PAP or CHAP, a few words in /etc/ppp/pap-secrets or /etc/ppp/chap-secrets respective.
Here is a list of the statements you may use, with descriptions.
| TELEPHONE=<phonenumber> | The telephone number to your ISP's modem pool. |
| LOGINSTR=<login string> | The string that should trigger sending your user name, for example "ogin:--ogin:" works quite well in quite a few cases. PPPD will wait for the string ogin: and then send your account name. |
| LOGIN=<account> | Your account name. |
| PASSWORDSTR=<password string> | Similar to the LOGINSTR, this tells pppd what to wait for before sending your password. "assword:" will probably work for many systems. |
| PASSWORD=<password> | Your password. |
| PAPLOGIN=<account> | If your provider uses PAP or CHAP, put your login name here, instead of in the LOGIN keyword. |
| USEPAP=<providername> | If your provider uses PAP or CHAP, put the name of your provider here, and put the same name as providername in the secrets file, described later. |
The secrets file.
If your provider uses PAP or CHAP, a line in the /etc/ppp/pap-secrets, or chap-secrets should be added. It should look like <account> <providername> <password> where account and providername is the same as you put in the /etc/ppp/provider with the PAPLOGIN and USEPAP statements.
Some examples of /etc/ppp/provider and /etc/ppp/pap-secrets
Provider not using PAP (or CHAP)
/etc/ppp/provider
TELEPHONE=555112233 LOGINSTR=ogin:--ogin: LOGIN=mystupidaccountname PASSWORDSTR=assword: PASSWORD=MyTooEasyPassword |
Provider using PAP (or CHAP)
/etc/ppp/provider
TELEPHONE=555221133 PAPLOGIN=mystupidaccountname USEPAP=providername |
mystupidaccountname providername MyTooEasyPassword |