]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/ppp/ppp.8.m4
MFC
[FreeBSD/FreeBSD.git] / usr.sbin / ppp / ppp.8.m4
1 changequote({,})dnl
2 changecom(,)dnl
3 .\"
4 .\" Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
5 .\" All rights reserved.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd August 25, 2009
31 .Dt PPP 8
32 .Os
33 .Sh NAME
34 .Nm ppp
35 .Nd Point to Point Protocol (a.k.a. user-ppp)
36 .Sh SYNOPSIS
37 .Nm
38 .Op Fl Va mode
39 .Op Fl nat
40 .Op Fl quiet
41 .Op Fl unit Ns Ar N
42 .Op Ar system ...
43 .Sh DESCRIPTION
44 This is a user process
45 .Em PPP
46 software package.
47 Sometimes,
48 .Em PPP
49 is implemented as a part of the kernel (e.g., as managed by
50 .Nm pppd )
51 and it is thus somewhat hard to debug and/or modify its behaviour.
52 However, in this implementation
53 .Em PPP
54 is done as a user process with the help of the
55 tunnel device driver (tun).
56 .Pp
57 The
58 .Fl nat
59 flag does the equivalent of a
60 .Dq nat enable yes ,
61 enabling
62 .Nm Ns No 's
63 network address translation features.
64 This allows
65 .Nm
66 to act as a NAT or masquerading engine for all machines on an internal
67 LAN.
68 ifdef({LOCALNAT},{},{Refer to
69 .Xr libalias 3
70 for details on the technical side of the NAT engine.
71 })dnl
72 Refer to the
73 .Sx NETWORK ADDRESS TRANSLATION (PACKET ALIASING)
74 section of this manual page for details on how to configure NAT in
75 .Nm .
76 .Pp
77 The
78 .Fl quiet
79 flag tells
80 .Nm
81 to be silent at startup rather than displaying the mode and interface
82 to standard output.
83 .Pp
84 The
85 .Fl unit
86 flag tells
87 .Nm
88 to only attempt to open
89 .Pa /dev/tun Ns Ar N .
90 Normally,
91 .Nm
92 will start with a value of 0 for
93 .Ar N ,
94 and keep trying to open a tunnel device by incrementing the value of
95 .Ar N
96 by one each time until it succeeds.
97 If it fails three times in a row
98 because the device file is missing, it gives up.
99 .Pp
100 The following
101 .Va mode Ns No s
102 are understood by
103 .Nm :
104 .Bl -tag -width XXX -offset XXX
105 .It Fl auto
106 .Nm
107 opens the tun interface, configures it then goes into the background.
108 The link is not brought up until outgoing data is detected on the tun
109 interface at which point
110 .Nm
111 attempts to bring up the link.
112 Packets received (including the first one) while
113 .Nm
114 is trying to bring the link up will remain queued for a default of
115 2 minutes.
116 See the
117 .Dq set choked
118 command below.
119 .Pp
120 In
121 .Fl auto
122 mode, at least one
123 .Dq system
124 must be given on the command line (see below) and a
125 .Dq set ifaddr
126 must be done in the system profile that specifies a peer IP address to
127 use when configuring the interface.
128 Something like
129 .Dq 10.0.0.1/0
130 is usually appropriate.
131 See the
132 .Dq pmdemand
133 system in
134 .Pa /usr/share/examples/ppp/ppp.conf.sample
135 for an example.
136 .It Fl background
137 Here,
138 .Nm
139 attempts to establish a connection with the peer immediately.
140 If it succeeds,
141 .Nm
142 goes into the background and the parent process returns an exit code
143 of 0.
144 If it fails,
145 .Nm
146 exits with a non-zero result.
147 .It Fl foreground
148 In foreground mode,
149 .Nm
150 attempts to establish a connection with the peer immediately, but never
151 becomes a daemon.
152 The link is created in background mode.
153 This is useful if you wish to control
154 .Nm Ns No 's
155 invocation from another process.
156 .It Fl direct
157 This is used for communicating over an already established connection,
158 usually when receiving incoming connections accepted by
159 .Xr getty 8 .
160 .Nm
161 ignores the
162 .Dq set device
163 line and uses descriptor 0 as the link.
164 .Nm
165 will also ignore any configured chat scripts unless the
166 .Dq force-scripts
167 option has been enabled.
168 .Pp
169 If callback is configured,
170 .Nm
171 will use the
172 .Dq set device
173 information when dialing back.
174 .Pp
175 When run in
176 .Fl direct
177 mode,
178 .Nm
179 will behave slightly differently if descriptor 0 was created by
180 .Xr pipe 2 .
181 As pipes are not bi-directional, ppp will redirect all writes to descriptor
182 1 (standard output), leaving only reads acting on descriptor 0.
183 No special action is taken if descriptor 0 was created by
184 .Xr socketpair 2 .
185 .It Fl dedicated
186 This option is designed for machines connected with a dedicated
187 wire.
188 .Nm
189 will always keep the device open and will ignore any configured
190 chat scripts unless the
191 .Dq force-scripts
192 option has been enabled.
193 .It Fl ddial
194 This mode is equivalent to
195 .Fl auto
196 mode except that
197 .Nm
198 will bring the link back up any time it is dropped for any reason.
199 .It Fl interactive
200 This is a no-op, and gives the same behaviour as if none of the above
201 modes have been specified.
202 .Nm
203 loads any sections specified on the command line then provides an
204 interactive prompt.
205 .El
206 .Pp
207 One or more configuration entries or systems
208 (as specified in
209 .Pa /etc/ppp/ppp.conf )
210 may also be specified on the command line.
211 .Nm
212 will read the
213 .Dq default
214 system from
215 .Pa /etc/ppp/ppp.conf
216 at startup, followed by each of the systems specified on the command line.
217 .Sh Major Features
218 .Bl -diag
219 .It Provides an interactive user interface.
220 Using its command mode, the user can
221 easily enter commands to establish the connection with the remote end, check
222 the status of connection and close the connection.
223 All functions can also be optionally password protected for security.
224 .It Supports both manual and automatic dialing.
225 Interactive mode has a
226 .Dq term
227 command which enables you to talk to the device directly.
228 When you are connected to the remote peer and it starts to talk
229 .Em PPP ,
230 .Nm
231 detects it and switches to packet mode automatically.
232 Once you have
233 determined the proper sequence for connecting with the remote host, you
234 can write a chat script to {define} the necessary dialing and login
235 procedure for later convenience.
236 .It Supports on-demand dialup capability.
237 By using
238 .Fl auto
239 mode,
240 .Nm
241 will act as a daemon and wait for a packet to be sent over the
242 .Em PPP
243 link.
244 When this happens, the daemon automatically dials and establishes the
245 connection.
246 In almost the same manner
247 .Fl ddial
248 mode (direct-dial mode) also automatically dials and establishes the
249 connection.
250 However, it differs in that it will dial the remote site
251 any time it detects the link is down, even if there are no packets to be
252 sent.
253 This mode is useful for full-time connections where we worry less
254 about line charges and more about being connected full time.
255 A third
256 .Fl dedicated
257 mode is also available.
258 This mode is targeted at a dedicated link between two machines.
259 .Nm
260 will never voluntarily quit from dedicated mode - you must send it the
261 .Dq quit all
262 command via its diagnostic socket.
263 A
264 .Dv SIGHUP
265 will force an LCP renegotiation, and a
266 .Dv SIGTERM
267 will force it to exit.
268 .It Supports client callback.
269 .Nm
270 can use either the standard LCP callback protocol or the Microsoft
271 CallBack Control Protocol (ftp://ftp.microsoft.com/developr/rfc/cbcp.txt).
272 .It Supports NAT or packet aliasing.
273 Packet aliasing (a.k.a.\& IP masquerading) allows computers on a
274 private, unregistered network to access the Internet.
275 The
276 .Em PPP
277 host acts as a masquerading gateway.
278 IP addresses as well as TCP and
279 UDP port numbers are NAT'd for outgoing packets and de-NAT'd for
280 returning packets.
281 .It Supports background PPP connections.
282 In background mode, if
283 .Nm
284 successfully establishes the connection, it will become a daemon.
285 Otherwise, it will exit with an error.
286 This allows the setup of
287 scripts that wish to execute certain commands only if the connection
288 is successfully established.
289 .It Supports server-side PPP connections.
290 In direct mode,
291 .Nm
292 acts as server which accepts incoming
293 .Em PPP
294 connections on stdin/stdout.
295 .It Supports PAP and CHAP (rfc 1994, 2433 and 2759) authentication.
296 With PAP or CHAP, it is possible to skip the Unix style
297 .Xr login 1
298 procedure, and use the
299 .Em PPP
300 protocol for authentication instead.
301 If the peer requests Microsoft CHAP authentication and
302 .Nm
303 is compiled with DES support, an appropriate MD4/DES response will be
304 made.
305 .It Supports RADIUS (rfc 2138 & 2548) authentication.
306 An extension to PAP and CHAP,
307 .Em \&R Ns No emote
308 .Em \&A Ns No ccess
309 .Em \&D Ns No ial
310 .Em \&I Ns No n
311 .Em \&U Ns No ser
312 .Em \&S Ns No ervice
313 allows authentication information to be stored in a central or
314 distributed database along with various per-user framed connection
315 characteristics.
316 ifdef({LOCALRAD},{},{If
317 .Xr libradius 3
318 is available at compile time,
319 .Nm
320 will use it to make
321 .Em RADIUS
322 requests when configured to do so.
323 })dnl
324 .It Supports Proxy Arp.
325 .Nm
326 can be configured to make one or more proxy arp entries on behalf of
327 the peer.
328 This allows routing from the peer to the LAN without
329 configuring each machine on that LAN.
330 .It Supports packet filtering.
331 User can {define} four kinds of filters: the
332 .Em in
333 filter for incoming packets, the
334 .Em out
335 filter for outgoing packets, the
336 .Em dial
337 filter to {define} a dialing trigger packet and the
338 .Em alive
339 filter for keeping a connection alive with the trigger packet.
340 .It Tunnel driver supports bpf.
341 The user can use
342 .Xr tcpdump 1
343 to check the packet flow over the
344 .Em PPP
345 link.
346 .It Supports PPP over TCP and PPP over UDP.
347 If a device name is specified as
348 .Em host Ns No : Ns Em port Ns
349 .Xo
350 .Op / Ns tcp|udp ,
351 .Xc
352 .Nm
353 will open a TCP or UDP connection for transporting data rather than using a
354 conventional serial device.
355 UDP connections force
356 .Nm
357 into synchronous mode.
358 .It Supports PPP over Ethernet (rfc 2516).
359 If
360 .Nm
361 is given a device specification of the format
362 .No PPPoE: Ns Ar iface Ns Xo
363 .Op \&: Ns Ar provider Ns
364 .Xc
365 and if
366 .Xr netgraph 4
367 is available,
368 .Nm
369 will attempt talk
370 .Em PPP
371 over Ethernet to
372 .Ar provider
373 using the
374 .Ar iface
375 network interface.
376 .Pp
377 On systems that do not support
378 .Xr netgraph 4 ,
379 an external program such as
380 .Xr pppoed 8
381 may be used.
382 .It "Supports IETF draft Predictor-1 (rfc 1978) and DEFLATE (rfc 1979) compression."
383 .Nm
384 supports not only VJ-compression but also Predictor-1 and DEFLATE compression.
385 Normally, a modem has built-in compression (e.g., v42.bis) and the system
386 may receive higher data rates from it as a result of such compression.
387 While this is generally a good thing in most other situations, this
388 higher speed data imposes a penalty on the system by increasing the
389 number of serial interrupts the system has to process in talking to the
390 modem and also increases latency.
391 Unlike VJ-compression, Predictor-1 and DEFLATE compression pre-compresses
392 .Em all
393 network traffic flowing through the link, thus reducing overheads to a
394 minimum.
395 .It Supports Microsoft's IPCP extensions (rfc 1877).
396 Name Server Addresses and NetBIOS Name Server Addresses can be negotiated
397 with clients using the Microsoft
398 .Em PPP
399 stack (i.e., Win95, WinNT)
400 .It Supports Multi-link PPP (rfc 1990)
401 It is possible to configure
402 .Nm
403 to open more than one physical connection to the peer, combining the
404 bandwidth of all links for better throughput.
405 .It Supports MPPE (draft-ietf-pppext-mppe)
406 MPPE is Microsoft Point to Point Encryption scheme.
407 It is possible to configure
408 .Nm
409 to participate in Microsoft's Windows VPN.
410 For now,
411 .Nm
412 can only get encryption keys from CHAP 81 authentication.
413 .Nm
414 must be compiled with DES for MPPE to operate.
415 .It Supports IPV6CP (rfc 2023).
416 An IPv6 connection can be made in addition to or instead of the normal
417 IPv4 connection.
418 .El
419 .Sh PERMISSIONS
420 .Nm
421 is installed as user
422 .Dv root
423 and group
424 .Dv network ,
425 with permissions
426 .Dv 04554 .
427 By default,
428 .Nm
429 will not run if the invoking user id is not zero.
430 This may be overridden by using the
431 .Dq allow users
432 command in
433 .Pa /etc/ppp/ppp.conf .
434 When running as a normal user,
435 .Nm
436 switches to user id 0 in order to alter the system routing table, set up
437 system lock files and read the ppp configuration files.
438 All external commands (executed via the "shell" or "!bg" commands) are executed
439 as the user id that invoked
440 .Nm .
441 Refer to the
442 .Sq ID0
443 logging facility if you are interested in what exactly is done as user id
444 zero.
445 .Sh GETTING STARTED
446 When you first run
447 .Nm
448 you may need to deal with some initial configuration details.
449 .Bl -bullet
450 .It
451 Make sure that your system has a group named
452 .Dq network
453 in the
454 .Pa /etc/group
455 file and that the group contains the names of all users expected to use
456 .Nm .
457 Refer to the
458 .Xr group 5
459 manual page for details.
460 Each of these users must also be given access using the
461 .Dq allow users
462 command in
463 .Pa /etc/ppp/ppp.conf .
464 .It
465 Create a log file.
466 .Nm
467 uses
468 .Xr syslog 3
469 to log information.
470 A common log file name is
471 .Pa /var/log/ppp.log .
472 To make output go to this file, put the following lines in the
473 .Pa /etc/syslog.conf
474 file:
475 .Bd -literal -offset indent
476 !ppp
477 *.*<TAB>/var/log/ppp.log
478 .Ed
479 .Pp
480 It is possible to have more than one
481 .Em PPP
482 log file by creating a link to the
483 .Nm
484 executable:
485 .Pp
486 .Dl # cd /usr/sbin
487 .Dl # ln ppp ppp0
488 .Pp
489 and using
490 .Bd -literal -offset indent
491 !ppp0
492 *.*<TAB>/var/log/ppp0.log
493 .Ed
494 .Pp
495 in
496 .Pa /etc/syslog.conf .
497 Do not forget to send a
498 .Dv HUP
499 signal to
500 .Xr syslogd 8
501 after altering
502 .Pa /etc/syslog.conf .
503 .It
504 Although not strictly relevant to
505 .Nm Ns No 's
506 operation, you should configure your resolver so that it works correctly.
507 This can be done by configuring a local DNS
508 (using
509 .Xr named 8 )
510 or by adding the correct
511 .Sq nameserver
512 lines to the file
513 .Pa /etc/resolv.conf .
514 Refer to the
515 .Xr resolv.conf 5
516 manual page for details.
517 .Pp
518 Alternatively, if the peer supports it,
519 .Nm
520 can be configured to ask the peer for the nameserver address(es) and to
521 update
522 .Pa /etc/resolv.conf
523 automatically.
524 Refer to the
525 .Dq enable dns
526 and
527 .Dq resolv
528 commands below for details.
529 .El
530 .Sh MANUAL DIALING
531 In the following examples, we assume that your machine name is
532 .Dv awfulhak .
533 when you invoke
534 .Nm
535 (see
536 .Sx PERMISSIONS
537 above) with no arguments, you are presented with a prompt:
538 .Bd -literal -offset indent
539 ppp ON awfulhak>
540 .Ed
541 .Pp
542 The
543 .Sq ON
544 part of your prompt should always be in upper case.
545 If it is in lower case, it means that you must supply a password using the
546 .Dq passwd
547 command.
548 This only ever happens if you connect to a running version of
549 .Nm
550 and have not authenticated yourself using the correct password.
551 .Pp
552 You can start by specifying the device name and speed:
553 .Bd -literal -offset indent
554 ppp ON awfulhak> set device /dev/cuau0
555 ppp ON awfulhak> set speed 38400
556 .Ed
557 .Pp
558 Normally, hardware flow control (CTS/RTS) is used.
559 However, under
560 certain circumstances (as may happen when you are connected directly
561 to certain PPP-capable terminal servers), this may result in
562 .Nm
563 hanging as soon as it tries to write data to your communications link
564 as it is waiting for the CTS (clear to send) signal - which will never
565 come.
566 Thus, if you have a direct line and cannot seem to make a
567 connection, try turning CTS/RTS off with
568 .Dq set ctsrts off .
569 If you need to do this, check the
570 .Dq set accmap
571 description below too - you will probably need to
572 .Dq set accmap 000a0000 .
573 .Pp
574 Usually, parity is set to
575 .Dq none ,
576 and this is
577 .Nm Ns No 's
578 default.
579 Parity is a rather archaic error checking mechanism that is no
580 longer used because modern modems do their own error checking, and most
581 link-layer protocols (that is what
582 .Nm
583 is) use much more reliable checking mechanisms.
584 Parity has a relatively
585 huge overhead (a 12.5% increase in traffic) and as a result, it is always
586 disabled
587 (set to
588 .Dq none )
589 when
590 .Dv PPP
591 is opened.
592 However, some ISPs (Internet Service Providers) may use
593 specific parity settings at connection time (before
594 .Dv PPP
595 is opened).
596 Notably, Compuserve insist on even parity when logging in:
597 .Bd -literal -offset indent
598 ppp ON awfulhak> set parity even
599 .Ed
600 .Pp
601 You can now see what your current device settings look like:
602 .Bd -literal -offset indent
603 ppp ON awfulhak> show physical
604 Name: deflink
605  State:           closed
606  Device:          N/A
607  Link Type:       interactive
608  Connect Count:   0
609  Queued Packets:  0
610  Phone Number:    N/A
611
612 Defaults:
613  Device List:     /dev/cuau0
614  Characteristics: 38400bps, cs8, even parity, CTS/RTS on
615
616 Connect time: 0 secs
617 0 octets in, 0 octets out
618 Overall 0 bytes/sec
619 ppp ON awfulhak>
620 .Ed
621 .Pp
622 The term command can now be used to talk directly to the device:
623 .Bd -literal -offset indent
624 ppp ON awfulhak> term
625 at
626 OK
627 atdt123456
628 CONNECT
629 login: myispusername
630 Password: myisppassword
631 Protocol: ppp
632 .Ed
633 .Pp
634 When the peer starts to talk in
635 .Em PPP ,
636 .Nm
637 detects this automatically and returns to command mode.
638 .Bd -literal -offset indent
639 ppp ON awfulhak>               # No link has been established
640 Ppp ON awfulhak>               # We've connected & finished LCP
641 PPp ON awfulhak>               # We've authenticated
642 PPP ON awfulhak>               # We've agreed IP numbers
643 .Ed
644 .Pp
645 If it does not, it is probable that the peer is waiting for your end to
646 start negotiating.
647 To force
648 .Nm
649 to start sending
650 .Em PPP
651 configuration packets to the peer, use the
652 .Dq ~p
653 command to drop out of terminal mode and enter packet mode.
654 .Pp
655 If you never even receive a login prompt, it is quite likely that the
656 peer wants to use PAP or CHAP authentication instead of using Unix-style
657 login/password authentication.
658 To set things up properly, drop back to
659 the prompt and set your authentication name and key, then reconnect:
660 .Bd -literal -offset indent
661 ~.
662 ppp ON awfulhak> set authname myispusername
663 ppp ON awfulhak> set authkey myisppassword
664 ppp ON awfulhak> term
665 at
666 OK
667 atdt123456
668 CONNECT
669 .Ed
670 .Pp
671 You may need to tell ppp to initiate negotiations with the peer here too:
672 .Bd -literal -offset indent
673 ~p
674 ppp ON awfulhak>               # No link has been established
675 Ppp ON awfulhak>               # We've connected & finished LCP
676 PPp ON awfulhak>               # We've authenticated
677 PPP ON awfulhak>               # We've agreed IP numbers
678 .Ed
679 .Pp
680 You are now connected!
681 Note that
682 .Sq PPP
683 in the prompt has changed to capital letters to indicate that you have
684 a peer connection.
685 If only some of the three Ps go uppercase, wait until
686 either everything is uppercase or lowercase.
687 If they revert to lowercase, it means that
688 .Nm
689 could not successfully negotiate with the peer.
690 A good first step for troubleshooting at this point would be to
691 .Bd -literal -offset indent
692 ppp ON awfulhak> set log local phase lcp ipcp
693 .Ed
694 .Pp
695 and try again.
696 Refer to the
697 .Dq set log
698 command description below for further details.
699 If things fail at this point,
700 it is quite important that you turn logging on and try again.
701 It is also
702 important that you note any prompt changes and report them to anyone trying
703 to help you.
704 .Pp
705 When the link is established, the show command can be used to see how
706 things are going:
707 .Bd -literal -offset indent
708 PPP ON awfulhak> show physical
709 * Modem related information is shown here *
710 PPP ON awfulhak> show ccp
711 * CCP (compression) related information is shown here *
712 PPP ON awfulhak> show lcp
713 * LCP (line control) related information is shown here *
714 PPP ON awfulhak> show ipcp
715 * IPCP (IP) related information is shown here *
716 PPP ON awfulhak> show ipv6cp
717 * IPV6CP (IPv6) related information is shown here *
718 PPP ON awfulhak> show link
719 * Link (high level) related information is shown here *
720 PPP ON awfulhak> show bundle
721 * Logical (high level) connection related information is shown here *
722 .Ed
723 .Pp
724 At this point, your machine has a host route to the peer.
725 This means
726 that you can only make a connection with the host on the other side
727 of the link.
728 If you want to add a default route entry (telling your
729 machine to send all packets without another routing entry to the other
730 side of the
731 .Em PPP
732 link), enter the following command:
733 .Bd -literal -offset indent
734 PPP ON awfulhak> add default HISADDR
735 .Ed
736 .Pp
737 The string
738 .Sq HISADDR
739 represents the IP address of the connected peer.
740 If the
741 .Dq add
742 command fails due to an existing route, you can overwrite the existing
743 route using:
744 .Bd -literal -offset indent
745 PPP ON awfulhak> add! default HISADDR
746 .Ed
747 .Pp
748 This command can also be executed before actually making the connection.
749 If a new IP address is negotiated at connection time,
750 .Nm
751 will update your default route accordingly.
752 .Pp
753 You can now use your network applications (ping, telnet, ftp, etc.)
754 in other windows or terminals on your machine.
755 If you wish to reuse the current terminal, you can put
756 .Nm
757 into the background using your standard shell suspend and background
758 commands (usually
759 .Dq ^Z
760 followed by
761 .Dq bg ) .
762 .Pp
763 Refer to the
764 .Sx PPP COMMAND LIST
765 section for details on all available commands.
766 .Sh AUTOMATIC DIALING
767 To use automatic dialing, you must prepare some Dial and Login chat scripts.
768 See the example definitions in
769 .Pa /usr/share/examples/ppp/ppp.conf.sample
770 (the format of
771 .Pa /etc/ppp/ppp.conf
772 is pretty simple).
773 Each line contains one comment, inclusion, label or command:
774 .Bl -bullet
775 .It
776 A line starting with a
777 .Pq Dq #
778 character is treated as a comment line.
779 Leading whitespace are ignored when identifying comment lines.
780 .It
781 An inclusion is a line beginning with the word
782 .Sq {!include} .
783 It must have one argument - the file to {include}.
784 You may wish to
785 .Dq {!include} ~/.ppp.conf
786 for compatibility with older versions of
787 .Nm .
788 .It
789 A label name starts in the first column and is followed by
790 a colon
791 .Pq Dq \&: .
792 .It
793 A command line must contain a space or tab in the first column.
794 .It
795 A string starting with the
796 .Dq $
797 character is substituted with the value of the environment variable by
798 the same name.
799 Likewise, a string starting with the
800 .Dq ~
801 character is substituted with the full path to the home directory of
802 the user account by the same name, and the
803 .Dq ~
804 character by itself is substituted with the full path to the home directory
805 of the current user.
806 If you want to include a literal
807 .Dq $
808 or
809 .Dq ~
810 character in a command or argument, enclose them in double quotes, e.g.,
811 .Bd -literal -offset indent
812 set password "pa$ss~word"
813 .Ed
814 .El
815 .Pp
816 The
817 .Pa /etc/ppp/ppp.conf
818 file should consist of at least a
819 .Dq default
820 section.
821 This section is always executed.
822 It should also contain
823 one or more sections, named according to their purpose, for example,
824 .Dq MyISP
825 would represent your ISP, and
826 .Dq ppp-in
827 would represent an incoming
828 .Nm
829 configuration.
830 You can now specify the destination label name when you invoke
831 .Nm .
832 Commands associated with the
833 .Dq default
834 label are executed, followed by those associated with the destination
835 label provided.
836 When
837 .Nm
838 is started with no arguments, the
839 .Dq default
840 section is still executed.
841 The load command can be used to manually load a section from the
842 .Pa /etc/ppp/ppp.conf
843 file:
844 .Bd -literal -offset indent
845 ppp ON awfulhak> load MyISP
846 .Ed
847 .Pp
848 Note, no action is taken by
849 .Nm
850 after a section is loaded, whether it is the result of passing a label on
851 the command line or using the
852 .Dq load
853 command.
854 Only the commands specified for that label in the configuration
855 file are executed.
856 However, when invoking
857 .Nm
858 with the
859 .Fl background ,
860 .Fl ddial ,
861 or
862 .Fl dedicated
863 switches, the link mode tells
864 .Nm
865 to establish a connection.
866 Refer to the
867 .Dq set mode
868 command below for further details.
869 .Pp
870 Once the connection is made, the
871 .Sq ppp
872 portion of the prompt will change to
873 .Sq PPP :
874 .Bd -literal -offset indent
875 # ppp MyISP
876 \&...
877 ppp ON awfulhak> dial
878 Ppp ON awfulhak>
879 PPp ON awfulhak>
880 PPP ON awfulhak>
881 .Ed
882 .Pp
883 The Ppp prompt indicates that
884 .Nm
885 has entered the authentication phase.
886 The PPp prompt indicates that
887 .Nm
888 has entered the network phase.
889 The PPP prompt indicates that
890 .Nm
891 has successfully negotiated a network layer protocol and is in
892 a usable state.
893 .Pp
894 If the
895 .Pa /etc/ppp/ppp.linkup
896 file is available, its contents are executed
897 when the
898 .Em PPP
899 connection is established.
900 See the provided
901 .Dq pmdemand
902 example in
903 .Pa /usr/share/examples/ppp/ppp.conf.sample
904 which runs a script in the background after the connection is established
905 (refer to the
906 .Dq shell
907 and
908 .Dq bg
909 commands below for a description of possible substitution strings).
910 Similarly, when a connection is closed, the contents of the
911 .Pa /etc/ppp/ppp.linkdown
912 file are executed.
913 Both of these files have the same format as
914 .Pa /etc/ppp/ppp.conf .
915 .Pp
916 In previous versions of
917 .Nm ,
918 it was necessary to re-add routes such as the default route in the
919 .Pa ppp.linkup
920 file.
921 .Nm
922 supports
923 .Sq sticky routes ,
924 where all routes that contain the
925 .Dv HISADDR ,
926 .Dv MYADDR ,
927 .Dv HISADDR6
928 or
929 .Dv MYADDR6
930 literals will automatically be updated when the values of these variables
931 change.
932 .Sh BACKGROUND DIALING
933 If you want to establish a connection using
934 .Nm
935 non-interactively (such as from a
936 .Xr crontab 5
937 entry or an
938 .Xr at 1
939 job) you should use the
940 .Fl background
941 option.
942 When
943 .Fl background
944 is specified,
945 .Nm
946 attempts to establish the connection immediately.
947 If multiple phone
948 numbers are specified, each phone number will be tried once.
949 If the attempt fails,
950 .Nm
951 exits immediately with a non-zero exit code.
952 If it succeeds, then
953 .Nm
954 becomes a daemon, and returns an exit status of zero to its caller.
955 The daemon exits automatically if the connection is dropped by the
956 remote system, or it receives a
957 .Dv TERM
958 signal.
959 .Sh DIAL ON DEMAND
960 Demand dialing is enabled with the
961 .Fl auto
962 or
963 .Fl ddial
964 options.
965 You must also specify the destination label in
966 .Pa /etc/ppp/ppp.conf
967 to use.
968 It must contain the
969 .Dq set ifaddr
970 command to {define} the remote peers IP address.
971 (refer to
972 .Pa /usr/share/examples/ppp/ppp.conf.sample )
973 .Bd -literal -offset indent
974 # ppp -auto pmdemand
975 .Ed
976 .Pp
977 When
978 .Fl auto
979 or
980 .Fl ddial
981 is specified,
982 .Nm
983 runs as a daemon but you can still configure or examine its
984 configuration by using the
985 .Dq set server
986 command in
987 .Pa /etc/ppp/ppp.conf ,
988 (for example,
989 .Dq Li "set server +3000 mypasswd" )
990 and connecting to the diagnostic port as follows:
991 .Bd -literal -offset indent
992 # pppctl 3000   (assuming tun0)
993 Password:
994 PPP ON awfulhak> show who
995 tcp (127.0.0.1:1028) *
996 .Ed
997 .Pp
998 The
999 .Dq show who
1000 command lists users that are currently connected to
1001 .Nm
1002 itself.
1003 If the diagnostic socket is closed or changed to a different
1004 socket, all connections are immediately dropped.
1005 .Pp
1006 In
1007 .Fl auto
1008 mode, when an outgoing packet is detected,
1009 .Nm
1010 will perform the dialing action (chat script) and try to connect
1011 with the peer.
1012 In
1013 .Fl ddial
1014 mode, the dialing action is performed any time the line is found
1015 to be down.
1016 If the connect fails, the default behaviour is to wait 30 seconds
1017 and then attempt to connect when another outgoing packet is detected.
1018 This behaviour can be changed using the
1019 .Dq set redial
1020 command:
1021 .Pp
1022 .No set redial Ar secs Ns
1023 .Oo + Ns Ar inc Ns
1024 .Oo - Ns Ar max Ns Oc Oc Ns
1025 .Op . Ns Ar next
1026 .Op Ar attempts
1027 .Pp
1028 .Bl -tag -width attempts -compact
1029 .It Ar secs
1030 is the number of seconds to wait before attempting
1031 to connect again.
1032 If the argument is the literal string
1033 .Sq Li random ,
1034 the delay period is a random value between 1 and 30 seconds inclusive.
1035 .It Ar inc
1036 is the number of seconds that
1037 .Ar secs
1038 should be incremented each time a new dial attempt is made.
1039 The timeout reverts to
1040 .Ar secs
1041 only after a successful connection is established.
1042 The default value for
1043 .Ar inc
1044 is zero.
1045 .It Ar max
1046 is the maximum number of times
1047 .Nm
1048 should increment
1049 .Ar secs .
1050 The default value for
1051 .Ar max
1052 is 10.
1053 .It Ar next
1054 is the number of seconds to wait before attempting
1055 to dial the next number in a list of numbers (see the
1056 .Dq set phone
1057 command).
1058 The default is 3 seconds.
1059 Again, if the argument is the literal string
1060 .Sq Li random ,
1061 the delay period is a random value between 1 and 30 seconds.
1062 .It Ar attempts
1063 is the maximum number of times to try to connect for each outgoing packet
1064 that triggers a dial.
1065 The previous value is unchanged if this parameter is omitted.
1066 If a value of zero is specified for
1067 .Ar attempts ,
1068 .Nm
1069 will keep trying until a connection is made.
1070 .El
1071 .Pp
1072 So, for example:
1073 .Bd -literal -offset indent
1074 set redial 10.3 4
1075 .Ed
1076 .Pp
1077 will attempt to connect 4 times for each outgoing packet that causes
1078 a dial attempt with a 3 second delay between each number and a 10 second
1079 delay after all numbers have been tried.
1080 If multiple phone numbers
1081 are specified, the total number of attempts is still 4 (it does not
1082 attempt each number 4 times).
1083 .Pp
1084 Alternatively,
1085 .Bd -literal -offset indent
1086 set redial 10+10-5.3 20
1087 .Ed
1088 .Pp
1089 tells
1090 .Nm
1091 to attempt to connect 20 times.
1092 After the first attempt,
1093 .Nm
1094 pauses for 10 seconds.
1095 After the next attempt it pauses for 20 seconds
1096 and so on until after the sixth attempt it pauses for 1 minute.
1097 The next 14 pauses will also have a duration of one minute.
1098 If
1099 .Nm
1100 connects, disconnects and fails to connect again, the timeout starts again
1101 at 10 seconds.
1102 .Pp
1103 Modifying the dial delay is very useful when running
1104 .Nm
1105 in
1106 .Fl auto
1107 mode on both ends of the link.
1108 If each end has the same timeout,
1109 both ends wind up calling each other at the same time if the link
1110 drops and both ends have packets queued.
1111 At some locations, the serial link may not be reliable, and carrier
1112 may be lost at inappropriate times.
1113 It is possible to have
1114 .Nm
1115 redial should carrier be unexpectedly lost during a session.
1116 .Bd -literal -offset indent
1117 set reconnect timeout ntries
1118 .Ed
1119 .Pp
1120 This command tells
1121 .Nm
1122 to re-establish the connection
1123 .Ar ntries
1124 times on loss of carrier with a pause of
1125 .Ar timeout
1126 seconds before each try.
1127 For example,
1128 .Bd -literal -offset indent
1129 set reconnect 3 5
1130 .Ed
1131 .Pp
1132 tells
1133 .Nm
1134 that on an unexpected loss of carrier, it should wait
1135 .Ar 3
1136 seconds before attempting to reconnect.
1137 This may happen up to
1138 .Ar 5
1139 times before
1140 .Nm
1141 gives up.
1142 The default value of ntries is zero (no reconnect).
1143 Care should be taken with this option.
1144 If the local timeout is slightly
1145 longer than the remote timeout, the reconnect feature will always be
1146 triggered (up to the given number of times) after the remote side
1147 times out and hangs up.
1148 NOTE: In this context, losing too many LQRs constitutes a loss of
1149 carrier and will trigger a reconnect.
1150 If the
1151 .Fl background
1152 flag is specified, all phone numbers are dialed at most once until
1153 a connection is made.
1154 The next number redial period specified with the
1155 .Dq set redial
1156 command is honoured, as is the reconnect tries value.
1157 If your redial
1158 value is less than the number of phone numbers specified, not all
1159 the specified numbers will be tried.
1160 To terminate the program, type
1161 .Bd -literal -offset indent
1162 PPP ON awfulhak> close
1163 ppp ON awfulhak> quit all
1164 .Ed
1165 .Pp
1166 A simple
1167 .Dq quit
1168 command will terminate the
1169 .Xr pppctl 8
1170 or
1171 .Xr telnet 1
1172 connection but not the
1173 .Nm
1174 program itself.
1175 You must use
1176 .Dq quit all
1177 to terminate
1178 .Nm
1179 as well.
1180 .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 1)
1181 To handle an incoming
1182 .Em PPP
1183 connection request, follow these steps:
1184 .Bl -enum
1185 .It
1186 Make sure the modem and (optionally)
1187 .Pa /etc/rc.serial
1188 is configured correctly.
1189 .Bl -bullet -compact
1190 .It
1191 Use Hardware Handshake (CTS/RTS) for flow control.
1192 .It
1193 Modem should be set to NO echo back (ATE0) and NO results string (ATQ1).
1194 .El
1195 .Pp
1196 .It
1197 Edit
1198 .Pa /etc/ttys
1199 to enable a
1200 .Xr getty 8
1201 on the port where the modem is attached.
1202 For example:
1203 .Pp
1204 .Dl ttyd1 Qo /usr/libexec/getty std.38400 Qc dialup on secure
1205 .Pp
1206 Do not forget to send a
1207 .Dv HUP
1208 signal to the
1209 .Xr init 8
1210 process to start the
1211 .Xr getty 8 :
1212 .Pp
1213 .Dl # kill -HUP 1
1214 .Pp
1215 It is usually also necessary to train your modem to the same DTR speed
1216 as the getty:
1217 .Bd -literal -offset indent
1218 # ppp
1219 ppp ON awfulhak> set device /dev/cuau1
1220 ppp ON awfulhak> set speed 38400
1221 ppp ON awfulhak> term
1222 deflink: Entering terminal mode on /dev/cuau1
1223 Type `~?' for help
1224 at
1225 OK
1226 at
1227 OK
1228 atz
1229 OK
1230 at
1231 OK
1232 ~.
1233 ppp ON awfulhak> quit
1234 .Ed
1235 .It
1236 Create a
1237 .Pa /usr/local/bin/ppplogin
1238 file with the following contents:
1239 .Bd -literal -offset indent
1240 #! /bin/sh
1241 exec /usr/sbin/ppp -direct incoming
1242 .Ed
1243 .Pp
1244 Direct mode
1245 .Pq Fl direct
1246 lets
1247 .Nm
1248 work with stdin and stdout.
1249 You can also use
1250 .Xr pppctl 8
1251 to connect to a configured diagnostic port, in the same manner as with
1252 client-side
1253 .Nm .
1254 .Pp
1255 Here, the
1256 .Ar incoming
1257 section must be set up in
1258 .Pa /etc/ppp/ppp.conf .
1259 .Pp
1260 Make sure that the
1261 .Ar incoming
1262 section contains the
1263 .Dq allow users
1264 command as appropriate.
1265 .It
1266 Prepare an account for the incoming user.
1267 .Bd -literal
1268 ppp:xxxx:66:66:PPP Login User:/home/ppp:/usr/local/bin/ppplogin
1269 .Ed
1270 .Pp
1271 Refer to the manual entries for
1272 .Xr adduser 8
1273 and
1274 .Xr vipw 8
1275 for details.
1276 .It
1277 Support for IPCP Domain Name Server and NetBIOS Name Server negotiation
1278 can be enabled using the
1279 .Dq accept dns
1280 and
1281 .Dq set nbns
1282 commands.
1283 Refer to their descriptions below.
1284 .El
1285 .Sh RECEIVING INCOMING PPP CONNECTIONS (Method 2)
1286 This method differs in that we use
1287 .Nm
1288 to authenticate the connection rather than
1289 .Xr login 1 :
1290 .Bl -enum
1291 .It
1292 Configure your default section in
1293 .Pa /etc/gettytab
1294 with automatic ppp recognition by specifying the
1295 .Dq pp
1296 capability:
1297 .Bd -literal
1298 default:\\
1299         :pp=/usr/local/bin/ppplogin:\\
1300         .....
1301 .Ed
1302 .It
1303 Configure your serial device(s), enable a
1304 .Xr getty 8
1305 and create
1306 .Pa /usr/local/bin/ppplogin
1307 as in the first three steps for method 1 above.
1308 .It
1309 Add either
1310 .Dq enable chap
1311 or
1312 .Dq enable pap
1313 (or both)
1314 to
1315 .Pa /etc/ppp/ppp.conf
1316 under the
1317 .Sq incoming
1318 label (or whatever label
1319 .Pa ppplogin
1320 uses).
1321 .It
1322 Create an entry in
1323 .Pa /etc/ppp/ppp.secret
1324 for each incoming user:
1325 .Bd -literal
1326 Pfred<TAB>xxxx
1327 Pgeorge<TAB>yyyy
1328 .Ed
1329 .El
1330 .Pp
1331 Now, as soon as
1332 .Xr getty 8
1333 detects a ppp connection (by recognising the HDLC frame headers), it runs
1334 .Dq /usr/local/bin/ppplogin .
1335 .Pp
1336 It is
1337 .Em VITAL
1338 that either PAP or CHAP are enabled as above.
1339 If they are not, you are
1340 allowing anybody to establish a ppp session with your machine
1341 .Em without
1342 a password, opening yourself up to all sorts of potential attacks.
1343 .Sh AUTHENTICATING INCOMING CONNECTIONS
1344 Normally, the receiver of a connection requires that the peer
1345 authenticates itself.
1346 This may be done using
1347 .Xr login 1 ,
1348 but alternatively, you can use PAP or CHAP.
1349 CHAP is the more secure of the two, but some clients may not support it.
1350 Once you decide which you wish to use, add the command
1351 .Sq enable chap
1352 or
1353 .Sq enable pap
1354 to the relevant section of
1355 .Pa ppp.conf .
1356 .Pp
1357 You must then configure the
1358 .Pa /etc/ppp/ppp.secret
1359 file.
1360 This file contains one line per possible client, each line
1361 containing up to five fields:
1362 .Pp
1363 .Ar name Ar key Oo
1364 .Ar hisaddr Op Ar label Op Ar callback-number
1365 .Oc
1366 .Pp
1367 The
1368 .Ar name
1369 and
1370 .Ar key
1371 specify the client username and password.
1372 If
1373 .Ar key
1374 is
1375 .Dq \&*
1376 and PAP is being used,
1377 .Nm
1378 will look up the password database
1379 .Pq Xr passwd 5
1380 when authenticating.
1381 If the client does not offer a suitable response based on any
1382 .Ar name Ns No / Ns Ar key
1383 combination in
1384 .Pa ppp.secret ,
1385 authentication fails.
1386 .Pp
1387 If authentication is successful,
1388 .Ar hisaddr
1389 (if specified)
1390 is used when negotiating IP numbers.
1391 See the
1392 .Dq set ifaddr
1393 command for details.
1394 .Pp
1395 If authentication is successful and
1396 .Ar label
1397 is specified, the current system label is changed to match the given
1398 .Ar label .
1399 This will change the subsequent parsing of the
1400 .Pa ppp.linkup
1401 and
1402 .Pa ppp.linkdown
1403 files.
1404 .Pp
1405 If authentication is successful and
1406 .Ar callback-number
1407 is specified and
1408 .Dq set callback
1409 has been used in
1410 .Pa ppp.conf ,
1411 the client will be called back on the given number.
1412 If CBCP is being used,
1413 .Ar callback-number
1414 may also contain a list of numbers or a
1415 .Dq \&* ,
1416 as if passed to the
1417 .Dq set cbcp
1418 command.
1419 The value will be used in
1420 .Nm Ns No 's
1421 subsequent CBCP phase.
1422 .Sh PPP OVER TCP and UDP (a.k.a Tunnelling)
1423 Instead of running
1424 .Nm
1425 over a serial link, it is possible to
1426 use a TCP connection instead by specifying the host, port and protocol as the
1427 device:
1428 .Pp
1429 .Dl set device ui-gate:6669/tcp
1430 .Pp
1431 Instead of opening a serial device,
1432 .Nm
1433 will open a TCP connection to the given machine on the given
1434 socket.
1435 It should be noted however that
1436 .Nm
1437 does not use the telnet protocol and will be unable to negotiate
1438 with a telnet server.
1439 You should set up a port for receiving this
1440 .Em PPP
1441 connection on the receiving machine (ui-gate).
1442 This is done by first updating
1443 .Pa /etc/services
1444 to name the service:
1445 .Pp
1446 .Dl ppp-in 6669/tcp # Incoming PPP connections over TCP
1447 .Pp
1448 and updating
1449 .Pa /etc/inetd.conf
1450 to tell
1451 .Xr inetd 8
1452 how to deal with incoming connections on that port:
1453 .Pp
1454 .Dl ppp-in stream tcp nowait root /usr/sbin/ppp ppp -direct ppp-in
1455 .Pp
1456 Do not forget to send a
1457 .Dv HUP
1458 signal to
1459 .Xr inetd 8
1460 after you have updated
1461 .Pa /etc/inetd.conf .
1462 Here, we use a label named
1463 .Dq ppp-in .
1464 The entry in
1465 .Pa /etc/ppp/ppp.conf
1466 on ui-gate (the receiver) should contain the following:
1467 .Bd -literal -offset indent
1468 ppp-in:
1469  set timeout 0
1470  set ifaddr 10.0.4.1 10.0.4.2
1471 .Ed
1472 .Pp
1473 and the entry in
1474 .Pa /etc/ppp/ppp.linkup
1475 should contain:
1476 .Bd -literal -offset indent
1477 ppp-in:
1478  add 10.0.1.0/24 HISADDR
1479 .Ed
1480 .Pp
1481 It is necessary to put the
1482 .Dq add
1483 command in
1484 .Pa ppp.linkup
1485 to ensure that the route is only added after
1486 .Nm
1487 has negotiated and assigned addresses to its interface.
1488 .Pp
1489 You may also want to enable PAP or CHAP for security.
1490 To enable PAP, add the following line:
1491 .Bd -literal -offset indent
1492  enable PAP
1493 .Ed
1494 .Pp
1495 You will also need to create the following entry in
1496 .Pa /etc/ppp/ppp.secret :
1497 .Bd -literal -offset indent
1498 MyAuthName MyAuthPasswd
1499 .Ed
1500 .Pp
1501 If
1502 .Ar MyAuthPasswd
1503 is a
1504 .Dq * ,
1505 the password is looked up in the
1506 .Xr passwd 5
1507 database.
1508 .Pp
1509 The entry in
1510 .Pa /etc/ppp/ppp.conf
1511 on awfulhak (the initiator) should contain the following:
1512 .Bd -literal -offset indent
1513 ui-gate:
1514  set escape 0xff
1515  set device ui-gate:ppp-in/tcp
1516  set dial
1517  set timeout 30
1518  set log Phase Chat Connect hdlc LCP IPCP IPV6CP CCP tun
1519  set ifaddr 10.0.4.2 10.0.4.1
1520 .Ed
1521 .Pp
1522 with the route setup in
1523 .Pa /etc/ppp/ppp.linkup :
1524 .Bd -literal -offset indent
1525 ui-gate:
1526  add 10.0.2.0/24 HISADDR
1527 .Ed
1528 .Pp
1529 Again, if you are enabling PAP, you will also need this in the
1530 .Pa /etc/ppp/ppp.conf
1531 profile:
1532 .Bd -literal -offset indent
1533  set authname MyAuthName
1534  set authkey MyAuthKey
1535 .Ed
1536 .Pp
1537 We are assigning the address of 10.0.4.1 to ui-gate, and the address
1538 10.0.4.2 to awfulhak.
1539 To open the connection, just type
1540 .Pp
1541 .Dl awfulhak # ppp -background ui-gate
1542 .Pp
1543 The result will be an additional "route" on awfulhak to the
1544 10.0.2.0/24 network via the TCP connection, and an additional
1545 "route" on ui-gate to the 10.0.1.0/24 network.
1546 The networks are effectively bridged - the underlying TCP
1547 connection may be across a public network (such as the
1548 Internet), and the
1549 .Em PPP
1550 traffic is conceptually encapsulated
1551 (although not packet by packet) inside the TCP stream between
1552 the two gateways.
1553 .Pp
1554 The major disadvantage of this mechanism is that there are two
1555 "guaranteed delivery" mechanisms in place - the underlying TCP
1556 stream and whatever protocol is used over the
1557 .Em PPP
1558 link - probably TCP again.
1559 If packets are lost, both levels will
1560 get in each others way trying to negotiate sending of the missing
1561 packet.
1562 .Pp
1563 To avoid this overhead, it is also possible to do all this using
1564 UDP instead of TCP as the transport by simply changing the protocol
1565 from "tcp" to "udp".
1566 When using UDP as a transport,
1567 .Nm
1568 will operate in synchronous mode.
1569 This is another gain as the incoming
1570 data does not have to be rearranged into packets.
1571 .Pp
1572 Care should be taken when adding a default route through a tunneled
1573 setup like this.
1574 It is quite common for the default route
1575 (added in
1576 .Pa /etc/ppp/ppp.linkup )
1577 to end up routing the link's TCP connection through the tunnel,
1578 effectively garrotting the connection.
1579 To avoid this, make sure you add a static route for the benefit of
1580 the link:
1581 .Bd -literal -offset indent
1582 ui-gate:
1583  set escape 0xff
1584  set device ui-gate:ppp-in/tcp
1585  add ui-gate x.x.x.x
1586  .....
1587 .Ed
1588 .Pp
1589 where
1590 .Dq x.x.x.x
1591 is the IP number that your route to
1592 .Dq ui-gate
1593 would normally use.
1594 .Pp
1595 When routing your connection across a public network such as the Internet,
1596 it is preferable to encrypt the data.
1597 This can be done with the help of the MPPE protocol, although currently this
1598 means that you will not be able to also compress the traffic as MPPE is
1599 implemented as a compression layer (thank Microsoft for this).
1600 To enable MPPE encryption, add the following lines to
1601 .Pa /etc/ppp/ppp.conf
1602 on the server:
1603 .Bd -literal -offset indent
1604   enable MSCHAPv2
1605   disable deflate pred1
1606   deny deflate pred1
1607 .Ed
1608 .Pp
1609 ensuring that you have put the requisite entry in
1610 .Pa /etc/ppp/ppp.secret
1611 (MSCHAPv2 is challenge based, so
1612 .Xr passwd 5
1613 cannot be used)
1614 .Pp
1615 MSCHAPv2 and MPPE are accepted by default, so the client end should work
1616 without any additional changes (although ensure you have
1617 .Dq set authname
1618 and
1619 .Dq set authkey
1620 in your profile).
1621 .Sh NETWORK ADDRESS TRANSLATION (PACKET ALIASING)
1622 The
1623 .Fl nat
1624 command line option enables network address translation (a.k.a.\& packet
1625 aliasing).
1626 This allows the
1627 .Nm
1628 host to act as a masquerading gateway for other computers over
1629 a local area network.
1630 Outgoing IP packets are NAT'd so that they appear to come from the
1631 .Nm
1632 host, and incoming packets are de-NAT'd so that they are routed
1633 to the correct machine on the local area network.
1634 NAT allows computers on private, unregistered subnets to have Internet
1635 access, although they are invisible from the outside world.
1636 In general, correct
1637 .Nm
1638 operation should first be verified with network address translation disabled.
1639 Then, the
1640 .Fl nat
1641 option should be switched on, and network applications (web browser,
1642 .Xr telnet 1 ,
1643 .Xr ftp 1 ,
1644 .Xr ping 8 ,
1645 .Xr traceroute 8 )
1646 should be checked on the
1647 .Nm
1648 host.
1649 Finally, the same or similar applications should be checked on other
1650 computers in the LAN.
1651 If network applications work correctly on the
1652 .Nm
1653 host, but not on other machines in the LAN, then the masquerading
1654 software is working properly, but the host is either not forwarding
1655 or possibly receiving IP packets.
1656 Check that IP forwarding is enabled in
1657 .Pa /etc/rc.conf
1658 and that other machines have designated the
1659 .Nm
1660 host as the gateway for the LAN.
1661 .Sh PACKET FILTERING
1662 This implementation supports packet filtering.
1663 There are four kinds of
1664 filters: the
1665 .Em in
1666 filter, the
1667 .Em out
1668 filter, the
1669 .Em dial
1670 filter and the
1671 .Em alive
1672 filter.
1673 Here are the basics:
1674 .Bl -bullet
1675 .It
1676 A filter definition has the following syntax:
1677 .Pp
1678 set filter
1679 .Ar name
1680 .Ar rule-no
1681 .Ar action
1682 .Op !\&
1683 .Oo
1684 .Op host
1685 .Ar src_addr Ns Op / Ns Ar width
1686 .Op Ar dst_addr Ns Op / Ns Ar width
1687 .Oc
1688 .Ar [ proto Op src Ar cmp port
1689 .Op dst Ar cmp port
1690 .Op estab
1691 .Op syn
1692 .Op finrst
1693 .Op timeout Ar secs ]
1694 .Bl -enum
1695 .It
1696 .Ar Name
1697 should be one of
1698 .Sq in ,
1699 .Sq out ,
1700 .Sq dial
1701 or
1702 .Sq alive .
1703 .It
1704 .Ar Rule-no
1705 is a numeric value between
1706 .Sq 0
1707 and
1708 .Sq 39
1709 specifying the rule number.
1710 Rules are specified in numeric order according to
1711 .Ar rule-no ,
1712 but only if rule
1713 .Sq 0
1714 is defined.
1715 .It
1716 .Ar Action
1717 may be specified as
1718 .Sq permit
1719 or
1720 .Sq deny ,
1721 in which case, if a given packet matches the rule, the associated action
1722 is taken immediately.
1723 .Ar Action
1724 can also be specified as
1725 .Sq clear
1726 to clear the action associated with that particular rule, or as a new
1727 rule number greater than the current rule.
1728 In this case, if a given
1729 packet matches the current rule, the packet will next be matched against
1730 the new rule number (rather than the next rule number).
1731 .Pp
1732 The
1733 .Ar action
1734 may optionally be followed with an exclamation mark
1735 .Pq Dq !\& ,
1736 telling
1737 .Nm
1738 to reverse the sense of the following match.
1739 .It
1740 .Op Ar src_addr Ns Op / Ns Ar width
1741 and
1742 .Op Ar dst_addr Ns Op / Ns Ar width
1743 are the source and destination IP number specifications.
1744 If
1745 .Op / Ns Ar width
1746 is specified, it gives the number of relevant netmask bits,
1747 allowing the specification of an address range.
1748 .Pp
1749 Either
1750 .Ar src_addr
1751 or
1752 .Ar dst_addr
1753 may be given the values
1754 .Dv MYADDR ,
1755 .Dv HISADDR ,
1756 .Dv MYADDR6
1757 or
1758 .Dv HISADDR6
1759 (refer to the description of the
1760 .Dq bg
1761 command for a description of these values).
1762 When these values are used,
1763 the filters will be updated any time the values change.
1764 This is similar to the behaviour of the
1765 .Dq add
1766 command below.
1767 .It
1768 .Ar Proto
1769 may be any protocol from
1770 .Xr protocols 5 .
1771 .It
1772 .Ar Cmp
1773 is one of
1774 .Sq \&lt ,
1775 .Sq \&eq
1776 or
1777 .Sq \&gt ,
1778 meaning less-than, equal and greater-than respectively.
1779 .Ar Port
1780 can be specified as a numeric port or by service name from
1781 .Pa /etc/services .
1782 .It
1783 The
1784 .Sq estab ,
1785 .Sq syn ,
1786 and
1787 .Sq finrst
1788 flags are only allowed when
1789 .Ar proto
1790 is set to
1791 .Sq tcp ,
1792 and represent the TH_ACK, TH_SYN and TH_FIN or TH_RST TCP flags respectively.
1793 .It
1794 The timeout value adjusts the current idle timeout to at least
1795 .Ar secs
1796 seconds.
1797 If a timeout is given in the alive filter as well as in the in/out
1798 filter, the in/out value is used.
1799 If no timeout is given, the default timeout (set using
1800 .Ic set timeout
1801 and defaulting to 180 seconds) is used.
1802 .El
1803 .Pp
1804 .It
1805 Each filter can hold up to 40 rules, starting from rule 0.
1806 The entire rule set is not effective until rule 0 is defined,
1807 i.e., the default is to allow everything through.
1808 .It
1809 If no rule in a defined set of rules matches a packet, that packet will
1810 be discarded (blocked).
1811 If there are no rules in a given filter, the packet will be permitted.
1812 .It
1813 It is possible to filter based on the payload of UDP frames where those
1814 frames contain a
1815 .Em PROTO_IP
1816 .Em PPP
1817 frame header.
1818 See the
1819 .Ar filter-decapsulation
1820 option below for further details.
1821 .It
1822 Use
1823 .Dq set filter Ar name No -1
1824 to flush all rules.
1825 .El
1826 .Pp
1827 See
1828 .Pa /usr/share/examples/ppp/ppp.conf.sample .
1829 .Sh SETTING THE IDLE TIMER
1830 To check/set the idle timer, use the
1831 .Dq show bundle
1832 and
1833 .Dq set timeout
1834 commands:
1835 .Bd -literal -offset indent
1836 ppp ON awfulhak> set timeout 600
1837 .Ed
1838 .Pp
1839 The timeout period is measured in seconds, the default value for which
1840 is 180 seconds
1841 (or 3 min).
1842 To disable the idle timer function, use the command
1843 .Bd -literal -offset indent
1844 ppp ON awfulhak> set timeout 0
1845 .Ed
1846 .Pp
1847 In
1848 .Fl ddial
1849 and
1850 .Fl dedicated
1851 modes, the idle timeout is ignored.
1852 In
1853 .Fl auto
1854 mode, when the idle timeout causes the
1855 .Em PPP
1856 session to be
1857 closed, the
1858 .Nm
1859 program itself remains running.
1860 Another trigger packet will cause it to attempt to re-establish the link.
1861 .Sh PREDICTOR-1 and DEFLATE COMPRESSION
1862 .Nm
1863 supports both Predictor type 1 and deflate compression.
1864 By default,
1865 .Nm
1866 will attempt to use (or be willing to accept) both compression protocols
1867 when the peer agrees
1868 (or requests them).
1869 The deflate protocol is preferred by
1870 .Nm .
1871 Refer to the
1872 .Dq disable
1873 and
1874 .Dq deny
1875 commands if you wish to disable this functionality.
1876 .Pp
1877 It is possible to use a different compression algorithm in each direction
1878 by using only one of
1879 .Dq disable deflate
1880 and
1881 .Dq deny deflate
1882 (assuming that the peer supports both algorithms).
1883 .Pp
1884 By default, when negotiating DEFLATE,
1885 .Nm
1886 will use a window size of 15.
1887 Refer to the
1888 .Dq set deflate
1889 command if you wish to change this behaviour.
1890 .Pp
1891 A special algorithm called DEFLATE24 is also available, and is disabled
1892 and denied by default.
1893 This is exactly the same as DEFLATE except that
1894 it uses CCP ID 24 to negotiate.
1895 This allows
1896 .Nm
1897 to successfully negotiate DEFLATE with
1898 .Nm pppd
1899 version 2.3.*.
1900 .Sh CONTROLLING IP ADDRESS
1901 For IPv4,
1902 .Nm
1903 uses IPCP to negotiate IP addresses.
1904 Each side of the connection
1905 specifies the IP address that it is willing to use, and if the requested
1906 IP address is acceptable then
1907 .Nm
1908 returns an ACK to the requester.
1909 Otherwise,
1910 .Nm
1911 returns NAK to suggest that the peer use a different IP address.
1912 When
1913 both sides of the connection agree to accept the received request (and
1914 send an ACK), IPCP is set to the open state and a network level connection
1915 is established.
1916 To control this IPCP behaviour, this implementation has the
1917 .Dq set ifaddr
1918 command for defining the local and remote IP address:
1919 .Bd -ragged -offset indent
1920 .No set ifaddr Oo Ar src_addr Ns
1921 .Op / Ns Ar \&nn
1922 .Oo Ar dst_addr Ns Op / Ns Ar \&nn
1923 .Oo Ar netmask
1924 .Op Ar trigger_addr
1925 .Oc
1926 .Oc
1927 .Oc
1928 .Ed
1929 .Pp
1930 where,
1931 .Sq src_addr
1932 is the IP address that the local side is willing to use,
1933 .Sq dst_addr
1934 is the IP address which the remote side should use and
1935 .Sq netmask
1936 is the netmask that should be used.
1937 .Sq Src_addr
1938 defaults to the current
1939 .Xr hostname 1 ,
1940 .Sq dst_addr
1941 defaults to 0.0.0.0, and
1942 .Sq netmask
1943 defaults to whatever mask is appropriate for
1944 .Sq src_addr .
1945 It is only possible to make
1946 .Sq netmask
1947 smaller than the default.
1948 The usual value is 255.255.255.255, as
1949 most kernels ignore the netmask of a POINTOPOINT interface.
1950 .Pp
1951 Some incorrect
1952 .Em PPP
1953 implementations require that the peer negotiates a specific IP
1954 address instead of
1955 .Sq src_addr .
1956 If this is the case,
1957 .Sq trigger_addr
1958 may be used to specify this IP number.
1959 This will not affect the
1960 routing table unless the other side agrees with this proposed number.
1961 .Bd -literal -offset indent
1962 set ifaddr 192.244.177.38 192.244.177.2 255.255.255.255 0.0.0.0
1963 .Ed
1964 .Pp
1965 The above specification means:
1966 .Pp
1967 .Bl -bullet -compact
1968 .It
1969 I will first suggest that my IP address should be 0.0.0.0, but I
1970 will only accept an address of 192.244.177.38.
1971 .It
1972 I strongly insist that the peer uses 192.244.177.2 as his own
1973 address and will not permit the use of any IP address but 192.244.177.2.
1974 When the peer requests another IP address, I will always suggest that
1975 it uses 192.244.177.2.
1976 .It
1977 The routing table entry will have a netmask of 0xffffffff.
1978 .El
1979 .Pp
1980 This is all fine when each side has a pre-determined IP address, however
1981 it is often the case that one side is acting as a server which controls
1982 all IP addresses and the other side should go along with it.
1983 In order to allow more flexible behaviour, the
1984 .Dq set ifaddr
1985 command allows the user to specify IP addresses more loosely:
1986 .Pp
1987 .Dl set ifaddr 192.244.177.38/24 192.244.177.2/20
1988 .Pp
1989 A number followed by a slash
1990 .Pq Dq /
1991 represents the number of bits significant in the IP address.
1992 The above example means:
1993 .Pp
1994 .Bl -bullet -compact
1995 .It
1996 I would like to use 192.244.177.38 as my address if it is possible, but I will
1997 also accept any IP address between 192.244.177.0 and 192.244.177.255.
1998 .It
1999 I would like to make him use 192.244.177.2 as his own address, but I will also
2000 permit him to use any IP address between 192.244.176.0 and
2001 192.244.191.255.
2002 .It
2003 As you may have already noticed, 192.244.177.2 is equivalent to saying
2004 192.244.177.2/32.
2005 .It
2006 As an exception, 0 is equivalent to 0.0.0.0/0, meaning that I have no
2007 preferred IP address and will obey the remote peers selection.
2008 When using zero, no routing table entries will be made until a connection
2009 is established.
2010 .It
2011 192.244.177.2/0 means that I will accept/permit any IP address but I will
2012 suggest that 192.244.177.2 be used first.
2013 .El
2014 .Pp
2015 When negotiating IPv6 addresses, no control is given to the user.
2016 IPV6CP negotiation is fully automatic.
2017 .Sh CONNECTING WITH YOUR INTERNET SERVICE PROVIDER
2018 The following steps should be taken when connecting to your ISP:
2019 .Bl -enum
2020 .It
2021 Describe your providers phone number(s) in the dial script using the
2022 .Dq set phone
2023 command.
2024 This command allows you to set multiple phone numbers for
2025 dialing and redialing separated by either a pipe
2026 .Pq Dq \&|
2027 or a colon
2028 .Pq Dq \&: :
2029 .Bd -ragged -offset indent
2030 .No set phone Ar telno Ns
2031 .Oo \&| Ns Ar backupnumber Oc Ns ... Ns Oo : Ns Ar nextnumber Oc Ns ...
2032 .Ed
2033 .Pp
2034 Numbers after the first in a pipe-separated list are only used if the
2035 previous number was used in a failed dial or login script.
2036 Numbers
2037 separated by a colon are used sequentially, irrespective of what happened
2038 as a result of using the previous number.
2039 For example:
2040 .Bd -literal -offset indent
2041 set phone "1234567|2345678:3456789|4567890"
2042 .Ed
2043 .Pp
2044 Here, the 1234567 number is attempted.
2045 If the dial or login script fails,
2046 the 2345678 number is used next time, but *only* if the dial or login script
2047 fails.
2048 On the dial after this, the 3456789 number is used.
2049 The 4567890
2050 number is only used if the dial or login script using the 3456789 fails.
2051 If the login script of the 2345678 number fails, the next number is still the
2052 3456789 number.
2053 As many pipes and colons can be used as are necessary
2054 (although a given site would usually prefer to use either the pipe or the
2055 colon, but not both).
2056 The next number redial timeout is used between all numbers.
2057 When the end of the list is reached, the normal redial period is
2058 used before starting at the beginning again.
2059 The selected phone number is substituted for the \\\\T string in the
2060 .Dq set dial
2061 command (see below).
2062 .It
2063 Set up your redial requirements using
2064 .Dq set redial .
2065 For example, if you have a bad telephone line or your provider is
2066 usually engaged (not so common these days), you may want to specify
2067 the following:
2068 .Bd -literal -offset indent
2069 set redial 10 4
2070 .Ed
2071 .Pp
2072 This says that up to 4 phone calls should be attempted with a pause of 10
2073 seconds before dialing the first number again.
2074 .It
2075 Describe your login procedure using the
2076 .Dq set dial
2077 and
2078 .Dq set login
2079 commands.
2080 The
2081 .Dq set dial
2082 command is used to talk to your modem and establish a link with your
2083 ISP, for example:
2084 .Bd -literal -offset indent
2085 set dial "ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 4 \\"\\" \e
2086   ATZ OK-ATZ-OK ATDT\\\\T TIMEOUT 60 CONNECT"
2087 .Ed
2088 .Pp
2089 This modem "chat" string means:
2090 .Bl -bullet
2091 .It
2092 Abort if the string "BUSY" or "NO CARRIER" are received.
2093 .It
2094 Set the timeout to 4 seconds.
2095 .It
2096 Expect nothing.
2097 .It
2098 Send ATZ.
2099 .It
2100 Expect OK.
2101 If that is not received within the 4 second timeout, send ATZ
2102 and expect OK.
2103 .It
2104 Send ATDTxxxxxxx where xxxxxxx is the next number in the phone list from
2105 above.
2106 .It
2107 Set the timeout to 60.
2108 .It
2109 Wait for the CONNECT string.
2110 .El
2111 .Pp
2112 Once the connection is established, the login script is executed.
2113 This script is written in the same style as the dial script, but care should
2114 be taken to avoid having your password logged:
2115 .Bd -literal -offset indent
2116 set authkey MySecret
2117 set login "TIMEOUT 15 login:-\\\\r-login: awfulhak \e
2118   word: \\\\P ocol: PPP HELLO"
2119 .Ed
2120 .Pp
2121 This login "chat" string means:
2122 .Bl -bullet
2123 .It
2124 Set the timeout to 15 seconds.
2125 .It
2126 Expect "login:".
2127 If it is not received, send a carriage return and expect
2128 "login:" again.
2129 .It
2130 Send "awfulhak"
2131 .It
2132 Expect "word:" (the tail end of a "Password:" prompt).
2133 .It
2134 Send whatever our current
2135 .Ar authkey
2136 value is set to.
2137 .It
2138 Expect "ocol:" (the tail end of a "Protocol:" prompt).
2139 .It
2140 Send "PPP".
2141 .It
2142 Expect "HELLO".
2143 .El
2144 .Pp
2145 The
2146 .Dq set authkey
2147 command is logged specially.
2148 When
2149 .Ar command
2150 or
2151 .Ar chat
2152 logging is enabled, the actual password is not logged;
2153 .Sq ********
2154 is logged instead.
2155 .Pp
2156 Login scripts vary greatly between ISPs.
2157 If you are setting one up for the first time,
2158 .Em ENABLE CHAT LOGGING
2159 so that you can see if your script is behaving as you expect.
2160 .It
2161 Use
2162 .Dq set device
2163 and
2164 .Dq set speed
2165 to specify your serial line and speed, for example:
2166 .Bd -literal -offset indent
2167 set device /dev/cuau0
2168 set speed 115200
2169 .Ed
2170 .Pp
2171 Cuad0 is the first serial port on
2172 .Fx .
2173 If you are running
2174 .Nm
2175 on
2176 .Ox ,
2177 cua00 is the first.
2178 A speed of 115200 should be specified
2179 if you have a modem capable of bit rates of 28800 or more.
2180 In general, the serial speed should be about four times the modem speed.
2181 .It
2182 Use the
2183 .Dq set ifaddr
2184 command to {define} the IP address.
2185 .Bl -bullet
2186 .It
2187 If you know what IP address your provider uses, then use it as the remote
2188 address (dst_addr), otherwise choose something like 10.0.0.2/0 (see below).
2189 .It
2190 If your provider has assigned a particular IP address to you, then use
2191 it as your address (src_addr).
2192 .It
2193 If your provider assigns your address dynamically, choose a suitably
2194 unobtrusive and unspecific IP number as your address.
2195 10.0.0.1/0 would be appropriate.
2196 The bit after the / specifies how many bits of the
2197 address you consider to be important, so if you wanted to insist on
2198 something in the class C network 1.2.3.0, you could specify 1.2.3.1/24.
2199 .It
2200 If you find that your ISP accepts the first IP number that you suggest,
2201 specify third and forth arguments of
2202 .Dq 0.0.0.0 .
2203 This will force your ISP to assign a number.
2204 (The third argument will
2205 be ignored as it is less restrictive than the default mask for your
2206 .Sq src_addr ) .
2207 .El
2208 .Pp
2209 An example for a connection where you do not know your IP number or your
2210 ISPs IP number would be:
2211 .Bd -literal -offset indent
2212 set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0
2213 .Ed
2214 .Pp
2215 .It
2216 In most cases, your ISP will also be your default router.
2217 If this is the case, add the line
2218 .Bd -literal -offset indent
2219 add default HISADDR
2220 .Ed
2221 .Pp
2222 to
2223 .Pa /etc/ppp/ppp.conf
2224 (or to
2225 .Pa /etc/ppp/ppp.linkup
2226 for setups that do not use
2227 .Fl auto
2228 mode).
2229 .Pp
2230 This tells
2231 .Nm
2232 to add a default route to whatever the peer address is
2233 (10.0.0.2 in this example).
2234 This route is
2235 .Sq sticky ,
2236 meaning that should the value of
2237 .Dv HISADDR
2238 change, the route will be updated accordingly.
2239 .It
2240 If your provider requests that you use PAP/CHAP authentication methods, add
2241 the next lines to your
2242 .Pa /etc/ppp/ppp.conf
2243 file:
2244 .Bd -literal -offset indent
2245 set authname MyName
2246 set authkey MyPassword
2247 .Ed
2248 .Pp
2249 Both are accepted by default, so
2250 .Nm
2251 will provide whatever your ISP requires.
2252 .Pp
2253 It should be noted that a login script is rarely (if ever) required
2254 when PAP or CHAP are in use.
2255 .It
2256 Ask your ISP to authenticate your nameserver address(es) with the line
2257 .Bd -literal -offset indent
2258 enable dns
2259 .Ed
2260 .Pp
2261 Do
2262 .Em NOT
2263 do this if you are running a local DNS unless you also either use
2264 .Dq resolv readonly
2265 or have
2266 .Dq resolv restore
2267 in
2268 .Pa /etc/ppp/ppp.linkdown ,
2269 as
2270 .Nm
2271 will simply circumvent its use by entering some nameserver lines in
2272 .Pa /etc/resolv.conf .
2273 .El
2274 .Pp
2275 Please refer to
2276 .Pa /usr/share/examples/ppp/ppp.conf.sample
2277 and
2278 .Pa /usr/share/examples/ppp/ppp.linkup.sample
2279 for some real examples.
2280 The pmdemand label should be appropriate for most ISPs.
2281 .Sh LOGGING FACILITY
2282 .Nm
2283 is able to generate the following log info either via
2284 .Xr syslog 3
2285 or directly to the screen:
2286 .Pp
2287 .Bl -tag -width XXXXXXXXX -offset XXX -compact
2288 .It Li All
2289 Enable all logging facilities.
2290 This generates a lot of log.
2291 The most common use of 'all' is as a basis, where you remove some facilities
2292 after enabling 'all' ('debug' and 'timer' are usually best disabled.)
2293 .It Li Async
2294 Dump async level packet in hex.
2295 .It Li CBCP
2296 Generate CBCP (CallBack Control Protocol) logs.
2297 .It Li CCP
2298 Generate a CCP packet trace.
2299 .It Li Chat
2300 Generate
2301 .Sq dial ,
2302 .Sq login ,
2303 .Sq logout
2304 and
2305 .Sq hangup
2306 chat script trace logs.
2307 .It Li Command
2308 Log commands executed either from the command line or any of the configuration
2309 files.
2310 .It Li Connect
2311 Log Chat lines containing the string "CONNECT".
2312 .It Li Debug
2313 Log debug information.
2314 .It Li DNS
2315 Log DNS QUERY packets.
2316 .It Li Filter
2317 Log packets permitted by the dial filter and denied by any filter.
2318 .It Li HDLC
2319 Dump HDLC packet in hex.
2320 .It Li ID0
2321 Log all function calls specifically made as user id 0.
2322 .It Li IPCP
2323 Generate an IPCP packet trace.
2324 .It Li LCP
2325 Generate an LCP packet trace.
2326 .It Li LQM
2327 Generate LQR reports.
2328 .It Li Phase
2329 Phase transition log output.
2330 .It Li Physical
2331 Dump physical level packet in hex.
2332 .It Li Radius
2333 Dump RADIUS information.
2334 RADIUS information resulting from the link coming up or down is logged at
2335 .Dq Phase
2336 level unless
2337 .Dq Radius
2338 logging is enabled.
2339 This log level is most useful for monitoring RADIUS alive information.
2340 .It Li Sync
2341 Dump sync level packet in hex.
2342 .It Li TCP/IP
2343 Dump all TCP/IP packets.
2344 .It Li Timer
2345 Log timer manipulation.
2346 .It Li TUN
2347 Include the tun device on each log line.
2348 .It Li Warning
2349 Output to the terminal device.
2350 If there is currently no terminal,
2351 output is sent to the log file using syslogs
2352 .Dv LOG_WARNING .
2353 .It Li Error
2354 Output to both the terminal device
2355 and the log file using syslogs
2356 .Dv LOG_ERROR .
2357 .It Li Alert
2358 Output to the log file using
2359 .Dv LOG_ALERT .
2360 .El
2361 .Pp
2362 The
2363 .Dq set log
2364 command allows you to set the logging output level.
2365 Multiple levels can be specified on a single command line.
2366 The default is equivalent to
2367 .Dq set log Phase .
2368 .Pp
2369 It is also possible to log directly to the screen.
2370 The syntax is the same except that the word
2371 .Dq local
2372 should immediately follow
2373 .Dq set log .
2374 The default is
2375 .Dq set log local
2376 (i.e., only the un-maskable warning, error and alert output).
2377 .Pp
2378 If The first argument to
2379 .Dq set log Op local
2380 begins with a
2381 .Sq +
2382 or a
2383 .Sq -
2384 character, the current log levels are
2385 not cleared, for example:
2386 .Bd -literal -offset indent
2387 PPP ON awfulhak> set log phase
2388 PPP ON awfulhak> show log
2389 Log:   Phase Warning Error Alert
2390 Local: Warning Error Alert
2391 PPP ON awfulhak> set log +tcp/ip -warning
2392 PPP ON awfulhak> set log local +command
2393 PPP ON awfulhak> show log
2394 Log:   Phase TCP/IP Warning Error Alert
2395 Local: Command Warning Error Alert
2396 .Ed
2397 .Pp
2398 Log messages of level Warning, Error and Alert are not controllable
2399 using
2400 .Dq set log Op local .
2401 .Pp
2402 The
2403 .Ar Warning
2404 level is special in that it will not be logged if it can be displayed
2405 locally.
2406 .Sh SIGNAL HANDLING
2407 .Nm
2408 deals with the following signals:
2409 .Bl -tag -width "USR2"
2410 .It INT
2411 Receipt of this signal causes the termination of the current connection
2412 (if any).
2413 This will cause
2414 .Nm
2415 to exit unless it is in
2416 .Fl auto
2417 or
2418 .Fl ddial
2419 mode.
2420 .It HUP, TERM & QUIT
2421 These signals tell
2422 .Nm
2423 to exit.
2424 .It USR1
2425 This signal, tells
2426 .Nm
2427 to re-open any existing server socket, dropping all existing diagnostic
2428 connections.
2429 Sockets that could not previously be opened will be retried.
2430 .It USR2
2431 This signal, tells
2432 .Nm
2433 to close any existing server socket, dropping all existing diagnostic
2434 connections.
2435 .Dv SIGUSR1
2436 can still be used to re-open the socket.
2437 .El
2438 .Sh MULTI-LINK PPP
2439 If you wish to use more than one physical link to connect to a
2440 .Em PPP
2441 peer, that peer must also understand the
2442 .Em MULTI-LINK PPP
2443 protocol.
2444 Refer to RFC 1990 for specification details.
2445 .Pp
2446 The peer is identified using a combination of his
2447 .Dq endpoint discriminator
2448 and his
2449 .Dq authentication id .
2450 Either or both of these may be specified.
2451 It is recommended that
2452 at least one is specified, otherwise there is no way of ensuring that
2453 all links are actually connected to the same peer program, and some
2454 confusing lock-ups may result.
2455 Locally, these identification variables are specified using the
2456 .Dq set enddisc
2457 and
2458 .Dq set authname
2459 commands.
2460 The
2461 .Sq authname
2462 (and
2463 .Sq authkey )
2464 must be agreed in advance with the peer.
2465 .Pp
2466 Multi-link capabilities are enabled using the
2467 .Dq set mrru
2468 command (set maximum reconstructed receive unit).
2469 Once multi-link is enabled,
2470 .Nm
2471 will attempt to negotiate a multi-link connection with the peer.
2472 .Pp
2473 By default, only one
2474 .Sq link
2475 is available
2476 (called
2477 .Sq deflink ) .
2478 To create more links, the
2479 .Dq clone
2480 command is used.
2481 This command will clone existing links, where all
2482 characteristics are the same except:
2483 .Bl -enum
2484 .It
2485 The new link has its own name as specified on the
2486 .Dq clone
2487 command line.
2488 .It
2489 The new link is an
2490 .Sq interactive
2491 link.
2492 Its mode may subsequently be changed using the
2493 .Dq set mode
2494 command.
2495 .It
2496 The new link is in a
2497 .Sq closed
2498 state.
2499 .El
2500 .Pp
2501 A summary of all available links can be seen using the
2502 .Dq show links
2503 command.
2504 .Pp
2505 Once a new link has been created, command usage varies.
2506 All link specific commands must be prefixed with the
2507 .Dq link Ar name
2508 command, specifying on which link the command is to be applied.
2509 When only a single link is available,
2510 .Nm
2511 is smart enough not to require the
2512 .Dq link Ar name
2513 prefix.
2514 .Pp
2515 Some commands can still be used without specifying a link - resulting
2516 in an operation at the
2517 .Sq bundle
2518 level.
2519 For example, once two or more links are available, the command
2520 .Dq show ccp
2521 will show CCP configuration and statistics at the multi-link level, and
2522 .Dq link deflink show ccp
2523 will show the same information at the
2524 .Dq deflink
2525 link level.
2526 .Pp
2527 Armed with this information, the following configuration might be used:
2528 .Bd -literal -offset indent
2529 mp:
2530  set timeout 0
2531  set log phase chat
2532  set device /dev/cuau0 /dev/cuau1 /dev/cuau2
2533  set phone "123456789"
2534  set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \\"\\" ATZ \e
2535            OK-AT-OK \\\\dATDT\\\\T TIMEOUT 45 CONNECT"
2536  set login
2537  set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0
2538  set authname ppp
2539  set authkey ppppassword
2540
2541  set mrru 1500
2542  clone 1,2,3            # Create 3 new links - duplicates of the default
2543  link deflink remove    # Delete the default link (called ``deflink'')
2544 .Ed
2545 .Pp
2546 Note how all cloning is done at the end of the configuration.
2547 Usually, the link will be configured first, then cloned.
2548 If you wish all links
2549 to be up all the time, you can add the following line to the end of your
2550 configuration.
2551 .Bd -literal -offset indent
2552   link 1,2,3 set mode ddial
2553 .Ed
2554 .Pp
2555 If you want the links to dial on demand, this command could be used:
2556 .Bd -literal -offset indent
2557   link * set mode auto
2558 .Ed
2559 .Pp
2560 Links may be tied to specific names by removing the
2561 .Dq set device
2562 line above, and specifying the following after the
2563 .Dq clone
2564 command:
2565 .Bd -literal -offset indent
2566  link 1 set device /dev/cuau0
2567  link 2 set device /dev/cuau1
2568  link 3 set device /dev/cuau2
2569 .Ed
2570 .Pp
2571 Use the
2572 .Dq help
2573 command to see which commands require context (using the
2574 .Dq link
2575 command), which have optional
2576 context and which should not have any context.
2577 .Pp
2578 When
2579 .Nm
2580 has negotiated
2581 .Em MULTI-LINK
2582 mode with the peer, it creates a local domain socket in the
2583 .Pa /var/run
2584 directory.
2585 This socket is used to pass link information (including
2586 the actual link file descriptor) between different
2587 .Nm
2588 invocations.
2589 This facilitates
2590 .Nm Ns No 's
2591 ability to be run from a
2592 .Xr getty 8
2593 or directly from
2594 .Pa /etc/gettydefs
2595 (using the
2596 .Sq pp=
2597 capability), without needing to have initial control of the serial
2598 line.
2599 Once
2600 .Nm
2601 negotiates multi-link mode, it will pass its open link to any
2602 already running process.
2603 If there is no already running process,
2604 .Nm
2605 will act as the master, creating the socket and listening for new
2606 connections.
2607 .Sh PPP COMMAND LIST
2608 This section lists the available commands and their effect.
2609 They are usable either from an interactive
2610 .Nm
2611 session, from a configuration file or from a
2612 .Xr pppctl 8
2613 or
2614 .Xr telnet 1
2615 session.
2616 .Bl -tag -width 2n
2617 .It accept|deny|enable|disable Ar option....
2618 These directives tell
2619 .Nm
2620 how to negotiate the initial connection with the peer.
2621 Each
2622 .Dq option
2623 has a default of either accept or deny and enable or disable.
2624 .Dq Accept
2625 means that the option will be ACK'd if the peer asks for it.
2626 .Dq Deny
2627 means that the option will be NAK'd if the peer asks for it.
2628 .Dq Enable
2629 means that the option will be requested by us.
2630 .Dq Disable
2631 means that the option will not be requested by us.
2632 .Pp
2633 .Dq Option
2634 may be one of the following:
2635 .Bl -tag -width 2n
2636 .It acfcomp
2637 Default: Enabled and Accepted.
2638 ACFComp stands for Address and Control Field Compression.
2639 Non LCP packets will usually have an address
2640 field of 0xff (the All-Stations address) and a control field of
2641 0x03 (the Unnumbered Information command).
2642 If this option is
2643 negotiated, these two bytes are simply not sent, thus minimising
2644 traffic.
2645 .Pp
2646 See
2647 .Pa rfc1662
2648 for details.
2649 .It chap Ns Op \&05
2650 Default: Disabled and Accepted.
2651 CHAP stands for Challenge Handshake Authentication Protocol.
2652 Only one of CHAP and PAP (below) may be negotiated.
2653 With CHAP, the authenticator sends a "challenge" message to its peer.
2654 The peer uses a one-way hash function to encrypt the
2655 challenge and sends the result back.
2656 The authenticator does the same, and compares the results.
2657 The advantage of this mechanism is that no
2658 passwords are sent across the connection.
2659 A challenge is made when the connection is first made.
2660 Subsequent challenges may occur.
2661 If you want to have your peer authenticate itself, you must
2662 .Dq enable chap .
2663 in
2664 .Pa /etc/ppp/ppp.conf ,
2665 and have an entry in
2666 .Pa /etc/ppp/ppp.secret
2667 for the peer.
2668 .Pp
2669 When using CHAP as the client, you need only specify
2670 .Dq AuthName
2671 and
2672 .Dq AuthKey
2673 in
2674 .Pa /etc/ppp/ppp.conf .
2675 CHAP is accepted by default.
2676 Some
2677 .Em PPP
2678 implementations use "MS-CHAP" rather than MD5 when encrypting the
2679 challenge.
2680 MS-CHAP is a combination of MD4 and DES.
2681 If
2682 .Nm
2683 was built on a machine with DES libraries available, it will respond
2684 to MS-CHAP authentication requests, but will never request them.
2685 .It deflate
2686 Default: Enabled and Accepted.
2687 This option decides if deflate
2688 compression will be used by the Compression Control Protocol (CCP).
2689 This is the same algorithm as used by the
2690 .Xr gzip 1
2691 program.
2692 Note: There is a problem negotiating
2693 .Ar deflate
2694 capabilities with
2695 .Nm pppd
2696 - a
2697 .Em PPP
2698 implementation available under many operating systems.
2699 .Nm pppd
2700 (version 2.3.1) incorrectly attempts to negotiate
2701 .Ar deflate
2702 compression using type
2703 .Em 24
2704 as the CCP configuration type rather than type
2705 .Em 26
2706 as specified in
2707 .Pa rfc1979 .
2708 Type
2709 .Ar 24
2710 is actually specified as
2711 .Dq PPP Magna-link Variable Resource Compression
2712 in
2713 .Pa rfc1975 !
2714 .Nm
2715 is capable of negotiating with
2716 .Nm pppd ,
2717 but only if
2718 .Dq deflate24
2719 is
2720 .Ar enable Ns No d
2721 and
2722 .Ar accept Ns No ed .
2723 .It deflate24
2724 Default: Disabled and Denied.
2725 This is a variance of the
2726 .Ar deflate
2727 option, allowing negotiation with the
2728 .Nm pppd
2729 program.
2730 Refer to the
2731 .Ar deflate
2732 section above for details.
2733 It is disabled by default as it violates
2734 .Pa rfc1975 .
2735 .It dns
2736 Default: Disabled and Denied.
2737 This option allows DNS negotiation.
2738 .Pp
2739 If
2740 .Dq enable Ns No d,
2741 .Nm
2742 will request that the peer confirms the entries in
2743 .Pa /etc/resolv.conf .
2744 If the peer NAKs our request (suggesting new IP numbers),
2745 .Pa /etc/resolv.conf
2746 is updated and another request is sent to confirm the new entries.
2747 .Pp
2748 If
2749 .Dq accept Ns No ed,
2750 .Nm
2751 will answer any DNS queries requested by the peer rather than rejecting
2752 them.
2753 The answer is taken from
2754 .Pa /etc/resolv.conf
2755 unless the
2756 .Dq set dns
2757 command is used as an override.
2758 .It enddisc
2759 Default: Enabled and Accepted.
2760 This option allows control over whether we
2761 negotiate an endpoint discriminator.
2762 We only send our discriminator if
2763 .Dq set enddisc
2764 is used and
2765 .Ar enddisc
2766 is enabled.
2767 We reject the peers discriminator if
2768 .Ar enddisc
2769 is denied.
2770 .It LANMan|chap80lm
2771 Default: Disabled and Accepted.
2772 The use of this authentication protocol
2773 is discouraged as it partially violates the authentication protocol by
2774 implementing two different mechanisms (LANMan & NT) under the guise of
2775 a single CHAP type (0x80).
2776 .Dq LANMan
2777 uses a simple DES encryption mechanism and is the least secure of the
2778 CHAP alternatives (although is still more secure than PAP).
2779 .Pp
2780 Refer to the
2781 .Dq MSChap
2782 description below for more details.
2783 .It lqr
2784 Default: Disabled and Accepted.
2785 This option decides if Link Quality Requests will be sent or accepted.
2786 LQR is a protocol that allows
2787 .Nm
2788 to determine that the link is down without relying on the modems
2789 carrier detect.
2790 When LQR is enabled,
2791 .Nm
2792 sends the
2793 .Em QUALPROTO
2794 option (see
2795 .Dq set lqrperiod
2796 below) as part of the LCP request.
2797 If the peer agrees, both sides will
2798 exchange LQR packets at the agreed frequency, allowing detailed link
2799 quality monitoring by enabling LQM logging.
2800 If the peer does not agree, and if the
2801 .Dq echo
2802 option is enabled,
2803 .Nm
2804 will send
2805 .Em LCP ECHO
2806 requests instead.
2807 These packets pass no information of interest, but they
2808 .Em MUST
2809 be replied to by the peer.
2810 .Pp
2811 Whether using
2812 .Em LQR
2813 or
2814 .Em LCP ECHO ,
2815 .Nm
2816 will abruptly drop the connection if 5 unacknowledged packets have been
2817 sent rather than sending a 6th.
2818 A message is logged at the
2819 .Em PHASE
2820 level, and any appropriate
2821 .Dq reconnect
2822 values are honoured as if the peer were responsible for dropping the
2823 connection.
2824 .Pp
2825 Refer to the
2826 .Dq enable echo
2827 command description for differences in behaviour prior to
2828 .Nm
2829 version 3.4.2.
2830 .It mppe
2831 Default: Enabled and Accepted.
2832 This is Microsoft Point to Point Encryption scheme.
2833 MPPE key size can be
2834 40-, 56- and 128-bits.
2835 Refer to
2836 .Dq set mppe
2837 command.
2838 .It MSChapV2|chap81
2839 Default: Disabled and Accepted.
2840 It is very similar to standard CHAP (type 0x05)
2841 except that it issues challenges of a fixed 16 bytes in length and uses a
2842 combination of MD4, SHA-1 and DES to encrypt the challenge rather than using the
2843 standard MD5 mechanism.
2844 .It MSChap|chap80nt
2845 Default: Disabled and Accepted.
2846 The use of this authentication protocol
2847 is discouraged as it partially violates the authentication protocol by
2848 implementing two different mechanisms (LANMan & NT) under the guise of
2849 a single CHAP type (0x80).
2850 It is very similar to standard CHAP (type 0x05)
2851 except that it issues challenges of a fixed 8 bytes in length and uses a
2852 combination of MD4 and DES to encrypt the challenge rather than using the
2853 standard MD5 mechanism.
2854 CHAP type 0x80 for LANMan is also supported - see
2855 .Dq enable LANMan
2856 for details.
2857 .Pp
2858 Because both
2859 .Dq LANMan
2860 and
2861 .Dq NT
2862 use CHAP type 0x80, when acting as authenticator with both
2863 .Dq enable Ns No d ,
2864 .Nm
2865 will rechallenge the peer up to three times if it responds using the wrong
2866 one of the two protocols.
2867 This gives the peer a chance to attempt using both protocols.
2868 .Pp
2869 Conversely, when
2870 .Nm
2871 acts as the authenticatee with both protocols
2872 .Dq accept Ns No ed ,
2873 the protocols are used alternately in response to challenges.
2874 .Pp
2875 Note: If only LANMan is enabled,
2876 .Nm pppd
2877 (version 2.3.5) misbehaves when acting as authenticatee.
2878 It provides both
2879 the NT and the LANMan answers, but also suggests that only the NT answer
2880 should be used.
2881 .It pap
2882 Default: Disabled and Accepted.
2883 PAP stands for Password Authentication Protocol.
2884 Only one of PAP and CHAP (above) may be negotiated.
2885 With PAP, the ID and Password are sent repeatedly to the peer until
2886 authentication is acknowledged or the connection is terminated.
2887 This is a rather poor security mechanism.
2888 It is only performed when the connection is first established.
2889 If you want to have your peer authenticate itself, you must
2890 .Dq enable pap .
2891 in
2892 .Pa /etc/ppp/ppp.conf ,
2893 and have an entry in
2894 .Pa /etc/ppp/ppp.secret
2895 for the peer (although see the
2896 .Dq passwdauth
2897 and
2898 .Dq set radius
2899 options below).
2900 .Pp
2901 When using PAP as the client, you need only specify
2902 .Dq AuthName
2903 and
2904 .Dq AuthKey
2905 in
2906 .Pa /etc/ppp/ppp.conf .
2907 PAP is accepted by default.
2908 .It pred1
2909 Default: Enabled and Accepted.
2910 This option decides if Predictor 1
2911 compression will be used by the Compression Control Protocol (CCP).
2912 .It protocomp
2913 Default: Enabled and Accepted.
2914 This option is used to negotiate
2915 PFC (Protocol Field Compression), a mechanism where the protocol
2916 field number is reduced to one octet rather than two.
2917 .It shortseq
2918 Default: Enabled and Accepted.
2919 This option determines if
2920 .Nm
2921 will request and accept requests for short
2922 (12 bit)
2923 sequence numbers when negotiating multi-link mode.
2924 This is only applicable if our MRRU is set (thus enabling multi-link).
2925 .It vjcomp
2926 Default: Enabled and Accepted.
2927 This option determines if Van Jacobson header compression will be used.
2928 .El
2929 .Pp
2930 The following options are not actually negotiated with the peer.
2931 Therefore, accepting or denying them makes no sense.
2932 .Bl -tag -width 2n
2933 .It echo
2934 Default: Disabled.
2935 When this option is enabled,
2936 .Nm
2937 will send
2938 .Em LCP ECHO
2939 requests to the peer at the frequency defined by
2940 .Dq echoperiod .
2941 Note,
2942 .Em LQR
2943 requests will supersede
2944 .Em LCP ECHO
2945 requests if enabled and negotiated.
2946 See
2947 .Dq set lqrperiod
2948 below for details.
2949 .Pp
2950 Prior to
2951 .Nm
2952 version 3.4.2,
2953 .Dq echo
2954 was considered enabled if lqr was enabled and negotiated, otherwise it was
2955 considered disabled.
2956 For the same behaviour, it is now necessary to
2957 .Dq enable lqr echo
2958 rather than just
2959 .Dq enable lqr .
2960 .It filter-decapsulation
2961 Default: Disabled.
2962 When this option is enabled,
2963 .Nm
2964 will examine UDP frames to see if they actually contain a
2965 .Em PPP
2966 frame as their payload.
2967 If this is the case, all filters will operate on the payload rather
2968 than the actual packet.
2969 .Pp
2970 This is useful if you want to send PPPoUDP traffic over a
2971 .Em PPP
2972 link, but want that link to do smart things with the real data rather than
2973 the UDP wrapper.
2974 .Pp
2975 The UDP frame payload must not be compressed in any way, otherwise
2976 .Nm
2977 will not be able to interpret it.
2978 It is therefore recommended that you
2979 .Ic disable vj pred1 deflate
2980 and
2981 .Ic deny vj pred1 deflate
2982 in the configuration for the
2983 .Nm
2984 invocation with the udp link.
2985 .It force-scripts
2986 Default: Disabled.
2987 Forces execution of the configured chat scripts in
2988 .Dv direct
2989 and
2990 .Dv dedicated
2991 modes.
2992 .It idcheck
2993 Default: Enabled.
2994 When
2995 .Nm
2996 exchanges low-level LCP, CCP and IPCP configuration traffic, the
2997 .Em Identifier
2998 field of any replies is expected to be the same as that of the request.
2999 By default,
3000 .Nm
3001 drops any reply packets that do not contain the expected identifier
3002 field, reporting the fact at the respective log level.
3003 If
3004 .Ar idcheck
3005 is disabled,
3006 .Nm
3007 will ignore the identifier field.
3008 .It iface-alias
3009 Default: Enabled if
3010 .Fl nat
3011 is specified.
3012 This option simply tells
3013 .Nm
3014 to add new interface addresses to the interface rather than replacing them.
3015 The option can only be enabled if network address translation is enabled
3016 .Pq Dq nat enable yes .
3017 .Pp
3018 With this option enabled,
3019 .Nm
3020 will pass traffic for old interface addresses through the NAT
3021 ifdef({LOCALNAT},{engine,},{engine
3022 (see
3023 .Xr libalias 3 ) ,})
3024 resulting in the ability (in
3025 .Fl auto
3026 mode) to properly connect the process that caused the PPP link to
3027 come up in the first place.
3028 .Pp
3029 Disabling NAT with
3030 .Dq nat enable no
3031 will also disable
3032 .Sq iface-alias .
3033 .It ipcp
3034 Default: Enabled.
3035 This option allows
3036 .Nm
3037 to attempt to negotiate IP control protocol capabilities and if
3038 successful to exchange IP datagrams with the peer.
3039 .It ipv6cp
3040 Default: Enabled.
3041 This option allows
3042 .Nm
3043 to attempt to negotiate IPv6 control protocol capabilities and if
3044 successful to exchange IPv6 datagrams with the peer.
3045 .It keep-session
3046 Default: Disabled.
3047 When
3048 .Nm
3049 runs as a Multi-link server, a different
3050 .Nm
3051 instance initially receives each connection.
3052 After determining that
3053 the link belongs to an already existing bundle (controlled by another
3054 .Nm
3055 invocation),
3056 .Nm
3057 will transfer the link to that process.
3058 .Pp
3059 If the link is a tty device or if this option is enabled,
3060 .Nm
3061 will not exit, but will change its process name to
3062 .Dq session owner
3063 and wait for the controlling
3064 .Nm
3065 to finish with the link and deliver a signal back to the idle process.
3066 This prevents the confusion that results from
3067 .Nm Ns No 's
3068 parent considering the link resource available again.
3069 .Pp
3070 For tty devices that have entries in
3071 .Pa /etc/ttys ,
3072 this is necessary to prevent another
3073 .Xr getty 8
3074 from being started, and for program links such as
3075 .Xr sshd 8 ,
3076 it prevents
3077 .Xr sshd 8
3078 from exiting due to the death of its child.
3079 As
3080 .Nm
3081 cannot determine its parents requirements (except for the tty case), this
3082 option must be enabled manually depending on the circumstances.
3083 .It loopback
3084 Default: Enabled.
3085 When
3086 .Ar loopback
3087 is enabled,
3088 .Nm
3089 will automatically loop back packets being sent
3090 out with a destination address equal to that of the
3091 .Em PPP
3092 interface.
3093 If disabled,
3094 .Nm
3095 will send the packet, probably resulting in an ICMP redirect from
3096 the other end.
3097 It is convenient to have this option enabled when
3098 the interface is also the default route as it avoids the necessity
3099 of a loopback route.
3100 .It NAS-IP-Address
3101 Default: Enabled.
3102 This option controls whether
3103 .Nm
3104 sends the
3105 .Dq NAS-IP-Address
3106 attribute to the RADIUS server when RADIUS is in use
3107 .Pq see Dq set radius .
3108 .Pp
3109 Note, at least one of
3110 .Dq NAS-IP-Address
3111 and
3112 .Dq NAS-Identifier
3113 must be enabled.
3114 .Pp
3115 Versions of
3116 .Nm
3117 prior to version 3.4.1 did not send the
3118 .Dq NAS-IP-Address
3119 attribute as it was reported to break the Radiator RADIUS server.
3120 As the latest rfc (2865) no longer hints that only one of
3121 .Dq NAS-IP-Address
3122 and
3123 .Dq NAS-Identifier
3124 should be sent (as rfc 2138 did),
3125 .Nm
3126 now sends both and leaves it up to the administrator that chooses to use
3127 bad RADIUS implementations to
3128 .Dq disable NAS-IP-Address .
3129 .It NAS-Identifier
3130 Default: Enabled.
3131 This option controls whether
3132 .Nm
3133 sends the
3134 .Dq NAS-Identifier
3135 attribute to the RADIUS server when RADIUS is in use
3136 .Pq see Dq set radius .
3137 .Pp
3138 Note, at least one of
3139 .Dq NAS-IP-Address
3140 and
3141 .Dq NAS-Identifier
3142 must be enabled.
3143 .It passwdauth
3144 Default: Disabled.
3145 Enabling this option will tell the PAP authentication
3146 code to use the password database (see
3147 .Xr passwd 5 )
3148 to authenticate the caller if they cannot be found in the
3149 .Pa /etc/ppp/ppp.secret
3150 file.
3151 .Pa /etc/ppp/ppp.secret
3152 is always checked first.
3153 If you wish to use passwords from
3154 .Xr passwd 5 ,
3155 but also to specify an IP number or label for a given client, use
3156 .Dq \&*
3157 as the client password in
3158 .Pa /etc/ppp/ppp.secret .
3159 .It proxy
3160 Default: Disabled.
3161 Enabling this option will tell
3162 .Nm
3163 to proxy ARP for the peer.
3164 This means that
3165 .Nm
3166 will make an entry in the ARP table using
3167 .Dv HISADDR
3168 and the
3169 .Dv MAC
3170 address of the local network in which
3171 .Dv HISADDR
3172 appears.
3173 This allows other machines connecteed to the LAN to talk to
3174 the peer as if the peer itself was connected to the LAN.
3175 The proxy entry cannot be made unless
3176 .Dv HISADDR
3177 is an address from a LAN.
3178 .It proxyall
3179 Default: Disabled.
3180 Enabling this will tell
3181 .Nm
3182 to add proxy arp entries for every IP address in all class C or
3183 smaller subnets routed via the tun interface.
3184 .Pp
3185 Proxy arp entries are only made for sticky routes that are added
3186 using the
3187 .Dq add
3188 command.
3189 No proxy arp entries are made for the interface address itself
3190 (as created by the
3191 .Dq set ifaddr
3192 command).
3193 .It sroutes
3194 Default: Enabled.
3195 When the
3196 .Dq add
3197 command is used with the
3198 .Dv HISADDR ,
3199 .Dv MYADDR ,
3200 .Dv HISADDR6
3201 or
3202 .Dv MYADDR6
3203 values, entries are stored in the
3204 .Sq sticky route
3205 list.
3206 Each time these variables change, this list is re-applied to the routing table.
3207 .Pp
3208 Disabling this option will prevent the re-application of sticky routes,
3209 although the
3210 .Sq stick route
3211 list will still be maintained.
3212 .It Oo tcp Oc Ns No mssfixup
3213 Default: Enabled.
3214 This option tells
3215 .Nm
3216 to adjust TCP SYN packets so that the maximum receive segment
3217 size is not greater than the amount allowed by the interface MTU.
3218 .It throughput
3219 Default: Enabled.
3220 This option tells
3221 .Nm
3222 to gather throughput statistics.
3223 Input and output is sampled over
3224 a rolling 5 second window, and current, best and total figures are retained.
3225 This data is output when the relevant
3226 .Em PPP
3227 layer shuts down, and is also available using the
3228 .Dq show
3229 command.
3230 Throughput statistics are available at the
3231 .Dq IPCP
3232 and
3233 .Dq physical
3234 levels.
3235 .It utmp
3236 Default: Enabled.
3237 Normally, when a user is authenticated using PAP or CHAP, and when
3238 .Nm
3239 is running in
3240 .Fl direct
3241 mode, an entry is made in the utmp and wtmp files for that user.
3242 Disabling this option will tell
3243 .Nm
3244 not to make any utmp or wtmp entries.
3245 This is usually only necessary if
3246 you require the user to both login and authenticate themselves.
3247 .El
3248 .Pp
3249 .It add Ns Xo
3250 .Op !\&
3251 .Ar dest Ns Op / Ns Ar nn
3252 .Op Ar mask
3253 .Op Ar gateway
3254 .Xc
3255 .Ar Dest
3256 is the destination IP address.
3257 The netmask is specified either as a number of bits with
3258 .Ar /nn
3259 or as an IP number using
3260 .Ar mask .
3261 .Ar 0 0
3262 or simply
3263 .Ar 0
3264 with no mask refers to the default route.
3265 It is also possible to use the literal name
3266 .Sq default
3267 instead of
3268 .Ar 0 .
3269 .Ar Gateway
3270 is the next hop gateway to get to the given
3271 .Ar dest
3272 machine/network.
3273 Refer to the
3274 .Xr route 8
3275 command for further details.
3276 .Pp
3277 It is possible to use the symbolic names
3278 .Sq MYADDR ,
3279 .Sq HISADDR ,
3280 .Sq MYADDR6
3281 or
3282 .Sq HISADDR6
3283 as the destination, and
3284 .Sq HISADDR
3285 or
3286 .Sq HISADDR6
3287 as the
3288 .Ar gateway .
3289 .Sq MYADDR
3290 is replaced with the interface IP address,
3291 .Sq HISADDR
3292 is replaced with the interface IP destination (peer) address,
3293 .Sq MYADDR6
3294 is replaced with the interface IPv6 address, and
3295 .Sq HISADDR6
3296 is replaced with the interface IPv6 destination address,
3297 .Pp
3298 If the
3299 .Ar add!\&
3300 command is used
3301 (note the trailing
3302 .Dq !\& ) ,
3303 then if the route already exists, it will be updated as with the
3304 .Sq route change
3305 command (see
3306 .Xr route 8
3307 for further details).
3308 .Pp
3309 Routes that contain the
3310 .Dq HISADDR ,
3311 .Dq MYADDR ,
3312 .Dq HISADDR6 ,
3313 .Dq MYADDR6 ,
3314 .Dq DNS0 ,
3315 or
3316 .Dq DNS1
3317 constants are considered
3318 .Sq sticky .
3319 They are stored in a list (use
3320 .Dq show ncp
3321 to see the list), and each time the value of one of these variables
3322 changes, the appropriate routing table entries are updated.
3323 This facility may be disabled using
3324 .Dq disable sroutes .
3325 .It allow Ar command Op Ar args
3326 This command controls access to
3327 .Nm
3328 and its configuration files.
3329 It is possible to allow user-level access,
3330 depending on the configuration file label and on the mode that
3331 .Nm
3332 is being run in.
3333 For example, you may wish to configure
3334 .Nm
3335 so that only user
3336 .Sq fred
3337 may access label
3338 .Sq fredlabel
3339 in
3340 .Fl background
3341 mode.
3342 .Pp
3343 User id 0 is immune to these commands.
3344 .Bl -tag -width 2n
3345 .It allow user Ns Xo
3346 .Op s
3347 .Ar logname Ns No ...
3348 .Xc
3349 By default, only user id 0 is allowed access to
3350 .Nm .
3351 If this command is used, all of the listed users are allowed access to
3352 the section in which the
3353 .Dq allow users
3354 command is found.
3355 The
3356 .Sq default
3357 section is always checked first (even though it is only ever automatically
3358 loaded at startup).
3359 .Dq allow users
3360 commands are cumulative in a given section, but users allowed in any given
3361 section override users allowed in the default section, so it is possible to
3362 allow users access to everything except a given label by specifying default
3363 users in the
3364 .Sq default
3365 section, and then specifying a new user list for that label.
3366 .Pp
3367 If user
3368 .Sq *
3369 is specified, access is allowed to all users.
3370 .It allow mode Ns Xo
3371 .Op s
3372 .Ar mode Ns No ...
3373 .Xc
3374 By default, access using any
3375 .Nm
3376 mode is possible.
3377 If this command is used, it restricts the access
3378 .Ar modes
3379 allowed to load the label under which this command is specified.
3380 Again, as with the
3381 .Dq allow users
3382 command, each
3383 .Dq allow modes
3384 command overrides any previous settings, and the
3385 .Sq default
3386 section is always checked first.
3387 .Pp
3388 Possible modes are:
3389 .Sq interactive ,
3390 .Sq auto ,
3391 .Sq direct ,
3392 .Sq dedicated ,
3393 .Sq ddial ,
3394 .Sq background
3395 and
3396 .Sq * .
3397 .Pp
3398 When running in multi-link mode, a section can be loaded if it allows
3399 .Em any
3400 of the currently existing line modes.
3401 .El
3402 .Pp
3403 .It nat Ar command Op Ar args
3404 This command allows the control of the network address translation (also
3405 known as masquerading or IP aliasing) facilities that are built into
3406 .Nm .
3407 NAT is done on the external interface only, and is unlikely to make sense
3408 if used with the
3409 .Fl direct
3410 flag.
3411 .Pp
3412 If nat is enabled on your system (it may be omitted at compile time),
3413 the following commands are possible:
3414 .Bl -tag -width 2n
3415 .It nat enable yes|no
3416 This command either switches network address translation on or turns it off.
3417 The
3418 .Fl nat
3419 command line flag is synonymous with
3420 .Dq nat enable yes .
3421 .It nat addr Op Ar addr_local addr_alias
3422 This command allows data for
3423 .Ar addr_alias
3424 to be redirected to
3425 .Ar addr_local .
3426 It is useful if you own a small number of real IP numbers that
3427 you wish to map to specific machines behind your gateway.
3428 .It nat deny_incoming yes|no
3429 If set to yes, this command will refuse all incoming packets where an
3430 aliasing link does not already exist.
3431 ifdef({LOCALNAT},{},{Refer to the
3432 .Sx CONCEPTUAL BACKGROUND
3433 section of
3434 .Xr libalias 3
3435 for a description of what an
3436 .Dq aliasing link
3437 is.
3438 })dnl
3439 .Pp
3440 It should be noted under what circumstances an aliasing link is
3441 ifdef({LOCALNAT},{created.},{created by
3442 .Xr libalias 3 .})
3443 It may be necessary to further protect your network from outside
3444 connections using the
3445 .Dq set filter
3446 or
3447 .Dq nat target
3448 commands.
3449 .It nat help|?
3450 This command gives a summary of available nat commands.
3451 .It nat log yes|no
3452 This option causes various NAT statistics and information to
3453 be logged to the file
3454 .Pa /var/log/alias.log .
3455 .It nat port Ar proto Ar targetIP Ns Xo
3456 .No : Ns Ar targetPort Ns
3457 .Oo
3458 .No - Ns Ar targetPort
3459 .Oc Ar aliasPort Ns
3460 .Oo
3461 .No - Ns Ar aliasPort
3462 .Oc Oo Ar remoteIP : Ns
3463 .Ar remotePort Ns
3464 .Oo
3465 .No - Ns Ar remotePort
3466 .Oc
3467 .Oc
3468 .Xc
3469 This command causes incoming
3470 .Ar proto
3471 connections to
3472 .Ar aliasPort
3473 to be redirected to
3474 .Ar targetPort
3475 on
3476 .Ar targetIP .
3477 .Ar proto
3478 is either
3479 .Dq tcp
3480 or
3481 .Dq udp .
3482 .Pp
3483 A range of port numbers may be specified as shown above.
3484 The ranges must be of the same size.
3485 .Pp
3486 If
3487 .Ar remoteIP
3488 is specified, only data coming from that IP number is redirected.
3489 .Ar remotePort
3490 must either be
3491 .Dq 0
3492 (indicating any source port)
3493 or a range of ports the same size as the other ranges.
3494 .Pp
3495 This option is useful if you wish to run things like Internet phone on
3496 machines behind your gateway, but is limited in that connections to only
3497 one interior machine per source machine and target port are possible.
3498 .It nat proto Ar proto localIP Oo
3499 .Ar publicIP Op Ar remoteIP
3500 .Oc
3501 This command tells
3502 .Nm
3503 to redirect packets of protocol type
3504 .Ar proto
3505 (see
3506 .Xr protocols 5 )
3507 to the internal address
3508 .Ar localIP .
3509 .Pp
3510 If
3511 .Ar publicIP
3512 is specified, only packets destined for that address are matched,
3513 otherwise the default alias address is used.
3514 .Pp
3515 If
3516 .Ar remoteIP
3517 is specified, only packets matching that source address are matched,
3518 .Pp
3519 This command is useful for redirecting tunnel endpoints to an internal machine,
3520 for example:
3521 .Pp
3522 .Dl nat proto ipencap 10.0.0.1
3523 .It "nat proxy cmd" Ar arg Ns No ...
3524 This command tells
3525 .Nm
3526 to proxy certain connections, redirecting them to a given server.
3527 ifdef({LOCALNAT},{},{Refer to the description of
3528 .Fn PacketAliasProxyRule
3529 in
3530 .Xr libalias 3
3531 for details of the available commands.
3532 })dnl
3533 .It nat punch_fw Op Ar base count
3534 This command tells
3535 .Nm
3536 to punch holes in the firewall for FTP or IRC DCC connections.
3537 This is done dynamically by installing termporary firewall rules which
3538 allow a particular connection (and only that connection) to go through
3539 the firewall.
3540 The rules are removed once the corresponding connection terminates.
3541 .Pp
3542 A maximum of
3543 .Ar count
3544 rules starting from rule number
3545 .Ar base
3546 will be used for punching firewall holes.
3547 The range will be cleared when the
3548 .Dq nat punch_fw
3549 command is run.
3550 .Pp
3551 If no arguments are given, firewall punching is disabled.
3552 .It nat skinny_port Op Ar port
3553 This command tells
3554 .Nm
3555 which TCP port is used by the Skinny Station protocol.
3556 Skinny is used by
3557 Cisco IP phones to communicate with Cisco Call Managers to setup voice
3558 over IP calls.
3559 The typical port used by Skinny is 2000.
3560 .Pp
3561 If no argument is given, skinny aliasing is disabled.
3562 .It nat same_ports yes|no
3563 When enabled, this command will tell the network address translation engine to
3564 attempt to avoid changing the port number on outgoing packets.
3565 This is useful
3566 if you want to support protocols such as RPC and LPD which require
3567 connections to come from a well known port.
3568 .It nat target Op Ar address
3569 Set the given target address or clear it if no address is given.
3570 The target address is used
3571 ifdef({LOCALNAT},{},{by libalias })dnl
3572 to specify how to NAT incoming packets by default.
3573 If a target address is not set or if
3574 .Dq default
3575 is given, packets are not altered and are allowed to route to the internal
3576 network.
3577 .Pp
3578 The target address may be set to
3579 .Dq MYADDR ,
3580 in which case
3581 ifdef({LOCALNAT},{all packets will be redirected},
3582 {libalias will redirect all packets})
3583 to the interface address.
3584 .It nat use_sockets yes|no
3585 When enabled, this option tells the network address translation engine to
3586 create a socket so that it can guarantee a correct incoming ftp data or
3587 IRC connection.
3588 .It nat unregistered_only yes|no
3589 Only alter outgoing packets with an unregistered source address.
3590 According to RFC 1918, unregistered source addresses
3591 are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
3592 .El
3593 .Pp
3594 These commands are also discussed in the file
3595 .Pa README.nat
3596 which comes with the source distribution.
3597 .Pp
3598 .It Oo !\& Oc Ns Xo
3599 .No bg Ar command
3600 .Xc
3601 The given
3602 .Ar command
3603 is executed in the background with the following words replaced:
3604 .Bl -tag -width COMPILATIONDATE
3605 .It Li AUTHNAME
3606 This is replaced with the local
3607 .Ar authname
3608 value.
3609 See the
3610 .Dq set authname
3611 command below.
3612 .It Li COMPILATIONDATE
3613 In previous software revisions, this was replaced with the date on which
3614 .Nm
3615 was compiled.
3616 This is no longer supported as it breaks the ability to recompile the same
3617 code to produce an exact duplicate of a previous compilation.
3618 .It Li DNS0 & DNS1
3619 These are replaced with the primary and secondary nameserver IP numbers.
3620 If nameservers are negotiated by IPCP, the values of these macros will change.
3621 .It Li ENDDISC
3622 This is replaced with the local endpoint discriminator value.
3623 See the
3624 .Dq set enddisc
3625 command below.
3626 .It Li HISADDR
3627 This is replaced with the peers IP number.
3628 .It Li HISADDR6
3629 This is replaced with the peers IPv6 number.
3630 .It Li INTERFACE
3631 This is replaced with the name of the interface that is in use.
3632 .It Li IPOCTETSIN
3633 This is replaced with the number of IP bytes received since the connection
3634 was established.
3635 .It Li IPOCTETSOUT
3636 This is replaced with the number of IP bytes sent since the connection
3637 was established.
3638 .It Li IPPACKETSIN
3639 This is replaced with the number of IP packets received since the connection
3640 was established.
3641 .It Li IPPACKETSOUT
3642 This is replaced with the number of IP packets sent since the connection
3643 was established.
3644 .It Li IPV6OCTETSIN
3645 This is replaced with the number of IPv6 bytes received since the connection
3646 was established.
3647 .It Li IPV6OCTETSOUT
3648 This is replaced with the number of IPv6 bytes sent since the connection
3649 was established.
3650 .It Li IPV6PACKETSIN
3651 This is replaced with the number of IPv6 packets received since the connection
3652 was established.
3653 .It Li IPV6PACKETSOUT
3654 This is replaced with the number of IPv6 packets sent since the connection
3655 was established.
3656 .It Li LABEL
3657 This is replaced with the last label name used.
3658 A label may be specified on the
3659 .Nm
3660 command line, via the
3661 .Dq load
3662 or
3663 .Dq dial
3664 commands and in the
3665 .Pa ppp.secret
3666 file.
3667 .It Li MYADDR
3668 This is replaced with the IP number assigned to the local interface.
3669 .It Li MYADDR6
3670 This is replaced with the IPv6 number assigned to the local interface.
3671 .It Li OCTETSIN
3672 This is replaced with the number of bytes received since the connection
3673 was established.
3674 .It Li OCTETSOUT
3675 This is replaced with the number of bytes sent since the connection
3676 was established.
3677 .It Li PACKETSIN
3678 This is replaced with the number of packets received since the connection
3679 was established.
3680 .It Li PACKETSOUT
3681 This is replaced with the number of packets sent since the connection
3682 was established.
3683 .It Li PEER_ENDDISC
3684 This is replaced with the value of the peers endpoint discriminator.
3685 .It Li PROCESSID
3686 This is replaced with the current process id.
3687 .It Li SOCKNAME
3688 This is replaced with the name of the diagnostic socket.
3689 .It Li UPTIME
3690 This is replaced with the bundle uptime in HH:MM:SS format.
3691 .It Li USER
3692 This is replaced with the username that has been authenticated with PAP or
3693 CHAP.
3694 Normally, this variable is assigned only in -direct mode.
3695 This value is available irrespective of whether utmp logging is enabled.
3696 .It Li VERSION
3697 This is replaced with the current version number of
3698 .Nm .
3699 .El
3700 .Pp
3701 These substitutions are also done by the
3702 .Dq set proctitle ,
3703 .Dq ident
3704 and
3705 .Dq log
3706 commands.
3707 .Pp
3708 If you wish to pause
3709 .Nm
3710 while the command executes, use the
3711 .Dq shell
3712 command instead.
3713 .It clear physical|ipcp|ipv6 Op current|overall|peak...
3714 Clear the specified throughput values at either the
3715 .Dq physical ,
3716 .Dq ipcp
3717 or
3718 .Dq ipv6cp
3719 level.
3720 If
3721 .Dq physical
3722 is specified, context must be given (see the
3723 .Dq link
3724 command below).
3725 If no second argument is given, all values are cleared.
3726 .It clone Ar name Ns Xo
3727 .Op \&, Ns Ar name Ns
3728 .No ...
3729 .Xc
3730 Clone the specified link, creating one or more new links according to the
3731 .Ar name
3732 argument(s).
3733 This command must be used from the
3734 .Dq link
3735 command below unless you have only got a single link (in which case that
3736 link becomes the default).
3737 Links may be removed using the
3738 .Dq remove
3739 command below.
3740 .Pp
3741 The default link name is
3742 .Dq deflink .
3743 .It close Op lcp|ccp Ns Op !\&
3744 If no arguments are given, the relevant protocol layers will be brought
3745 down and the link will be closed.
3746 If
3747 .Dq lcp
3748 is specified, the LCP layer is brought down, but
3749 .Nm
3750 will not bring the link offline.
3751 It is subsequently possible to use
3752 .Dq term
3753 (see below)
3754 to talk to the peer machine if, for example, something like
3755 .Dq slirp
3756 is being used.
3757 If
3758 .Dq ccp
3759 is specified, only the relevant compression layer is closed.
3760 If the
3761 .Dq !\&
3762 is used, the compression layer will remain in the closed state, otherwise
3763 it will re-enter the STOPPED state, waiting for the peer to initiate
3764 further CCP negotiation.
3765 In any event, this command does not disconnect the user from
3766 .Nm
3767 or exit
3768 .Nm .
3769 See the
3770 .Dq quit
3771 command below.
3772 .It delete Ns Xo
3773 .Op !\&
3774 .Ar dest
3775 .Xc
3776 This command deletes the route with the given
3777 .Ar dest
3778 IP address.
3779 If
3780 .Ar dest
3781 is specified as
3782 .Sq ALL ,
3783 all non-direct entries in the routing table for the current interface,
3784 and all
3785 .Sq sticky route
3786 entries are deleted.
3787 If
3788 .Ar dest
3789 is specified as
3790 .Sq default ,
3791 the default route is deleted.
3792 .Pp
3793 If the
3794 .Ar delete!\&
3795 command is used
3796 (note the trailing
3797 .Dq !\& ) ,
3798 .Nm
3799 will not complain if the route does not already exist.
3800 .It dial|call Oo Ar label Oc Ns Xo
3801 .No ...
3802 .Xc
3803 This command is the equivalent of
3804 .Dq load label
3805 followed by
3806 .Dq open ,
3807 and is provided for backwards compatibility.
3808 .It down Op Ar lcp|ccp
3809 Bring the relevant layer down ungracefully, as if the underlying layer
3810 had become unavailable.
3811 It is not considered polite to use this command on
3812 a Finite State Machine that is in the OPEN state.
3813 If no arguments are
3814 supplied, the entire link is closed (or if no context is given, all links
3815 are terminated).
3816 If
3817 .Sq lcp
3818 is specified, the
3819 .Em LCP
3820 layer is terminated but the device is not brought offline and the link
3821 is not closed.
3822 If
3823 .Sq ccp
3824 is specified, only the relevant compression layer(s) are terminated.
3825 .It help|? Op Ar command
3826 Show a list of available commands.
3827 If
3828 .Ar command
3829 is specified, show the usage string for that command.
3830 .It ident Op Ar text Ns No ...
3831 Identify the link to the peer using
3832 .Ar text .
3833 If
3834 .Ar text
3835 is empty, link identification is disabled.
3836 It is possible to use any of the words described for the
3837 .Ic bg
3838 command above.
3839 Refer to the
3840 .Ic sendident
3841 command for details of when
3842 .Nm
3843 identifies itself to the peer.
3844 .It iface Ar command Op args
3845 This command is used to control the interface used by
3846 .Nm .
3847 .Ar Command
3848 may be one of the following:
3849 .Bl -tag -width 2n
3850 .It iface add Ns Xo
3851 .Op !\&
3852 .Ar addr Ns Op / Ns Ar bits
3853 .Op Ar peer
3854 .Xc
3855 .It iface add Ns Xo
3856 .Op !\&
3857 .Ar addr
3858 .Ar mask
3859 .Ar peer
3860 .Xc
3861 Add the given
3862 .Ar addr mask peer
3863 combination to the interface.
3864 Instead of specifying
3865 .Ar mask ,
3866 .Ar /bits
3867 can be used
3868 (with no space between it and
3869 .Ar addr ) .
3870 If the given address already exists, the command fails unless the
3871 .Dq !\&
3872 is used - in which case the previous interface address entry is overwritten
3873 with the new one, allowing a change of netmask or peer address.
3874 .Pp
3875 If only
3876 .Ar addr
3877 is specified,
3878 .Ar bits
3879 defaults to
3880 .Dq 32
3881 and
3882 .Ar peer
3883 defaults to
3884 .Dq 255.255.255.255 .
3885 This address (the broadcast address) is the only duplicate peer address that
3886 .Nm
3887 allows.
3888 .It iface clear Op INET | INET6
3889 If this command is used while
3890 .Nm
3891 is in the OPENED state or while in
3892 .Fl auto
3893 mode, all addresses except for the NCP negotiated address are deleted
3894 from the interface.
3895 If
3896 .Nm
3897 is not in the OPENED state and is not in
3898 .Fl auto
3899 mode, all interface addresses are deleted.
3900 .Pp
3901 If the INET or INET6 arguments are used, only addresses for that address
3902 family are cleared.
3903 .Pp
3904 .It iface delete Ns Xo
3905 .Op !\& Ns
3906 .No |rm Ns Op !\&
3907 .Ar addr
3908 .Xc
3909 This command deletes the given
3910 .Ar addr
3911 from the interface.
3912 If the
3913 .Dq !\&
3914 is used, no error is given if the address is not currently assigned to
3915 the interface (and no deletion takes place).
3916 .It iface name Ar name
3917 Renames the interface to
3918 .Ar name .
3919 .It iface description Ar description
3920 Sets the interface description to
3921 .Ar description .
3922 Useful if you have many interfaces on your system.
3923 .It iface show
3924 Shows the current state and current addresses for the interface.
3925 It is much the same as running
3926 .Dq ifconfig INTERFACE .
3927 .It iface help Op Ar sub-command
3928 This command, when invoked without
3929 .Ar sub-command ,
3930 will show a list of possible
3931 .Dq iface
3932 sub-commands and a brief synopsis for each.
3933 When invoked with
3934 .Ar sub-command ,
3935 only the synopsis for the given sub-command is shown.
3936 .El
3937 .It Oo data Oc Ns Xo
3938 .No link
3939 .Ar name Ns Oo , Ns Ar name Oc Ns ... Ar command Op Ar args
3940 .Xc
3941 This command may prefix any other command if the user wishes to
3942 specify which link the command should affect.
3943 This is only applicable after multiple links have been created in Multi-link
3944 mode using the
3945 .Dq clone
3946 command.
3947 .Pp
3948 .Ar Name
3949 specifies the name of an existing link.
3950 If
3951 .Ar name
3952 is a comma separated list,
3953 .Ar command
3954 is executed on each link.
3955 If
3956 .Ar name
3957 is
3958 .Dq * ,
3959 .Ar command
3960 is executed on all links.
3961 .It load Oo Ar label Oc Ns Xo
3962 .No ...
3963 .Xc
3964 Load the given
3965 .Ar label Ns No (s)
3966 from the
3967 .Pa ppp.conf
3968 file.
3969 If
3970 .Ar label
3971 is not given, the
3972 .Ar default
3973 label is used.
3974 .Pp
3975 Unless the
3976 .Ar label
3977 section uses the
3978 .Dq set mode ,
3979 .Dq open
3980 or
3981 .Dq dial
3982 commands,
3983 .Nm
3984 will not attempt to make an immediate connection.
3985 .It log Ar word Ns No ...
3986 Send the given word(s) to the log file with the prefix
3987 .Dq LOG: .
3988 Word substitutions are done as explained under the
3989 .Dq !bg
3990 command above.
3991 .It open Op lcp|ccp|ipcp
3992 This is the opposite of the
3993 .Dq close
3994 command.
3995 All closed links are immediately brought up apart from second and subsequent
3996 .Ar demand-dial
3997 links - these will come up based on the
3998 .Dq set autoload
3999 command that has been used.
4000 .Pp
4001 If the
4002 .Dq lcp
4003 argument is used while the LCP layer is already open, LCP will be
4004 renegotiated.
4005 This allows various LCP options to be changed, after which
4006 .Dq open lcp
4007 can be used to put them into effect.
4008 After renegotiating LCP,
4009 any agreed authentication will also take place.
4010 .Pp
4011 If the
4012 .Dq ccp
4013 argument is used, the relevant compression layer is opened.
4014 Again, if it is already open, it will be renegotiated.
4015 .Pp
4016 If the
4017 .Dq ipcp
4018 argument is used, the link will be brought up as normal, but if
4019 IPCP is already open, it will be renegotiated and the network
4020 interface will be reconfigured.
4021 .Pp
4022 It is probably not good practice to re-open the PPP state machines
4023 like this as it is possible that the peer will not behave correctly.
4024 It
4025 .Em is
4026 however useful as a way of forcing the CCP or VJ dictionaries to be reset.
4027 .It passwd Ar pass
4028 Specify the password required for access to the full
4029 .Nm
4030 command set.
4031 This password is required when connecting to the diagnostic port (see the
4032 .Dq set server
4033 command).
4034 .Ar Pass
4035 is specified on the
4036 .Dq set server
4037 command line.
4038 The value of
4039 .Ar pass
4040 is not logged when
4041 .Ar command
4042 logging is active, instead, the literal string
4043 .Sq ********
4044 is logged.
4045 .It quit|bye Op all
4046 If
4047 .Dq quit
4048 is executed from the controlling connection or from a command file,
4049 ppp will exit after closing all connections.
4050 Otherwise, if the user
4051 is connected to a diagnostic socket, the connection is simply dropped.
4052 .Pp
4053 If the
4054 .Ar all
4055 argument is given,
4056 .Nm
4057 will exit despite the source of the command after closing all existing
4058 connections.
4059 .It remove|rm
4060 This command removes the given link.
4061 It is only really useful in multi-link mode.
4062 A link must be in the
4063 .Dv CLOSED
4064 state before it is removed.
4065 .It rename|mv Ar name
4066 This command renames the given link to
4067 .Ar name .
4068 It will fail if
4069 .Ar name
4070 is already used by another link.
4071 .Pp
4072 The default link name is
4073 .Sq deflink .
4074 Renaming it to
4075 .Sq modem ,
4076 .Sq cuau0
4077 or
4078 .Sq USR
4079 may make the log file more readable.
4080 .It resolv Ar command
4081 This command controls
4082 .Nm Ns No 's
4083 manipulation of the
4084 .Xr resolv.conf 5
4085 file.
4086 When
4087 .Nm
4088 starts up, it loads the contents of this file into memory and retains this
4089 image for future use.
4090 .Ar command
4091 is one of the following:
4092 .Bl -tag -width readonly
4093 .It Em readonly
4094 Treat
4095 .Pa /etc/resolv.conf
4096 as read only.
4097 If
4098 .Dq dns
4099 is enabled,
4100 .Nm
4101 will still attempt to negotiate nameservers with the peer, making the results
4102 available via the
4103 .Dv DNS0
4104 and
4105 .Dv DNS1
4106 macros.
4107 This is the opposite of the
4108 .Dq resolv writable
4109 command.
4110 .It Em reload
4111 Reload
4112 .Pa /etc/resolv.conf
4113 into memory.
4114 This may be necessary if for example a DHCP client overwrote
4115 .Pa /etc/resolv.conf .
4116 .It Em restore
4117 Replace
4118 .Pa /etc/resolv.conf
4119 with the version originally read at startup or with the last
4120 .Dq resolv reload
4121 command.
4122 This is sometimes a useful command to put in the
4123 .Pa /etc/ppp/ppp.linkdown
4124 file.
4125 .It Em rewrite
4126 Rewrite the
4127 .Pa /etc/resolv.conf
4128 file.
4129 This command will work even if the
4130 .Dq resolv readonly
4131 command has been used.
4132 It may be useful as a command in the
4133 .Pa /etc/ppp/ppp.linkup
4134 file if you wish to defer updating
4135 .Pa /etc/resolv.conf
4136 until after other commands have finished.
4137 .It Em writable
4138 Allow
4139 .Nm
4140 to update
4141 .Pa /etc/resolv.conf
4142 if
4143 .Dq dns
4144 is enabled and
4145 .Nm
4146 successfully negotiates a DNS.
4147 This is the opposite of the
4148 .Dq resolv readonly
4149 command.
4150 .El
4151 .It save
4152 This option is not (yet) implemented.
4153 .It sendident
4154 This command tells
4155 .Nm
4156 to identify itself to the peer.
4157 The link must be in LCP state or higher.
4158 If no identity has been set (via the
4159 .Ic ident
4160 command),
4161 .Ic sendident
4162 will fail.
4163 .Pp
4164 When an identity has been set,
4165 .Nm
4166 will automatically identify itself when it sends or receives a configure
4167 reject, when negotiation fails or when LCP reaches the opened state.
4168 .Pp
4169 Received identification packets are logged to the LCP log (see
4170 .Ic set log
4171 for details) and are never responded to.
4172 .It set Ns Xo
4173 .Op up
4174 .Ar var value
4175 .Xc
4176 This option allows the setting of any of the following variables:
4177 .Bl -tag -width 2n
4178 .It set accmap Ar hex-value
4179 ACCMap stands for Asynchronous Control Character Map.
4180 This is always
4181 negotiated with the peer, and defaults to a value of 00000000 in hex.
4182 This protocol is required to defeat hardware that depends on passing
4183 certain characters from end to end (such as XON/XOFF etc).
4184 .Pp
4185 For the XON/XOFF scenario, use
4186 .Dq set accmap 000a0000 .
4187 .It set Oo auth Oc Ns Xo
4188 .No key Ar value
4189 .Xc
4190 This sets the authentication key (or password) used in client mode
4191 PAP or CHAP negotiation to the given value.
4192 It also specifies the
4193 password to be used in the dial or login scripts in place of the
4194 .Sq \eP
4195 sequence, preventing the actual password from being logged.
4196 If
4197 .Ar command
4198 or
4199 .Ar chat
4200 logging is in effect,
4201 .Ar value
4202 is logged as
4203 .Sq ********
4204 for security reasons.
4205 .Pp
4206 If the first character of
4207 .Ar value
4208 is an exclamation mark
4209 .Pq Dq !\& ,
4210 .Nm
4211 treats the remainder of the string as a program that must be executed
4212 to determine the
4213 .Dq authname
4214 and
4215 .Dq authkey
4216 values.
4217 .Pp
4218 If the
4219 .Dq !\&
4220 is doubled up
4221 (to
4222 .Dq !! ) ,
4223 it is treated as a single literal
4224 .Dq !\& ,
4225 otherwise, ignoring the
4226 .Dq !\& ,
4227 .Ar value
4228 is parsed as a program to execute in the same was as the
4229 .Dq !bg
4230 command above, substituting special names in the same manner.
4231 Once executed,
4232 .Nm
4233 will feed the program three lines of input, each terminated by a newline
4234 character:
4235 .Bl -bullet
4236 .It
4237 The host name as sent in the CHAP challenge.
4238 .It
4239 The challenge string as sent in the CHAP challenge.
4240 .It
4241 The locally defined
4242 .Dq authname .
4243 .El
4244 .Pp
4245 Two lines of output are expected:
4246 .Bl -bullet
4247 .It
4248 The
4249 .Dq authname
4250 to be sent with the CHAP response.
4251 .It
4252 The
4253 .Dq authkey ,
4254 which is encrypted with the challenge and request id, the answer being sent
4255 in the CHAP response packet.
4256 .El
4257 .Pp
4258 When configuring
4259 .Nm
4260 in this manner, it is expected that the host challenge is a series of ASCII
4261 digits or characters.
4262 An encryption device or Secure ID card is usually
4263 required to calculate the secret appropriate for the given challenge.
4264 .It set authname Ar id
4265 This sets the authentication id used in client mode PAP or CHAP negotiation.
4266 .Pp
4267 If used in
4268 .Fl direct
4269 mode with CHAP enabled,
4270 .Ar id
4271 is used in the initial authentication challenge and should normally be set to
4272 the local machine name.
4273 .It set autoload Xo
4274 .Ar min-percent max-percent period
4275 .Xc
4276 These settings apply only in multi-link mode and default to zero, zero and
4277 five respectively.
4278 When more than one
4279 .Ar demand-dial
4280 (also known as
4281 .Fl auto )
4282 mode link is available, only the first link is made active when
4283 .Nm
4284 first reads data from the tun device.
4285 The next
4286 .Ar demand-dial
4287 link will be opened only when the current bundle throughput is at least
4288 .Ar max-percent
4289 percent of the total bundle bandwidth for
4290 .Ar period
4291 seconds.
4292 When the current bundle throughput decreases to
4293 .Ar min-percent
4294 percent or less of the total bundle bandwidth for
4295 .Ar period
4296 seconds, a
4297 .Ar demand-dial
4298 link will be brought down as long as it is not the last active link.
4299 .Pp
4300 Bundle throughput is measured as the maximum of inbound and outbound
4301 traffic.
4302 .Pp
4303 The default values cause
4304 .Ar demand-dial
4305 links to simply come up one at a time.
4306 .Pp
4307 Certain devices cannot determine their physical bandwidth, so it
4308 is sometimes necessary to use the
4309 .Dq set bandwidth
4310 command (described below) to make
4311 .Dq set autoload
4312 work correctly.
4313 .It set bandwidth Ar value
4314 This command sets the connection bandwidth in bits per second.
4315 .Ar value
4316 must be greater than zero.
4317 It is currently only used by the
4318 .Dq set autoload
4319 command above.
4320 .It set callback Ar option Ns No ...
4321 If no arguments are given, callback is disabled, otherwise,
4322 .Nm
4323 will request (or in
4324 .Fl direct
4325 mode, will accept) one of the given
4326 .Ar option Ns No s .
4327 In client mode, if an
4328 .Ar option
4329 is NAK'd
4330 .Nm
4331 will request a different
4332 .Ar option ,
4333 until no options remain at which point
4334 .Nm
4335 will terminate negotiations (unless
4336 .Dq none
4337 is one of the specified
4338 .Ar option ) .
4339 In server mode,
4340 .Nm
4341 will accept any of the given protocols - but the client
4342 .Em must
4343 request one of them.
4344 If you wish callback to be optional, you must {include}
4345 .Ar none
4346 as an option.
4347 .Pp
4348 The
4349 .Ar option Ns No s
4350 are as follows (in this order of preference):
4351 .Bl -tag -width Ds
4352 .It auth
4353 The callee is expected to decide the callback number based on
4354 authentication.
4355 If
4356 .Nm
4357 is the callee, the number should be specified as the fifth field of
4358 the peers entry in
4359 .Pa /etc/ppp/ppp.secret .
4360 .It cbcp
4361 Microsoft's callback control protocol is used.
4362 See
4363 .Dq set cbcp
4364 below.
4365 .Pp
4366 If you wish to negotiate
4367 .Ar cbcp
4368 in client mode but also wish to allow the server to request no callback at
4369 CBCP negotiation time, you must specify both
4370 .Ar cbcp
4371 and
4372 .Ar none
4373 as callback options.
4374 .It E.164 *| Ns Xo
4375 .Ar number Ns Op , Ns Ar number Ns
4376 .No ...
4377 .Xc
4378 The caller specifies the
4379 .Ar number .
4380 If
4381 .Nm
4382 is the callee,
4383 .Ar number
4384 should be either a comma separated list of allowable numbers or a
4385 .Dq \&* ,
4386 meaning any number is permitted.
4387 If
4388 .Nm
4389 is the caller, only a single number should be specified.
4390 .Pp
4391 Note, this option is very unsafe when used with a
4392 .Dq \&*
4393 as a malicious caller can tell
4394 .Nm
4395 to call any (possibly international) number without first authenticating
4396 themselves.
4397 .It none
4398 If the peer does not wish to do callback at all,
4399 .Nm
4400 will accept the fact and continue without callback rather than terminating
4401 the connection.
4402 This is required (in addition to one or more other callback
4403 options) if you wish callback to be optional.
4404 .El
4405 .Pp
4406 .It set cbcp Oo
4407 .No *| Ns Ar number Ns Oo
4408 .No , Ns Ar number Ns ...\& Oc
4409 .Op Ar delay Op Ar retry
4410 .Oc
4411 If no arguments are given, CBCP (Microsoft's CallBack Control Protocol)
4412 is disabled - ie, configuring CBCP in the
4413 .Dq set callback
4414 command will result in
4415 .Nm
4416 requesting no callback in the CBCP phase.
4417 Otherwise,
4418 .Nm
4419 attempts to use the given phone
4420 .Ar number Ns No (s).
4421 .Pp
4422 In server mode
4423 .Pq Fl direct ,
4424 .Nm
4425 will insist that the client uses one of these numbers, unless
4426 .Dq \&*
4427 is used in which case the client is expected to specify the number.
4428 .Pp
4429 In client mode,
4430 .Nm
4431 will attempt to use one of the given numbers (whichever it finds to
4432 be agreeable with the peer), or if
4433 .Dq \&*
4434 is specified,
4435 .Nm
4436 will expect the peer to specify the number.
4437 .It set cd Oo
4438 .No off| Ns Ar seconds Ns Op !\&
4439 .Oc
4440 Normally,
4441 .Nm
4442 checks for the existence of carrier depending on the type of device
4443 that has been opened:
4444 .Bl -tag -width XXX -offset XXX
4445 .It Terminal Devices
4446 Carrier is checked one second after the login script is complete.
4447 If it is not set,
4448 .Nm
4449 assumes that this is because the device does not support carrier (which
4450 is true for most
4451 .Dq laplink
4452 NULL-modem cables), logs the fact and stops checking
4453 for carrier.
4454 .Pp
4455 As ptys do not support the TIOCMGET ioctl, the tty device will switch all
4456 carrier detection off when it detects that the device is a pty.
4457 .It PPPoE (netgraph) Devices
4458 Carrier is checked once per second for 5 seconds.
4459 If it is not set after
4460 the fifth second, the connection attempt is considered to have failed and
4461 the device is closed.
4462 Carrier is always required for PPPoE devices.
4463 .El
4464 .Pp
4465 All other device types do not support carrier.
4466 Setting a carrier value will
4467 result in a warning when the device is opened.
4468 .Pp
4469 Some modems take more than one second after connecting to assert the carrier
4470 signal.
4471 If this delay is not increased, this will result in
4472 .Nm Ns No 's
4473 inability to detect when the link is dropped, as
4474 .Nm
4475 assumes that the device is not asserting carrier.
4476 .Pp
4477 The
4478 .Dq set cd
4479 command overrides the default carrier behaviour.
4480 .Ar seconds
4481 specifies the maximum number of seconds that
4482 .Nm
4483 should wait after the dial script has finished before deciding if
4484 carrier is available or not.
4485 .Pp
4486 If
4487 .Dq off
4488 is specified,
4489 .Nm
4490 will not check for carrier on the device, otherwise
4491 .Nm
4492 will not proceed to the login script until either carrier is detected
4493 or until
4494 .Ar seconds
4495 has elapsed, at which point
4496 .Nm
4497 assumes that the device will not set carrier.
4498 .Pp
4499 If no arguments are given, carrier settings will go back to their default
4500 values.
4501 .Pp
4502 If
4503 .Ar seconds
4504 is followed immediately by an exclamation mark
4505 .Pq Dq !\& ,
4506 .Nm
4507 will
4508 .Em require
4509 carrier.
4510 If carrier is not detected after
4511 .Ar seconds
4512 seconds, the link will be disconnected.
4513 .It set choked Op Ar timeout
4514 This sets the number of seconds that
4515 .Nm
4516 will keep a choked output queue before dropping all pending output packets.
4517 If
4518 .Ar timeout
4519 is less than or equal to zero or if
4520 .Ar timeout
4521 is not specified, it is set to the default value of
4522 .Em 120 seconds .
4523 .Pp
4524 A choked output queue occurs when
4525 .Nm
4526 has read a certain number of packets from the local network for transmission,
4527 but cannot send the data due to link failure (the peer is busy etc.).
4528 .Nm
4529 will not read packets indefinitely.
4530 Instead, it reads up to
4531 .Em 30
4532 packets (or
4533 .Em 30 No +
4534 .Em nlinks No *
4535 .Em 2
4536 packets in multi-link mode), then stops reading the network interface
4537 until either
4538 .Ar timeout
4539 seconds have passed or at least one packet has been sent.
4540 .Pp
4541 If
4542 .Ar timeout
4543 seconds pass, all pending output packets are dropped.
4544 .It set ctsrts|crtscts on|off
4545 This sets hardware flow control.
4546 Hardware flow control is
4547 .Ar on
4548 by default.
4549 .It set deflate Ar out-winsize Op Ar in-winsize
4550 This sets the DEFLATE algorithms default outgoing and incoming window
4551 sizes.
4552 Both
4553 .Ar out-winsize
4554 and
4555 .Ar in-winsize
4556 must be values between
4557 .Em 8
4558 and
4559 .Em 15 .
4560 If
4561 .Ar in-winsize
4562 is specified,
4563 .Nm
4564 will insist that this window size is used and will not accept any other
4565 values from the peer.
4566 .It set dns Op Ar primary Op Ar secondary
4567 This command specifies DNS overrides for the
4568 .Dq accept dns
4569 command.
4570 Refer to the
4571 .Dq accept
4572 command description above for details.
4573 This command does not affect the IP numbers requested using
4574 .Dq enable dns .
4575 .It set device|line Xo
4576 .Ar value Ns No ...
4577 .Xc
4578 This sets the device(s) to which
4579 .Nm
4580 will talk to the given
4581 .Dq value .
4582 .Pp
4583 All serial device names are expected to begin with
4584 .Pa /dev/ .
4585 Serial devices are usually called
4586 .Pa cuaXX .
4587 .Pp
4588 If
4589 .Dq value
4590 does not begin with
4591 .Pa /dev/ ,
4592 it must either begin with an exclamation mark
4593 .Pq Dq !\& ,
4594 be of the format
4595 .No PPPoE: Ns Ar iface Ns Xo
4596 .Op \&: Ns Ar provider Ns
4597 .Xc
4598 (on
4599 .Xr netgraph 4
4600 enabled systems), or be of the format
4601 .Sm off
4602 .Ar host : port Op /tcp|udp .
4603 .Sm on
4604 .Pp
4605 If it begins with an exclamation mark, the rest of the device name is
4606 treated as a program name, and that program is executed when the device
4607 is opened.
4608 Standard input, output and error are fed back to
4609 .Nm
4610 and are read and written as if they were a regular device.
4611 .Pp
4612 If a
4613 .No PPPoE: Ns Ar iface Ns Xo
4614 .Op \&: Ns Ar provider Ns
4615 .Xc
4616 specification is given,
4617 .Nm
4618 will attempt to create a
4619 .Em PPP
4620 over Ethernet connection using the given
4621 .Ar iface
4622 interface by using
4623 .Xr netgraph 4 .
4624 If
4625 .Xr netgraph 4
4626 is not available,
4627 .Nm
4628 will attempt to load it using
4629 .Xr kldload 2 .
4630 If this fails, an external program must be used such as the
4631 .Xr pppoed 8
4632 program available under
4633 .Ox .
4634 The given
4635 .Ar provider
4636 is passed as the service name in the PPPoE Discovery Initiation (PADI)
4637 packet.
4638 If no provider is given, an empty value will be used.
4639 .Pp
4640 When a PPPoE connection is established,
4641 .Nm
4642 will place the name of the Access Concentrator in the environment variable
4643 .Ev ACNAME .
4644 .Pp
4645 Refer to
4646 .Xr netgraph 4
4647 and
4648 .Xr ng_pppoe 4
4649 for further details.
4650 .Pp
4651 If a
4652 .Ar host Ns No : Ns Ar port Ns Oo
4653 .No /tcp|udp
4654 .Oc
4655 specification is given,
4656 .Nm
4657 will attempt to connect to the given
4658 .Ar host
4659 on the given
4660 .Ar port .
4661 If a
4662 .Dq /tcp
4663 or
4664 .Dq /udp
4665 suffix is not provided, the default is
4666 .Dq /tcp .
4667 Refer to the section on
4668 .Em PPP OVER TCP and UDP
4669 above for further details.
4670 .Pp
4671 If multiple
4672 .Dq values
4673 are specified,
4674 .Nm
4675 will attempt to open each one in turn until it succeeds or runs out of
4676 devices.
4677 .It set dial Ar chat-script
4678 This specifies the chat script that will be used to dial the other
4679 side.
4680 See also the
4681 .Dq set login
4682 command below.
4683 Refer to
4684 .Xr chat 8
4685 and to the example configuration files for details of the chat script
4686 format.
4687 It is possible to specify some special
4688 .Sq values
4689 in your chat script as follows:
4690 .Bl -tag -width 2n
4691 .It Li \ec
4692 When used as the last character in a
4693 .Sq send
4694 string, this indicates that a newline should not be appended.
4695 .It Li \ed
4696 When the chat script encounters this sequence, it delays two seconds.
4697 .It Li \ep
4698 When the chat script encounters this sequence, it delays for one quarter of
4699 a second.
4700 .It Li \en
4701 This is replaced with a newline character.
4702 .It Li \er
4703 This is replaced with a carriage return character.
4704 .It Li \es
4705 This is replaced with a space character.
4706 .It Li \et
4707 This is replaced with a tab character.
4708 .It Li \eT
4709 This is replaced by the current phone number (see
4710 .Dq set phone
4711 below).
4712 .It Li \eP
4713 This is replaced by the current
4714 .Ar authkey
4715 value (see
4716 .Dq set authkey
4717 above).
4718 .It Li \eU
4719 This is replaced by the current
4720 .Ar authname
4721 value (see
4722 .Dq set authname
4723 above).
4724 .El
4725 .Pp
4726 Note that two parsers will examine these escape sequences, so in order to
4727 have the
4728 .Sq chat parser
4729 see the escape character, it is necessary to escape it from the
4730 .Sq command parser .
4731 This means that in practice you should use two escapes, for example:
4732 .Bd -literal -offset indent
4733 set dial "... ATDT\\\\T CONNECT"
4734 .Ed
4735 .Pp
4736 It is also possible to execute external commands from the chat script.
4737 To do this, the first character of the expect or send string is an
4738 exclamation mark
4739 .Pq Dq !\& .
4740 If a literal exclamation mark is required, double it up to
4741 .Dq !!\&
4742 and it will be treated as a single literal
4743 .Dq !\& .
4744 When the command is executed, standard input and standard output are
4745 directed to the open device (see the
4746 .Dq set device
4747 command), and standard error is read by
4748 .Nm
4749 and substituted as the expect or send string.
4750 If
4751 .Nm
4752 is running in interactive mode, file descriptor 3 is attached to
4753 .Pa /dev/tty .
4754 .Pp
4755 For example (wrapped for readability):
4756 .Bd -literal -offset indent
4757 set login "TIMEOUT 5 \\"\\" \\"\\" login:--login: ppp \e
4758 word: ppp \\"!sh \\\\-c \\\\\\"echo \\\\-n label: >&2\\\\\\"\\" \e
4759 \\"!/bin/echo in\\" HELLO"
4760 .Ed
4761 .Pp
4762 would result in the following chat sequence (output using the
4763 .Sq set log local chat
4764 command before dialing):
4765 .Bd -literal -offset indent
4766 Dial attempt 1 of 1
4767 dial OK!
4768 Chat: Expecting:
4769 Chat: Sending:
4770 Chat: Expecting: login:--login:
4771 Chat: Wait for (5): login:
4772 Chat: Sending: ppp
4773 Chat: Expecting: word:
4774 Chat: Wait for (5): word:
4775 Chat: Sending: ppp
4776 Chat: Expecting: !sh \\-c "echo \\-n label: >&2"
4777 Chat: Exec: sh -c "echo -n label: >&2"
4778 Chat: Wait for (5): !sh \\-c "echo \\-n label: >&2" --> label:
4779 Chat: Exec: /bin/echo in
4780 Chat: Sending:
4781 Chat: Expecting: HELLO
4782 Chat: Wait for (5): HELLO
4783 login OK!
4784 .Ed
4785 .Pp
4786 Note (again) the use of the escape character, allowing many levels of
4787 nesting.
4788 Here, there are four parsers at work.
4789 The first parses the original line, reading it as three arguments.
4790 The second parses the third argument, reading it as 11 arguments.
4791 At this point, it is
4792 important that the
4793 .Dq \&-
4794 signs are escaped, otherwise this parser will see them as constituting
4795 an expect-send-expect sequence.
4796 When the
4797 .Dq !\&
4798 character is seen, the execution parser reads the first command as three
4799 arguments, and then
4800 .Xr sh 1
4801 itself expands the argument after the
4802 .Fl c .
4803 As we wish to send the output back to the modem, in the first example
4804 we redirect our output to file descriptor 2 (stderr) so that
4805 .Nm
4806 itself sends and logs it, and in the second example, we just output to stdout,
4807 which is attached directly to the modem.
4808 .Pp
4809 This, of course means that it is possible to execute an entirely external
4810 .Dq chat
4811 command rather than using the internal one.
4812 See
4813 .Xr chat 8
4814 for a good alternative.
4815 .Pp
4816 The external command that is executed is subjected to the same special
4817 word expansions as the
4818 .Dq !bg
4819 command.
4820 .It set enddisc Op label|IP|MAC|magic|psn value
4821 This command sets our local endpoint discriminator.
4822 If set prior to LCP negotiation, and if no
4823 .Dq disable enddisc
4824 command has been used,
4825 .Nm
4826 will send the information to the peer using the LCP endpoint discriminator
4827 option.
4828 The following discriminators may be set:
4829 .Bl -tag -width indent
4830 .It Li label
4831 The current label is used.
4832 .It Li IP
4833 Our local IP number is used.
4834 As LCP is negotiated prior to IPCP, it is
4835 possible that the IPCP layer will subsequently change this value.
4836 If
4837 it does, the endpoint discriminator stays at the old value unless manually
4838 reset.
4839 .It Li MAC
4840 This is similar to the
4841 .Ar IP
4842 option above, except that the MAC address associated with the local IP
4843 number is used.
4844 If the local IP number is not resident on any Ethernet
4845 interface, the command will fail.
4846 .Pp
4847 As the local IP number defaults to whatever the machine host name is,
4848 .Dq set enddisc mac
4849 is usually done prior to any
4850 .Dq set ifaddr
4851 commands.
4852 .It Li magic
4853 A 20 digit random number is used.
4854 Care should be taken when using magic numbers as restarting
4855 .Nm
4856 or creating a link using a different
4857 .Nm
4858 invocation will also use a different magic number and will therefore not
4859 be recognised by the peer as belonging to the same bundle.
4860 This makes it unsuitable for
4861 .Fl direct
4862 connections.
4863 .It Li psn Ar value
4864 The given
4865 .Ar value
4866 is used.
4867 .Ar Value
4868 should be set to an absolute public switched network number with the
4869 country code first.
4870 .El
4871 .Pp
4872 If no arguments are given, the endpoint discriminator is reset.
4873 .It set escape Ar value...
4874 This option is similar to the
4875 .Dq set accmap
4876 option above.
4877 It allows the user to specify a set of characters that will be
4878 .Sq escaped
4879 as they travel across the link.
4880 .It set filter dial|alive|in|out Ar rule-no Xo
4881 .No permit|deny|clear| Ns Ar rule-no
4882 .Op !\&
4883 .Oo Op host
4884 .Ar src_addr Ns Op / Ns Ar width
4885 .Op Ar dst_addr Ns Op / Ns Ar width
4886 .Oc [ Ns Ar proto
4887 .Op src lt|eq|gt Ar port
4888 .Op dst lt|eq|gt Ar port
4889 .Op estab
4890 .Op syn
4891 .Op finrst
4892 .Op timeout Ar secs ]
4893 .Xc
4894 .Nm
4895 supports four filter sets.
4896 The
4897 .Em alive
4898 filter specifies packets that keep the connection alive - resetting the
4899 idle timer.
4900 The
4901 .Em dial
4902 filter specifies packets that cause
4903 .Nm
4904 to dial when in
4905 .Fl auto
4906 mode.
4907 The
4908 .Em in
4909 filter specifies packets that are allowed to travel
4910 into the machine and the
4911 .Em out
4912 filter specifies packets that are allowed out of the machine.
4913 .Pp
4914 Filtering is done prior to any IP alterations that might be done by the
4915 NAT engine on outgoing packets and after any IP alterations that might
4916 be done by the NAT engine on incoming packets.
4917 By default all empty filter sets allow all packets to pass.
4918 Rules are processed in order according to
4919 .Ar rule-no
4920 (unless skipped by specifying a rule number as the
4921 .Ar action ) .
4922 Up to 40 rules may be given for each set.
4923 If a packet does not match
4924 any of the rules in a given set, it is discarded.
4925 In the case of
4926 .Em in
4927 and
4928 .Em out
4929 filters, this means that the packet is dropped.
4930 In the case of
4931 .Em alive
4932 filters it means that the packet will not reset the idle timer (even if
4933 the
4934 .Ar in Ns No / Ns Ar out
4935 filter has a
4936 .Dq timeout
4937 value) and in the case of
4938 .Em dial
4939 filters it means that the packet will not trigger a dial.
4940 A packet failing to trigger a dial will be dropped rather than queued.
4941 Refer to the
4942 section on
4943 .Sx PACKET FILTERING
4944 above for further details.
4945 .It set hangup Ar chat-script
4946 This specifies the chat script that will be used to reset the device
4947 before it is closed.
4948 It should not normally be necessary, but can
4949 be used for devices that fail to reset themselves properly on close.
4950 .It set help|? Op Ar command
4951 This command gives a summary of available set commands, or if
4952 .Ar command
4953 is specified, the command usage is shown.
4954 .It set ifaddr Oo Ar myaddr Ns
4955 .Op / Ns Ar \&nn
4956 .Oo Ar hisaddr Ns Op / Ns Ar \&nn
4957 .Oo Ar netmask
4958 .Op Ar triggeraddr
4959 .Oc Oc
4960 .Oc
4961 This command specifies the IP addresses that will be used during
4962 IPCP negotiation.
4963 Addresses are specified using the format
4964 .Pp
4965 .Dl a.b.c.d/nn
4966 .Pp
4967 Where
4968 .Dq a.b.c.d
4969 is the preferred IP, but
4970 .Ar nn
4971 specifies how many bits of the address we will insist on.
4972 If
4973 .No / Ns Ar nn
4974 is omitted, it defaults to
4975 .Dq /32
4976 unless the IP address is 0.0.0.0 in which case it defaults to
4977 .Dq /0 .
4978 .Pp
4979 If you wish to assign a dynamic IP number to the peer,
4980 .Ar hisaddr
4981 may also be specified as a range of IP numbers in the format
4982 .Bd -ragged -offset indent
4983 .Ar \&IP Ns Oo \&- Ns Ar \&IP Ns Oc Ns Oo , Ns Ar \&IP Ns
4984 .Oo \&- Ns Ar \&IP Ns Oc Oc Ns ...
4985 .Ed
4986 .Pp
4987 for example:
4988 .Pp
4989 .Dl set ifaddr 10.0.0.1 10.0.1.2-10.0.1.10,10.0.1.20
4990 .Pp
4991 will only negotiate
4992 .Dq 10.0.0.1
4993 as the local IP number, but may assign any of the given 10 IP
4994 numbers to the peer.
4995 If the peer requests one of these numbers,
4996 and that number is not already in use,
4997 .Nm
4998 will grant the peers request.
4999 This is useful if the peer wants
5000 to re-establish a link using the same IP number as was previously
5001 allocated (thus maintaining any existing tcp or udp connections).
5002 .Pp
5003 If the peer requests an IP number that is either outside
5004 of this range or is already in use,
5005 .Nm
5006 will suggest a random unused IP number from the range.
5007 .Pp
5008 If
5009 .Ar triggeraddr
5010 is specified, it is used in place of
5011 .Ar myaddr
5012 in the initial IPCP negotiation.
5013 However, only an address in the
5014 .Ar myaddr
5015 range will be accepted.
5016 This is useful when negotiating with some
5017 .Dv PPP
5018 implementations that will not assign an IP number unless their peer
5019 requests
5020 .Dq 0.0.0.0 .
5021 .Pp
5022 It should be noted that in
5023 .Fl auto
5024 mode,
5025 .Nm
5026 will configure the interface immediately upon reading the
5027 .Dq set ifaddr
5028 line in the config file.
5029 In any other mode, these values are just
5030 used for IPCP negotiations, and the interface is not configured
5031 until the IPCP layer is up.
5032 .Pp
5033 Note that the
5034 .Ar HISADDR
5035 argument may be overridden by the third field in the
5036 .Pa ppp.secret
5037 file once the client has authenticated itself
5038 (if PAP or CHAP are
5039 .Dq enabled ) .
5040 Refer to the
5041 .Sx AUTHENTICATING INCOMING CONNECTIONS
5042 section for details.
5043 .Pp
5044 In all cases, if the interface is already configured,
5045 .Nm
5046 will try to maintain the interface IP numbers so that any existing
5047 bound sockets will remain valid.
5048 .It set ifqueue Ar packets
5049 Set the maximum number of packets that
5050 .Nm
5051 will read from the tunnel interface while data cannot be sent to any of
5052 the available links.
5053 This queue limit is necessary to flow control outgoing data as the tunnel
5054 interface is likely to be far faster than the combined links available to
5055 .Nm .
5056 .Pp
5057 If
5058 .Ar packets
5059 is set to a value less than the number of links,
5060 .Nm
5061 will read up to that value regardless.
5062 This prevents any possible latency problems.
5063 .Pp
5064 The default value for
5065 .Ar packets
5066 is
5067 .Dq 30 .
5068 .It set ccpretry|ccpretries Oo Ar timeout
5069 .Op Ar reqtries Op Ar trmtries
5070 .Oc
5071 .It set chapretry|chapretries Oo Ar timeout
5072 .Op Ar reqtries
5073 .Oc
5074 .It set ipcpretry|ipcpretries Oo Ar timeout
5075 .Op Ar reqtries Op Ar trmtries
5076 .Oc
5077 .It set ipv6cpretry|ipv6cpretries Oo Ar timeout
5078 .Op Ar reqtries Op Ar trmtries
5079 .Oc
5080 .It set lcpretry|lcpretries Oo Ar timeout
5081 .Op Ar reqtries Op Ar trmtries
5082 .Oc
5083 .It set papretry|papretries Oo Ar timeout
5084 .Op Ar reqtries
5085 .Oc
5086 These commands set the number of seconds that
5087 .Nm
5088 will wait before resending Finite State Machine (FSM) Request packets.
5089 The default
5090 .Ar timeout
5091 for all FSMs is 3 seconds (which should suffice in most cases).
5092 .Pp
5093 If
5094 .Ar reqtries
5095 is specified, it tells
5096 .Nm
5097 how many configuration request attempts it should make while receiving
5098 no reply from the peer before giving up.
5099 The default is 5 attempts for
5100 CCP, LCP and IPCP and 3 attempts for PAP and CHAP.
5101 .Pp
5102 If
5103 .Ar trmtries
5104 is specified, it tells
5105 .Nm
5106 how many terminate requests should be sent before giving up waiting for the
5107 peers response.
5108 The default is 3 attempts.
5109 Authentication protocols are
5110 not terminated and it is therefore invalid to specify
5111 .Ar trmtries
5112 for PAP or CHAP.
5113 .Pp
5114 In order to avoid negotiations with the peer that will never converge,
5115 .Nm
5116 will only send at most 3 times the configured number of
5117 .Ar reqtries
5118 in any given negotiation session before giving up and closing that layer.
5119 .It set log Xo
5120 .Op local
5121 .Op +|- Ns
5122 .Ar value Ns No ...
5123 .Xc
5124 This command allows the adjustment of the current log level.
5125 Refer to the Logging Facility section for further details.
5126 .It set login Ar chat-script
5127 This
5128 .Ar chat-script
5129 compliments the dial-script.
5130 If both are specified, the login
5131 script will be executed after the dial script.
5132 Escape sequences available in the dial script are also available here.
5133 .It set logout Ar chat-script
5134 This specifies the chat script that will be used to logout
5135 before the hangup script is called.
5136 It should not normally be necessary.
5137 .It set lqrperiod|echoperiod Ar frequency
5138 This command sets the
5139 .Ar frequency
5140 in seconds at which
5141 .Em LQR
5142 or
5143 .Em LCP ECHO
5144 packets are sent.
5145 The default is 30 seconds.
5146 You must also use the
5147 .Dq enable lqr
5148 and/or
5149 .Dq enable echo
5150 commands if you wish to send
5151 .Em LQR
5152 or
5153 .Em LCP ECHO
5154 requests to the peer.
5155 .It set mode Ar interactive|auto|ddial|background
5156 This command allows you to change the
5157 .Sq mode
5158 of the specified link.
5159 This is normally only useful in multi-link mode,
5160 but may also be used in uni-link mode.
5161 .Pp
5162 It is not possible to change a link that is
5163 .Sq direct
5164 or
5165 .Sq dedicated .
5166 .Pp
5167 Note: If you issue the command
5168 .Dq set mode auto ,
5169 and have network address translation enabled, it may be useful to
5170 .Dq enable iface-alias
5171 afterwards.
5172 This will allow
5173 .Nm
5174 to do the necessary address translations to enable the process that
5175 triggers the connection to connect once the link is up despite the
5176 peer assigning us a new (dynamic) IP address.
5177 .It set mppe Op 40|56|128|* Op stateless|stateful|*
5178 This option selects the encryption parameters used when negotiation
5179 MPPE.
5180 MPPE can be disabled entirely with the
5181 .Dq disable mppe
5182 command.
5183 If no arguments are given,
5184 .Nm
5185 will attempt to negotiate a stateful link with a 128 bit key, but
5186 will agree to whatever the peer requests (including no encryption
5187 at all).
5188 .Pp
5189 If any arguments are given,
5190 .Nm
5191 will
5192 .Em insist
5193 on using MPPE and will close the link if it is rejected by the peer (Note;
5194 this behaviour can be overridden by a configured RADIUS server).
5195 .Pp
5196 The first argument specifies the number of bits that
5197 .Nm
5198 should insist on during negotiations and the second specifies whether
5199 .Nm
5200 should insist on stateful or stateless mode.
5201 In stateless mode, the
5202 encryption dictionary is re-initialised with every packet according to
5203 an encryption key that is changed with every packet.
5204 In stateful mode,
5205 the encryption dictionary is re-initialised every 256 packets or after
5206 the loss of any data and the key is changed every 256 packets.
5207 Stateless mode is less efficient but is better for unreliable transport
5208 layers.
5209 .It set mrru Op Ar value
5210 Setting this option enables Multi-link PPP negotiations, also known as
5211 Multi-link Protocol or MP.
5212 There is no default MRRU (Maximum Reconstructed Receive Unit) value.
5213 If no argument is given, multi-link mode is disabled.
5214 .It set mru Xo
5215 .Op max Ns Op imum
5216 .Op Ar value
5217 .Xc
5218 The default MRU (Maximum Receive Unit) is 1500.
5219 If it is increased, the other side *may* increase its MTU.
5220 In theory there is no point in decreasing the MRU to below the default as the
5221 .Em PPP
5222 protocol says implementations *must* be able to accept packets of at
5223 least 1500 octets.
5224 .Pp
5225 If the
5226 .Dq maximum
5227 keyword is used,
5228 .Nm
5229 will refuse to negotiate a higher value.
5230 The maximum MRU can be set to 2048 at most.
5231 Setting a maximum of less than 1500 violates the
5232 .Em PPP
5233 rfc, but may sometimes be necessary.
5234 For example,
5235 .Em PPPoE
5236 imposes a maximum of 1492 due to hardware limitations.
5237 .Pp
5238 If no argument is given, 1500 is assumed.
5239 A value must be given when
5240 .Dq maximum
5241 is specified.
5242 .It set mtu Xo
5243 .Op max Ns Op imum
5244 .Op Ar value
5245 .Xc
5246 The default MTU is 1500.
5247 At negotiation time,
5248 .Nm
5249 will accept whatever MRU the peer requests (assuming it is
5250 not less than 296 bytes or greater than the assigned maximum).
5251 If the MTU is set,
5252 .Nm
5253 will not accept MRU values less than
5254 .Ar value .
5255 When negotiations are complete, the MTU is used when writing to the
5256 interface, even if the peer requested a higher value MRU.
5257 This can be useful for
5258 limiting your packet size (giving better bandwidth sharing at the expense
5259 of more header data).
5260 .Pp
5261 If the
5262 .Dq maximum
5263 keyword is used,
5264 .Nm
5265 will refuse to negotiate a higher value.
5266 The maximum MTU can be set to 2048 at most.
5267 Note, it is necessary to use the
5268 .Dq maximum
5269 keyword to limit the MTU when using PPPoE.
5270 .Pp
5271 If no
5272 .Ar value
5273 is given, 1500, or whatever the peer asks for is used.
5274 A value must be given when
5275 .Dq maximum
5276 is specified.
5277 .It set nbns Op Ar x.x.x.x Op Ar y.y.y.y
5278 This option allows the setting of the Microsoft NetBIOS name server
5279 values to be returned at the peers request.
5280 If no values are given,
5281 .Nm
5282 will reject any such requests.
5283 .It set openmode active|passive Op Ar delay
5284 By default,
5285 .Ar openmode
5286 is always
5287 .Ar active
5288 with a one second
5289 .Ar delay .
5290 That is,
5291 .Nm
5292 will always initiate LCP/IPCP/CCP negotiation one second after the line
5293 comes up.
5294 If you want to wait for the peer to initiate negotiations, you
5295 can use the value
5296 .Ar passive .
5297 If you want to initiate negotiations immediately or after more than one
5298 second, the appropriate
5299 .Ar delay
5300 may be specified here in seconds.
5301 .It set parity odd|even|none|mark
5302 This allows the line parity to be set.
5303 The default value is
5304 .Ar none .
5305 .It set phone Ar telno Ns Xo
5306 .Oo \&| Ns Ar backupnumber Oc Ns ... Ns Oo : Ns Ar nextnumber Oc Ns ... Xc
5307 This allows the specification of the phone number to be used in
5308 place of the \\\\T string in the dial and login chat scripts.
5309 Multiple phone numbers may be given separated either by a pipe
5310 .Pq Dq \&|
5311 or a colon
5312 .Pq Dq \&: .
5313 .Pp
5314 Numbers after the pipe are only dialed if the dial or login
5315 script for the previous number failed.
5316 .Pp
5317 Numbers after the colon are tried sequentially, irrespective of
5318 the reason the line was dropped.
5319 .Pp
5320 If multiple numbers are given,
5321 .Nm
5322 will dial them according to these rules until a connection is made, retrying
5323 the maximum number of times specified by
5324 .Dq set redial
5325 below.
5326 In
5327 .Fl background
5328 mode, each number is attempted at most once.
5329 .It set pppoe Op standard|3Com
5330 This option configures the underlying
5331 .Xr ng_pppoe 4
5332 node to either standard RFC2516 PPPoE or proprietary 3Com mode.
5333 If not set the system default will be used.
5334 .It set Oo proc Oc Ns Xo
5335 .No title Op Ar value
5336 .Xc
5337 The current process title as displayed by
5338 .Xr ps 1
5339 is changed according to
5340 .Ar value .
5341 If
5342 .Ar value
5343 is not specified, the original process title is restored.
5344 All the
5345 word replacements done by the shell commands (see the
5346 .Dq bg
5347 command above) are done here too.
5348 .Pp
5349 Note, if USER is required in the process title, the
5350 .Dq set proctitle
5351 command must appear in
5352 .Pa ppp.linkup ,
5353 as it is not known when the commands in
5354 .Pa ppp.conf
5355 are executed.
5356 .It set radius Op Ar config-file
5357 This command enables RADIUS support (if it is compiled in).
5358 .Ar config-file
5359 refers to the radius client configuration file as described in
5360 .Xr radius.conf 5 .
5361 If PAP, CHAP, MSCHAP or MSCHAPv2 are
5362 .Dq enable Ns No d ,
5363 .Nm
5364 behaves as a
5365 .Em \&N Ns No etwork
5366 .Em \&A Ns No ccess
5367 .Em \&S Ns No erver
5368 and uses the configured RADIUS server to authenticate rather than
5369 authenticating from the
5370 .Pa ppp.secret
5371 file or from the passwd database.
5372 .Pp
5373 If none of PAP, CHAP, MSCHAP or MSCHAPv2 are enabled,
5374 .Dq set radius
5375 will do nothing.
5376 .Pp
5377 .Nm
5378 uses the following attributes from the RADIUS reply:
5379 .Bl -tag -width XXX -offset XXX
5380 .It RAD_FRAMED_IP_ADDRESS
5381 The peer IP address is set to the given value.
5382 .It RAD_FRAMED_IP_NETMASK
5383 The tun interface netmask is set to the given value.
5384 .It RAD_FRAMED_MTU
5385 If the given MTU is less than the peers MRU as agreed during LCP
5386 negotiation, *and* it is less that any configured MTU (see the
5387 .Dq set mru
5388 command), the tun interface MTU is set to the given value.
5389 .It RAD_FRAMED_COMPRESSION
5390 If the received compression type is
5391 .Dq 1 ,
5392 .Nm
5393 will request VJ compression during IPCP negotiations despite any
5394 .Dq disable vj
5395 configuration command.
5396 .It RAD_FILTER_ID
5397 If this attribute is supplied,
5398 .Nm
5399 will attempt to use it as an additional label to load from the
5400 .Pa ppp.linkup
5401 and
5402 .Pa ppp.linkdown
5403 files.
5404 The load will be attempted before (and in addition to) the normal
5405 label search.
5406 If the label does not exist, no action is taken and
5407 .Nm
5408 proceeds to the normal load using the current label.
5409 .It RAD_FRAMED_ROUTE
5410 The received string is expected to be in the format
5411 .Ar dest Ns Op / Ns Ar bits
5412 .Ar gw
5413 .Op Ar metrics .
5414 Any specified metrics are ignored.
5415 .Dv MYADDR
5416 and
5417 .Dv HISADDR
5418 are understood as valid values for
5419 .Ar dest
5420 and
5421 .Ar gw ,
5422 .Dq default
5423 can be used for
5424 .Ar dest
5425 to sepcify the default route, and
5426 .Dq 0.0.0.0
5427 is understood to be the same as
5428 .Dq default
5429 for
5430 .Ar dest
5431 and
5432 .Dv HISADDR
5433 for
5434 .Ar gw .
5435 .Pp
5436 For example, a returned value of
5437 .Dq 1.2.3.4/24 0.0.0.0 1 2 -1 3 400
5438 would result in a routing table entry to the 1.2.3.0/24 network via
5439 .Dv HISADDR
5440 and a returned value of
5441 .Dq 0.0.0.0 0.0.0.0
5442 or
5443 .Dq default HISADDR
5444 would result in a default route to
5445 .Dv HISADDR .
5446 .Pp
5447 All RADIUS routes are applied after any sticky routes are applied, making
5448 RADIUS routes override configured routes.
5449 This also applies for RADIUS routes that do not {include} the
5450 .Dv MYADDR
5451 or
5452 .Dv HISADDR
5453 keywords.
5454 .Pp
5455 .It RAD_FRAMED_IPV6_PREFIX
5456 If this attribute is supplied, the value is substituted for IPV6PREFIX
5457 in a command.
5458 You may pass it to an upper layer protocol such as DHCPv6 for delegating an
5459 IPv6 prefix to a peer.
5460 .It RAD_FRAMED_IPV6_ROUTE
5461 The received string is expected to be in the format
5462 .Ar dest Ns Op / Ns Ar bits
5463 .Ar gw
5464 .Op Ar metrics .
5465 Any specified metrics are ignored.
5466 .Dv MYADDR6
5467 and
5468 .Dv HISADDR6
5469 are understood as valid values for
5470 .Ar dest
5471 and
5472 .Ar gw ,
5473 .Dq default
5474 can be used for
5475 .Ar dest
5476 to sepcify the default route, and
5477 .Dq ::
5478 is understood to be the same as
5479 .Dq default
5480 for
5481 .Ar dest
5482 and
5483 .Dv HISADDR6
5484 for
5485 .Ar gw .
5486 .Pp
5487 For example, a returned value of
5488 .Dq 3ffe:505:abcd::/48 ::
5489 would result in a routing table entry to the 3ffe:505:abcd::/48 network via
5490 .Dv HISADDR6
5491 and a returned value of
5492 .Dq :: ::
5493 or
5494 .Dq default HISADDR6
5495 would result in a default route to
5496 .Dv HISADDR6 .
5497 .Pp
5498 All RADIUS IPv6 routes are applied after any sticky routes are
5499 applied, making RADIUS IPv6 routes override configured routes.
5500 This
5501 also applies for RADIUS IPv6 routes that do not {include} the
5502 .Dv MYADDR6
5503 or
5504 .Dv HISADDR6
5505 keywords.
5506 .Pp
5507 .It RAD_SESSION_TIMEOUT
5508 If supplied, the client connection is closed after the given number of
5509 seconds.
5510 .It RAD_REPLY_MESSAGE
5511 If supplied, this message is passed back to the peer as the authentication
5512 SUCCESS text.
5513 .It RAD_MICROSOFT_MS_CHAP_ERROR
5514 If this
5515 .Dv RAD_VENDOR_MICROSOFT
5516 vendor specific attribute is supplied, it is passed back to the peer as the
5517 authentication FAILURE text.
5518 .It RAD_MICROSOFT_MS_CHAP2_SUCCESS
5519 If this
5520 .Dv RAD_VENDOR_MICROSOFT
5521 vendor specific attribute is supplied and if MS-CHAPv2 authentication is
5522 being used, it is passed back to the peer as the authentication SUCCESS text.
5523 .It RAD_MICROSOFT_MS_MPPE_ENCRYPTION_POLICY
5524 If this
5525 .Dv RAD_VENDOR_MICROSOFT
5526 vendor specific attribute is supplied and has a value of 2 (Required),
5527 .Nm
5528 will insist that MPPE encryption is used (even if no
5529 .Dq set mppe
5530 configuration command has been given with arguments).
5531 If it is supplied with a value of 1 (Allowed), encryption is made optional
5532 (despite any
5533 .Dq set mppe
5534 configuration commands with arguments).
5535 .It RAD_MICROSOFT_MS_MPPE_ENCRYPTION_TYPES
5536 If this
5537 .Dv RAD_VENDOR_MICROSOFT
5538 vendor specific attribute is supplied, bits 1 and 2 are examined.
5539 If either or both are set, 40 bit and/or 128 bit (respectively) encryption
5540 options are set, overriding any given first argument to the
5541 .Dq set mppe
5542 command.
5543 Note, it is not currently possible for the RADIUS server to specify 56 bit
5544 encryption.
5545 .It RAD_MICROSOFT_MS_MPPE_RECV_KEY
5546 If this
5547 .Dv RAD_VENDOR_MICROSOFT
5548 vendor specific attribute is supplied, it is value is used as the master
5549 key for decryption of incoming data.
5550 When clients are authenticated using
5551 MSCHAPv2, the RADIUS server MUST provide this attribute if inbound MPPE is
5552 to function.
5553 .It RAD_MICROSOFT_MS_MPPE_SEND_KEY
5554 If this
5555 .Dv RAD_VENDOR_MICROSOFT
5556 vendor specific attribute is supplied, it is value is used as the master
5557 key for encryption of outgoing data.
5558 When clients are authenticated using
5559 MSCHAPv2, the RADIUS server MUST provide this attribute if outbound MPPE is
5560 to function.
5561 .El
5562 .Pp
5563 Values received from the RADIUS server may be viewed using
5564 .Dq show bundle .
5565 .It set rad_alive Ar timeout
5566 When RADIUS is configured, setting
5567 .Dq rad_alive
5568 to a non-zero
5569 .Ar timeout
5570 value will tell
5571 .Nm
5572 to sent RADIUS accounting information to the RADIUS server every
5573 .Ar timeout
5574 seconds.
5575 .It set rad_port_id Ar option
5576 When RADIUS is configured, setting the
5577 .Dq rad_port_id
5578 value allows to specify what should be sent to the RADIUS server as
5579 NAS-Port-Id.
5580 The
5581 .Ar option Ns No s
5582 are as follows:
5583 .Bl -tag -width Ds
5584 .It pid
5585 PID of the corresponding tunnel.
5586 .It tunnum
5587 .Xr tun 4
5588 interface number.
5589 .It ifnum
5590 index of the interface as returned by
5591 .Xr if_nametoindex 3 .
5592 .It default
5593 keeps the default behavior.
5594 .El
5595 .It set reconnect Ar timeout ntries
5596 Should the line drop unexpectedly (due to loss of CD or LQR
5597 failure), a connection will be re-established after the given
5598 .Ar timeout .
5599 The line will be re-connected at most
5600 .Ar ntries
5601 times.
5602 .Ar Ntries
5603 defaults to zero.
5604 A value of
5605 .Ar random
5606 for
5607 .Ar timeout
5608 will result in a variable pause, somewhere between 1 and 30 seconds.
5609 .It set recvpipe Op Ar value
5610 This sets the routing table RECVPIPE value.
5611 The optimum value is just over twice the MTU value.
5612 If
5613 .Ar value
5614 is unspecified or zero, the default kernel controlled value is used.
5615 .It set redial Ar secs Ns Xo
5616 .Oo + Ns Ar inc Ns
5617 .Oo - Ns Ar max Ns Oc Oc Ns
5618 .Op . Ns Ar next
5619 .Op Ar attempts
5620 .Xc
5621 .Nm
5622 can be instructed to attempt to redial
5623 .Ar attempts
5624 times.
5625 If more than one phone number is specified (see
5626 .Dq set phone
5627 above), a pause of
5628 .Ar next
5629 is taken before dialing each number.
5630 A pause of
5631 .Ar secs
5632 is taken before starting at the first number again.
5633 A literal value of
5634 .Dq Li random
5635 may be used here in place of
5636 .Ar secs
5637 and
5638 .Ar next ,
5639 causing a random delay of between 1 and 30 seconds.
5640 .Pp
5641 If
5642 .Ar inc
5643 is specified, its value is added onto
5644 .Ar secs
5645 each time
5646 .Nm
5647 tries a new number.
5648 .Ar secs
5649 will only be incremented at most
5650 .Ar max
5651 times.
5652 .Ar max
5653 defaults to 10.
5654 .Pp
5655 Note, the
5656 .Ar secs
5657 delay will be effective, even after
5658 .Ar attempts
5659 has been exceeded, so an immediate manual dial may appear to have
5660 done nothing.
5661 If an immediate dial is required, a
5662 .Dq !\&
5663 should immediately follow the
5664 .Dq open
5665 keyword.
5666 See the
5667 .Dq open
5668 description above for further details.
5669 .It set sendpipe Op Ar value
5670 This sets the routing table SENDPIPE value.
5671 The optimum value is just over twice the MTU value.
5672 If
5673 .Ar value
5674 is unspecified or zero, the default kernel controlled value is used.
5675 .It "set server|socket" Ar TcpPort Ns No \&| Ns Xo
5676 .Ar LocalName Ns No |none|open|closed
5677 .Op password Op Ar mask
5678 .Xc
5679 This command tells
5680 .Nm
5681 to listen on the given socket or
5682 .Sq diagnostic port
5683 for incoming command connections.
5684 .Pp
5685 The word
5686 .Dq none
5687 instructs
5688 .Nm
5689 to close any existing socket and clear the socket configuration.
5690 The word
5691 .Dq open
5692 instructs
5693 .Nm
5694 to attempt to re-open the port.
5695 The word
5696 .Dq closed
5697 instructs
5698 .Nm
5699 to close the open port.
5700 .Pp
5701 If you wish to specify a local domain socket,
5702 .Ar LocalName
5703 must be specified as an absolute file name, otherwise it is assumed
5704 to be the name or number of a TCP port.
5705 You may specify the octal umask to be used with a local domain socket.
5706 Refer to
5707 .Xr umask 2
5708 for umask details.
5709 Refer to
5710 .Xr services 5
5711 for details of how to translate TCP port names.
5712 .Pp
5713 You must also specify the password that must be entered by the client
5714 (using the
5715 .Dq passwd
5716 variable above) when connecting to this socket.
5717 If the password is
5718 specified as an empty string, no password is required for connecting clients.
5719 .Pp
5720 When specifying a local domain socket, the first
5721 .Dq %d
5722 sequence found in the socket name will be replaced with the current
5723 interface unit number.
5724 This is useful when you wish to use the same
5725 profile for more than one connection.
5726 .Pp
5727 In a similar manner TCP sockets may be prefixed with the
5728 .Dq +
5729 character, in which case the current interface unit number is added to
5730 the port number.
5731 .Pp
5732 When using
5733 .Nm
5734 with a server socket, the
5735 .Xr pppctl 8
5736 command is the preferred mechanism of communications.
5737 Currently,
5738 .Xr telnet 1
5739 can also be used, but link encryption may be implemented in the future, so
5740 .Xr telnet 1
5741 should be avoided.
5742 .Pp
5743 Note;
5744 .Dv SIGUSR1
5745 and
5746 .Dv SIGUSR2
5747 interact with the diagnostic socket.
5748 .It set speed Ar value
5749 This sets the speed of the serial device.
5750 If speed is specified as
5751 .Dq sync ,
5752 .Nm
5753 treats the device as a synchronous device.
5754 .Pp
5755 Certain device types will know whether they should be specified as
5756 synchronous or asynchronous.
5757 These devices will override incorrect
5758 settings and log a warning to this effect.
5759 .It set stopped Op Ar LCPseconds Op Ar CCPseconds
5760 If this option is set,
5761 .Nm
5762 will time out after the given FSM (Finite State Machine) has been in
5763 the stopped state for the given number of
5764 .Dq seconds .
5765 This option may be useful if the peer sends a terminate request,
5766 but never actually closes the connection despite our sending a terminate
5767 acknowledgement.
5768 This is also useful if you wish to
5769 .Dq set openmode passive
5770 and time out if the peer does not send a Configure Request within the
5771 given time.
5772 Use
5773 .Dq set log +lcp +ccp
5774 to make
5775 .Nm
5776 log the appropriate state transitions.
5777 .Pp
5778 The default value is zero, where
5779 .Nm
5780 does not time out in the stopped state.
5781 .Pp
5782 This value should not be set to less than the openmode delay (see
5783 .Dq set openmode
5784 above).
5785 .It set timeout Ar idleseconds Op Ar mintimeout
5786 This command allows the setting of the idle timer.
5787 Refer to the section titled
5788 .Sx SETTING THE IDLE TIMER
5789 for further details.
5790 .Pp
5791 If
5792 .Ar mintimeout
5793 is specified,
5794 .Nm
5795 will never idle out before the link has been up for at least that number
5796 of seconds.
5797 .It set urgent Xo
5798 .Op tcp|udp|none
5799 .Oo Op +|- Ns
5800 .Ar port
5801 .Oc No ...
5802 .Xc
5803 This command controls the ports that
5804 .Nm
5805 prioritizes when transmitting data.
5806 The default priority TCP ports
5807 are ports 21 (ftp control), 22 (ssh), 23 (telnet), 513 (login), 514 (shell),
5808 543 (klogin) and 544 (kshell).
5809 There are no priority UDP ports by default.
5810 See
5811 .Xr services 5
5812 for details.
5813 .Pp
5814 If neither
5815 .Dq tcp
5816 or
5817 .Dq udp
5818 are specified,
5819 .Dq tcp
5820 is assumed.
5821 .Pp
5822 If no
5823 .Ar port Ns No s
5824 are given, the priority port lists are cleared (although if
5825 .Dq tcp
5826 or
5827 .Dq udp
5828 is specified, only that list is cleared).
5829 If the first
5830 .Ar port
5831 argument is prefixed with a plus
5832 .Pq Dq \&+
5833 or a minus
5834 .Pq Dq \&- ,
5835 the current list is adjusted, otherwise the list is reassigned.
5836 .Ar port Ns No s
5837 prefixed with a plus or not prefixed at all are added to the list and
5838 .Ar port Ns No s
5839 prefixed with a minus are removed from the list.
5840 .Pp
5841 If
5842 .Dq none
5843 is specified, all priority port lists are disabled and even
5844 .Dv IPTOS_LOWDELAY
5845 packets are not prioritised.
5846 .It set vj slotcomp on|off
5847 This command tells
5848 .Nm
5849 whether it should attempt to negotiate VJ slot compression.
5850 By default, slot compression is turned
5851 .Ar on .
5852 .It set vj slots Ar nslots
5853 This command sets the initial number of slots that
5854 .Nm
5855 will try to negotiate with the peer when VJ compression is enabled (see the
5856 .Sq enable
5857 command above).
5858 It defaults to a value of 16.
5859 .Ar Nslots
5860 must be between
5861 .Ar 4
5862 and
5863 .Ar 16
5864 inclusive.
5865 .El
5866 .Pp
5867 .It shell|! Op Ar command
5868 If
5869 .Ar command
5870 is not specified a shell is invoked according to the
5871 .Dv SHELL
5872 environment variable.
5873 Otherwise, the given
5874 .Ar command
5875 is executed.
5876 Word replacement is done in the same way as for the
5877 .Dq !bg
5878 command as described above.
5879 .Pp
5880 Use of the !\& character
5881 requires a following space as with any of the other commands.
5882 You should note that this command is executed in the foreground;
5883 .Nm
5884 will not continue running until this process has exited.
5885 Use the
5886 .Dv bg
5887 command if you wish processing to happen in the background.
5888 .It show Ar var
5889 This command allows the user to examine the following:
5890 .Bl -tag -width 2n
5891 .It show bundle
5892 Show the current bundle settings.
5893 .It show ccp
5894 Show the current CCP compression statistics.
5895 .It show compress
5896 Show the current VJ compression statistics.
5897 .It show escape
5898 Show the current escape characters.
5899 .It show filter Op Ar name
5900 List the current rules for the given filter.
5901 If
5902 .Ar name
5903 is not specified, all filters are shown.
5904 .It show hdlc
5905 Show the current HDLC statistics.
5906 .It show help|?
5907 Give a summary of available show commands.
5908 .It show iface
5909 Show the current interface information
5910 (the same as
5911 .Dq iface show ) .
5912 .It show ipcp
5913 Show the current IPCP statistics.
5914 .It show layers
5915 Show the protocol layers currently in use.
5916 .It show lcp
5917 Show the current LCP statistics.
5918 .It show Oo data Oc Ns Xo
5919 .No link
5920 .Xc
5921 Show high level link information.
5922 .It show links
5923 Show a list of available logical links.
5924 .It show log
5925 Show the current log values.
5926 .It show mem
5927 Show current memory statistics.
5928 .It show ncp
5929 Show the current NCP statistics.
5930 .It show physical
5931 Show low level link information.
5932 .It show mp
5933 Show Multi-link information.
5934 .It show proto
5935 Show current protocol totals.
5936 .It show route
5937 Show the current routing tables.
5938 .It show stopped
5939 Show the current stopped timeouts.
5940 .It show timer
5941 Show the active alarm timers.
5942 .It show version
5943 Show the current version number of
5944 .Nm .
5945 .El
5946 .Pp
5947 .It term
5948 Go into terminal mode.
5949 Characters typed at the keyboard are sent to the device.
5950 Characters read from the device are displayed on the screen.
5951 When a remote
5952 .Em PPP
5953 peer is detected,
5954 .Nm
5955 automatically enables Packet Mode and goes back into command mode.
5956 .El
5957 .Sh MORE DETAILS
5958 .Bl -bullet
5959 .It
5960 Read the example configuration files.
5961 They are a good source of information.
5962 .It
5963 Use
5964 .Dq help ,
5965 .Dq nat \&? ,
5966 .Dq enable \&? ,
5967 .Dq set ?\&
5968 and
5969 .Dq show ?\&
5970 to get online information about what is available.
5971 .It
5972 The following URLs contain useful information:
5973 .Bl -bullet -compact
5974 .It
5975 http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/faq/ppp.html
5976 .It
5977 http://www.FreeBSD.org/doc/handbook/userppp.html
5978 .El
5979 .Pp
5980 .El
5981 .Sh FILES
5982 .Nm
5983 refers to four files:
5984 .Pa ppp.conf ,
5985 .Pa ppp.linkup ,
5986 .Pa ppp.linkdown
5987 and
5988 .Pa ppp.secret .
5989 These files are placed in the
5990 .Pa /etc/ppp
5991 directory.
5992 .Bl -tag -width 2n
5993 .It Pa /etc/ppp/ppp.conf
5994 System default configuration file.
5995 .It Pa /etc/ppp/ppp.secret
5996 An authorisation file for each system.
5997 .It Pa /etc/ppp/ppp.linkup
5998 A file to check when
5999 .Nm
6000 establishes a network level connection.
6001 .It Pa /etc/ppp/ppp.linkdown
6002 A file to check when
6003 .Nm
6004 closes a network level connection.
6005 .It Pa /var/log/ppp.log
6006 Logging and debugging information file.
6007 Note, this name is specified in
6008 .Pa /etc/syslog.conf .
6009 See
6010 .Xr syslog.conf 5
6011 for further details.
6012 .It Pa /var/spool/lock/LCK..*
6013 tty port locking file.
6014 Refer to
6015 .Xr uucplock 3
6016 for further details.
6017 .It Pa /var/run/tunN.pid
6018 The process id (pid) of the
6019 .Nm
6020 program connected to the tunN device, where
6021 .Sq N
6022 is the number of the device.
6023 .It Pa /var/run/ttyXX.if
6024 The tun interface used by this port.
6025 Again, this file is only created in
6026 .Fl background ,
6027 .Fl auto
6028 and
6029 .Fl ddial
6030 modes.
6031 .It Pa /etc/services
6032 Get port number if port number is using service name.
6033 .It Pa /var/run/ppp-authname-class-value
6034 In multi-link mode, local domain sockets are created using the peer
6035 authentication name
6036 .Pq Sq authname ,
6037 the peer endpoint discriminator class
6038 .Pq Sq class
6039 and the peer endpoint discriminator value
6040 .Pq Sq value .
6041 As the endpoint discriminator value may be a binary value, it is turned
6042 to HEX to determine the actual file name.
6043 .Pp
6044 This socket is used to pass links between different instances of
6045 .Nm .
6046 .El
6047 .Sh SEE ALSO
6048 .Xr at 1 ,
6049 .Xr ftp 1 ,
6050 .Xr gzip 1 ,
6051 .Xr hostname 1 ,
6052 .Xr login 1 ,
6053 .Xr tcpdump 1 ,
6054 .Xr telnet 1 ,
6055 .Xr kldload 2 ,
6056 .Xr pipe 2 ,
6057 .Xr socketpair 2 ,
6058 ifdef({LOCALNAT},{},{.Xr libalias 3 ,
6059 })dnl
6060 ifdef({LOCALRAD},{},{.Xr libradius 3 ,
6061 })dnl
6062 .Xr syslog 3 ,
6063 .Xr uucplock 3 ,
6064 .Xr netgraph 4 ,
6065 .Xr ng_pppoe 4 ,
6066 .Xr crontab 5 ,
6067 .Xr group 5 ,
6068 .Xr passwd 5 ,
6069 .Xr protocols 5 ,
6070 .Xr radius.conf 5 ,
6071 .Xr resolv.conf 5 ,
6072 .Xr syslog.conf 5 ,
6073 .Xr adduser 8 ,
6074 .Xr chat 8 ,
6075 .Xr getty 8 ,
6076 .Xr inetd 8 ,
6077 .Xr init 8 ,
6078 .Xr named 8 ,
6079 .Xr ping 8 ,
6080 .Xr pppctl 8 ,
6081 .Xr pppoed 8 ,
6082 .Xr route 8 ,
6083 .Xr sshd 8 ,
6084 .Xr syslogd 8 ,
6085 .Xr traceroute 8 ,
6086 .Xr vipw 8
6087 .Sh HISTORY
6088 This program was originally written by
6089 .An Toshiharu OHNO Aq tony-o@iij.ad.jp ,
6090 and was submitted to
6091 .Fx 2.0.5
6092 by
6093 .An Atsushi Murai Aq amurai@spec.co.jp .
6094 .Pp
6095 It was substantially modified during 1997 by
6096 .An Brian Somers Aq brian@Awfulhak.org ,
6097 and was ported to
6098 .Ox
6099 in November that year
6100 (just after the 2.2 release).
6101 .Pp
6102 Most of the code was rewritten by
6103 .An Brian Somers
6104 in early 1998 when multi-link ppp support was added.