README.linux 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. PPP for Linux
  2. -------------
  3. Paul Mackerras
  4. 8 March 2001
  5. for ppp-2.4.2
  6. Updated for ppp-2.4.5, Sep 08
  7. 1. Introduction
  8. ---------------
  9. The Linux PPP implementation includes both kernel and user-level
  10. parts. This package contains the user-level part, which consists of
  11. the PPP daemon (pppd) and associated utilities. In the past this
  12. package has contained updated kernel drivers. This is no longer
  13. necessary, as the current kernel sources contain up-to-date drivers
  14. (and have done since the 2.4.x kernel series).
  15. The Linux PPP implementation is capable of being used both for
  16. initiating PPP connections (as a `client') or for handling incoming
  17. PPP connections (as a `server'). Note that this is an operational
  18. distinction, based on how the connection is created, rather than a
  19. distinction that is made in the PPP protocols themselves.
  20. Mostly this package is used for PPP connections over modems connected
  21. via asynchronous serial ports, so this guide concentrates on this
  22. situation.
  23. The PPP protocol consists of two parts. One is a scheme for framing
  24. and encoding packets, the other is a series of protocols called LCP,
  25. IPCP, PAP and CHAP, for negotiating link options and for
  26. authentication. This package similarly consists of two parts: a
  27. kernel module which handles PPP's low-level framing protocol, and a
  28. user-level program called pppd which implements PPP's negotiation
  29. protocols.
  30. The kernel module assembles/disassembles PPP frames, handles error
  31. detection, and forwards packets between the serial port and either the
  32. kernel network code or the user-level program pppd. IP packets go
  33. directly to the kernel network code. So once pppd has negotiated the
  34. link, it in practice lies completely dormant until you want to take
  35. the link down, when it negotiates a graceful disconnect.
  36. 2. Installation
  37. ---------------
  38. 2.1 Kernel driver
  39. Assuming you are running a recent 2.4 or 2.6 (or later) series kernel,
  40. the kernel source code will contain an up-to-date kernel PPP driver.
  41. If the PPP driver was included in your kernel configuration when your
  42. kernel was built, then you only need to install the user-level
  43. programs. Otherwise you will need to get the source tree for your
  44. kernel version, configure it with PPP included, and recompile. Most
  45. Linux distribution vendors ship kernels with PPP included in the
  46. configuration.
  47. The PPP driver can be either compiled into the kernel or compiled as a
  48. kernel module. If it is compiled into the kernel, the PPP driver is
  49. included in the kernel image which is loaded at boot time. If it is
  50. compiled as a module, the PPP driver is present in one or more files
  51. under /lib/modules and is loaded into the kernel when needed.
  52. The 2.2 series kernels contain an older version of the kernel PPP
  53. driver, one which doesn't support multilink. If you want multilink,
  54. you need to run a 2.4 or 2.6 series kernel. The kernel PPP driver
  55. was completely rewritten for the 2.4 series kernels to support
  56. multilink and to allow it to operate over diverse kinds of
  57. communication medium (the 2.2 driver only operates over serial ports
  58. and devices which look like serial ports, such as pseudo-ttys).
  59. Under the 2.2 kernels, if PPP is compiled as a module, the PPP driver
  60. modules should be present in the /lib/modules/`uname -r`/net directory
  61. (where `uname -r` represents the kernel version number). The PPP
  62. driver module itself is called ppp.o, and there will usually be
  63. compression modules there, ppp_deflate.o and bsd_comp.o, as well as
  64. slhc.o, which handles TCP/IP header compression. If the PPP driver is
  65. compiled into the kernel, the compression code will still be compiled
  66. as modules, for kernels before 2.2.17pre12. For 2.2.17pre12 and later,
  67. if the PPP driver is compiled in, the compression code will also.
  68. Under the 2.4 kernels, there are two PPP modules, ppp_generic.o and
  69. ppp_async.o, plus the compression modules (ppp_deflate.o, bsd_comp.o
  70. and slhc.o). If the PPP generic driver is compiled into the kernel,
  71. the other four can then be present either as modules or compiled into
  72. the kernel. There is a sixth module, ppp_synctty.o, which is used for
  73. synchronous tty devices such as high-speed WAN adaptors.
  74. 2.2 User-level programs
  75. If you obtained this package in .rpm or .deb format, you simply follow
  76. the usual procedure for installing the package.
  77. If you are using the .tar.gz form of this package, then cd into the
  78. ppp-2.4.5 directory you obtained by unpacking the archive and issue
  79. the following commands:
  80. $ ./configure
  81. $ make
  82. # make install
  83. The `make install' has to be done as root. This makes and installs
  84. four programs and their man pages: pppd, chat, pppstats and pppdump.
  85. If the /etc/ppp configuration directory doesn't exist, the `make
  86. install' step will create it and install some default configuration
  87. files.
  88. 2.3 System setup for 2.4 kernels
  89. Under the 2.4 series kernels, pppd needs to be able to open /dev/ppp,
  90. character device (108,0). If you are using udev (as most distributions
  91. do), the /dev/ppp node should be created by udevd.
  92. Otherwise you may need to create a /dev/ppp device node with the
  93. commands:
  94. # mknod /dev/ppp c 108 0
  95. # chmod 600 /dev/ppp
  96. 2.4 System setup under 2.2 series kernels
  97. Under the 2.2 series kernels, you should add the following to your
  98. /etc/modules.conf or /etc/conf.modules:
  99. alias tty-ldisc-3 ppp
  100. alias ppp-compress-21 bsd_comp
  101. alias ppp-compress-24 ppp_deflate
  102. alias ppp-compress-26 ppp_deflate
  103. 3. Getting help with problems
  104. -----------------------------
  105. If you have problems with your PPP setup, or you just want to ask some
  106. questions, or better yet if you can help others with their PPP
  107. questions, then you should join the linux-ppp mailing list. Send an
  108. email to majordomo@vger.kernel.org with a line in the body saying
  109. subscribe linux-ppp
  110. To leave the mailing list, send an email to majordomo@vger.kernel.org
  111. with a line in the body saying
  112. unsubscribe linux-ppp
  113. To send a message to the list, email it to linux-ppp@vger.kernel.org.
  114. You don't have to be subscribed to send messages to the list.
  115. You can also email me (paulus@samba.org) but I am overloaded with
  116. email and I can't respond to most messages I get in a timely fashion.
  117. There are also several relevant news groups, such as comp.protocols.ppp,
  118. comp.os.linux.networking, or comp.os.linux.setup.
  119. 4. Configuring your dial-out PPP connections
  120. --------------------------------------------
  121. Some Linux distribution makers include tools in their distributions
  122. for setting up PPP connections. For example, for Red Hat Linux and
  123. derivatives, you should probably use linuxconf or netcfg to set up
  124. your PPP connections.
  125. The two main windowing environments for Linux, KDE and Gnome, both
  126. come with GUI utilities for configuring and controlling PPP dial-out
  127. connections. They are convenient and relatively easy to configure.
  128. A third alternative is to use a PPP front-end package such as wvdial
  129. or ezppp. These also will handle most of the details of talking to
  130. the modem and setting up the PPP connection for you.
  131. Assuming that you don't want to use any of these tools, you want to
  132. set up the configuration manually yourself, then read on. This
  133. document gives a brief description and example. More details can be
  134. found by reading the pppd and chat man pages and the PPP-HOWTO.
  135. We assume that you have a modem that uses the Hayes-compatible AT
  136. command set connected to an async serial port (e.g. /dev/ttyS0) and
  137. that you are dialling out to an ISP.
  138. The trickiest and most variable part of setting up a dial-out PPP
  139. connection is the part which involves getting the modem to dial and
  140. then invoking PPP service at the far end. Generally, once both ends
  141. are talking PPP the rest is relatively straightforward.
  142. Now in fact pppd doesn't know anything about how to get modems to dial
  143. or what you have to say to the system at the far end to get it to talk
  144. PPP. That's handled by an external program such as chat, specified
  145. with the connect option to pppd. Chat takes a series of strings to
  146. expect from the modem interleaved with a series of strings to send to
  147. the modem. See the chat man page for more information. Here is a
  148. simple example for connecting to an ISP, assuming that the ISP's
  149. system starts talking PPP as soon as it answers the phone:
  150. pppd connect 'chat -v "" AT OK ATDT5551212 ~' \
  151. /dev/ttyS0 57600 crtscts debug defaultroute
  152. Going through pppd's options in order:
  153. connect 'chat ...' This gives a command to run to contact the
  154. PPP server. Here the supplied 'chat' program is used to dial a
  155. remote computer. The whole command is enclosed in single quotes
  156. because pppd expects a one-word argument for the 'connect' option.
  157. The options to 'chat' itself are:
  158. -v verbose mode; log what we do to syslog
  159. "" don't wait for any prompt, but instead...
  160. AT send the string "AT"
  161. OK expect the response "OK", then
  162. ATDT5551212 dial the modem, then
  163. ~ wait for a ~ character, indicating the start
  164. of a PPP frame from the server
  165. /dev/ttyS0 specifies which serial port the modem is connected to
  166. 57600 specifies the baud rate to use
  167. crtscts use hardware flow control using the RTS & CTS signals
  168. debug log the PPP negotiation with syslog
  169. defaultroute add default network route via the PPP link
  170. Pppd will write error messages and debugging logs to the syslogd
  171. daemon using the facility name "daemon". These messages may already
  172. be logged to the console or to a file like /var/log/messages; consult
  173. your /etc/syslog.conf file to see. If you want to make all pppd
  174. messages go to a file such as /var/log/ppp-debug, add the line
  175. daemon.* /var/log/ppp-debug
  176. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  177. This is one or more tabs. Do not use spaces.
  178. to syslog.conf; make sure to put one or more TAB characters (not
  179. spaces!) between the two fields. Then you need to create an empty
  180. /var/log/ppp-debug file with a command such as
  181. touch /var/log/ppp-debug
  182. and then restart syslogd, usually by sending it a SIGHUP signal with a
  183. command like this:
  184. killall -HUP syslogd
  185. 4.1 Is the link up?
  186. The main way to tell if your PPP link is up and operational is the
  187. ifconfig ("interface configuration") command. Type
  188. /sbin/ifconfig
  189. at a shell prompt. It should print a list of interfaces including one
  190. like this example:
  191. ppp0 Link encap Point-to-Point Protocol
  192. inet addr 192.76.32.3 P-t-P 129.67.1.165 Mask 255.255.255.0
  193. UP POINTOPOINT RUNNING MTU 1500 Metric 1
  194. RX packets 33 errors 0 dropped 0 overrun 0
  195. TX packets 42 errors 0 dropped 0 overrun 0
  196. Assuming that ifconfig shows the ppp network interface, you can test
  197. the link using the ping command like this:
  198. /sbin/ping -c 3 129.67.1.165
  199. where the address you give is the address shown as the P-t-P address
  200. in the ifconfig output. If the link is operating correctly, you
  201. should see output like this:
  202. PING 129.67.1.165 (129.67.1.165): 56 data bytes
  203. 64 bytes from 129.67.1.165: icmp_seq=0 ttl=255 time=268 ms
  204. 64 bytes from 129.67.1.165: icmp_seq=1 ttl=255 time=247 ms
  205. 64 bytes from 129.67.1.165: icmp_seq=2 ttl=255 time=266 ms
  206. --- 129.67.1.165 ping statistics ---
  207. 3 packets transmitted, 3 packets received, 0% packet loss
  208. round-trip min/avg/max = 247/260/268 ms