Dial-up Networking (PPP) I
Summary:
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
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> ~–– ""
This file mustn't contain any empty lines. Save this file under the name you've specified in the peers file.
'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}
The chat-file is by default world-readable. This is certainly a bad idea if this file contains your account information. On the other hand it must be readable by the user who uses it. What to do? Open '/etc/group' in your editor as 'root' and add your local login name to the group 'ppp-users'. Save and close. As 'root', run
chmod 640 /etc/ppp/chat-{name} && chown root:pppusers /etc/ppp/chat-{name}
Now only 'root' and members of the pppusers group have read-access to this file and only 'root' may edit it.
'/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
The clever thing is that you can provide wildcards ('') for values you don't know about, like the server name or IP addresses. The only important values are 'client' (=username) and 'secret' (=password). So enter these values and put in '' for the other fields. Separate entries with the 'TAB' key. It should now look like this:
# Secrets for authentication using {PAP|CHAP}<br> ~# client server secret IP addresses<br> {yourusername} * {yourpassword} *
If you're using more than one provider, just enter every username - password combination you have. 'pppd' will try every combination until it finds one that matches.
'/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
-
lock
-
defaultroute
-
noipdefault
-
idle 1200
man pppd
demand
-
usepeerdns
man pppd
Next Item: Testing And Customization
Related Resources:
Modem HOWTO
A 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.
Wersja 1.4 ostatnio modyfikowane przez ptyxs w 03/03/2006 przy 11:35
Dane dokumentu
- Straciłeś konto?
- Nie jesteś jeszcze klubowiczem? Dołącz do Klubu i pobierz już dziś!
- get_the_pwp_subscription