📄 readme.linux
字号:
PPP for Linux ------------- Paul Mackerras 8 March 2001 for ppp-2.4.11. Introduction---------------The Linux PPP implementation includes both kernel and user-levelparts. This package contains the user-level part, which consists ofthe PPP daemon (pppd) and associated utilities. In the past thispackage has contained updated kernel drivers. This is no longernecessary, as the current 2.2 and 2.4 kernel sources containup-to-date drivers.The Linux PPP implementation is capable of being used both forinitiating PPP connections (as a `client') or for handling incomingPPP connections (as a `server'). Note that this is an operationaldistinction, based on how the connection is created, rather than adistinction that is made in the PPP protocols themselves.Mostly this package is used for PPP connections over modems connectedvia asynchronous serial ports, so this guide concentrates on thissituation.The PPP protocol consists of two parts. One is a scheme for framingand encoding packets, the other is a series of protocols called LCP,IPCP, PAP and CHAP, for negotiating link options and forauthentication. This package similarly consists of two parts: akernel module which handles PPP's low-level framing protocol, and auser-level program called pppd which implements PPP's negotiationprotocols.The kernel module assembles/disassembles PPP frames, handles errordetection, and forwards packets between the serial port and either thekernel network code or the user-level program pppd. IP packets godirectly to the kernel network code. So once pppd has negotiated thelink, it in practice lies completely dormant until you want to takethe link down, when it negotiates a graceful disconnect.2. Installation---------------2.1 Kernel driverAssuming you are running a recent 2.2 or 2.4 (or later) series kernel,the kernel source code will contain an up-to-date kernel PPP driver.If the PPP driver was included in your kernel configuration when yourkernel was built, then you only need to install the user-levelprograms. Otherwise you will need to get the source tree for yourkernel version, configure it with PPP included, and recompile. MostLinux distribution vendors ship kernels with PPP included in theconfiguration.The PPP driver can be either compiled into the kernel or compiled as akernel module. If it is compiled into the kernel, the PPP driver isincluded in the kernel image which is loaded at boot time. If it iscompiled as a module, the PPP driver is present in one or more filesunder /lib/modules and is loaded into the kernel when needed.The 2.2 series kernels contain an older version of the kernel PPPdriver, one which doesn't support multilink. If you want multilink,you need to run the latest 2.4 series kernel. The kernel PPP driverwas completely rewritten for the 2.4 series kernels to supportmultilink and to allow it to operate over diverse kinds ofcommunication medium (the 2.2 driver only operates over serial portsand devices which look like serial ports, such as pseudo-ttys).Under the 2.2 kernels, if PPP is compiled as a module, the PPP drivermodules should be present in the /lib/modules/`uname -r`/net directory(where `uname -r` represents the kernel version number). The PPPdriver module itself is called ppp.o, and there will usually becompression modules there, ppp_deflate.o and bsd_comp.o, as well asslhc.o, which handles TCP/IP header compression. If the PPP driver iscompiled into the kernel, the compression code will still be compiledas modules, for kernels before 2.2.17pre12. For 2.2.17pre12 and later,if the PPP driver is compiled in, the compression code will also.Under the 2.4 kernels, there are two PPP modules, ppp_generic.o andppp_async.o, plus the compression modules (ppp_deflate.o, bsd_comp.oand slhc.o). If the PPP generic driver is compiled into the kernel,the other four can then be present either as modules or compiled intothe kernel. There is a sixth module, ppp_synctty.o, which is used forsynchronous tty devices such as high-speed WAN adaptors.2.2 User-level programsIf you obtained this package in .rpm or .deb format, you simply followthe usual procedure for installing the package.If you are using the .tar.gz form of this package, then cd into theppp-2.4.1b1 directory you obtained by unpacking the archive and issuethe following commands:$ ./configure$ make# make installThe `make install' has to be done as root. This makes and installsfour programs and their man pages: pppd, chat, pppstats and pppdump.If the /etc/ppp configuration directory doesn't exist, the `makeinstall' step will create it and install some default configurationfiles.2.3 System setup for 2.4 kernelsUnder the 2.4 series kernels, pppd needs to be able to open /dev/ppp,character device (108,0). If you are using devfs (the devicefilesystem), the /dev/ppp node will automagically appear when theppp_generic module is loaded, or at startup if ppp_generic is compiledin.If you have ppp_generic as a module, and you are using devfsd (thedevfs daemon), you will need to add a line like this to your/etc/devfsd.conf:LOOKUP ppp MODLOADOtherwise you will need to create a /dev/ppp device node with thecommands:# mknod /dev/ppp c 108 0# chmod 600 /dev/pppIf you use module autoloading and have PPP as a module, you will needto add the following to your /etc/modules.conf or /etc/conf.modules:alias /dev/ppp ppp_genericalias char-major-108 ppp_genericalias tty-ldisc-3 ppp_asyncalias tty-ldisc-14 ppp_syncttyalias ppp-compress-21 bsd_compalias ppp-compress-24 ppp_deflatealias ppp-compress-26 ppp_deflate2.4 System setup under 2.2 series kernelsUnder the 2.2 series kernels, you should add the following to your/etc/modules.conf or /etc/conf.modules:alias tty-ldisc-3 pppalias ppp-compress-21 bsd_compalias ppp-compress-24 ppp_deflatealias ppp-compress-26 ppp_deflate3. Getting help with problems-----------------------------If you have problems with your PPP setup, or you just want to ask somequestions, or better yet if you can help others with their PPPquestions, then you should join the linux-ppp mailing list. Send anemail to majordomo@vger.kernel.org with a line in the body sayingsubscribe linux-pppTo leave the mailing list, send an email to majordomo@vger.kernel.orgwith a line in the body sayingunsubscribe linux-pppTo send a message to the list, email it to linux-ppp@vger.kernel.org.You don't have to be subscribed to send messages to the list.You can also email me (paulus@linuxcare.com.au) but I am overloadedwith email and I can't respond to most messages I get in a timelyfashion.There are also several relevant news groups, such as comp.protocols.ppp,comp.os.linux.networking, or comp.os.linux.setup.4. Configuring your dial-out PPP connections--------------------------------------------Some Linux distribution makers include tools in their distributionsfor setting up PPP connections. For example, for Red Hat Linux andderivatives, you should probably use linuxconf or netcfg to set upyour PPP connections.The two main windowing environments for Linux, KDE and Gnome, bothcome with GUI utilities for configuring and controlling PPP dial-outconnections. They are convenient and relatively easy to configure.A third alternative is to use a PPP front-end package such as wvdialor ezppp. These also will handle most of the details of talking tothe modem and setting up the PPP connection for you.Assuming that you don't want to use any of these tools, you want toset up the configuration manually yourself, then read on. Thisdocument gives a brief description and example. More details can befound by reading the pppd and chat man pages and the PPP-HOWTO.We assume that you have a modem that uses the Hayes-compatible ATcommand set connected to an async serial port (e.g. /dev/ttyS0) andthat you are dialling out to an ISP. The trickiest and most variable part of setting up a dial-out PPPconnection is the part which involves getting the modem to dial andthen invoking PPP service at the far end. Generally, once both endsare talking PPP the rest is relatively straightforward.Now in fact pppd doesn't know anything about how to get modems to dialor what you have to say to the system at the far end to get it to talkPPP. That's handled by an external program such as chat, specifiedwith the connect option to pppd. Chat takes a series of strings toexpect from the modem interleaved with a series of strings to send tothe modem. See the chat man page for more information. Here is asimple example for connecting to an ISP, assuming that the ISP'ssystem starts talking PPP as soon as it answers the phone:pppd connect 'chat -v "" AT OK ATDT5551212 ~' \ /dev/ttyS0 57600 crtscts debug defaultrouteGoing through pppd's options in order: connect 'chat ...' This gives a command to run to contact the PPP server. Here the supplied 'chat' program is used to dial a remote computer. The whole command is enclosed in single quotes because pppd expects a one-word argument for the 'connect' option. The options to 'chat' itself are: -v verbose mode; log what we do to syslog "" don't wait for any prompt, but instead... AT send the string "AT" OK expect the response "OK", then ATDT5551212 dial the modem, then ~ wait for a ~ character, indicating the start of a PPP frame from the server /dev/ttyS0 specifies which serial port the modem is connected to 57600 specifies the baud rate to use crtscts use hardware flow control using the RTS & CTS signals debug log the PPP negotiation with syslog defaultroute add default network route via the PPP linkPppd will write error messages and debugging logs to the syslogddaemon using the facility name "daemon". These messages may alreadybe logged to the console or to a file like /var/log/messages; consultyour /etc/syslog.conf file to see. If you want to make all pppdmessages go to a file such as /var/log/ppp-debug, add the linedaemon.* /var/log/ppp-debug ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is one or more tabs. Do not use spaces.to syslog.conf; make sure to put one or more TAB characters (notspaces!) between the two fields. Then you need to create an empty/var/log/ppp-debug file with a command such as touch /var/log/ppp-debugand then restart syslogd, usually by sending it a SIGHUP signal with acommand like this: killall -HUP syslogd4.1 Is the link up?The main way to tell if your PPP link is up and operational is theifconfig ("interface configuration") command. Type /sbin/ifconfigat a shell prompt. It should print a list of interfaces including onelike this example:ppp0 Link encap Point-to-Point Protocol inet addr 192.76.32.3 P-t-P 129.67.1.165 Mask 255.255.255.0 UP POINTOPOINT RUNNING MTU 1500 Metric 1 RX packets 33 errors 0 dropped 0 overrun 0 TX packets 42 errors 0 dropped 0 overrun 0Assuming that ifconfig shows the ppp network interface, you can testthe link using the ping command like this: /sbin/ping -c 3 129.67.1.165where the address you give is the address shown as the P-t-P addressin the ifconfig output. If the link is operating correctly, youshould see output like this: PING 129.67.1.165 (129.67.1.165): 56 data bytes 64 bytes from 129.67.1.165: icmp_seq=0 ttl=255 time=268 ms 64 bytes from 129.67.1.165: icmp_seq=1 ttl=255 time=247 ms 64 bytes from 129.67.1.165: icmp_seq=2 ttl=255 time=266 ms --- 129.67.1.165 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 247/260/268 ms
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -