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