xref: /freebsd/usr.sbin/ppp/ppp.8 (revision e627b39baccd1ec9129690167cf5e6d860509655)
1.\" manual page [] for ppp 0.94 beta2 + alpha
2.\" $Id: ppp.8,v 1.16 1996/05/02 19:18:47 mpp Exp $
3.Dd 20 September 1995
4.Os FreeBSD
5.Dt PPP 8
6.Sh NAME
7.Nm ppp
8.Nd
9Point to Point Protocol (aka iijppp)
10.Sh SYNOPSIS
11.Nm
12.Op Fl auto | Fl direct | Fl dedicated
13.Op Ar system
14.Sh DESCRIPTION
15This is a user process
16.Em PPP
17software package.  Normally,
18.Em PPP
19is implemented as a part of the kernel (e.g. as managed by pppd) and it's
20thus somewhat hard to debug and/or modify its behavior.  However, in this
21implementation
22.Em PPP
23is done as a user process with the help of the
24tunnel device driver (tun).
25
26.Sh Major Features
27
28.Bl -diag
29.It Provides interactive user interface.
30Using its command mode, the user can
31easily enter commands to establish the connection with the remote end, check
32the status of connection and close the connection.  All functions can
33also be optionally password protected for security.
34
35.It Supports both manual and automatic dialing.
36Interactive mode has a
37.Dq term
38command which enables you to talk to your modem directly.  When your
39modem is connected to the remote peer and it starts to talk
40.Em PPP
41, the
42.Em PPP
43software detects it and switches to packet
44mode automatically. Once you have determined the proper sequence for connecting
45with the remote host, you can write a chat script to define the necessary
46dialing and login procedure for later convenience.
47
48.It Supports on-demand dialup capability.
49By using auto mode,
50.Nm
51will act as a daemon and wait for a packet to be sent over the
52.Em PPP
53link.  When this happens, the daemon automatically dials and establishes the
54connection.
55
56.It Supports server-side PPP connections.
57Can act as server which accepts incoming
58.Em PPP
59connections.
60
61.It Supports PAP and CHAP authentication.
62
63
64.It Supports Proxy Arp.
65When
66.Em PPP
67is set up as server, you can also configure it to do proxy arp for your
68connection.
69
70.It Supports packet filtering.
71User can define four kinds of filters:
72.Em ifilter
73for incoming packets,
74.Em ofilter
75for outgoing packets,
76.Em dfilter
77to define a dialing trigger packet and
78.Em afilter
79for keeping a connection alive with the trigger packet.
80
81.It Tunnel driver supports bpf.
82The user can use
83.Xr tcpdump 1
84to check the packet flow over the
85.Em PPP
86link.
87
88.It Supports PPP over TCP capability.
89
90
91.It Supports IETF draft Predictor-1 compression.
92.Nm
93supports not only VJ-compression but also Predictor-1 compression.
94Normally, a modem has built-in compression (e.g. v42.bis) and the system
95may receive higher data rates from it as a result of such compression.
96While this is generally a good thing in most other situations, this
97higher speed data imposes a penalty on the system by increasing the
98number of serial interrupts the system has to process in talking to the
99modem and also increases latency.  Unlike VJ-compression, Predictor-1
100compression pre-compresses
101.Em all
102data flowing through the link, thus reducing overhead to a minimum.
103
104.It Runs under BSDI-1.1 and FreeBSD.
105
106.El
107
108
109Patches for NeXTSTEP 3.2 are also available on the net.
110
111.Sh GETTING STARTED
112
113When you first run
114.Nm
115you may need to deal with some initial configuration details.  First,
116your kernel should include a tunnel device (the default in FreeBSD 2.0.5
117and later). If it doesn't, you'll need to rebuild your kernel with the
118following line in your kernel configuration file:
119
120.Dl pseudo-device   tun             1
121
122You should set the numeric field to the maximum number of
123.Em PPP
124connections you wish to support.
125
126Second, check your
127.Pa /dev
128directory for the tunnel device entry
129.Pa /dev/tun0.
130If it doesn't exist, you can create it by running "MAKEDEV tun0"
131
132.Sh MANUAL DIALING
133
134%
135.Nm
136User Process PPP written by Toshiharu OHNO.
137
138* If you set your hostname and password in
139.Pa /etc/ppp/ppp.secret,
140you can't do
141anything except run the quit and help commands *
142
143ppp on "your hostname"> help
144  passwd  : Password for security
145  quit    : Quit the PPP program
146  help    : Display this message
147
148ppp on tama> pass <password>
149
150* "on" will change to "ON" if you specify the correct password. *
151
152ppp ON tama>
153
154* You can specify the device name and speed for your modem using the
155following commands: *
156
157ppp ON tama> set line /dev/cuaa0
158
159ppp ON tama> set speed 38400
160
161ppp ON tama> set parity even
162
163ppp ON tama> show modem
164
165* Modem related parameters are shown in here *
166
167ppp ON tama>
168
169* Use term command to talk with your modem *
170
171ppp ON tama> term
172 at
173 OK
174 atdt123456
175 CONNECT
176
177 login: ppp
178 Password:
179
180* PPP started in remote side.  When the peer start to talk PPP, the
181program will detect it automatically and return to command mode. *
182
183ppp ON tama>
184
185.Nm PPP
186ON tama>
187
188* NOW, you are connected!  Note that
189.Sq PPP
190in the prompt has changed to capital letters to indicate this. *
191
192PPP ON tama> show lcp
193
194* You'll see LCP status *
195
196PPP ON tama> show ipcp
197
198* You'll see IPCP status.  At this point, your machine has a host route
199to the peer. If you want to add a default route entry, then enter the
200following command. *
201
202PPP ON tama> add 0 0 HISADDR
203
204* The string
205.Sq HISADDR
206represents the IP address of connected peer. *
207
208PPP ON tama>
209
210* Use network applications (i.e. ping, telnet, ftp) in other windows *
211
212PPP ON tama> show log
213
214* Gives you some logging messages *
215
216PPP ON tama> close
217
218* The connection is closed and modem will be disconnected. *
219
220ppp ON tama> quit
221
222%
223
224.Sh AUTOMATIC DIALING
225
226To use automatic dialing, you must prepare some Dial and Login chat scripts.
227See the example definitions in
228.Pa /etc/ppp/ppp.conf.sample
229(the format of ppp.conf is pretty simple).
230
231.Bl -bullet -compact
232.It
233Each line contains one command, label or comment.
234.It
235A line starting with a
236.Sq #
237character is treated as a comment line.
238.It
239A label name has to start in the first column and should be followed by
240a colon (:).
241.It
242A command line must contain a space or tab in the first column.
243.El
244
245Once ppp.conf is ready, specify the destination label name when you
246invoke
247.Nm ppp .
248Commands associated with the destination label are then
249executed. Note that the commands associated with the
250.Dq default
251label are ALWAYS executed.
252
253Once the connection is made, you'll find that the
254.Nm ppp
255portion of the prompt has changed to
256.Nm PPP .
257
258   % ppp pm2
259   ...
260   ppp ON tama> dial
261   dial OK!
262   login OK!
263   PPP ON tama>
264
265If the
266.Pa /etc/ppp/ppp.linkup
267file is available, its contents are executed
268when the
269.Em PPP
270connection is established.  See the provided example which adds a
271default route.  The string HISADDR represents the IP address of the
272remote peer.
273
274.Sh DIAL ON DEMAND
275
276To play with demand dialing, you must use the
277.Fl auto
278option.  You must also specify the destination label in
279.Pa /etc/ppp/ppp.conf
280to use.  It should contain the
281.Dq ifaddr
282command to define the remote peer's IP address. (refer to
283.Pa /etc/ppp/ppp.conf.sample )
284
285   % ppp -auto pm2demand
286   ...
287   %
288
289When
290.Fl auto
291is specified,
292.Nm
293runs as a daemon but you can still configure or examine its
294configuration by using the diagnostic port as follows:
295
296
297  % telnet localhost 3000
298    Trying 127.0.0.1...
299    Connected to localhost.spec.co.jp.
300    Escape character is '^]'.
301    User Process PPP. Written by Toshiharu OHNO.
302    Working as auto mode.
303    PPP on tama> show ipcp
304    what ?
305    PPP on tama> pass xxxx
306    PPP ON tama> show ipcp
307    IPCP [OPEND]
308      his side: xxxx
309      ....
310
311.Pp
312Each
313.Nm
314daemon has an associated port number which is computed as "3000 +
315tunnel_device_number". If 3000 is not good base number, edit defs.h in
316the ppp sources (
317.Pa /usr/src/usr.sbin/ppp )
318and recompile it.
319
320When an outgoing packet is detected,
321.Nm
322will perform the dialing action (chat script) and try to connect
323with the peer.
324
325If the connect fails, the default behavior is to wait 30 seconds
326and then attempt to connect when another outgoing packet is detected.
327This behavior can be changed with
328.Bd -literal -offset indent
329set redial seconds|random [dial_attempts]
330.Ed
331.Pp
332Seconds is the number of seconds to wait before attempting
333to connect again. If the argument is
334.Sq random ,
335the delay period is a random value between 0 and 30 seconds.
336.Sq dial_attempts
337is the number of times to try to connect for each outgoing packet
338that is received. The previous value is unchanged if this parameter
339is omitted.
340.Bd -literal -offset indent
341set redial 10 4
342.Ed
343.Pp
344will attempt to connect 4 times for each outgoing packet that is
345detected with a 10 second delay between each attempt.
346
347Modifying the dial delay is very useful when running
348.Nm
349in demand
350dial mode on both ends of the link. If each end has the same timeout,
351both ends wind up calling each other at the same time if the link
352drops and both ends have packets queued.
353
354 To terminate the program, type
355
356  PPP ON tama> close
357  ppp ON tama> quit all
358
359.Pp
360A simple
361.Dq quit
362command will terminate the telnet connection but not the program itself.
363You must use
364.Dq quit all
365to terminate the program as well.
366
367.Sh PACKET FILTERING
368
369This implementation supports packet filtering. There are three kinds of
370filters: ifilter, ofilter and dfilter.  Here are the basics:
371
372.Bl -bullet -compact
373.It
374A filter definition has the following syntax:
375
376set filter-name rule-no action [src_addr/src_width] [dst_addr/dst_width]
377[proto [src [lt|eq|gt] port ]] [dst [lt|eq|gt] port] [estab]
378.Bl -enum
379.It
380.Sq filter-name
381should be one of ifilter, ofilter, or dfilter.
382.It
383There are two actions:
384.Sq permit
385and
386.Sq deny .
387If a given packet
388matches the rule, the associated action is taken immediately.
389.It
390.Sq src_width
391and
392.Sq dst_width
393work like a netmask to represent an address range.
394.It
395.Sq proto
396must be one of icmp, udp or tcp.
397.It
398.Sq port number
399can be specified by number and service name from
400.Pa /etc/services .
401
402.El
403
404.It
405Each filter can hold up to 20 rules, starting from rule 0.
406
407The entire rule set is not effective until rule 0 is defined.
408
409.It
410If no rule is matched to a packet, that packet will be discarded
411(blocked).
412
413.It
414Use
415.Dq set filter-name -1
416to flush all rules.
417
418.El
419
420See
421.Pa /etc/ppp/ppp.conf.filter.example .
422
423
424.Sh RECEIVING INCOMING PPP CONNECTIONS
425
426To handle an incoming
427.Em PPP
428connection request, follow these steps:
429
430.Bl -enum
431.It
432Make sure the modem and (optionally)
433.Pa /etc/rc.serial
434is configured correctly.
435.Bl -bullet -compact
436.It
437Use Hardware Handshake (CTS/RTS) for flow control.
438.It
439Modem should be set to NO echo back (ATE0) and NO results string (ATQ1).
440.El
441
442.It
443Edit
444.Pa /etc/ttys
445to enable a getty on the port where the modem is attached.
446
447For example:
448
449.Dl ttyd1  "/usr/libexec/getty std.38400" dialup on secure
450
451Don't forget to send a HUP signal to the init process to start the getty.
452
453.Dl # kill -HUP 1
454
455.It
456Prepare an account for the incoming user.
457.Bd -literal
458ppp:xxxx:66:66:PPP Login User:/home/ppp:/usr/local/bin/ppplogin
459.Ed
460
461.It
462Create a
463.Pa /usr/local/bin/ppplogin
464file with the following contents:
465.Bd -literal -offset indent
466#!/bin/sh
467/usr/sbin/ppp -direct
468.Ed
469
470(You can specify a label name for further control.)
471
472.El
473
474.Pp
475Direct mode (
476.Fl direct )
477lets
478.Nm
479work with stdin and stdout.  You can also telnet to port 3000 to get
480command mode control in the same manner as client-side
481.Nm .
482
483.Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
484
485To check/set idletimer, use the
486.Dq show timeout
487and
488.Dq set timeout [lqrtimer [retrytimer]]
489commands.
490
491 Ex:
492.Dl ppp ON tama> set timeout 600
493
494The timeout period is measured in seconds, the  default values for which
495are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
496To disable the idle timer function,
497use the command
498.Dq set timeout 0 .
499
500In
501.Fl auto
502mode, an idle timeout causes the
503.Em PPP
504session to be
505closed, though the
506.Nm
507program itself remains running.  Another trigger packet will cause it to
508attempt to reestablish the link.
509
510.Sh Predictor-1 compression
511
512This version supports CCP and Predictor type 1 compression based on
513the current IETF-draft specs. As a default behavior,
514.Nm
515will attempt to use (or be willing to accept) this capability when the
516peer agrees (or requests it).
517
518To disable CCP/predictor functionality completely, use the
519.Dq disable pred1
520and
521.Dq deny pred1
522commands.
523
524.Sh Controlling IP address
525
526.Nm
527uses IPCP to negotiate IP addresses. Each side of the connection
528specifies the IP address that it's willing to use, and if the requested
529IP address is acceptable then
530.Nm
531returns ACK to the requester.  Otherwise,
532.Nm
533returns NAK to suggest that the peer use a different IP address. When
534both sides of the connection agree to accept the received request (and
535send ACK), IPCP is set to the open state and a network level connection
536is established.
537
538To control this IPCP behavior, this implementation has the
539.Dq set ifaddr
540command for defining the local and remote IP address:
541
542.Nm set ifaddr
543.Op src_addr Op dst_addr Op netmask Op trg_addr
544
545Where,
546.Sq src_addr
547is the IP address that the local side is willing to use and
548.Sq dst_addr
549is the IP address which the remote side should use.
550.Sq netmask
551is interface netmask.
552.Sq trg_addr
553is the IP address which used in address negotiation.
554
555Ex:
556.Dl set ifaddr 192.244.177.38 192.244.177.2 255.255.255.0
557
558The above specification means:
559.Bl -bullet -compact
560.It
561I strongly want to use 192.244.177.38 as my IP address, and I'll
562disagree if the peer suggests that I use another address.
563
564.It
565I strongly insist that peer use 192.244.177.2 as own side address and
566don't permit it to use any IP address but 192.244.177.2.  When peer
567request another IP address, I always suggest that it use 192.244.177.2.
568
569.It
570My interface netmask will be 255.255.255.0.
571
572.It
573This is all fine when each side has a pre-determined IP address, however
574it is often the case that one side is acting as a server which controls
575all IP addresses and the other side should obey the direction from it.
576.El
577
578In order to allow more flexible behavior, `ifaddr' variable allows the
579user to specify IP address more loosely:
580
581.Dl set ifaddr 192.244.177.38/24 192.244.177.2/20
582
583A number followed by a slash (/) represent the number of bits significant in
584the IP address.  The above example signifies that:
585
586.Bl -bullet -compact
587.It
588I'd like to use 192.244.177.38 as my address if it is possible, but I'll
589also accept any IP address between 192.244.177.0 and 192.244.177.255.
590
591.It
592I'd like to make him use 192.244.177.2 as his own address, but I'll also
593permit him to use any IP address between 192.244.176.0 and
594192.244.191.255.
595
596.It
597As you may have already noticed, 192.244.177.2 is equivalent to saying
598192.244.177.2/32.
599
600.It
601As an exception, 0 is equivalent to 0.0.0.0/0, meaning that I have no
602preferred IP address and will obey the remote peer's selection.
603
604.It
605192.244.177.2/0 means that I'll accept/permit any IP address but I'll
606try to insist that 192.244.177.2 be used first.
607.El
608
609.Sh Connecting with your service provider
610
611.Bl -enum
612.It
613Describe provider's phone number(s) in DialScript: Use the
614.Dq set dial
615or
616.Dq set phone
617commands.
618.Dq Set phone
619command allows you to set multiply phone numbers for dialing and redialing
620separated by a colon (:).
621.It
622Describe login procedure in LoginScript: Use the
623.Dq set login
624command.
625.It
626Use
627.Dq set ifaddr
628command to define the IP address.
629.Bl -bullet
630.It
631If you know what IP address provider uses, then use it as the remote address.
632.It
633If provider has assigned a particular IP address to you, then use it as
634your address.
635.It
636If provider assigns your address dynamically, use 0 as your address.
637.It
638If you have no idea which IP addresses to use, then try
639.Dq set ifaddr 0 0 .
640.El
641.It
642If provider requests that you use PAP/CHAP authentication methods, add
643the next lines to your
644.Pa ppp.conf
645file:
646.Bd -literal -offset indent
647enable pap (or enable chap)
648disable chap (or disable pap)
649set authname MyName
650set authkey MyPassword
651.Ed
652.El
653
654Please refer to
655.Pa /etc/ppp/ppp.conf.iij
656for some real examples.
657
658.Sh Logging facility
659
660.Nm
661is able to generate the following log info into
662.Pa /var/log/ppp.log :
663
664.Bl -column SMMMMMM -offset indent -compat
665.It Li Phase	Phase transition log output
666.It Li Chat	Generate Chat script trace log
667.It Li Connect	Generate complete Chat log
668.It Li Carrier	Log Chat lines with 'CARRIER'
669.It Li LQM	Generate LQR report
670.It Li LCP	Generate LCP/IPCP packet trace
671.It Li Link	Log address assignments and link up/down events
672.It Li TCP/IP	Dump TCP/IP packet
673.It Li HDLC	Dump HDLC packet in hex
674.It Li Async	Dump async level packet in hex
675.El
676
677The
678.Dq set debug
679command allows you to set logging output level, of which
680multiple levels can be specified.  The default is equivalent to
681.Dq set debug carrier link phase .
682
683.Sh MORE DETAILS
684
685.Bl -bullet -compact
686.It
687Please read the Japanese doc for complete explanation. It may not be
688useful for non-japanese readers,  but examples in the document may help
689you to guess.
690
691.It
692Please read example configuration files.
693
694.It
695Use
696.Dq help ,
697.Dq show ? ,
698.Dq set ?
699and
700.Dq set ? <var>
701commands.
702
703.It
704NetBSD and BSDI-1.0 were supported in previous releases but are no
705longer supported in this release.  Please contact the author if you need
706old driver code.
707.El
708
709.Sh FILES
710.Nm
711refers to three files: ppp.conf, ppp.linkup and ppp.secret.
712These files are placed in
713.Pa /etc/ppp ,
714but the user can create his own files under his $HOME directory as
715.Pa .ppp.conf ,
716.Pa .ppp.linkup
717and
718.Pa .ppp.secret.
719.Nm
720will always try to consult the user's personal setup first.
721
722.Bl -tag -width flag
723.Pa $HOME/ppp/.ppp.[conf|linkup|secret]
724User dependent configuration files.
725
726.Pa /etc/ppp/ppp.conf
727System default configuration file.
728
729.Pa /etc/ppp/ppp.secret
730An authorization file for each system.
731
732.Pa /etc/ppp/ppp.linkup
733A file to check when
734.Nm
735establishes a network level connection.
736
737.Pa /var/log/ppp.log
738Logging and debugging information file.
739
740.Pa /var/spool/lock/Lck..*
741tty port locking file.
742
743.Pa /var/run/PPP.system
744Holds the pid for ppp -auto system.
745
746.Pa /etc/services
747Get port number if port number is using service name.
748.El
749.Sh SEE ALSO
750.Xr chat 8 ,
751.Xr pppd 8
752.Sh HISTORY
753This program was submitted in FreeBSD-2.0.5 Atsushi Murai (amurai@spec.co.jp).
754
755.Sh AUTHORS
756Toshiharu OHNO (tony-o@iij.ad.jp)
757