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