📄 faq
字号:
This is a list of Frequently Asked Questions about using ppp-2.x andtheir answers.------------------------------------------------------------------------Q: Can you give me an example of how I might set up my machine to dialout to an ISP?A: Here's an example for dialling out to an ISP via a modem on/dev/tty02. The modem uses hardware (CTS/RTS) flow control, and theserial port is run at 38400 baud. The ISP assigns our IP address.To configure pppd for this connection, create a file under/etc/ppp/peers called (say) my-isp containing the following:tty02 crtscts 38400connect 'chat -v -f /etc/ppp/chat/my-isp'defaultrouteThe ppp connection is then initiated using the following command:pppd call my-ispOf course, if the directory containing pppd is not in your path, youwill need to give the full pathname for pppd, for example,/usr/sbin/pppd.When you run this, pppd will use the chat program to dial the ISP andinvoke its ppp service. Chat will read the file specified with -f,namely /etc/ppp/chat/my-isp, to find a list of strings to expect toreceive, and strings to send. This file would contain something likethis:ABORT "NO CARRIER"ABORT "NO DIALTONE"ABORT "ERROR"ABORT "NO ANSWER"ABORT "BUSY"ABORT "Username/Password Incorrect""" "at"OK "at&d2&c1"OK "atdt2479381""name:" "^Uusername""word:" "\qpassword""annex" "\q^Uppp""Switching to PPP-ppp-Switching to PPP"You will need to change the details here. The first string on eachline is a string to expect to receive; the second is the string tosend. You can add or delete lines according to the dialog required toaccess your ISP's system. This example is for a modem with a standardAT command set, dialling out to an Annex terminal server. The \qtoggles "quiet" mode; when quiet mode is on, the strings to be sentare replaced by ?????? in the log. You may need to go through thedialog manually using kermit or tip first to determine what should goin the script.To terminate the link, run the following script, called (say)kill-ppp:#!/bin/shunit=ppp${1-0}piddir=/var/runif [ -f $piddir/$unit.pid ]; then kill -1 `cat $piddir/$unit.pid`fiOn some systems (SunOS, Solaris, Ultrix), you will need to change/var/run to /etc/ppp.------------------------------------------------------------------------Q: Can you give me an example of how I could set up my office machineso I can dial in to it from home?A: Let's assume that the office machine is called "office" and is on alocal ethernet subnet. Call the home machine "home" and give it an IPaddress on the same subnet as "office". We'll require both machinesto authenticate themselves to each other.Set up the files on "office" as follows:/etc/ppp/options contains:auth # require the peer to authenticate itselflock# other options can go here if desired/etc/ppp/chap-secrets contains:home office "beware the frub-jub" homeoffice home "bird, my son!%&*" -Set up a modem on a serial port so that users can dial in to themodem and get a login prompt.On "home", set up the files as follows:/etc/ppp/options contains the same as on "office"./etc/ppp/chap-secrets contains:home office "beware the frub-jub" -office home "bird, my son!%&*" officeCreate a file called /etc/ppp/peers/office containing the following:tty02 crtscts 38400connect 'chat -v -f /etc/ppp/chat/office'defaultroute(You may need to change some of the details here.)Create the /etc/ppp/chat/office file containing the following:ABORT "NO CARRIER"ABORT "NO DIALTONE"ABORT "ERROR"ABORT "NO ANSWER"ABORT "BUSY"ABORT "ogin incorrect""" "at"OK "at&d2&c1"OK "atdt2479381""name:" "^Uusername""word:" "\qpassword""$" "\q^U/usr/sbin/pppd proxyarp""~"You will need to change the details. Note that the "$" in thesecond-last line is expecting the shell prompt after a successfullogin - you may need to change it to "%" or something else.You then initiate the connection (from home) with the command:pppd call office------------------------------------------------------------------------Q: When I try to establish a connection, the modem successfully dialsthe remote system, but then hangs up a few seconds later. How do Ifind out what's going wrong?A: There are a number of possible problems here. The first thing todo is to ensure that pppd's messages are visible. Pppd uses thesyslog facility to log messages which help to identify specificproblems. Messages from pppd have facility "daemon" and levelsranging from "debug" to "error".Usually it is useful to see messages of level "notice" or higher onthe console. To see these, find the line in /etc/syslog.conf whichhas /dev/console on the right-hand side, and add "daemon.notice" inthe list on the left. The line will end up looking something likethis:*.err;kern.debug;auth.notice;mail.crit;daemon.notice /dev/consoleNote that the whitespace is tabs, *not* spaces.If you are having problems, it may be useful to see messages of level"info" as well, in which case you would change "daemon.notice" to"daemon.info".In addition, it is useful to collect pppd's debugging output in afile - the debug option to pppd causes it to log the contents of allcontrol packets sent and received in human-readable form. To do this,add a line like this to /etc/syslog.conf:daemon,local2.debug /etc/ppp/logand create an empty /etc/ppp/log file.When you change syslog.conf, you will need to send a HUP signal tosyslogd to causes it to re-read syslog.conf. You can do this with acommand like this (as root): kill -HUP `cat /etc/syslogd.pid`(On some systems, you need to use /var/run/syslog.pid instead of/etc/syslogd.pid.)After setting up syslog like this, you can use the -v flag to chat andthe `debug' option to pppd to get more information. Try initiatingthe connection again; when it fails, inspect /etc/ppp/log to see whathappened and where the connection failed.------------------------------------------------------------------------Q: When I try to establish a connection, I get an error message saying"Serial link is not 8-bit clean". Why?A: The most common cause is that your connection script hasn'tsuccessfully dialled out to the remote system and invoked ppp servicethere. Instead, pppd is talking to something (a shell or loginprocess on the remote machine, or maybe just the modem) which is onlyoutputting 7-bit characters.This can also arise with a modem which uses an AT command set if thedial command is issued before pppd is invoked, rather than within aconnect script started by pppd. If the serial port is set to 7bits/character plus parity when the last AT command is issued, themodem serial port will be set to the same setting.Note that pppd *always* sets the local serial port to 8 bits percharacter, with no parity and 1 stop bit. So you shouldn't need toissue an stty command before invoking pppd.------------------------------------------------------------------------Q: When I try to establish a connection, I get an error message saying"Serial line is looped back". Why?A: Probably your connection script hasn't successfully dialled out tothe remote system and invoked ppp service there. Instead, pppd istalking to something which is just echoing back the characters itreceives. The -v option to chat can help you find out what's goingon. It can be useful to include "~" as the last expect string tochat, so chat won't return until it's seen the start of the first PPPframe from the remote system.Another possibility is that your phone connection has dropped for someobscure reason and the modem is echoing the characters it receivesfrom your system.------------------------------------------------------------------------Q: I installed pppd successfully, but when I try to run it, I get amessage saying something like "peer authentication required but noauthentication files accessible".A: When pppd is used on a machine which already has a connection tothe Internet (or to be more precise, one which has a default route inits routing table), it will require all peers to authenticatethemselves. The reason for this is that if you don't requireauthentication, you have a security hole, because the peer canbasically choose any IP address it wants, even the IP address of sometrusted host (for example, a host mentioned in some .rhosts file).On machines which don't have a default route, pppd does not requirethe peer to authenticate itself. The reason is that such machineswould mostly be using pppd to dial out to an ISP which will refuse toauthenticate itself. In that case the peer can use any IP address aslong as the system does not already have a route to that address.For example, if you have a local ethernet network, the peer can't usean address on that network. (In fact it could if it authenticateditself and it was permitted to use that address by the pap-secrets orchap-secrets file.)There are 3 ways around the problem:1. If possible, arrange for the peer to authenticate itself, andcreate the necessary secrets files (/etc/ppp/pap-secrets and/or/etc/ppp/chap-secrets).2. If the peer refuses to authenticate itself, and will always beusing the same IP address, or one of a small set of IP addresses, youcan create an entry in the /etc/ppp/pap-secrets file like this: "" * "" his-ip.his-domain his-other-ip.other-domain(that is, using the empty string for the client name and passwordfields). Of couse, you replace the 4th and following fields in theexample above with the IP address(es) that the peer may use. You canuse either hostnames or numeric IP addresses.3. You can add the `noauth' option to the /etc/ppp/options file.Pppd will then not ask the peer to authenticate itself. If you dothis, I *strongly* recommend that you remove the set-uid bit from thepermissions on the pppd executable, with a command like this: chmod u-s /usr/sbin/pppdThen, an intruder could only use pppd maliciously if they had alreadybecome root, in which case they couldn't do any more damage using pppdthan they could anyway.------------------------------------------------------------------------Q: What do I need to put in the secrets files?A: Three things: - secrets (i.e. passwords) to use for authenticating this host to other hosts (i.e., for proving our identity to others); - secrets which other hosts can use for authenticating themselves to us (i.e., so that they can prove their identity to us); and - information about which IP addresses other hosts may use, once they have authenticated themselves.There are two authentication files: /etc/ppp/pap-secrets, whichcontains secrets for use with PAP (the Password AuthenticationProtocol), and /etc/ppp/chap-secrets, which contains secrets for usewith CHAP (the Challenge Handshake Authentication Protocol). Bothfiles have the same simple format, which is as follows:- The file contains a series of entries, each of which contains asecret for authenticating one machine to another.- Each entry is contained on a single logical line. A logical linemay be continued across several lines by placing a backslash (\) atthe end of each line except the last.- Each entry has 3 or more fields, separated by whitespace (spacesand/or tabs). These fields are, in order: * The name of the machine that is authenticating itself (the "client"). * The name of the machine that is authenticating the client (the "server"). * The secret to be used for authenticating that client to that server. If this field begins with the at-sign `@', the rest of the field is taken as the name of a file containing the actual secret. * The 4th and any following fields list the IP address(es)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -