ppp.conf.sample revision 58636
1#################################################################
2#
3#              PPP  Sample Configuration File
4#
5#           Originally written by Toshiharu OHNO
6#
7# $FreeBSD: head/share/examples/ppp/ppp.conf.sample 58636 2000-03-26 18:33:08Z brian $
8#
9#################################################################
10
11# This file is separated into sections.  Each section is named with
12# a label starting in column 0 and followed directly by a ``:''.  The
13# section continues until the next section.  Blank lines and lines
14# beginning with ``#'' are ignored.
15#
16# Lines beginning with "!include" will ``include'' another file.  You
17# may want to ``!include ~/.ppp.conf'' for backwards compatibility.
18#
19
20# Default setup. Always executed when PPP is invoked.
21#  This section is *not* pre-loaded by the ``load'' or ``dial'' commands.
22#
23#  This is the best place to specify your modem device, it's DTR rate,
24#  your dial script and any logging specification.  Logging specs should
25#  be done first so that the results of subsequent commands are logged.
26#
27default:
28 set log Phase Chat LCP IPCP CCP tun command
29 set device /dev/cuaa1
30 set speed 115200
31 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" AT \
32           OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
33
34# Client side PPP
35#
36#  Although the PPP protocol is a peer to peer protocol, we normally
37#  consider the side that initiates the connection as the client and
38#  the side that receives the connection as the server.  Authentication
39#  is required by the server either using a unix-style login procedure
40#  or by demanding PAP or CHAP authentication from the client.
41#
42
43# An on demand example where we have dynamic IP addresses and wish to
44# use a unix-style login script:
45#
46#  If the peer assigns us an arbitrary IP (most ISPs do this) and we
47#  can't predict what their IP will be either, take a wild guess at
48#  some IPs that you can't currently route to.  Ppp can change this
49#  when the link comes up.
50#
51#  The /0 bit in "set ifaddr" says that we insist on 0 bits of the
52#  specified IP actually being correct, therefore, the other side can assign
53#  any IP number.
54#
55#  The forth arg to "set ifaddr" makes us send "0.0.0.0" as our requested
56#  IP number, forcing the peer to make the decision.  This is necessary
57#  when negotiating with some (broken) ppp implementations.
58#
59#  This entry also works with static IP numbers or when not in -auto mode.
60#  The ``add'' line adds a `sticky' default route that will be updated if
61#  and when any of the IP numbers are changed in IPCP negotiations.
62#  The "set ifaddr" is required in -auto mode.
63#
64#  Finally, the ``enable dns'' line tells ppp to ask the peer for the
65#  nameserver addresses that should be used.  This isn't always supported
66#  by the other side, but if it is, ppp will update /etc/resolv.conf with
67#  the correct nameserver values at connection time.
68#
69#  The login script shown says that you're expecting ``ogin:''.  If you
70#  don't receive that, send a ``\n'' and expect ``ogin:'' again.  When
71#  it's received, send ``ppp'', expect ``word:'' then send ``ppp''.
72#  You *MUST* customise this login script according to your local
73#  requirements.
74#
75pmdemand:
76 set phone 1234567
77 set login "ABORT NO\\sCARRIER TIMEOUT 5 ogin:--ogin: ppp word: ppp"
78 set timeout 120
79 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
80 add default HISADDR
81 enable dns
82
83# If you want to use PAP or CHAP instead of using a unix-style login
84# procedure, do the following.  Note, the peer suggests whether we
85# should send PAP or CHAP.  By default, we send whatever we're asked for.
86#
87# You *MUST* customise ``MyName'' and ``MyKey'' below.
88#
89PAPorCHAPpmdemand:
90 set phone 1234567
91 set login
92 set authname MyName
93 set authkey MyKey
94 set timeout 120
95 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
96 add default HISADDR
97 enable dns
98
99# On demand dialup example with static IP addresses:
100#  Here, the local side uses 192.244.185.226 and the remote side
101#  uses 192.244.176.44.
102#
103#  # ppp -auto ondemand
104#
105#  With static IP numbers, our setup is similar to dynamic:
106#  Remember, ppp.linkup is searched for a "192.244.176.44" label, then
107#  a "ondemand" label, and finally the "MYADDR" label.
108#
109ondemand:
110 set phone 1234567
111 set login "ABORT NO\\sCARRIER TIMEOUT 5 ogin:--ogin: ppp word: ppp"
112 set timeout 120
113 set ifaddr 192.244.185.226 192.244.176.44
114 add default HISADDR
115 enable dns
116
117#                          Example segments
118#
119# The following lines may be included as part of your configuration
120# section and aren't themselves complete.  They're provided as examples
121# of how to achieve different things.
122
123examples:
124# Multi-phone example.  Numbers separated by a : are used sequentially.
125# Numbers separated by a | are used if the previous dial or login script
126# failed.  Usually, you will prefer to use only one of | or :, but both
127# are allowed.
128#
129    set phone 12345678|12345679:12345670|12345671
130#
131# Ppp can accept control instructions from the ``pppctl'' program.
132# First, you must set up your control socket.  It's safest to use
133# a UNIX domain socket, and watch the permissions:
134#
135    set server /var/tmp/internet MySecretPassword 0177
136#
137# Although a TCP port may be used if you want to allow control
138# connections from other machines:
139#
140    set server 6670 MySecretpassword
141#
142# If you don't like ppp's builtin chat, use an external one:
143#
144    set login "\"!chat \\-f /etc/ppp/ppp.dev.chat\""
145#
146# If we have a ``strange'' modem that must be re-initialized when we
147# hangup:
148#
149    set hangup "\"\" AT OK-AT-OK ATZ OK"
150#
151# To adjust logging withouth blasting the setting in default:
152#
153    set log -command +tcp/ip
154#
155# To see log messages on the screen in interactive mode:
156#
157    set log local LCP IPCP CCP
158#
159# If you're seeing a lot of magic number problems and failed connections,
160# try this (see the man page):
161#
162    set openmode active 5
163#
164# For noisy lines, we may want to reconnect (up to 20 times) after loss
165# of carrier, with 3 second delays between each attempt:
166#
167    set reconnect 3 20
168#
169# When playing server for M$ clients, tell them who our NetBIOS name
170# servers are:
171#
172    set nbns 10.0.0.1 10.0.0.2
173#
174# Inform the client if they ask for our DNS IP numbers:
175#
176    enable dns
177#
178# If you don't want to tell them what's in your /etc/resolv.conf file
179# with `enable dns', override the values:
180#
181    set dns 10.0.0.1 10.0.0.2
182#
183# Some people like to prioritize DNS packets:
184#
185   set urgent udp +53
186#
187# If we're using the -nat switch, redirect ftp and http to an internal
188# machine:
189#
190    nat port tcp 10.0.0.2:ftp ftp
191    nat port tcp 10.0.0.2:http http
192#
193# or don't trust the outside at all
194#
195    nat deny_incoming yes
196#
197# I trust user brian to run ppp, so this goes in the `default' section:
198#
199    allow user brian
200#
201# But label `internet' contains passwords that even brian can't have, so
202# I empty out the user access list in that section so that only root can
203# have access:
204#
205    allow users
206#
207# I also may wish to set up my ppp login script so that it asks the client
208# for the label they wish to use.  I may only want user ``dodgy'' to access
209# their own label in direct mode:
210#
211dodgy:
212    allow user dodgy
213    allow mode direct
214#
215# We don't want certain packets to keep our connection alive
216#
217    set filter alive 0 deny udp src eq 520         # routed
218    set filter alive 1 deny udp dst eq 520         # routed
219    set filter alive 2 deny udp src eq 513         # rwhod
220    set filter alive 3 deny udp src eq 525         # timed
221    set filter alive 4 deny 0/0 MYADDR icmp        # Ping to us from outside
222    set filter alive 5 permit 0/0 0/0
223#
224# And in auto mode, we don't want certain packets to cause a dialup
225#
226    set filter dial 0 deny udp src eq 513          # rwhod
227    set filter dial 1 deny udp src eq 525          # timed
228    set filter dial 2 deny udp src eq 137          # NetBIOS name service
229    set filter dial 3 deny udp src eq 138          # NetBIOS datagram service
230    set filter dial 4 deny udp src eq 139          # NetBIOS session service
231    set filter dial 5 deny udp dst eq 137          # NetBIOS name service
232    set filter dial 6 deny udp dst eq 138          # NetBIOS datagram service
233    set filter dial 7 deny udp dst eq 139          # NetBIOS session service
234    set filter dial 8 deny tcp finrst              # Badly closed TCP channels
235    set filter dial 9 permit 0 0
236#
237# Once the line's up, allow these connections
238#
239    set filter in  0 permit tcp dst eq 113            # ident
240    set filter out 0 permit tcp src eq 113            # ident
241    set filter in  1 permit tcp src eq 23 estab       # telnet
242    set filter out 1 permit tcp dst eq 23             # telnet
243    set filter in  2 permit tcp src eq 21 estab       # ftp
244    set filter out 2 permit tcp dst eq 21             # ftp
245    set filter in  3 permit tcp src eq 20 dst gt 1023 # ftp-data
246    set filter out 3 permit tcp dst eq 20             # ftp-data
247    set filter in  4 permit udp src eq 53             # DNS
248    set filter out 4 permit udp dst eq 53             # DNS
249    set filter in  5 permit 192.244.191.0/24 0/0      # Where I work
250    set filter out 5 permit 0/0 192.244.191.0/24      # Where I work
251    set filter in  6 permit icmp                      # pings
252    set filter out 6 permit icmp                      # pings
253    set filter in  7 permit udp dst gt 33433          # traceroute
254    set filter out 7 permit udp dst gt 33433          # traceroute
255
256#
257# ``dodgynet'' is an example intended for an autodial configuration which
258# is connecting a local network to a host on an untrusted network.
259dodgynet:
260    # Log link uptime
261    set log Phase
262    # For autoconnect only
263    allow modes auto
264    # Define modem device and speed
265    set device /dev/cuaa1
266    set speed 115200
267    # Don't support LQR
268    deny lqr
269    # Remote system phone number, login and password
270    set phone 0W1194
271    set authname pppLogin
272    set authkey MyPassword
273    # Chat script to dial remote system
274    set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATZ OK-ATZ-OK \
275              ATE1Q0M0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
276    # Chat script to login to remote Unix system
277    set login "TIMEOUT 10 \"\" \"\" gin:--gin: \\U word: \\P"
278    # Drop the link after 15 minutes of inactivity
279    # Inactivity is defined by the `set filter alive' line below
280    set timeout 900
281    # Hard-code remote system to appear within local subnet and use proxy arp
282    # to make this system the gateway
283    set ifaddr 172.17.20.247 172.17.20.248 255.255.240.0
284    enable proxy
285
286    # Allow any TCP packet to keep the link alive
287    set filter alive 0 permit tcp
288
289    # Only allow dialup to be triggered by http, rlogin, rsh, telnet, ftp or
290    # private TCP ports 24 and 4000
291    set filter dial  0 7      0 0 tcp dst eq http
292    set filter dial  1 7      0 0 tcp dst eq login
293    set filter dial  2 7      0 0 tcp dst eq shell
294    set filter dial  3 7      0 0 tcp dst eq telnet
295    set filter dial  4 7      0 0 tcp dst eq ftp
296    set filter dial  5 7      0 0 tcp dst eq 24
297    set filter dial  6 deny ! 0 0 tcp dst eq 4000
298    # From hosts on a couple of local subnets to the remote peer
299    # If the remote host allowed IP forwarding and we wanted to use it, the
300    # following rules could be split into two groups to separately validate
301    # the source and destination addresses.
302    set filter dial  7 permit 172.17.16.0/20  172.17.20.248 
303    set filter dial  8 permit 172.17.36.0/22  172.17.20.248 
304    set filter dial  9 permit 172.17.118.0/26 172.17.20.248 
305    set filter dial 10 permit 10.123.5.0/24   172.17.20.248 
306
307    # Once the link's up, limit outgoing access to the specified hosts
308    set filter out  0 4      172.17.16.0/20  172.17.20.248 
309    set filter out  1 4      172.17.36.0/22  172.17.20.248 
310    set filter out  2 4      172.17.118.0/26 172.17.20.248 
311    set filter out  3 deny ! 10.123.5.0/24   172.17.20.248 
312    # Allow established TCP connections
313    set filter out  4 permit 0 0 tcp estab
314    # And new connections to http, rlogin, rsh, telnet, ftp and ports
315    # 24 and 4000
316    set filter out  5 permit 0 0 tcp dst eq http
317    set filter out  6 permit 0 0 tcp dst eq login
318    set filter out  7 permit 0 0 tcp dst eq shell
319    set filter out  8 permit 0 0 tcp dst eq telnet
320    set filter out  9 permit 0 0 tcp dst eq ftp
321    set filter out 10 permit 0 0 tcp dst eq 24
322    set filter out 11 permit 0 0 tcp dst eq 4000
323    # And outgoing icmp
324    set filter out 12 permit 0 0 icmp
325
326    # Once the link's up, limit incoming access to the specified hosts
327    set filter in   0 4      172.17.20.248  172.17.16.0/20
328    set filter in   1 4      172.17.20.248  172.17.36.0/22
329    set filter in   2 4      172.17.20.248  172.17.118.0/26
330    set filter in   3 deny ! 172.17.20.248  10.123.5.0/24
331    # Established TCP connections and non-PASV FTP
332    set filter in   4 permit 0/0  0/0  tcp estab
333    set filter in   5 permit 0/0  0/0  tcp src eq 20
334    # Useful ICMP messages
335    set filter in   6 permit 0/0  0/0  icmp src eq 3
336    set filter in   7 permit 0/0  0/0  icmp src eq 4
337    set filter in   8 permit 0/0  0/0  icmp src eq 11
338    set filter in   9 permit 0/0  0/0  icmp src eq 12
339    # Echo reply (local systems can ping the remote host)
340    set filter in  10 permit 0/0  0/0  icmp src eq 0
341    # And the remote host can ping the local gateway (only)
342    set filter in  11 permit 0/0  172.17.20.247 icmp src eq 8
343
344
345# Server side PPP
346#
347#  If you want the remote system to authenticate itself, you must insist
348#  that the peer uses CHAP or PAP with the "enable" keyword.  Both CHAP and
349#  PAP are disabled by default.  You may enable either or both.  If both
350#  are enabled, CHAP is requested first.  If the client doesn't agree, PAP
351#  will then be requested.
352#
353#  Note:  If you use the getty/login process to authenticate users, you
354#         don't need to enable CHAP or PAP, but the user that has logged
355#         in *MUST* be a member of the ``network'' group (in /etc/group).
356#
357#  If you wish to allow any user in the passwd database ppp access, you
358#  can ``enable passwdauth''.
359#
360#  When the peer authenticates itself, we use ppp.secret for verification
361#  (although refer to the ``set radius'' command below for an alternative).
362#
363#  Note:  We may supply a third field in ppp.secret specifying the IP
364#         address for that user, a forth field to specify the
365#         ppp.link{up,down} label to use and a fifth field to specify
366#         callback characteristics.
367#
368#  The easiest way to allow transparent LAN access to your dialin users
369#  is to assign them a number from your local LAN and tell ppp to make a
370#  ``proxy'' arp entry for them.  In this example, we have a local LAN
371#  with IP numbers 10.0.0.1 - 10.0.0.99, and we assign numbers to our
372#  ppp clients between 10.0.0.100 and 10.0.0.199.  It is possible to
373#  override the dynamic IP number with a static IP number specified in
374#  ppp.secret.
375#
376#  Ppp is launched with:
377#   # ppp -direct server
378#
379server:
380 enable chap
381 enable pap
382 enable passwdauth
383 enable proxy
384 set ifaddr 10.0.0.1 10.0.0.100-10.0.0.199
385 accept dns
386
387# Example of a RADIUS configuration:
388#  If there are one or more radius servers available, we can use them
389#  instead of the ppp.secret file.  Simply put then in a radius
390#  configuration file (usually /etc/radius.conf) and give ppp the
391#  file name.
392#  Ppp will use the FRAMED characteristics supplied by the radius server
393#  to configure the link.
394
395radius-server:
396 load server
397 set radius /etc/radius.conf
398
399
400# Example to connect using a null-modem cable:
401#  The important thing here is to allow the lqr packets on both sides.
402#  Without them enabled, we can't tell if the line's dropped - there
403#  should always be carrier on a direct connection.
404#  Here, the server sends lqr's every 10 seconds and quits if five in a
405#  row fail.
406#
407#  Make sure you don't have "deny lqr" in your default: on the client !
408#  If the peer denies LQR, we still send ECHO LQR packets at the given
409#  lqrperiod interval (ppp-style-pings).
410#
411direct-client:
412 set dial ""
413 set device /dev/cuaa0
414 set sp 115200
415 set timeout 900
416 set lqrperiod 10
417 set log Phase Chat LQM
418 set login "ABORT NO\\sCARRIER TIMEOUT 5 ogin:--ogin: ppp word: ppp HELLO"
419 set ifaddr 10.0.4.2 10.0.4.1
420 enable lqr
421 accept lqr
422 
423direct-server:
424 set timeout 0
425 set lqrperiod 10
426 set log Phase LQM
427 set ifaddr 10.0.4.1 10.0.4.2
428 enable lqr
429 accept lqr
430
431
432# Example to connect via compuserve
433#  Compuserve insists on 7 bits even parity during the chat phase.  Modem
434#  parity is always reset to ``none'' after the link has been established.
435#
436compuserve:
437 set phone 1234567
438 set parity even
439 set login "TIMEOUT 100 \"\" \"\" Name: CIS ID: 999999,9999/go:pppconnect \
440            word: XXXXXXXX PPP"
441 set timeout 300
442 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
443 delete ALL
444 add default HISADDR
445
446
447# Example for PPP over TCP.
448#  We assume that inetd on tcpsrv.mynet has been
449#  configured to run "ppp -direct tcp-server" when it gets a connection on
450#  port 1234.  Read the man page for further details
451#
452#  Note, we assume we're using a binary-clean connection.  If something
453#  such as `rlogin' is involved, you may need to ``set escape 0xff''
454#
455tcp-client:
456 set device tcpsrv.mynet:1234
457 set dial
458 set login
459 set ifaddr 10.0.5.1 10.0.4.1 255.255.255.0
460
461tcp-server:
462 set ifaddr 10.0.4.1 10.0.5.1 255.255.255.0
463
464# Example for PPP testing.
465#  If you want to test ppp, do it through the loopback interface:
466#
467#  Requires a line in /etc/services:
468#    ppploop 6671/tcp # loopback ppp daemon
469#
470#  and a line in /etc/inetd.conf:
471#    ppploop stream tcp nowait root /usr/sbin/ppp ppp -direct loop-in
472#
473loop:
474 set timeout 0
475 set log phase chat connect lcp ipcp command
476 set device localhost:ppploop
477 set dial
478 set login
479 set ifaddr 127.0.0.2 127.0.0.3
480 set server /var/tmp/loop "" 0177
481 
482loop-in:
483 set timeout 0
484 set log phase lcp ipcp command
485 allow mode direct
486
487# Example of a VPN.
488#  If you're going to create a tunnel through a public network, your VPN
489#  should be set up something like this:
490#
491#  You should already have set up ssh using ssh-agent & ssh-add.
492#
493sloop:
494 load loop
495 # Passive mode allows ssh plenty of time to establish the connection
496 set openmode passive
497 set device "!ssh whatevermachine /usr/sbin/ppp -direct loop-in"
498
499# Example of non-PPP callback.
500#  If you wish to connect to a server that will dial back *without* using
501#  the ppp callback facility (rfc1570), take advantage of the fact that
502#  ppp doesn't look for carrier 'till `set login' is complete:
503#
504#  Here, we expect the server to say DIALBACK then disconnect after
505#  we've authenticated ourselves.  When this has happened, we wait
506#  60 seconds for a RING.
507#
508#  Note, it's important that we tell ppp not to expect carrier, otherwise
509#  we'll drop out at the ``NO CARRIER'' stage.
510#
511dialback:
512 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATZ OK-ATZ-OK \
513           ATDT\\T TIMEOUT 60 CONNECT"
514 set cd off
515 set login "TIMEOUT 5 ogin:--ogin: ppp word: ppp TIMEOUT 15 DIALBACK \
516           \"\" NO\\sCARRIER \"\" TIMEOUT 60 RING ATA CONNECT"
517
518# Example of PPP callback.
519#  Alternatively, if the peer is using the PPP callback protocol, we're
520#  happy either with ``auth'' style callback where the server dials us
521#  back based on what we authenticate ourselves with, ``cbcp'' style
522#  callback (invented by Microsoft but not agreed by the IETF) where
523#  we negotiate callback *after* authentication or E.164 callback where
524#  we specify only a phone number.  I would recommend only ``auth'' and/or
525#  ``cbcp'' callback methods.
526#  For ``cbcp'', we insist that we choose ``1234567'' as the number that
527#  the server must call back.
528#
529callback:
530 load pmdemand
531 set callback auth cbcp e.164 1234567
532 set cbcp 1234567
533
534# If we're running a ppp server that wants to only call back microsoft
535# clients on numbers configured in /etc/ppp/ppp.secret (the 5th field):
536#
537callback-server:
538 load server
539 set callback cbcp
540 set cbcp
541 set log +cbcp
542 set redial 3 1
543 set device /dev/cuaa0
544 set speed 115200
545 set dial "TIMEOUT 10 \"\" AT OK-AT-OK ATDT\\T CONNECT"
546
547# Or if we want to allow authenticated clients to specify their own
548# callback number:
549#
550callback-server-client-decides:
551 load callback-server
552 set cbcp *
553
554# Multilink mode is available (rfc1990).
555# To enable multilink capabilities, you must specify a MRRU.  1500 is
556# a reasonable value.  To create new links, use the ``clone'' command
557# to duplicate an existing link.  If you already have more than one
558# link, you must specify which link you wish to run the command on via
559# the ``link'' command.
560#
561# You can now ``dial'' specific links, or even dial all links at the
562# same time.  The `dial' command may also be prefixed with a specific
563# link that should do the dialing.
564#
565mloop:
566 load loop
567 set mode interactive
568 set mrru 1500
569 clone 1 2 3
570 link deflink remove
571 # dial
572 # link 2 dial 
573 # link 3 dial 
574
575mloop-in:
576 set timeout 0
577 set log tun phase
578 allow mode direct
579 set mrru 1500
580
581# User supplied authentication:
582#  It's possible to run ppp in the background while specifying a
583#  program to use to obtain authentication details on demand.
584#  This program would usually be a simple GUI that presents a
585#  prompt to a known user.  The ``chap-auth'' program is supplied
586#  as an example (and requires tcl version 8.0).
587#
588CHAPprompt:
589 load PAPorCHAPpmdemand
590 set authkey !/usr/share/examples/ppp/chap-auth
591
592#  It's possible to do the same sort of thing at the login prompt.
593#  Here, after sending ``brian'' in response to the ``name'' prompt,
594#  we're prompted with ``code:''.  A window is then displayed on the
595#  ``keep:0.0'' display and the typed response is sent to the peer
596#  as the password.  We then expect to see ``MTU'' and ``.'' in the
597#  servers response.
598#
599loginprompt:
600 load pmdemand
601 set authname brian
602 set login "ABORT NO\\sCARRIER TIMEOUT 15 \"\" \"\" name:--name: \\U \
603            code: \"!/usr/share/examples/ppp/login-auth -display keep:0.0 \
604                    AUTHNAME\" MTU \\c ."
605
606# ppp supports ppp over ethernet (PPPoE)
607#
608# The client should be something like:
609#
610pppoe:
611 set device PPPoE:de0:pppoe-in
612 set mru 1492
613 set mtu 1492
614 set speed sync   
615 enable lqr
616 set cd 5
617 set dial
618 set login
619 set redial 0 0
620
621# And the server should be running
622#
623#   /usr/libexec/pppoed -p pppoe-in fxp0
624#
625pppoe-in:
626 allow mode direct
627 set mru 1492
628 set mtu 1492
629 set speed sync
630 enable lqr
631 set ifaddr 10.0.0.1 10.0.0.2
632