home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / PPP / _PPP.TAR / usr / lib / ppp / README.linux < prev    next >
Encoding:
Text File  |  1994-10-17  |  28.3 KB  |  666 lines

  1.  
  2. PPP for Linux                                             Version 1.0.1
  3. =============                                                  based on
  4.                                                               ppp-2.1.2
  5.                                                               June 1994
  6.  
  7. Michael Callahan    callahan@maths.ox.ac.uk
  8. Al Longyear         longyear@netcom.com
  9.  
  10.   Contents:
  11.     INTRODUCTION
  12.     CREDITS
  13.     FUTURE PLANS
  14.     INSTALLATION
  15.     GENERAL NETWORK CONFIGURATION
  16.     CONNECTING TO A PPP SERVER
  17.     IF IT WORKS
  18.     IF IT DOESN'T WORK
  19.     IF IT STILL DOESN'T WORK (OR, BUG REPORTS)
  20.     DYNAMIC ADDRESS ASSIGNMENT
  21.     SETTING UP A MACHINE FOR INCOMING PPP CONNECTIONS
  22.     ADDING MORE PPP CHANNELS
  23.     CHANGES FROM LINUX PPP 0.1.x
  24.     CONCLUSION
  25.  
  26.  
  27. INTRODUCTION
  28.  
  29. This is a PPP driver for Linux.  It has been used by many people and
  30. seems to be quite stable.  It is capable of being used either as a
  31. 'client'--for connecting a Linux machine to a local Internet provider,
  32. for example--or as a 'server'--allowing a Linux machine with a modem
  33. and an Ethernet connection to the Internet to provide dial-in PPP
  34. links.  (In fact, the PPP protocol does not make the distinction
  35. between client and server, but this is the way people often think
  36. about it.)
  37.  
  38. The PPP protocol consists of two parts.  One is a scheme for framing
  39. and encoding packets, the other is a series of protocols called LCP,
  40. IPCP, UPAP and CHAP, for negotiating link options and for
  41. authentication.  This package similarly consists of two parts: a
  42. kernel module which handles PPP's low-level framing protocol, and a
  43. user-level program called pppd which implements PPP's negotiation
  44. protocols.
  45.  
  46. The kernel module assembles/disassembles PPP frames, handles error
  47. detection, and forwards packets between the serial port and either the
  48. kernel network code or the user-level program pppd.  IP packets go
  49. directly to the kernel network code.  So once pppd has negotiated the
  50. link, it in practice lies completely dormant until you want to take
  51. the link down, when it negotiates a graceful disconnect.
  52.  
  53. CREDITS
  54.  
  55. I (MJC) wrote the original kernel driver from scratch.  Laurence
  56. Culhane and Fred van Kempen's slip.c was priceless as a model (a
  57. perusal of the files will reveal that I often mimicked what slip.c
  58. did).  Otherwise I just implemented what pppd needs, using RFC1331 as
  59. a guide.  For the most part, the Linux driver provides the same
  60. interface as the free 386BSD and SunOS drivers.  The exception is that
  61. Linux has no support for asynchronous I/O, so I hacked an ioctl into
  62. the PPP kernel module that provides a signal when packets appear and
  63. made pppd use this instead.
  64.  
  65. Al Longyear ported version 2.0.4 of pppd (from the free package
  66. ppp-2.0.4) to Linux.  He also provided several enhancements to both
  67. the kernel driver and the OS-independent part of pppd.  His
  68. contributions to Linux PPP have been immense, and so this release
  69. is being distributed over both our names.
  70.  
  71. The pppd program comes from the free distribution of PPP for Suns and
  72. 386BSD machines, maintained by Paul Mackerras.  This package lists
  73. "thanks to" Brad Parker, Greg Christy, Drew D. Perkins, Rick Adams and
  74. Chris Torek.
  75.  
  76.  
  77. FUTURE PLANS
  78.  
  79. The main missing feature is the ability to fire up a PPP connection
  80. automatically when a packet destined for the remote host is generated
  81. ("demand-dialing").  Work is progressing on this, but it involves some
  82. nontrivial design issues.
  83.  
  84.  
  85. INSTALLATION
  86.  
  87. This version of PPP has been tested on 1.0.x (x=0..9) and 1.1.x
  88. (x=0..14) kernels.  It will probably not work on kernels much earlier
  89. than this due to a change in the routing code.  If you have an earlier
  90. kernel, please upgrade.
  91.  
  92. joining the PPP channel of linux-activists:
  93.  
  94.       This isn't really part of installation, but if you DO use
  95.       Linux PPP you should do this.  Send a message with the line
  96.     X-Mn-Admin: join PPP
  97.       contained in the body to linux-activists-request@niksula.hut.fi
  98.       You can send to the list by mailing to
  99.       linux-activists@niksula.hut.fi and putting the line
  100.         X-Mn-Key: PPP
  101.       at the start of your message.
  102.  
  103.       The advantage of subscribing is that you'll be informed of
  104.       updates and patches, and you'll be able to draw on the
  105.       experience of many PPP users.  If you have a problem, I may not
  106.       be able to diagnose it, but someone else may have solved it
  107.       already.
  108.  
  109.       Note also that I do not read the linux Usenet newsgroups
  110.       regularly enough to catch any discussions of PPP; if you want to
  111.       reach the PPP audience you should join the linux-activists
  112.       channel.
  113.  
  114.       To leave the PPP mailing list :-(, send a message with the line
  115.         X-Mn-Admin: leave PPP
  116.       to linux-activists-request.
  117.  
  118.       YOU MUST USE THE EXACT SAME ACCOUNT WHICH YOU USED WHEN YOU JOINED.
  119.       THIS MEANS THAT YOU NEED THE SAME ACCOUNT NAME, HOST NAME, AND
  120.       SYSTEM NAME.
  121.  
  122. kernel driver installation:
  123.  
  124.       This depends on the kernel version you're using.
  125.  
  126.       Since 1.1.14, Linux kernels have had built-in support for PPP.
  127.       You'll be asked whether you want PPP when you run "make config".
  128.       It's as easy as that.
  129.  
  130.       NEVER, NEVER, REPLACE THE FILES IN THE KERNEL WITH ANY FILE IN
  131.       THIS PACKAGE. THE KERNEL IS ALWAYS MORE CURRENT THAN FILES IN
  132.       THIS PACKAGE.
  133.  
  134.       In 1.1.13, PPP is there but the PPP line in config.in is
  135.       commented out.  If you have 1.1.13, you probably should just
  136.       upgrade anyway.
  137.  
  138.       Kernel versions prior to 1.1.13 (including all 1.0.x kernels)
  139.       have had (hidden) support for PPP in the kernel configuration
  140.       setup for quite some time.  Adding the PPP kernel driver is
  141.       easy:
  142.  
  143.     1) copy ppp.c from the linux subdirectory of the distribution
  144.            to drivers/net and ppp.h to include/linux
  145.     2) uncomment the CONFIG_PPP line in config.in
  146.         3) if you are using 1.1.3 or earlier (including 1.0.x):
  147.            uncomment the line in ppp.c that begins
  148.             /* #define NET02D
  149.            by removing the "/* " characters
  150.         4) in the top level of the kernel source
  151.                make config
  152.                make dep
  153.                make
  154.  
  155.       Reboot with the new kernel.  At startup, you should see
  156.       something like this:
  157.  
  158.   PPP: version 0.2.7 (4 channels) NEW_TTY_DRIVERS OPTIMIZE_FLAGS
  159.   TCP compression code copyright 1989 Regents of the University of California
  160.   PPP line discipline registered.
  161.  
  162.       Don't worry if the words in capitals on the first line are
  163.       slightly different.
  164.  
  165.       If you want more than 4 channels, see the section "ADDING MORE
  166.       PPP CHANNELS" below.
  167.  
  168.       Now, try looking at the contents of /proc/net/dev.  It should
  169.       look something like this:
  170.  
  171.   Inter-|   Receive                  |  Transmit
  172.    face |packets errs drop fifo frame|packets errs drop fifo colls carrier
  173.       lo:      0    0    0    0    0        0    0    0    0     0    0
  174.     ppp0:      0    0    0    0    0        0    0    0    0     0    0
  175.     ppp1:      0    0    0    0    0        0    0    0    0     0    0
  176.     ppp2:      0    0    0    0    0        0    0    0    0     0    0
  177.     ppp3:      0    0    0    0    0        0    0    0    0     0    0
  178.  
  179.       This indicates that the driver is successfully installed.
  180.  
  181.       (Of course, you should keep a kernel without PPP around, in case
  182.       something goes wrong.)
  183.  
  184. pppd installation:
  185.  
  186.       If you want to recompile pppd, go to the pppd subdirectory of
  187.       the installation.  Type
  188.          ln -s Makefile.linux Makefile
  189.          make
  190.       There will be some warnings when compiling lcp.c, upap.c and
  191.       chap.c but these are OK.
  192.  
  193.       If you want to recompile chat, consult README.linux in the chat
  194.       directory.
  195.  
  196.       To install, type 'make install' in the chat and pppd
  197.       directories.   This will put chat and pppd binaries in /usr/etc
  198.       and the pppd.8 manual page in /usr/man/man8.
  199.  
  200.       pppd needs to be run as root.  You can either make it setuid
  201.       root or just use it when you are root.  'make install' will try
  202.       to install it setuid root.  Making pppd setuid root is
  203.       convenient for a single-user machine, but has security
  204.       implications which you should investigate carefully before
  205.       making it available on a multiuser machine.
  206.  
  207. GENERAL NETWORK CONFIGURATION
  208.  
  209. Since many people don't use the Linux networking code at all until
  210. they get a PPP link, this section describes generally what's needed to
  211. get things running.  In principle none of this is special to PPP.  For
  212. more details, you should consult the relevant Linux HOWTOs.  If you
  213. already understand network setup, you can skip this section.
  214.  
  215. The first file that requires attention is the rc script that does
  216. network configuration at boot time, called /etc/rc.net or
  217. /etc/rc.d/rc.net.{1,2} or something similar, depending on your Linux
  218. distribution.  This file should 'ifconfig' the loopback interface lo,
  219. and should add an interface route for it.  These lines might look
  220. something like this:
  221.         $CONFIG lo 127.0.0.1
  222.     $ROUTE add loopback
  223. or
  224.         /sbin/ifconfig lo 127.0.0.1
  225.         /sbin/route add 127.0.0.1
  226.  
  227. However, it should *not* config an ethernet card or install any other
  228. routes (unless you actually have an ethernet card, in which case I'll
  229. assume you know what to do).  Many distributions will provide scripts
  230. that expect you to have an ethernet card.
  231.  
  232. You also need to decide whether you want to allow incoming
  233. telnet/ftp/finger, etc.  If so, you should have the rc startup script
  234. run the 'inetd' daemon.
  235.  
  236. Next, you should set up /etc/hosts to have two lines.  The first
  237. should just give the loopback or localhost address and the second
  238. should give your own host name and the IP address your PPP connection
  239. will use.  For example:
  240.      127.0.0.1  loopback localhost   # useful aliases
  241.      192.1.1.17  billpc.whitehouse.gov bill  # my hostname
  242. where my IP address is 192.1.1.17 and my hostname is
  243. billpc.whitehouse.gov.  (Not really, you understand.)  If your PPP
  244. server does dynamic IP address assignment, give a guess as to an
  245. address you might get (see also "Dynamic Address Assignment" below).
  246.  
  247. Finally, you need to configure the domain name system by putting
  248. appropriate lines in /etc/resolv.conf .  It should look something like
  249. this:
  250.      domain whitehouse.gov
  251.      nameserver 192.1.2.1
  252.      nameserver 192.1.2.10
  253. Assuming there are nameservers at 192.1.2.1 and 192.1.2.10, then when
  254. you get connected with PPP, you can reach hosts whose full names are
  255. 'hillarypc.whitehouse.gov' and 'chelseapc.whitehouse.gov' by the names
  256. 'hillarypc' and 'chelseapc'.  You can probably find out the right
  257. domain name to use and the IP numbers of nameservers from whoever's
  258. providing your PPP link.
  259.  
  260. CONNECTING TO A PPP SERVER
  261.  
  262. To use PPP, you invoke the pppd program with appropriate options.
  263. Everything you need to know is contained in the pppd(8) manual page.
  264. However, it's useful to see some examples:
  265.  
  266. Example 1: A simple dial-up connection.
  267.  
  268. Here's a command for connecting to a PPP server by modem.
  269.  
  270.   pppd connect 'chat -v "" ATDT5551212 CONNECT "" ogin: ppp word: whitewater' \
  271.       /dev/cua1 38400 -detach debug crtscts modem defaultroute 192.1.1.17:
  272.  
  273. Going through pppd's options in order:
  274.    connect 'chat etc...'  This gives a command to run to contact the
  275.     PPP server.  Here the supplied 'chat' program is used to dial a
  276.     remote computer.  The whole command is enclosed in single quotes
  277.     because pppd expects a one-word argument for the 'connect' option.
  278.     The options to 'chat' itself are:
  279.          -v            verbose mode; log what we do to syslog
  280.          ""            don't wait for any prompt, but instead...
  281.          ATDT5551212   dial the modem, then
  282.          CONNECT       wait for answer
  283.          ""            send a return (null text followed by usual return)
  284.          ogin: ppp word: whitewater    log in.
  285.    /dev/cua1  specify the callout serial port cua1
  286.    38400  specify baud rate
  287.    -detach   normally, pppd forks and puts itself in the background;
  288.         this option prevents this
  289.    debug  log status in syslog
  290.    crtscts  use hardware flow control between computer and modem
  291.         (at 38400 this is a must)
  292.    modem  indicate that this is a modem device; pppd will hang up the
  293.         phone before and after making the call
  294.    defaultroute  once the PPP link is established, make it the
  295.         default route; if you have a PPP link to the Internet this
  296.         is probably what you want
  297.    192.1.1.17:  this is a degenerate case of a general option
  298.         of the form  x.x.x.x:y.y.y.y  .  Here x.x.x.x is the local IP
  299.         address and y.y.y.y is the IP address of the remote end of the
  300.         PPP connection.  If this option is not specified, or if just
  301.         one side is specified, then x.x.x.x defaults to the IP address
  302.         associated with the local machine's hostname (in /etc/hosts),
  303.         and y.y.y.y is determined by the remote machine.  So if this
  304.         example had been taken from the fictional machine 'billpc',
  305.         this option would actually be redundant.
  306.  
  307. pppd will write error messages and debugging logs to the syslogd
  308. daemon using the facility name "local2".  (Verbose output from chat is
  309. the same.)  These messages may already be logged to the console or to
  310. a file like /usr/adm/messages; consult your /etc/syslog.conf file to
  311. see.  If you want to make all pppd and chat messages go to the
  312. console, add the line
  313.    local2.*                    /dev/console
  314. to syslog.conf; make sure to put one or more TAB characters between
  315. the two fields.
  316.  
  317. Example 2: Connecting to PPP server over hard-wired link.
  318.  
  319. This is a slightly more complicated example.  This is the script I run
  320. to make my own PPP link, which is over a hard-wired Gandalf link to an
  321. Ultrix machine running Morningstar PPP.
  322.  
  323.   pppd connect /etc/ppp/ppp-connect defaultroute noipdefault debug \
  324.       kdebug 2 /dev/cua0 9600
  325.  
  326. Here /etc/ppp/ppp-connect is the following script:
  327.   #! /bin/sh
  328.   /etc/ppp/sendbreak
  329.   chat -v -t60 "" \; "service :" blackice ogin: callahan word: PASSWORD \
  330.       black% "stty -echo; ppp" "Starting PPP now"  && sleep 5
  331.  
  332. This sends a break to wake up my terminal server, sends a semicolon
  333. (which lets my terminal server do autobaud detection), then says we
  334. want the service "blackice".  It logs in, waits for a shell prompt
  335. ("black%"), then starts PPP.  The -t60 argument sets the timeout to a
  336. minute, since things here are sometimes very slow.
  337.  
  338. The "&& sleep 5" causes the script to pause for 5 seconds, unless chat
  339. fails in which case it exits immediately.  This is just to give the
  340. PPP server time to start (it's very slow).  Also, the "stty -echo"
  341. turned out to be very important for me; without it, my pppd would
  342. sometimes start to send negotiation packets before the remote PPP
  343. server had time to turn off echoing.  The negotiation packets would
  344. then get sent back to my local machine, be rejected (PPP is able to
  345. detect loopback) and pppd would fail before the remote PPP server even
  346. got going.  The "stty -echo" command prevents this confusion.  This
  347. kind of problem should only ever affect a *very* few people who
  348. connect to a PPP server that runs as a command on a slow Unix machine,
  349. but I wanted to mention it because it took me several frustrating
  350. hours to figure out.
  351.  
  352. The pppd options are mostly familiar.  Two that are new are
  353. "noipdefault" and "kdebug 2".  "noipdefault" tells pppd to ask the
  354. remote end for the IP address to use; this is necessary if the PPP
  355. server implements dynamic IP address assignment as mine does (i.e., I
  356. don't know what address I'll get ahead of time).  "kdebug 2" sets the
  357. kernel debugging level to 2, enabling slightly chattier messages from
  358. the ppp kernel code.
  359.  
  360.  
  361.  
  362. Anyway, assuming your connection is working, you should see chat dial
  363. the modem, then perhaps some messages from pppd (depending on your
  364. syslog.conf setup), then some kernel messages like this:
  365.  
  366.     ppp: channel ppp0 mtu changed to 1500
  367.     ppp: channel ppp0 open
  368.     ppp: channel ppp0 going up for IP packets!
  369.  
  370. (These messages will only appear if you gave the option "kdebug 2" and
  371. have kern.info messages directed to the screen.)  Simultaneously, pppd
  372. is also writing interesting things to /usr/adm/messages (or other log
  373. file, depending on syslog.conf).
  374.  
  375. IF IT WORKS
  376.  
  377. If you think you've got a connection, there are a number of things you
  378. can do to test it.
  379.  
  380. First, type
  381.     /sbin/ifconfig
  382. (ifconfig may live elsewhere, depending on your distribution.)  This
  383. should show you all the network interfaces that are 'UP'.  ppp0 should
  384. be one of them, and you should recognize the first IP address as your
  385. own and the "POINT-TO-POINT ADDR" as the address of your server.
  386. Here's what it looks like on my machine:
  387.  
  388. lo        Link encap Local Loopback  
  389.           inet addr 127.0.0.1  Bcast 127.255.255.255  Mask 255.0.0.0
  390.           UP LOOPBACK RUNNING  MTU 2000  Metric 1
  391.           RX packets 0 errors 0 dropped 0 overrun 0
  392.           TX packets 0 errors 0 dropped 0 overrun 0
  393.  
  394. ppp0      Link encap Point-Point Protocol
  395.           inet addr 192.76.32.2  P-t-P 129.67.1.165  Mask 255.255.255.0
  396.           UP POINTOPOINT RUNNING  MTU 1500  Metric 1
  397.           RX packets 33 errors 0 dropped 0 overrun 0
  398.           TX packets 42 errors 0 dropped 0 overrun 0
  399.  
  400. Now, type
  401.     ping z.z.z.z
  402. where z.z.z.z is the address of your server.  This should work.
  403. Here's what it looks like for me:
  404.   waddington:~$ ping 129.67.1.165
  405.   PING 129.67.1.165 (129.67.1.165): 56 data bytes
  406.   64 bytes from 129.67.1.165: icmp_seq=0 ttl=255 time=268 ms
  407.   64 bytes from 129.67.1.165: icmp_seq=1 ttl=255 time=247 ms
  408.   64 bytes from 129.67.1.165: icmp_seq=2 ttl=255 time=266 ms
  409.   ^C
  410.   --- 129.67.1.165 ping statistics ---
  411.   3 packets transmitted, 3 packets received, 0% packet loss
  412.   round-trip min/avg/max = 247/260/268 ms
  413.   waddington:~$
  414.  
  415. Try typing:
  416.     netstat -nr
  417. This should show three routes, something like this:
  418. Kernel routing table
  419. Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  420. 129.67.1.165    0.0.0.0         255.255.255.255 UH    0      0        6 ppp0
  421. 127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
  422. 0.0.0.0         129.67.1.165    0.0.0.0         UG    0      0     6298 ppp0
  423.  
  424. If your output looks similar but doesn't have the destination 0.0.0.0
  425. line (which refers to the default route used for connections), you may
  426. have run pppd without the 'defaultroute' option.
  427.  
  428. At this point you can try telnetting/ftping/fingering whereever you
  429. want, bearing in mind that you'll have to use numeric IP addresses
  430. unless you've set up your /etc/resolv.conf correctly.
  431.  
  432. IF IT DOESN'T WORK
  433.  
  434. We have included a small FAQ of related problems in the linux
  435. directory. It is called "FAQ".
  436.  
  437. If you don't seem to get a connection, the thing to do is to collect
  438. 'debug' output from pppd.  To do this, make sure you run pppd with the
  439. 'debug' option, and put the following two lines in your
  440. /etc/syslog.conf file:
  441.     local2.*                    /dev/console
  442.     local2.*                    /usr/adm/ppplog
  443. This will cause pppd's messages to be written to the current virtual
  444. console and to the file /usr/adm/ppplog.  Note that the left-hand
  445. field and the right-hand field must be separated by at least one TAB
  446. character.  After modifying /etc/syslog.conf, you must execute the
  447. command 'kill -HUP <pid>' where <pid> is the process ID of the
  448. currently running syslogd process to cause it to re-read the
  449. configuration file.
  450.  
  451. Some messages to look for: 
  452.   - "pppd[NNN]: Connected..." means that the "connect" script has
  453.     completed successfully.  
  454.   - "pppd[NNN]: sent [LCP ConfReq"... means that pppd has attempted to
  455.     begin negotiation with the remote end.  
  456.   - "pppd[NNN]: recv [LCP ConfReq"... means that pppd has received a
  457.     negotiation frame from the remote end.
  458.   - "pppd[NNN]: ipcp up" means that pppd has reached the point where
  459.     it believes the link is ready for IP traffic to travel across it.
  460.  
  461. If you never see a "recv" message then there may be serious problems
  462. with your link.  (For example, the link may not be passing all 8
  463. bits.)  If that's the case, it would be useful to collect a debug log
  464. which contains all the bytes being passed between your computer and
  465. the remote PPP server.  To do this, alter your syslog.conf lines to
  466. look like this
  467.     local2.*,kern.*                /dev/console
  468.     local2.*,kern.*                /usr/adm/ppplog
  469. and HUP the syslog daemon as before.  Then, run pppd with the option
  470. "kdebug 5".  Whatever characters arrive over the PPP terminal line
  471. will appear in the debugging output.
  472.  
  473. Occasionally you may see a message like
  474.    ppp_toss: tossing frame, reason = 4
  475. The PPP code is throwing away a packet ("frame") from the remote
  476. server because of a serial overrun.  This means your CPU isn't able to
  477. read characters from the serial port as quickly as they arrive; the
  478. best solution is to get a 16550A serial chip, which gives the CPU some
  479. grace period.  Reasons other than 4 indicate other kinds of serial
  480. errors, which should not occur.
  481.  
  482. During the initial connection sequence, you may see one or more
  483. messages which indicate "bad fcs".  This refers to a checksum error in
  484. a received PPP frame, and usually occurs at the start of a session
  485. when the peer system is sending some "text" messages, such as "hello
  486. this is the XYZ company".  Messages of "bad fcs" once the link is
  487. established and the routes have been added are not normal and indicate
  488. transmssion errors or noise on the telephone line.
  489.  
  490. IF IT STILL DOESN'T WORK (OR, BUG REPORTS)
  491.  
  492. If you're still having difficulty, send the linux-activists PPP
  493. channel a bug report.  It is extremely important to include as much
  494. information as possible; for example:
  495.  - the version number of the kernel you are using
  496.  - the version number of Linux PPP you are using
  497.  - the exact command you use to start the PPP session
  498.  - log output from a session run with the 'debug' option, captured
  499.    using local2.*,kern.* in your syslog.conf file
  500.  - the type of PPP peer that you are connecting to (eg, Xyzzy Corp
  501.    terminal server, Morningstar PPP software, etc)
  502.  - the kind of connection you use (modem, hardwired, etc...)
  503.  
  504. DYNAMIC ADDRESS ASSIGNMENT
  505.  
  506. You can use Linux PPP with a PPP server which assigns a different IP
  507. address every time you connect.  You need to use the 'noipdefault'
  508. option to tell pppd to request the IP address from the remote host.
  509.  
  510. Sometimes you may get an error message like "Cannot assign requested
  511. address" when you use a Linux client (for example, "talk").  This
  512. happens when the IP address given in /etc/hosts for our hostname
  513. differs from the IP address used by the PPP interface.  The solution
  514. is to use ifconfig ppp0 to get the interface address and then edit
  515. /etc/hosts appropriately.
  516.  
  517. SETTING UP A MACHINE FOR INCOMING PPP CONNECTIONS
  518.  
  519. Suppose you want to permit another machine to call yours up and start
  520. a PPP session.  This is possible using Linux PPP.
  521.  
  522. Before doing anything else, you should make sure that your Linux
  523. machine is set up to answer incoming calls and provide login prompts
  524. over the serial line.  You should verify that you can dial up, log in
  525. as a normal user, get a shell prompt, and issue some commands.  This
  526. document does not discuss how to set up a Linux machine to answer
  527. incoming calls; for that, refer to the documentation that came with
  528. your distribution or the Serial HOWTO.
  529.  
  530. Now, to provide PPP service, one way is to create an account named,
  531. say, 'ppp', with the login shell being a short script that starts
  532. pppd.  For example, the /etc/passwd entry might look like this:
  533.  
  534.   ppp:(encrypted password):102:50:PPP client login:/tmp:/etc/ppp/ppplogin
  535.  
  536. Here the file /etc/ppp/ppplogin would be an executable script
  537. containing something like:
  538.  
  539.   #!/bin/sh
  540.   exec /usr/etc/pppd passive :192.1.2.23
  541.  
  542. Here we will insist that the remote machine use IP address 192.1.2.23,
  543. while the local PPP interface will use the IP address associated with
  544. this machine's hostname in /etc/hosts.  The 'passive' option (which is
  545. not required) just means that pppd will try to open negotiations when
  546. it starts, but if it receives no reply it will just wait silently.
  547. This is appropriate if the remote end might take some time before it's
  548. ready to negotiate.  (Note that the meaning of the 'passive' option
  549. changed between ppp-1.3 and ppp-2.0.)
  550.  
  551. This setup is sufficient if you just want to connect two machines so
  552. that they can talk to one another.  If you want to use Linux PPP to
  553. connect a single machine to an entire network, or to connect two
  554. networks together, then you need to arrange for packets to be routed
  555. from the networks to the PPP link.  Setting up a link between networks
  556. is beyond the scope of this document; you should examine the routing
  557. options in the manual page for pppd carefully and find out about
  558. routed, etc.
  559.  
  560. Let's consider just the first case.  Suppose you have a Linux machine
  561. attached to an Ethernet, and you want to allow its PPP peer to be able
  562. to communicate with hosts on that Ethernet.  To do this, you should
  563. have the remote machine use an IP address that would normally appear
  564. to be on the local Ethernet segment and you should give the 'proxyarp'
  565. option to pppd on the server.  Suppose, for example, we have this
  566. setup:
  567.  
  568.  192.1.2.23                        192.1.2.17
  569. +-----------+      PPP link       +----------+
  570. | chelseapc | ------------------- |  billpc  |
  571. +-----------+                  +----------+
  572.                                         |           Ethernet 
  573.                             ----------------------------------- 192.1.2.x 
  574.  
  575. Here the PPP and Ethernet interfaces of billpc will have IP address
  576. 192.1.2.17.  (It's OK for one or more PPP interfaces on a machine to
  577. share an IP address with an Ethernet interface.)  There is an
  578. appropriate entry in /etc/passwd on billpc to allow chelseapc to call
  579. in, with the /etc/ppp/ppplogin script containing
  580.   #!/bin/sh
  581.   exec /usr/etc/pppd passive proxyarp :192.1.2.23
  582. When the link comes up, pppd will enter a "proxy arp" entry for
  583. chelseapc into the arp table on billpc.  What this means effectively
  584. is that billpc will pretend to the other machines on the 192.1.2.x
  585. Ethernet that its Ethernet interface is ALSO the interface for
  586. chelseapc (192.1.2.23) as well as billpc (192.1.2.17).  In practice
  587. this means that chelseapc can communicate just as if it was directly
  588. connected to the Ethernet.
  589.  
  590. ADDING MORE PPP CHANNELS
  591.  
  592. By default, Linux PPP comes with 4 kernel channels, which means that
  593. at most 4 simultaneous PPP sessions are possible.  If you desire more
  594. such sessions (for example if you are serving many dialup lines), you
  595. can easily reconfigure the kernel to add new channels.  There are two
  596. steps.
  597.  
  598. First you need to edit the kernel file drivers/net/Space.c .  As
  599. distributed, it contains a section that looks like this:
  600.   
  601. #if defined(CONFIG_PPP)
  602. extern int ppp_init(struct device *);
  603. static struct device ppp3_dev = {
  604.     "ppp3", 0x0, 0x0, 0x0, 0x0, 3, 0, 0, 0, 0, NEXT_DEV,  ppp_init, };
  605. static struct device ppp2_dev = {
  606.     "ppp2", 0x0, 0x0, 0x0, 0x0, 2, 0, 0, 0, 0, &ppp3_dev, ppp_init, };
  607. static struct device ppp1_dev = {
  608.     "ppp1", 0x0, 0x0, 0x0, 0x0, 1, 0, 0, 0, 0, &ppp2_dev, ppp_init, };
  609. static struct device ppp0_dev = {
  610.     "ppp0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, &ppp1_dev, ppp_init, };
  611. #undef NEXT_DEV
  612. #define NEXT_DEV (&ppp0_dev)
  613. #endif   /* PPP */
  614.  
  615. The pattern should be obvious.  For more channels, you need to add
  616. more "static struct device pppN_dev" lines, changing the first, sixth
  617. and eleventh structure entries as appropriate.  The highest numbered
  618. PPP device should have NEXT_DEV in its eleventh structure field, and
  619. you should change the ppp3_dev structure to have &ppp4_dev there
  620. instead.
  621.  
  622. For example, to add 2 extra channels, you would have
  623.  
  624. #if defined(CONFIG_PPP)
  625. extern int ppp_init(struct device *);
  626. static struct device ppp5_dev = {
  627.     "ppp5", 0x0, 0x0, 0x0, 0x0, 5, 0, 0, 0, 0, NEXT_DEV,  ppp_init, };
  628. static struct device ppp4_dev = {
  629.     "ppp4", 0x0, 0x0, 0x0, 0x0, 4, 0, 0, 0, 0, &ppp5_dev,  ppp_init, };
  630. static struct device ppp3_dev = {
  631.     "ppp3", 0x0, 0x0, 0x0, 0x0, 3, 0, 0, 0, 0, &ppp4_dev,  ppp_init, };
  632. ... etc.
  633.  
  634. Second, you need to change the line in ppp.h (in include/linux) to
  635. change the line that reads
  636.  
  637. #define PPP_NRUNIT     4
  638.  
  639. to show the new number of channels; in our case it would become
  640.  
  641. #define PPP_NRUNIT     6
  642.  
  643. Finally, recompile and reboot.  The bootup message and the contents of
  644. /proc/net/dev should show the correct number of channels.
  645.  
  646. CHANGES FROM LINUX PPP 0.1.x
  647.  
  648. Linux PPP 0.1.x was based on the free PPP package PPP-1.3.  Linux PPP
  649. 0.2.1 is based on PPP-2.0.4.  There have been some changes to the pppd
  650. options along with significant enhancements.  You should read
  651. "RELNOTES" in the pppd directory for a description of the changes.
  652.  
  653. Also, some options which were added to PPP-1.3 for the Linux version
  654. have now changed names:
  655.     'defroute'  is now 'defaultroute'
  656.     'kerndebug' is now 'kdebug'
  657.     'dropdtr'   is now 'modem'
  658. In addition, it is now necessary to use the 'noipdefault' option if
  659. you want to get the local IP address from the remote PPP server.
  660.  
  661. CONCLUSION
  662.  
  663. Good luck!
  664.  
  665. Michael
  666.