xref: /freebsd/usr.sbin/ppp/ppp.8 (revision 0de89efe5c443f213c7ea28773ef2dc6cf3af2ed)
1.\" $Id: ppp.8,v 1.67 1997/09/22 23:59:15 brian Exp $
2.Dd 20 September 1995
3.Os FreeBSD
4.Dt PPP 8
5.Sh NAME
6.Nm ppp
7.Nd
8Point to Point Protocol (aka iijppp)
9.Sh SYNOPSIS
10.Nm
11.Op Fl auto | background | ddial | direct | dedicated
12.Op Fl alias
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
56In almost the same manner ddial mode (dedicated or daemon dialing)
57also automatically dials and establishes the connection.  However, it
58differs in that it will dial the remote site any time it detects the
59link is down, even if there are no packets to be sent.  This mode is
60useful for full-time connections who worry less about line charges
61and more about being connected full time.
62
63.It Supports packet aliasing.
64Packet aliasing, more commonly known as masquerading, allows computers
65on a private, unregistered network to access the internet.  The
66.Em PPP
67host acts as a masquerading gateway.  IP addresses as well as TCP and
68UDP port numbers are aliased for outgoing packets and de-aliased for
69returning packets.
70
71.It Supports background PPP connections.
72In background mode, if
73.Nm
74successfully establishes the connection, it will become a daemon.
75Otherwise, it will exit with an error.
76
77.It Supports server-side PPP connections.
78In direct mode,
79.nm
80acts as server which accepts incoming
81.Em PPP
82connections on stdin/stdout.
83
84.It Supports PAP and CHAP authentication.
85
86.It Supports Proxy Arp.
87When
88.Em PPP
89is set up as server, you can also configure it to do proxy arp for your
90connection.
91
92.It Supports packet filtering.
93User can define four kinds of filters:
94.Em ifilter
95for incoming packets,
96.Em ofilter
97for outgoing packets,
98.Em dfilter
99to define a dialing trigger packet and
100.Em afilter
101for keeping a connection alive with the trigger packet.
102
103.It Tunnel driver supports bpf.
104The user can use
105.Xr tcpdump 1
106to check the packet flow over the
107.Em PPP
108link.
109
110.It Supports PPP over TCP capability.
111
112
113.It Supports IETF draft Predictor-1 compression.
114.Nm
115supports not only VJ-compression but also Predictor-1 compression.
116Normally, a modem has built-in compression (e.g. v42.bis) and the system
117may receive higher data rates from it as a result of such compression.
118While this is generally a good thing in most other situations, this
119higher speed data imposes a penalty on the system by increasing the
120number of serial interrupts the system has to process in talking to the
121modem and also increases latency.  Unlike VJ-compression, Predictor-1
122compression pre-compresses
123.Em all
124data flowing through the link, thus reducing overhead to a minimum.
125
126.It Supports Microsofts IPCP extensions.
127Name Server Addresses and NetBIOS Name Server Addresses can be negotiated
128with clients using the Microsoft
129.Em PPP
130stack (ie. Win95, WinNT)
131
132.Sh PERMISSIONS
133.Nm Ppp
134is installed as user
135.Dv root
136and group
137.Dv network ,
138with permissions
139.Dv 4550 .
140.Nm Ppp
141will not execute in client mode if the invoking user id is not zero.
142.Nm Ppp
143will run in
144.Fl direct
145mode as a normal user, but due to its execution permissions, this user
146must be a member of group
147.Dv network .
148When running as a normal user,
149.Nm
150switches to user id 0 in order to alter the system routing table.  All
151external commands (executed via the "shell" or "!bg" commands) are executed
152as the user id that invoked
153.Nm ppp .
154
155.Sh GETTING STARTED
156
157When you first run
158.Nm
159you may need to deal with some initial configuration details.  First,
160your kernel should include a tunnel device (the GENERIC kernel includes
161one by default).  If it doesn't, or if you require more than one tun
162interface, you'll need to rebuild your kernel with the following line in
163your kernel configuration file:
164
165.Dl pseudo-device tun N
166
167where
168.Ar N
169is the maximum number of
170.Em PPP
171connections you wish to support.
172
173Second, check your
174.Pa /dev
175directory for the tunnel device entries
176.Pa /dev/tunN ,
177where
178.Ar N
179represents the number of the tun device, starting at zero.
180If they don't exist, you can create them by running "sh ./MAKEDEV tunN".
181This will create tun devices 0 through
182.Ar N .
183
184Last of all, create a log file.
185.Nm Ppp
186uses
187.Xr syslog 3
188to log information.  A common log file name is
189.Pa /var/log/ppp.log .
190To make output go to this file, put the following lines in the
191.Pa /etc/syslog.conf
192file:
193
194.Dl !ppp
195.Dl *.* /var/log/ppp.log
196
197It is possible to have more than one ppp log file by creating a link
198to the ppp executable:
199
200.Dl # cd /usr/sbin
201.Dl # ln ppp ppp0
202
203and using
204
205.Dl !ppp0
206.Dl *.* /var/log/ppp0.log
207
208in
209.Pa /etc/syslog.conf .
210Don't forget to send a
211.Dv HUP
212signal to
213.Nm syslogd
214after altering
215.Pa /etc/syslog.conf .
216
217.Sh MANUAL DIALING
218
219In the following examples, we assume that your machine name is
220.Nm awfulhak .
221
222If you set your hostname and password in
223.Pa /etc/ppp/ppp.secret ,
224you can't do anything except run the help, passwd and quit commands.
225
226.Bd -literal -offset indent
227ppp on "your hostname"> help
228 help    : Display this message
229 passwd  : Password for security
230 quit    : Quit the PPP program
231ppp on awfulhak> pass <password>
232.Ed
233
234The "on" part of your prompt will change to "ON" if you specify the
235correct password.
236
237.Bd -literal -offset indent
238ppp ON awfulhak>
239.Ed
240
241You can now specify the device name, speed and parity for your modem,
242and whether CTS/RTS signalling should be used (CTS/RTS is used by
243default).  If your hardware does not provide CTS/RTS lines (as
244may happen when you are connected directly to certain ppp-capable
245terminal servers),
246.Nm
247will never send any output through the port; it waits for a signal
248which never comes.  Thus, if you have a direct line and can't seem
249to make a connection, try turning ctsrts off:
250
251
252.Bd -literal -offset indent
253ppp ON awfulhak> set line /dev/cuaa0
254ppp ON awfulhak> set speed 38400
255ppp ON awfulhak> set parity even
256ppp ON awfulhak> set ctsrts on
257ppp ON awfulhak> show modem
258
259* Modem related information is shown here *
260
261ppp ON awfulhak>
262.Ed
263
264The term command can now be used to talk directly with your modem:
265
266.Bd -literal -offset indent
267ppp ON awfulhak> term
268at
269OK
270atdt123456
271CONNECT
272login: ppp
273Password:
274Protocol: ppp
275.Ed
276
277When the peer starts to talk in PPP,
278.Nm
279detects this automatically and returns to command mode.
280
281.Bd -literal -offset indent
282ppp ON awfulhak>
283PPP ON awfulhak>
284.Ed
285
286You are now connected!  Note that
287.Sq PPP
288in the prompt has changed to capital letters to indicate that you have
289a peer connection.  The show command can be used to see how things are
290going:
291
292.Bd -literal -offset indent
293PPP ON awfulhak> show lcp
294
295* LCP related information is shown here *
296
297PPP ON awfulhak> show ipcp
298
299* IPCP related information is shown here *
300.Ed
301
302At this point, your machine has a host route to the peer.  This means
303that you can only make a connection with the host on the other side
304of the link.  If you want to add a default route entry (telling your
305machine to send all packets without another routing entry to the other
306side of the ppp link), enter the following command:
307
308.Bd -literal -offset indent
309PPP ON awfulhak> add 0 0 HISADDR
310.Ed
311
312The string
313.Sq HISADDR
314represents the IP address of the connected peer.  This variable is only
315available once a connection has been established.  A common error
316is to specify the above command in your
317.Pa ppp.conf
318file.  This won't work as the remote IP address hasn't been
319established when this file is read.
320
321You can now use your network applications (ping, telnet, ftp etc.)
322in other windows on your machine.
323
324Refer to the PPP COMMAND LIST section for details on all available commands.
325
326.Sh AUTOMATIC DIALING
327
328To use automatic dialing, you must prepare some Dial and Login chat scripts.
329See the example definitions in
330.Pa /etc/ppp/ppp.conf.sample
331(the format of ppp.conf is pretty simple).
332
333.Bl -bullet -compact
334
335.It
336Each line contains one command, label or comment.
337
338.It
339A line starting with a
340.Sq #
341character is treated as a comment line.
342
343.It
344A label name starts in the first column and is followed by
345a colon (:).
346
347.It
348A command line must contain a space or tab in the first column.
349
350.El
351
352The
353.Pa ppp.conf
354file should consist of at least a
355.Dq default
356section.  This section is always executed.  It should also contain
357one or more sections, named according to their purpose, for example,
358.Dq MyISP
359would represent your ISP, and
360.Dq ppp-in
361would represent an incoming
362.Nm
363configuration.
364
365You can now specify the destination label name when you invoke
366.Nm ppp .
367Commands associated with the
368.Dq default
369label are executed, followed by those associated with the destination
370label provided.  When
371.Nm
372is started with no arguments, the
373.Dq default
374section is still executed.  The load command can be used to manually
375load a section from the
376.Pa ppp.conf
377file:
378
379.Bd -literal -offset indent
380PPP ON awfulhak> load MyISP
381.Ed
382
383Once the connection is made, the ppp portion of the prompt will change
384to PPP:
385
386.Bd -literal -offset indent
387# ppp MyISP
388...
389ppp ON awfulhak> dial
390dial OK!
391login OK!
392PPP ON awfulhak>
393.Ed
394
395If the
396.Pa /etc/ppp/ppp.linkup
397file is available, its contents are executed
398when the
399.Em PPP
400connection is established.  See the provided
401.Dq pmdemand
402example in
403.Pa /etc/ppp/ppp.conf.sample
404which adds a default route.  The string HISADDR is available as the IP
405address of the remote peer.  Similarly, when a connection is closed, the
406contents of the
407.Pa /etc/ppp/ppp.linkdown
408file are executed.
409
410.Sh BACKGROUND DIALING
411
412If you want to establish a connection using
413.Nm
414non-interactively (such as from a
415.Xr crontab(5)
416entry or an
417.Xr at(1)
418job) you should use the
419.Fl background
420option.  You must also specify the destination label in
421.Pa /etc/ppp/ppp.conf
422to use.  This label must contain the
423.Dq set ifaddr
424command to define the remote peer's IP address. (refer to
425.Pa /etc/ppp/ppp.conf.sample )
426
427When
428.Fl background
429is specified,
430.Nm
431attempts to establish the connection immediately.  If multiple phone
432numbers are specified, each phone number will be tried once.  If the
433attempt fails,
434.Nm
435exits immediately with a non-zero exit code.
436
437If it succeeds, then
438.Nm
439becomes a daemon, and returns an exit status of zero to its caller.
440The daemon exits automatically if the connection is dropped by the
441remote system, or it receives a
442.Dv TERM
443signal.
444
445.Sh DIAL ON DEMAND
446
447Demand dialing is enabled with the
448.Fl auto
449or
450.Fl ddial
451options.  You must also specify the destination label in
452.Pa /etc/ppp/ppp.conf
453to use.  It must contain the
454.Dq set ifaddr
455command to define the remote peer's IP address. (refer to
456.Pa /etc/ppp/ppp.conf.sample )
457
458.Bd -literal -offset indent
459# ppp -auto pmdemand
460...
461#
462.Ed
463
464When
465.Fl auto
466or
467.Fl ddial
468is specified,
469.Nm
470runs as a daemon but you can still configure or examine its
471configuration by using the diagnostic port as follows (this
472can be done in
473.Fl background
474and
475.Fl direct
476mode too):
477
478
479.Bd -literal -offset indent
480# telnet localhost 3000
481Trying 127.0.0.1...
482Connected to awfulhak.
483Escape character is '^]'.
484....
485PPP on awfulhak> pass xxxx
486PPP ON awfulhak> show ipcp
487IPCP [OPEND]
488  his side: xxxx
489  ....
490.Ed
491
492.Pp
493Each
494.Nm
495daemon has an associated port number which is computed as "3000 +
496tunnel_device_number".
497
498In
499.Fl auto
500mode, when an outgoing packet is detected,
501.Nm
502will perform the dialing action (chat script) and try to connect
503with the peer.  In
504.Fl ddial
505mode, the dialing action is performed any time the line is found
506to be down.
507
508If the connect fails, the default behavior is to wait 30 seconds
509and then attempt to connect when another outgoing packet is detected.
510This behavior can be changed with
511.Bd -literal -offset indent
512set redial seconds|random[.nseconds|random] [dial_attempts]
513.Ed
514.Pp
515.Sq Seconds
516is the number of seconds to wait before attempting
517to connect again. If the argument is
518.Sq random ,
519the delay period is a random value between 0 and 30 seconds.
520.Sq Nseconds
521is the number of seconds to wait before attempting
522to dial the next number in a list of numbers (see the
523.Dq set phone
524command).  The default is 3 seconds.  Again, if the argument is
525.Sq random ,
526the delay period is a random value between 0 and 30 seconds.
527.Sq dial_attempts
528is the number of times to try to connect for each outgoing packet
529that is received. The previous value is unchanged if this parameter
530is omitted.  If a value of zero is specified for
531.Sq dial_attempts ,
532.Nm
533will keep trying until a connection is made.
534.Bd -literal -offset indent
535set redial 10.3 4
536.Ed
537.Pp
538will attempt to connect 4 times for each outgoing packet that is
539detected with a 3 second delay between each number and a 10 second
540delay after all numbers have been tried.  If multiple phone numbers
541are specified, the total number of attempts is still 4 (it does not
542attempt each number 4 times).
543
544Modifying the dial delay is very useful when running
545.Nm
546in demand
547dial mode on both ends of the link. If each end has the same timeout,
548both ends wind up calling each other at the same time if the link
549drops and both ends have packets queued.
550
551At some locations, the serial link may not be reliable, and carrier
552may be lost at inappropriate times.  It is possible to have
553.Nm
554redial should carrier be unexpectedly lost during a session.
555.Bd -literal -offset indent
556set reconnect timeout ntries
557.Ed
558
559This command tells ppp to re-establish the connection
560.Ar ntries
561times on loss of carrier with a pause of
562.Ar timeout
563seconds before each try.  For example,
564.Bd -literal -offset indent
565set reconnect 3 5
566.Ed
567
568tells
569.Nm
570that on an unexpected loss of carrier, it should wait
571.Ar 3
572seconds before attempting to reconnect.  This may happen up to
573.Ar 5
574times before
575.Nm
576gives up.  The default value of ntries is zero (no reconnect).  Care
577should be taken with this option.  If the local timeout is slightly
578longer than the remote timeout, the reconnect feature will always be
579triggered (up to the given number of times) after the remote side
580times out and hangs up.
581
582NOTE:  In this context, losing too many LQRs constitutes a loss of
583carrier and will trigger a reconnect.
584
585If the
586.Fl background
587flag is specified, all phone numbers are dialed at most once until
588a connection is made.  The next number redial period specified with
589the
590.Dq set redial
591command is honoured, as is the reconnect tries value.  If your redial
592value is less than the number of phone numbers specified, not all
593the specified numbers will be tried.
594
595To terminate the program, type
596
597  PPP ON awfulhak> close
598  ppp ON awfulhak> quit all
599
600.Pp
601A simple
602.Dq quit
603command will terminate the telnet connection but not the program itself.
604You must use
605.Dq quit all
606to terminate the program as well.
607
608.Sh RECEIVING INCOMING PPP CONNECTIONS (Method 1)
609
610To handle an incoming
611.Em PPP
612connection request, follow these steps:
613
614.Bl -enum
615.It
616Make sure the modem and (optionally)
617.Pa /etc/rc.serial
618is configured correctly.
619.Bl -bullet -compact
620.It
621Use Hardware Handshake (CTS/RTS) for flow control.
622.It
623Modem should be set to NO echo back (ATE0) and NO results string (ATQ1).
624.El
625
626.It
627Edit
628.Pa /etc/ttys
629to enable a getty on the port where the modem is attached.
630
631For example:
632
633.Dl ttyd1  "/usr/libexec/getty std.38400" dialup on secure
634
635Don't forget to send a
636.Dv HUP
637signal to the init process to start the getty.
638
639.Dl # kill -HUP 1
640
641.It
642Prepare an account for the incoming user.
643.Bd -literal
644ppp:xxxx:66:66:PPP Login User:/home/ppp:/usr/local/bin/ppplogin
645.Ed
646
647.It
648Create a
649.Pa /usr/local/bin/ppplogin
650file with the following contents:
651.Bd -literal -offset indent
652#!/bin/sh -p
653exec /usr/sbin/ppp -direct
654.Ed
655
656(You can specify a label name for further control.)
657
658.Pp
659Direct mode (
660.Fl direct
661) lets
662.Nm
663work with stdin and stdout.  You can also telnet to port 3000 plus
664the current tunnel device number to get command mode control in the
665same manner as client-side
666.Nm.
667
668.It
669Optional support for Microsoft's IPCP Name Server and NetBIOS
670Name Server negotiation can be enabled use
671.Dq enable msext
672and
673.Dq set ns pri-addr [sec-addr]
674along with
675.Dq set nbns pri-addr [sec-addr]
676in your ppp.conf file
677
678.El
679
680.Sh RECEIVING INCOMING PPP CONNECTIONS (Method 2)
681
682This method differs in that it recommends the use of
683.Em mgetty+sendfax
684to handle the modem connections.  The latest version 0.99
685can be compiled with the
686.Dq AUTO_PPP
687option to allow detection of clients speaking PPP to the login
688prompt.
689
690Follow these steps:
691
692.Bl -enum
693
694.It
695Get, configure, and install mgetty+sendfax v0.99 or later making
696sure you have used the AUTO_PPP option.
697
698.It
699Edit
700.Pa /etc/ttys
701to enable a mgetty on the port where the modem is attached.  For
702example:
703
704.Dl cuaa1  "/usr/local/sbin/mgetty -s 57600"       dialup on
705
706.It
707Prepare an account for the incoming user.
708.Bd -literal
709Pfred:xxxx:66:66:Fred's PPP:/home/ppp:/etc/ppp/ppp-dialup
710.Ed
711
712.It
713Examine the files
714.Pa /etc/ppp/sample.ppp-dialup
715.Pa /etc/ppp/sample.ppp-pap-dialup
716and
717.Pa /etc/ppp/ppp.conf.sample
718for ideas.   ppp-pap-dialup is supposed to be called from
719.Pa /usr/local/etc/mgetty+sendfax/login.conf
720from a line like
721
722.Dl /AutoPPP/ -     -       /etc/ppp/ppp-pap-dialup
723.El
724
725.Sh PPP OVER TCP (a.k.a Tunneling)
726
727Instead of running ppp over a serial link, it is possible to
728use a tcp connection instead by specifying a host and port as the
729device:
730
731.Dl set device ui-gate:6669
732
733Instead of opening a serial device,
734.Nm
735will open a tcp connection to the given machine on the given
736socket.  It should be noted however that
737.Nm
738doesn't use the telnet protocol and will be unable to negotiate
739with a telnet server.  You should set up a port for receiving
740this ppp connection on the receiving machine (ui-gate).  This is
741done by first updating
742.Pa /etc/services
743to name the service:
744
745.Dl ppp-in 6669/tcp # Incoming ppp connections over tcp
746
747and updating
748.Pa /etc/inetd.conf
749to tell inetd how to deal with incoming connections on that port:
750
751.Dl ppp-in stream tcp nowait root /usr/sbin/ppp ppp -direct ppp-in
752
753Don't forget to send a
754.Dv HUP
755signal to
756.Nm inetd
757after you've updated
758.Pa /etc/inetd.conf .
759
760Here, we use a label named
761.Dq ppp-in .
762The entry in
763.Pa /etc/ppp/ppp.conf
764on ui-gate (the receiver) should contain the following:
765
766.Bd -literal -offset indent
767ppp-in:
768 set timeout 0
769 set ifaddr 10.0.4.1 10.0.4.2
770 add 10.0.1.0 255.255.255.0 10.0.4.1
771.Ed
772
773You may also want to enable PAP or CHAP for security.  To enable PAP, add
774the following line:
775.Bd -literal -offset indent
776 enable PAP
777.Ed
778.Pp
779You'll also need to create the following entry in
780.Pa /etc/ppp/ppp.secret :
781.Bd -literal -offset indent
782MyAuthName MyAuthPasswd
783.Ed
784.Pp
785The entry in
786.Pa /etc/ppp/ppp.conf
787on awfulhak (the initiator) should contain the following:
788
789.Bd -literal -offset indent
790ui-gate:
791 set escape 0xff
792 set device ui-gate:ppp-in
793 set dial
794 set timeout 30 5 4
795 set log Phase Chat Connect Carrier hdlc LCP IPCP CCP tun
796 set ifaddr 10.0.4.2 10.0.4.1
797 add 10.0.2.0 255.255.255.0 10.0.4.2
798.Ed
799.Pp
800Again, if you're enabling PAP, you'll also need:
801.Bd -literal -offset indent
802 set authname MyAuthName
803 set authkey MyAuthKey
804.Ed
805
806We're assigning the address of 10.0.4.1 to ui-gate, and the address
80710.0.4.2 to awfulhak.
808
809To open the connection, just type
810
811.Dl awfulhak # ppp -background ui-gate
812
813The result will be an additional "route" on awfulhak to the
81410.0.2.0/24 network via the tcp connection, and an additional
815"route" on ui-gate to the 10.0.1.0/24 network.
816
817The networks are effectively bridged - the underlying tcp
818connection may be across a public network (such as the
819Internet), and the ppp traffic is conceptually encapsulated
820(although not packet by packet) inside the tcp stream between
821the two gateways.
822
823The major disadvantage of this mechanism is that there are two
824"guaranteed delivery" mechanisms in place - the underlying tcp
825stream and whatever protocol is used over the ppp link - probably
826tcp again.  If packets are lost, both levels will get in eachothers
827way trying to negotiate sending of the missing packet.
828
829.Sh PACKET ALIASING
830
831The
832.Fl alias
833command line option enables packet aliasing.  This allows the
834ppp host to act as a masquerading gateway for other computers over
835a local area network.  Outgoing IP packets are aliased so that
836they appear to come from the ppp host, and incoming packets are
837de-aliased so that they are routed to the correct machine on the
838local area network.
839
840Packet aliasing allows computers on private, unregistered
841subnets to have internet access, although they are invisible
842from the outside world.
843
844In general, correct ppp operation should first be verified
845with packet aliasing disabled.  Then, the
846.Fl alias
847option should be switched on, and network applications (web browser,
848telnet, ftp, ping, traceroute) should be checked on the ppp host.
849Finally, the same or similar applications should be checked on other
850computers in the LAN.
851
852If network applications work correctly on the ppp host, but not on
853other machines in the LAN, then the masquerading software is working
854properly, but the host is either not forwarding or possibly receiving
855IP packets.  Check that IP forwarding is enabled in
856.Pa /etc/rc.conf
857and that other machines have designated the ppp host as the gateway
858for the LAN.
859
860.Sh PACKET FILTERING
861
862This implementation supports packet filtering. There are four kinds of
863filters; ifilter, ofilter, dfilter and afilter.  Here are the basics:
864
865.Bl -bullet -compact
866.It
867A filter definition has the following syntax:
868
869set filter-name rule-no action [src_addr/src_width] [dst_addr/dst_width]
870[proto [src [lt|eq|gt] port ]] [dst [lt|eq|gt] port] [estab]
871.Bl -enum
872.It
873.Sq filter-name
874should be one of ifilter, ofilter, dfilter or afilter.
875.It
876There are two actions:
877.Sq permit
878and
879.Sq deny .
880If a given packet
881matches the rule, the associated action is taken immediately.
882.It
883.Sq src_width
884and
885.Sq dst_width
886work like a netmask to represent an address range.
887.It
888.Sq proto
889must be one of icmp, udp or tcp.
890.It
891.Sq port number
892can be specified by number and service name from
893.Pa /etc/services .
894
895.El
896
897.It
898Each filter can hold up to 20 rules, starting from rule 0.
899The entire rule set is not effective until rule 0 is defined,
900ie. the default is to allow everything through.
901
902.It
903If no rule is matched to a packet, that packet will be discarded
904(blocked).
905
906.It
907Use
908.Dq set filter-name -1
909to flush all rules.
910
911.El
912
913See
914.Pa /etc/ppp/ppp.conf.filter.example .
915
916
917.Sh SETTING IDLE, LINE QUALITY REQUEST, RETRY TIMER
918
919To check/set idletimer, use the
920.Dq show timeout
921and
922.Dq set timeout [lqrtimer [retrytimer]]
923commands:
924
925.Bd -literal -offset indent
926ppp ON awfulhak> set timeout 600
927.Ed
928
929The timeout period is measured in seconds, the  default values for which
930are timeout = 180 or 3 min, lqrtimer = 30sec and retrytimer = 3sec.
931To disable the idle timer function, use the command
932
933.Bd -literal -offset indent
934ppp ON awfulhak> set timeout 0
935.Ed
936
937In
938.Fl auto
939mode, an idle timeout causes the
940.Em PPP
941session to be
942closed, though the
943.Nm
944program itself remains running.  Another trigger packet will cause it to
945attempt to reestablish the link.
946
947.Sh PREDICTOR-1 COMPRESSION
948
949This version supports CCP and Predictor type 1 compression based on
950the current IETF-draft specs. As a default behavior,
951.Nm
952will attempt to use (or be willing to accept) this capability when the
953peer agrees (or requests it).
954
955To disable CCP/predictor functionality completely, use the
956.Dq disable pred1
957and
958.Dq deny pred1
959commands.
960
961.Sh CONTROLLING IP ADDRESS
962
963.Nm
964uses IPCP to negotiate IP addresses. Each side of the connection
965specifies the IP address that it's willing to use, and if the requested
966IP address is acceptable then
967.Nm
968returns ACK to the requester.  Otherwise,
969.Nm
970returns NAK to suggest that the peer use a different IP address. When
971both sides of the connection agree to accept the received request (and
972send ACK), IPCP is set to the open state and a network level connection
973is established.
974
975To control this IPCP behavior, this implementation has the
976.Dq set ifaddr
977command for defining the local and remote IP address:
978
979.Bd -literal -offset indent
980set ifaddr [src_addr [dst_addr [netmask [trigger_addr]]]]
981.Ed
982
983where,
984.Sq src_addr
985is the IP address that the local side is willing to use,
986.Sq dst_addr
987is the IP address which the remote side should use and
988.Sq netmask
989is the netmask that should be used.
990.Sq Src_addr
991and
992.Sq dst_addr
993default to 0.0.0.0, and
994.Sq netmask
995defaults to whatever mask is appropriate for
996.Sq src_addr .
997It is only possible to make
998.Sq netmask
999smaller than the default.  The usual value is 255.255.255.255.
1000Some incorrect ppp implementations require that the peer negotiates
1001a specific IP address instead of
1002.Sq src_addr .
1003If this is the case,
1004.Sq trigger_addr
1005may be used to specify this IP number.  This will not affect the
1006routing table unless the other side agrees with this proposed number.
1007
1008.Bd -literal -offset indent
1009set ifaddr 192.244.177.38 192.244.177.2 255.255.255.255 0.0.0.0
1010.Ed
1011
1012The above specification means:
1013.Bl -bullet -compact
1014.It
1015I will first suggest that my IP address should be 0.0.0.0, but I
1016will only accept an address of 192.244.177.38.
1017
1018.It
1019I strongly insist that the peer uses 192.244.177.2 as his own
1020address and won't permit the use of any IP address but 192.244.177.2.
1021When the peer requests another IP address, I will always suggest that
1022it uses 192.244.177.2.
1023
1024.It
1025The routing table entry will have a netmask of 0xffffffff.
1026.El
1027
1028This is all fine when each side has a pre-determined IP address, however
1029it is often the case that one side is acting as a server which controls
1030all IP addresses and the other side should obey the direction from it.
1031
1032In order to allow more flexible behavior, `ifaddr' variable allows the
1033user to specify IP address more loosely:
1034
1035.Dl set ifaddr 192.244.177.38/24 192.244.177.2/20
1036
1037A number followed by a slash (/) represent the number of bits significant in
1038the IP address.  The above example signifies that:
1039
1040.Bl -bullet -compact
1041.It
1042I'd like to use 192.244.177.38 as my address if it is possible, but I'll
1043also accept any IP address between 192.244.177.0 and 192.244.177.255.
1044
1045.It
1046I'd like to make him use 192.244.177.2 as his own address, but I'll also
1047permit him to use any IP address between 192.244.176.0 and
1048192.244.191.255.
1049
1050.It
1051As you may have already noticed, 192.244.177.2 is equivalent to saying
1052192.244.177.2/32.
1053
1054.It
1055As an exception, 0 is equivalent to 0.0.0.0/0, meaning that I have no
1056preferred IP address and will obey the remote peer's selection.  When
1057using zero, no routing table entries will be made until a connection
1058is established.
1059
1060.It
1061192.244.177.2/0 means that I'll accept/permit any IP address but I'll
1062try to insist that 192.244.177.2 be used first.
1063.El
1064
1065.Sh CONNECTING WITH YOUR INTERNET SERVICE PROVIDER
1066
1067The following steps should be taken when connecting to your ISP:
1068
1069.Bl -enum
1070.It
1071Describe your provider's phone number(s) in the dial script using the
1072.Dq set phone
1073command.  This command allows you to set multiple phone numbers for
1074dialing and redialing separated by either a pipe (|) or a colon (:)
1075.Bd -literal -offset indent
1076set phone "111[|222]...[:333[|444]...]...
1077.Ed
1078Numbers after the first in a pipe-separated list are only used if the
1079previous number was used in a failed dial or login script.  Numbers
1080separated by a colon are used sequentially, irrespective of what happened
1081as a result of using the previous number.  For example:
1082.Bd -literal -offset indent
1083set phone "1234567|2345678:3456789|4567890"
1084.Ed
1085.Pp
1086Here, the 1234567 number is attempted.  If the dial or login script fails,
1087the 2345678 number is used next time, but *only* if the dial or login script
1088fails.  On the dial after this, the 3456789 number is used.  The 4567890
1089number is only used if the dial or login script using the 3456789 fails.  If
1090the login script of the 2345678 number fails, the next number is still the
10913456789 number.  As many pipes and colons can be used as are necessary
1092(although a given site would usually prefer to use either the pipe or the
1093colon, but not both).  The next number redial timeout is used between all
1094numbers.  When the end of the list is reached, the normal redial period is
1095used before starting at the beginning again.
1096
1097The selected phone number is substituted for the \\\\T string in the
1098.Dq set dial
1099command (see below).
1100
1101.It
1102Set up your redial requirements using
1103.Dq set redial .
1104For example, if you have a bad telephone line or your provider is
1105usually engaged (not so common these days), you may want to specify
1106the following:
1107.Bd -literal -offset indent
1108set redial 10 4
1109.Ed
1110.Pp
1111This says that up to 4 phone calls should be attempted with a pause of 10
1112seconds before dialing the first number again.
1113
1114.It
1115Describe your login procedure using the
1116.Dq set dial
1117and
1118.Dq set login
1119commands.  The
1120.Dq set dial
1121command is used to talk to your modem and establish a link with your
1122ISP, for example:
1123.Bd -literal -offset indent
1124set dial "ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 4 \\"\\" ATZ OK-ATZ-OK ATDT\\\\T TIMEOUT 60 CONNECT"
1125.Ed
1126.Pp
1127This modem "chat" string means:
1128
1129.Bl -bullet
1130.It
1131Abort if the string "BUSY" or "NO CARRIER" are received.
1132.It
1133Set the timeout to 4.
1134.It
1135Expect nothing.
1136.It
1137Send ATZ.
1138.It
1139Expect OK.  If that's not received, send ATZ and expect OK.
1140.It
1141Send ATDTxxxxxxx where xxxxxxx is the next number in the phone list from
1142above.
1143.It
1144Set the timeout to 60.
1145.It
1146Wait for the CONNECT string.
1147.El
1148
1149Once the connection is established, the login script is executed.  This
1150script is written in the same style as the dial script:
1151.Bd -literal -offset indent
1152set login "TIMEOUT 15 login:-\\\\r-login: awfulhak word: xxx ocol: PPP HELLO"
1153.Ed
1154.Pp
1155This login "chat" string means:
1156
1157.Bl -bullet
1158.It
1159Set the timeout to 15 seconds.
1160.It
1161Expect "login:".  If it's not received, send a carriage return and expect
1162"login:" again.
1163.It
1164Send "awfulhak"
1165.It
1166Expect "word:" (the tail end of a "Password:" prompt).
1167.It
1168Send "xxx".
1169.It
1170Expect "ocol:" (the tail end of a "Protocol:" prompt).
1171.It
1172Send "PPP".
1173.It
1174Expect "HELLO".
1175.El
1176.Pp
1177Login scripts vary greatly between ISPs.
1178
1179.It
1180Use
1181.Dq set line
1182and
1183.Dq set speed
1184to specify your serial line and speed, for example:
1185.Bd -literal -offset indent
1186set line /dev/cuaa0
1187set sp 115200
1188.Ed
1189.Pp
1190Cuaa0 is the first serial port on FreeBSD.  If you're running
1191.Nm
1192on OpenBSD, cua00 is the first.  A speed of 115200 should be specified
1193if you have a modem capable of bit rates of 28800 or more.  In general,
1194the serial speed should be about four times the modem speed.
1195
1196.It
1197Use the
1198.Dq set ifaddr
1199command to define the IP address.
1200.Bl -bullet
1201.It
1202If you know what IP address your provider uses, then use it as the remote
1203address (dst_addr), otherwise choose something like 10.0.0.2/0 (see below).
1204.It
1205If your provider has assigned a particular IP address to you, then use
1206it as your address (src_addr).
1207.It
1208If your provider assigns your address dynamically, choose a suitably
1209unobtrusive and unspecific IP number as your address.  10.0.0.1/0 would
1210be appropriate.  The bit after the / specifies how many bits of the
1211address you consider to be important, so if you wanted to insist on
1212something in the class C network 1.2.3.0, you could specify 1.2.3.1/24.
1213.It
1214If you find that your ISP accepts the first IP number that you suggest,
1215specify third and forth arguments of
1216.Dq 0.0.0.0 .
1217This will force your ISP to assign a number.  (The third argument will
1218be ignored as it is less restrictive than the default mask for your
1219.Sq src_addr .
1220.El
1221.Pp
1222An example for a connection where you don't know your IP number or your
1223ISPs IP number would be:
1224.Bd -literal -offset indent
1225set ifaddr 10.10.10.10/0 10.10.11.11/0 0.0.0.0 0.0.0.0
1226.Ed
1227
1228.It
1229In most cases, your ISP will also be your default router.  If this is
1230the case, add the lines
1231
1232.Bd -literal -offset indent
1233delete ALL
1234add 0 0 HISADDR
1235.Ed
1236
1237.Pp
1238to
1239.Pa ppp.conf .
1240.Pp
1241This tells
1242.Nm
1243to delete all non-direct routing entries for the tun interface that
1244.Nm
1245is running on, then to add a default route to 10.10.11.11.
1246.Pp
1247If you're using dynamic IP numbers, you must also put these two lines
1248in the
1249.Pa ppp.linkup
1250file:
1251
1252.Bd -literal -offset indent
1253delete ALL
1254add 0 0 HISADDR
1255.Ed
1256
1257HISADDR is a macro meaning the "other side"s IP number, and is
1258available once an IP number has been agreed (using IPCP).
1259Now, once a connection is established,
1260.Nm
1261will delete all non-direct interface routes, and add a default route
1262pointing at the peers IP number.  You should use the same label as the
1263one used in
1264.Pa ppp.conf .
1265.Pp
1266If commands are being typed interactively, the only requirement is
1267to type
1268.Bd -literal -offset indent
1269add 0 0 HISADDR
1270.Ed
1271.Pp
1272after a successful dial.
1273
1274.It
1275If your provider requests that you use PAP/CHAP authentication methods, add
1276the next lines to your
1277.Pa ppp.conf
1278file:
1279.Bd -literal -offset indent
1280set authname MyName
1281set authkey MyPassword
1282.Ed
1283.Pp
1284Both are accepted by default, so ppp will provide whatever your ISP
1285requires.
1286.El
1287
1288Please refer to
1289.Pa /etc/ppp/ppp.conf.sample
1290and
1291.Pa /etc/ppp/ppp.linkup.sample
1292for some real examples.  The pmdemand label should be appropriate for most
1293ISPs.
1294
1295.Sh LOGGING FACILITY
1296
1297.Nm
1298is able to generate the following log info via
1299.Xr syslog 3 :
1300
1301.Bl -column SMMMMMM -offset indent
1302.It Li Async	Dump async level packet in hex
1303.It Li Carrier	Log Chat lines with 'CARRIER'
1304.It Li CCP	Generate a CPP packet trace
1305.It Li Chat	Generate Chat script trace log
1306.It Li Command	Log commands executed
1307.It Li Connect	Generate complete Chat log
1308.It Li Debug	Log (very verbose) debug information
1309.It Li HDLC	Dump HDLC packet in hex
1310.It Li IPCP	Generate an IPCP packet trace
1311.It Li LCP	Generate an LCP packet trace
1312.It Li Link	Log address assignments and link up/down events
1313.It Li LQM	Generate LQR report
1314.It Li Phase	Phase transition log output
1315.It Li TCP/IP	Dump all TCP/IP packets
1316.It Li TUN	Include the tun device on each log line
1317.It Li Warning	Output to the terminal device.  If there is currently no
1318terminal, output is sent to the log file using LOG_WARNING.
1319.It Li Error	Output to both the terminal device and the log file using
1320LOG_ERROR.
1321.It Li Alert	Output to the log file using LOG_ALERT
1322.El
1323
1324The
1325.Dq set log
1326command allows you to set logging output level, of which
1327multiple levels can be specified.  The default is equivalent to
1328.Dq set log Carrier Link Phase .
1329
1330If The first argument to
1331.Dq set log
1332begins with a '+' or a '-' character, the current log levels are
1333not cleared, for example:
1334
1335.Bd -literal -offset indent
1336PPP ON awfulhak> show log
1337Log: Carrier Link Phase
1338PPP ON awfulhak> set log -Link +tcp/ip
1339PPP ON awfulhak> show log
1340Log: Carrier Phase TCP/IP
1341.Ed
1342
1343Log messages of level Warning, Error and Alert are not controlable
1344using
1345.Dq set log .
1346
1347.Sh SIGNAL HANDLING
1348
1349.Nm Ppp
1350deals with the following signals:
1351
1352.Bl -tag -width 20
1353.It INT
1354Receipt of this signal causes the termination of the current connection
1355(if any).  This will cause
1356.Nm
1357to exit unless it is in
1358.Fl auto
1359or
1360.Fl ddial
1361mode.
1362
1363.It HUP, TERM & QUIT
1364These signals tell
1365.Nm
1366to exit.
1367
1368.It USR1
1369This signal, when not in interactive mode, tells
1370.Nm
1371to close any existing server socket and open an internet socket using
1372the default rules for choosing a port number - that is, using port
13733000 plus the current tunnel device number.
1374
1375.El
1376
1377.Sh PPP COMMAND LIST
1378
1379This section lists the available commands and their effect.  They are
1380usable either from an interactive ppp session, from a configuration
1381file or from a telnet session.
1382
1383.Bl -tag -width 20
1384.It accept|deny|enable|disable option....
1385These directives tell
1386.Nm
1387how to negotiate the initial connection with the peer.  Each
1388.Dq option
1389has a default of either accept or deny and enable or disable.
1390.Dq Accept
1391means that the option will be ACK'd if the peer asks for it.
1392.Dq Deny
1393means that the option will be NAK'd if the peer asks for it.
1394.Dq Enable
1395means that the option will be requested by us.
1396.Dq Disable
1397means that the option will not be requested by us.
1398.Pp
1399.Dq Option
1400may be one of the following:
1401
1402.Bl -tag -width 20
1403.It vjcomp
1404Default: Enabled and Accepted.  This option decides if Van Jacobson
1405header compression will be used.
1406
1407.It lqr
1408Default: Disabled and Accepted.  This option decides if Link Quality
1409Requests will be sent.  LQR is a protocol that allows
1410.Nm
1411to determine that the link is down without relying on the modems
1412carrier detect.
1413
1414.It chap
1415Default: Disabled and Accepted.  CHAP stands for Challenge Handshake
1416Authentication Protocol.  Only one of CHAP and PAP (below) may be
1417negotiated.  With CHAP, the authenticator sends a "challenge" message
1418to its peer.  The peer uses a one-way hash function to encrypt the
1419challenge and sends the result back.  The authenticator does the same,
1420and compares the results.  The advantage of this mechanism is that no
1421passwords are sent across the connection.
1422
1423A challenge is made when the connection is first made.  Subsequent
1424challenges may occur.  If you want to have your peer authenticate
1425itself, you must
1426.Dq enable chap .
1427in
1428.Pa ppp.conf ,
1429and have an entry in
1430.Pa ppp.secret
1431for the peer.
1432.Pp
1433When using CHAP as the client, you need only specify
1434.Dq AuthName
1435and
1436.Dq AuthKey
1437in
1438.Pa ppp.conf .
1439CHAP is accepted by default.
1440
1441Some ppp implementations use "MS-CHAP" rather than MD5 when encrypting the
1442challenge.  Refer to the description of the
1443.Dq set encrypt
1444command for further details.
1445
1446.It pap
1447Default: Disabled and Accepted.  PAP stands for Password Authentication
1448Protocol.  Only one of PAP and CHAP (above) may be negotiated.  With
1449PAP, the ID and Password are sent repeatedly to the peer until
1450authentication is acknowledged or the connection is terminated.  This
1451is a rather poor security mechanism.  It is only performed when the
1452connection is first established.
1453
1454If you want to have your peer authenticate itself, you must
1455.Dq enable pap .
1456in
1457.Pa ppp.conf ,
1458and have an entry in
1459.Pa ppp.secret
1460for the peer (although see the
1461.Dq passwdauth
1462option below).
1463.Pp
1464When using PAP as the client, you need only specify
1465.Dq AuthName
1466and
1467.Dq AuthKey
1468in
1469.Pa ppp.conf .
1470PAP is accepted by default.
1471
1472.It acfcomp
1473Default: Enabled and Accepted.  ACFComp stands for Address and Control
1474Field Compression.  Non LCP packets usually have very similar address
1475and control fields - making them easily compressable.
1476
1477.It protocomp
1478Default: Enabled and Accepted.  This option is used to negotiate
1479PFC (Protocol Field Compression), a mechanism where the protocol
1480field number is reduced to one octet rather than two.
1481
1482.It pred1
1483Default: Enabled and Accepted.  This option decides if Predictor 1
1484compression will be used.
1485
1486.It msext
1487Default: Disabled.  This option allows the use of Microsoft's ppp
1488extensions, supporting the negotiation of the Microsoft PPP DNS
1489and the Microsoft NetBIOS NS.  Enabling this allows us to pass back
1490the values given in "set ns" and "set nbns".
1491
1492.El
1493The following options are not actually negotiated with the peer.
1494Therefore, accepting or denying them makes no sense.
1495
1496.Bl -tag -width 20
1497.It proxy
1498Default: Disabled.  Enabling this option will tell
1499.Nm
1500to proxy ARP for the peer.
1501
1502.It passwdauth
1503Default: Disabled.  Enabling this option will tell the PAP authentication
1504code to use the
1505.Pa passwd
1506file to authenticate the caller rather than the
1507.Pa ppp.secret
1508file.
1509
1510.It utmp
1511Default: Enabled.  Normally, when a user is authenticated using PAP or
1512CHAP, and when
1513.Nm
1514is running in
1515.Fl direct
1516mode, an entry is made in the utmp and wtmp files for that user.  Disabling
1517this option will tell ppp not to make any utmp or wtmp entries.  This is
1518usually only necessary if you require the user to both login and authenticate
1519themselves.
1520
1521.El
1522
1523.It add dest mask gateway
1524.Dq Dest
1525is the destination IP address and
1526.Dq mask
1527is its mask.
1528.Dq 0 0
1529refers to the default route.
1530.Dq Gateway
1531is the next hop gateway to get to the given
1532.Dq dest
1533machine/network.
1534
1535.It [!]bg command
1536The given command is executed in the background.
1537Any of the pseudo arguments
1538.Dv HISADDR ,
1539.Dv INTERFACE
1540and
1541.Dv MYADDR
1542will be replaced with the appropriate values.  If you wish to pause
1543.Nm
1544while the command executes, use the
1545.Dv shell
1546command instead.
1547
1548.It close
1549Close the current connection (but don't quit).
1550
1551.It delete ALL | dest [gateway [mask]]
1552If
1553.Dq ALL
1554is specified, all non-direct entries in the routing for the interface
1555that
1556.Nm
1557is using are deleted.  This means all entries for tunX, except the entry
1558representing the actual link.  When
1559.Dq ALL
1560is not used, any existing route with the given
1561.Dq dest ,
1562destination network
1563.Dq mask
1564and
1565.Dq gateway
1566is deleted.  The default
1567.Dq mask
1568value is 0.0.0.0.
1569
1570.It dial|call [remote]
1571If
1572.Dq remote
1573is specified, a connection is established using the
1574.Dq dial
1575and
1576.Dq login
1577scripts for the given
1578.Dq remote
1579system.  Otherwise, the current settings are used to establish
1580the connection.
1581
1582.It display
1583Displays the current status of the negotiable protocol
1584values as specified under
1585.Dq accept|deny|enable|disable option....
1586above.
1587
1588.It passwd pass
1589Specify the password required for access to the full
1590.Nm
1591command set.
1592
1593.It load [remote]
1594Load the given
1595.Dq remote
1596label.  If
1597.Dq remote
1598is not given, the
1599.Dq default
1600label is assumed.
1601
1602.It save
1603This option is not (yet) implemented.
1604
1605.It set[up] var value
1606This option allows the setting of any of the following variables:
1607
1608.Bl -tag -width 20
1609.It set accmap hex-value
1610ACCMap stands for Asyncronous Control Character Map.  This is always
1611negotiated with the peer, and defaults to a value of 0x00000000.
1612This protocol is required to defeat hardware that depends on passing
1613certain characters from end to end (such as XON/XOFF etc).
1614
1615.It set filter-name rule-no action [src_addr/src_width]
1616[dst_addr/dst_width] [proto [src [lt|eq|gt] port ]]
1617[dst [lt|eq|gt] port] [estab]
1618.Pp
1619.Nm Ppp
1620supports four filter sets.  The afilter specifies packets that keep
1621the connection alive - reseting the idle timer.  The dfilter specifies
1622packets that cause
1623.Nm
1624to dial when in
1625.Fl auto
1626mode.  The ifilter specifies packets that are allowed to travel
1627into the machine and the ofilter specifies packets that are allowed
1628out of the machine.  By default all filter sets allow all packets
1629to pass.
1630
1631Rules are processed in order according to
1632.Dq n .
1633Up to 20 rules may be given for each set.  If a packet doesn't match
1634any of the rules in a given set, it is discarded.  In the case of
1635ifilters and ofilters, this means that the packet is dropped.  In
1636the case of afilters it means that the packet will not reset the
1637idle timer and in the case of dfilters it means that the packet will
1638not trigger a dial.
1639
1640Refer to the section on PACKET FILTERING above for further details.
1641
1642.It set authkey|key value
1643This sets the authentication key (or password) used in client mode
1644PAP or CHAP negotiation to the given value.  It can also be used to
1645specify the password to be used in the dial or login scripts, preventing
1646the actual password from being logged.
1647
1648.It set authname id
1649This sets the authentication id used in client mode PAP or CHAP negotiation.
1650
1651.It set ctsrts
1652This sets hardware flow control and is the default.
1653
1654.It set device|line value
1655This sets the device to which ppp will talk to the given
1656.Dq value .
1657All serial device names are expected to begin with
1658.Pa /dev/ .
1659If
1660.Dq value
1661does not begin with
1662.Pa /dev/ ,
1663it must be of the format
1664.Dq host:port .
1665If this is the case,
1666.Nm
1667will attempt to connect to the given
1668.Dq host
1669on the given
1670.Dq port .
1671Refer to the section on PPP OVER TCP above for further details.
1672
1673.It set dial chat-script
1674This specifies the chat script that will be used to dial the other
1675side.  See also the
1676.Dv set login
1677command below.  Refer to
1678.Xr chat 8
1679and to the example configuration files for details of the chat script
1680format.  The string \\\\T will be replaced with the current phone number
1681(see
1682.Dq set phone
1683below) and the string \\\\P will be replaced with the password (see
1684.Dq set key
1685above).
1686
1687.It set hangup chat-script
1688This specifies the chat script that will be used to reset the modem
1689before it is closed.  It should not normally be necessary, but can
1690be used for devices that fail to reset themselves properly on close.
1691
1692.It set encrypt MSChap|MD5
1693This specifies the encryption algorithm to request and use when issuing
1694the CHAP challenge, and defaults to MD5.  If this is set to MSChap,
1695.Nm
1696will behave like a Microsoft RAS when sending the CHAP challenge (assuming
1697CHAP is enabled).  When responding to a challenge,
1698.Nm
1699determines how to encrypt the response based on the challenge, so this
1700setting is ignored.
1701
1702.Bl -tag -width NOTE:
1703.It NOTE:
1704Because the Microsoft encryption algorithm uses a combination of MD4 and DES,
1705if you have not installed DES encryption software on your machine
1706before building
1707.Nm ppp ,
1708this option will not be available - only MD5 will be used.
1709.El
1710
1711.It set escape value...
1712This option is similar to the
1713.Dq set accmap
1714option above.  It allows the user to specify a set of characters that
1715will be `escaped' as they travel across the link.
1716
1717.It set ifaddr [myaddr [hisaddr [netmask [triggeraddr]]]]
1718This command specifies the IP addresses that will be used during
1719IPCP negotiation.  Addresses are specified using the format
1720
1721.Dl a.b.c.d/n
1722
1723Where a.b.c.d is the preferred IP, but n specifies how many bits
1724of the address we will insist on.  If the /n bit is omitted, it
1725defaults to /32 unless the IP address is 0.0.0.0 in which case
1726the mask defaults to /0.
1727
1728If
1729.Dq triggeraddr
1730is specified, it is used in place of
1731.Dq myaddr
1732in the initial IPCP negotiation.  However, only an address in the
1733.Dq myaddr
1734range will be accepted.
1735
1736.It set loopback on|off
1737When set to
1738.Dq on
1739(the default),
1740.Nm
1741will automatically loop back packets being sent
1742out with a destination address equal to that of the ppp interface.
1743If set to
1744.Dq off ,
1745.Nm
1746will send the packet, probably resulting in an ICMP redirect from
1747the other end.
1748
1749.It set log [+|-]value...
1750This command allows the adjustment of the current log level.  Please
1751refer to the Logging Facility section for further details.
1752
1753.It set login chat-script
1754This chat-script compliments the dial-script.  If both are specified,
1755the login script will be executed after the dial script.  Escape
1756sequences available in the dial script are also available here.
1757
1758.It set mru value
1759The default MRU is 1500.  If it is increased, the other side *may*
1760increase its mtu.  There is no use decreasing the MRU to below the
1761default as the PPP protocol *must* be able to accept packets of at
1762least 1500 octets.
1763
1764.It set mtu value
1765The default MTU is 1500.  This may be increased by the MRU specified
1766by the peer.  It may only be subsequently decreased by this option.
1767Increasing it is not valid as the peer is not necessarily able to
1768receive the increased packet size.
1769
1770.It set openmode active|passive
1771By default, openmode is always active.  That is,
1772.Nm
1773will always initiate LCP/IPCP/CCP negotiation.  If you want to wait for the
1774peer to initiate negotiations, you may use the value
1775.Dq passive .
1776
1777.It set parity odd|even|none|mark
1778This allows the line parity to be set.  The default value is none.
1779
1780.It set phone telno[|telno]...[:telno[|telno]...]...
1781This allows the specification of the phone number to be used in
1782place of the \\\\T string in the dial and login chat scripts.
1783Multiple phone numbers may be given separated by a pipe (|) or
1784a colon (:).  Numbers after the pipe are only dialed if the dial or login
1785script for the previous number failed.  Numbers separated by a colon are
1786tried sequentially, irrespective of the reason the line was dropped.
1787If multiple numbers are given,
1788.Nm
1789will dial them according to these rules until a connection is made, retrying
1790the maximum number of times specified by
1791.Dq set redial
1792below.  In
1793.Fl background
1794mode, each number is attempted at most once.
1795
1796.It set reconnect timeout ntries
1797Should the line drop unexpectedly (due to loss of CD or LQR
1798failure), a connection will be re-established after the given
1799.Dq timeout .
1800The line will be re-connected at most
1801.Dq ntries
1802times.
1803.Dq Ntries
1804defaults to zero.  A value of
1805.Dq random
1806for
1807.Dq timeout
1808will result in a variable pause, somewhere between 0 and 30 seconds.
1809
1810.It set redial seconds[.nseconds] [attempts]
1811.Nm Ppp
1812can be instructed to attempt to redial
1813.Dq attempts
1814times.  If more than one number is specified (see
1815.Dq set phone
1816above), a pause of
1817.Dq nseconds
1818is taken before dialing each number.  A pause of
1819.Dq seconds
1820is taken before starting at the first number again.  A value of
1821.Dq random
1822may be used here too.
1823
1824.It set stopped [LCPseconds [IPCPseconds [CCPseconds]]]
1825If this option is set,
1826.Nm
1827will time out after the given FSM (Finite State Machine) has been in
1828the stopped state for the given number of
1829.Dq seconds .
1830This option may be useful if you see ppp failing to respond in the
1831stopped state.  Use
1832.Dq set log +lcp +ipcp +ccp
1833to make
1834.Nm
1835log all state transitions.
1836.Pp
1837The default value is zero, where ppp doesn't time out in the stopped
1838state.
1839
1840.It set server|socket TcpPort|LocalName|none [mask]
1841Normally, when not in interactive mode,
1842.Nm
1843listens to a tcp socket for incoming command connections.  The
1844socket number is calculated as 3000 plus the number of the
1845tunnel device that
1846.Nm
1847opened.  So, for example, if
1848.Nm
1849opened tun2, socket 3002 would be used.
1850.Pp
1851Using this command, you can specify your own port number, a
1852local domain socket (specified as an absolute file name), or
1853you can tell
1854.Nm
1855not to accept any command connections.  If a local domain socket
1856is specified, you may also specify an octal mask that should be
1857set before creating the socket.  See also the use of
1858the
1859.Dv USR1
1860signal.
1861
1862.It set speed value
1863This sets the speed of the serial device.
1864
1865.It set timeout Idle [ lqr [ retry ] ]
1866This command allows the setting of the idle timer, the LQR timer (if
1867enabled) and the retry timer.
1868
1869.It set ns x.x.x.x y.y.y.y
1870This option allows the setting of the Microsoft PPP DNS servers that
1871will be negotiated.
1872
1873.It set nbns x.x.x.x y.y.y.y
1874This option allows the setting of the Microsoft NetBIOS DNS servers that
1875will be negotiated.
1876
1877.It set help|?
1878This command gives a summary of available set commands.
1879.El
1880
1881.It shell|! [command]
1882If
1883.Dq command
1884is not specified a shell is invoked according to the
1885.Dv SHELL
1886environment variable.  Otherwise, the given command is executed.
1887Any of the pseudo arguments
1888.Dv HISADDR ,
1889.Dv INTERFACE
1890and
1891.Dv MYADDR
1892will be replaced with the appropriate values.  Use of the ! character
1893requires a following space as with any other commands.  You should note
1894that this command is executed in the foreground - ppp will not continue
1895running until this process has exited.  Use the
1896.Dv bg
1897command if you wish processing to happen in the background.
1898
1899.It show var
1900This command allows the user to examine the following:
1901
1902.Bl -tag -width 20
1903.It show [adio]filter
1904List the current rules for the given filter.
1905
1906.It show auth
1907Show the current authname and authkey.
1908
1909.It show ccp
1910Show the current CCP statistics.
1911
1912.It show compress
1913Show the current compress statistics.
1914
1915.It show escape
1916Show the current escape characters.
1917
1918.It show hdlc
1919Show the current HDLC statistics.
1920
1921.It show ipcp
1922Show the current IPCP statistics.
1923
1924.It show lcp
1925Show the current LCP statistics.
1926
1927.It show loopback
1928Show the current loopback status.
1929
1930.It show log
1931Show the current log values.
1932
1933.It show mem
1934Show current memory statistics.
1935
1936.It show modem
1937Show current modem statistics.
1938
1939.It show mru
1940Show the current MRU.
1941
1942.It show mtu
1943Show the current MTU.
1944
1945.It show proto
1946Show current protocol totals.
1947
1948.It show reconnect
1949Show the current reconnect values.
1950
1951.It show redial
1952Show the current redial values.
1953
1954.It show stopped
1955Show the current stopped timeouts.
1956
1957.It show route
1958Show the current routing tables.
1959
1960.It show timeout
1961Show the current timeout values.
1962
1963.It show msext
1964Show the current Microsoft extension values.
1965
1966.It show version
1967Show the current version number of ppp.
1968
1969.It show help|?
1970Give a summary of available show commands.
1971.El
1972
1973.It term
1974Go into terminal mode.  Characters typed at the keyboard are sent to
1975the modem.  Characters read from the modem are displayed on the
1976screen.  When a
1977.Nm
1978peer is detected on the other side of the modem,
1979.Nm
1980automatically enables Packet Mode and goes back into command mode.
1981
1982.It alias .....
1983This command allows the control of the aliasing (or masquerading)
1984facilities that are built into
1985.Nm ppp .
1986Until this code is required, it is not loaded by
1987.Nm ppp ,
1988and it is quite possible that the alias library is not installed
1989on your system (some administrators consider it a security risk).
1990
1991If aliasing is enabled on your system, the following commands are
1992possible:
1993
1994.Bl -tag -width 20
1995.It alias enable [yes|no]
1996This command either switches aliasing on or turns it off.
1997The
1998.Fl alias
1999command line flag is synonomous with
2000.Dq alias enable yes .
2001
2002.It alias port [proto targetIP:targetPORT [aliasIP:]aliasPORT]
2003This command allows us to redirect connections arriving at
2004.Dq aliasPORT
2005for machine [aliasIP] to
2006.Dq targetPORT
2007on
2008.Dq targetIP .
2009If proto is specified, only connections of the given protocol
2010are matched.  This option is useful if you wish to run things like
2011internet phone on the machines behind your gateway.
2012
2013.It alias addr [addr_local addr_alias]
2014This command allows data for
2015.Dq addr_alias
2016to be redirected to
2017.Dq addr_local .
2018It is useful if you own a small number of real IP numbers that
2019you wish to map to specific machines behind your gateway.
2020
2021.It alias deny_incoming [yes|no]
2022If set to yes, this command will refuse all incoming connections
2023by dropping the packets in much the same way as a firewall would.
2024
2025.It alias log [yes|no]
2026This option causes various aliasing statistics and information to
2027be logged to the file
2028.Pa /var/log/alias.log .
2029
2030.It alias same_ports [yes|no]
2031When enabled, this command will tell the alias library attempt to
2032avoid changing the port number on outgoing packets.  This is useful
2033if you want to support protocols such as RPC and LPD which require
2034connections to come from a well known port.
2035
2036.It alias use_sockets [yes|no]
2037When enabled, this option tells the alias library to create a
2038socket so that it can guarantee a correct incoming ftp data or
2039IRC connection.
2040
2041.It alias unregistered_only [yes|no]
2042Only alter outgoing packets with an unregistered source ad-
2043dress.  According to rfc 1918, unregistered source addresses
2044are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
2045
2046.It alias help|?
2047This command gives a summary of available alias commands.
2048
2049.El
2050
2051.It quit|bye [all]
2052Exit
2053.Nm ppp .
2054If
2055.Nm
2056is in interactive mode or if the
2057.Dq all
2058argument is given, ppp will exit, closing the connection.  A simple
2059.Dq quit
2060issued from a telnet session will not close the current connection.
2061
2062.It help|? [command]
2063Show a list of available commands.  If
2064.Dq command
2065is specified, show the usage string for that command.
2066
2067.It down
2068Bring the link down ungracefully.  It's not considered polite to
2069use this command.
2070
2071.El
2072
2073.Sh MORE DETAILS
2074
2075.Bl -bullet -compact
2076
2077.It
2078Read the example configuration files.  They are a good source of information.
2079
2080.It
2081Use
2082.Dq help ,
2083.Dq show ? ,
2084.Dq alias ? ,
2085.Dq set ?
2086and
2087.Dq set ? <var>
2088commands.
2089.El
2090
2091.Sh FILES
2092.Nm Ppp
2093refers to four files: ppp.conf, ppp.linkup, ppp.linkdown and
2094ppp.secret.  These files are placed in
2095.Pa /etc/ppp ,
2096but the user can create his own files under his $HOME directory as
2097.Pa .ppp.conf ,
2098.Pa .ppp.linkup ,
2099.Pa .ppp.linkdown
2100and
2101.Pa .ppp.secret.
2102.Nm
2103will always try to consult the user's personal setup first.
2104
2105.Bl -tag -width flag
2106.Pa $HOME/ppp/.ppp.[conf|linkup|linkdown|secret]
2107User dependent configuration files.
2108
2109.Pa /etc/ppp/ppp.conf
2110System default configuration file.
2111
2112.Pa /etc/ppp/ppp.secret
2113An authorization file for each system.
2114
2115.Pa /etc/ppp/ppp.linkup
2116A file to check when
2117.Nm
2118establishes a network level connection.
2119
2120.Pa /etc/ppp/ppp.linkdown
2121A file to check when
2122.Nm
2123closes a network level connection.
2124
2125.Pa /var/log/ppp.log
2126Logging and debugging information file.
2127
2128.Pa /var/spool/lock/LCK..*
2129tty port locking file.  Refer to
2130.Xr uucplock 8
2131for further details.
2132
2133.Pa /var/run/tunX.pid
2134The process id (pid) of the ppp program connected to the tunX device, where
2135'X' is the number of the device.  This file is only created in
2136.Fl background ,
2137.Fl auto
2138and
2139.Fl ddial
2140modes.
2141
2142.Pa /var/run/ttyXX.if
2143The tun interface used by this port.  Again, this file is only created in
2144.Fl background ,
2145.Fl auto
2146and
2147.Fl ddial
2148modes.
2149
2150.Pa /etc/services
2151Get port number if port number is using service name.
2152.El
2153
2154.Sh SEE ALSO
2155
2156.Xr chat 8 ,
2157.Xr pppd 8 ,
2158.Xr uucplock 3 ,
2159.Xr syslog 3 ,
2160.Xr syslog.conf 5 ,
2161.Xr syslogd 8 ,
2162.Xr pppctl 8
2163
2164.Sh HISTORY
2165
2166This program was originally written by Toshiharu OHNO (tony-o@iij.ad.jp),
2167and was submitted to FreeBSD-2.0.5 by Atsushi Murai (amurai@spec.co.jp).
2168It has since had an enormous face lift and looks substantially different.
2169