Dial-up Networking (PPP) I
Summary: Section index - KB index In most cases, configuring a dial-up connection on Linux is about as simple as it is in Windows. You either use '~DrakNet' from the Mandrake Control Center or one of the many other dialers provided (like kppp or ~GnomePPP).However, there may be times you want a more generic and general solution, be it that you have to provide a multiuser system with dial-up connections or be it that you can't get it working with graphical tools. Or maybe you are looking for a more powerful - i.e. scripted - solution. Then you might find this article helpful.
Preparations
OK, before going right into heavy editing mode, check if you have all the needed hardware, software and data and hand:- A modem supported by Linux. Some modems, like most internal PCI modems or some external USB modems are so-called ~WinModems. Which means that they rely on Windows-only software to work.
Read Winmodems are not modems for more information and a compatibility list and check out Linmodems.org for (a few) drivers. - The modem's init-string. GNU/Linux does not have an equivalent to the Windows hardware information file (.inf) mechanism. You may have to find out the init-string for your modem yourself. It should(TM) be listed in your hardware's documentation or in the modem's INF file, but there are also online sources like this list of modem init-strings. If you have no clue at all, use , that works with many modems.
ATZ
- Provider data. You'll need your login name, password and the telephone number. DNS addresses would be fine, too, but are optional for recent versions of pppd.
With an external modem, that's pretty easy. As 'root' do
echo >/dev/ttyS0
echo >/dev/ttyS1
With an internal modem, use ~HardDrake to check if the system sees the modem. Or use this command to query the PCI list directly:
cat /proc/pci
man isapnp
man isapnp.conf
Setting Up The Connection Files
You will have to edit or create these files:- '/etc/ppp/peers/{peer}' will be the ISP specific communication setup file. It determines how your machine will talk to the other machine (the provider's login server).
- '/etc/ppp/chat-{peer}' will be the ISP specific login file. It determines how your machine will connect to the ISP.
- '/etc/ppp/chap-secrets', '/etc/ppp/pap-secrets' contain the account data necessary to identify you to the other machine.
- '/etc/ppp/options' contains general options valid for all PPP connections.
'/etc/ppp/peers/{...}'
Create a new file in the directory '/etc/ppp/peers/'. The filename should reflect the name of your ISP, but you can name it as you please. For demonstration purposes I will assume the name 'isp1'.Put these lines in there:
/dev/ttyS{0,1,2,3} 115200 crtscts<br> connect '/usr/sbin/chat -v -f /etc/ppp/chat-isp1'<br> noauth user {username}
/dev/ttyS{0,1,2,3}
115200 is the modem speed in baud/second. '115200' is suited for all 56k or better modems and ISDN TAs. If your modem is older, use '57200' instead.
crtcts
connect '/usr/sbin/chat -v -f /etc/ppp/chat-isp1'
chat
'-v' will give you more output in the log files.
noauth
user {username}
'/etc/ppp/chat-{peer}
In this example, the name of the 'chat' peers file to be created is 'chat-isp1' as determined by the 'peers' file in '/etc/ppp/peers/'. It contains the exact instructions for the 'chat' program how to handle your modem. It looks like this:TIMEOUT 20<br> ABORT "NO CARRIER"<br> ABORT "NO DIALTONE"<br> ABORT ERROR<br> ABORT "NO ANSWER"<br> ABORT BUSY<br> ABORT "Username/Password Incorrect"<br> "" +++{modem init-string}<br> OK ATDT{ISP server phonenumber}<br> CONNECT ""<br> ~–– ""
'chat' uses this file to initialize your modem, dial the number and report connect to pppd which then starts the authentication procedure. If the modem encounters one of the error conditions defined by 'ABORT...', 'chat' returns the error to pppd, which will then terminate itself after 20 seconds. Some error conditions are quoted because their names contain empty spaces.
The second part contains 'expect-from-modem send-to-modem' pairs, separated by an empty space. Empty spaces which do not separate expect/send pairs will cause the 'chat' script to fail. In the vast majority of cases, ISPs use CHAP or PAP for authentication, if your provider requires a terminal login however, you'll have to provide the authentication data in the chat file, too:
ogin:––ogin: {accountname}<br> word: {password}
chmod 640 /etc/ppp/chat-{name} && chown root:pppusers /etc/ppp/chat-{name}
'/etc/ppp/{pap|chap}-secrets'
Most ISPs use either PAP (Password Authentication Protocol) or CHAP (Challenge Handshake Authentication Protocol) for authenticating clients, with PAP being the more popular of the two. Most providers won't tell you if they use PAP or CHAP, but that's no problem since the PPP program will happily try both if the authentication data are in both files. The syntax is the same for both files. Open one of them in an editor (as 'root'), the file should look like this:# Secrets for authentication using {PAP|CHAP}<br> ~# client server secret IP addresses# Secrets for authentication using {PAP|CHAP}<br> ~# client server secret IP addresses<br> {yourusername} * {yourpassword} *'/etc/ppp/options'
This file keeps some general options for pppd, options that should apply for every connection regardless of which peers-file you are going to use.A typical 'options' file might look like this:
lock<br> defaultroute<br> noipdefault<br> idle 1200<br> usepeerdns
- tells pppd to create a lockfile as soon as it gets hold of the modem. This will prevent other programs from accessing the device while pppd uses it.
lock
- tells pppd to create a default lookup route while it is running, using your ISP's server as a standard gateway. This is necessary to keep the different networking layers on your machine separate.
defaultroute
- tells pppd to accept every IP-number your ISP will assign to your machine when it connects.
noipdefault
- tells pppd to cut the connection after twenty minutes (1200 seconds) of inactivity. I am forgetful from time to time ;-). Note that
idle 1200
advises you not to use this option without the optionman pppd
. From my experience however there is no reason not to use it on its own.demand
- will use the DNS server addresses supplied by your ISP's server and write them to '/etc/ppp/resolv.conf'.
usepeerdns
man pppd
Related Resources:
Modem HOWTOA List of PPP Utilities Revision / Modified: July 31, 2001
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Dial-up Networking (PPP) I
Version 1.4 last modified by ptyxs on 03/03/2006 at 11:35
Version 1.4 last modified by ptyxs on 03/03/2006 at 11:35
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!
Mandriva.com
Store
Club

