diff --git a/en_US.ISO8859-1/books/handbook/ppp-and-slip/chapter.xml b/en_US.ISO8859-1/books/handbook/ppp-and-slip/chapter.xml index 92aec12a54..8d6317121d 100644 --- a/en_US.ISO8859-1/books/handbook/ppp-and-slip/chapter.xml +++ b/en_US.ISO8859-1/books/handbook/ppp-and-slip/chapter.xml @@ -1,1942 +1,1885 @@ <acronym>PPP</acronym> Synopsis PPP - &os; has a number of ways to link one computer to another. - To establish a network or Internet connection through a dial-up - modem, or to allow others to do so through you, requires the use - of PPP. This chapter describes setting u - p these modem-based communication services in detail. + &os; supports the Point-to-Point (PPP) + protocol which can be used to establish a network or Internet + connection using a dial-up modem. This chapter describes how to + configure modem-based communication services in &os;. After reading this chapter, you will know: - How to set configure PPP. + How to configure PPP. How to set up PPP over Ethernet (PPPoE). How to set up PPP over ATM (PPPoA). PPP PPP over Ethernet Before reading this chapter, you should: Be familiar with basic network terminology. - Understand the basics and purpose of a dialup connection + Understand the basics and purpose of a dial-up connection and PPP. Configuring <acronym>PPP</acronym> - This document assumes you have the following: + In order to configure PPP, the following + items are needed: - An account with an Internet Service Provider - (ISP) which you connect to using - PPP. + A dial-up account with an Internet Service Provider + (ISP). - A modem or other device connected to your system and - properly configured to allow you to connect to your - ISP. + A dial-up modem. - The dial-up number(s) of your ISP. + The dial-up number for the ISP. - The login name and password assigned by the ISP. + The login name and password assigned by the ISP. - The IP address of one or more name servers. - Normally, you will be given two IP addresses by your - ISP to use for this. If they have not given you at - least one, then you can use the enable - dns command in ppp.conf + The IP address of one or more name servers. + Normally, an ISP provides these addresses. + If not, use enable + dns in ppp.conf and ppp will set the name - servers for you. This feature depends on your ISP's - PPP implementation supporting DNS + servers. This feature requires the ISP + to supporting DNS negotiation. - The following information may be supplied by your ISP, but - is not completely necessary: + The following information may be supplied by the ISP, but + is not necessary: - The IP address of your ISP's gateway. The gateway is - the machine to which you will connect and will be set up as - your default route. If you do not have - this information, we can make one up and your ISP's PPP - server will tell us the correct value when we - connect. - - This IP number is referred to as + The IP address of the default gateway. + If this information is missing + the ISP's PPP + server will provide the correct value during + connection setup. + + This IP number is referred to as HISADDR by ppp. - The netmask you should use. If your ISP has not - provided you with one, you can safely use The subnet mask. If the ISP has not + provided one, use 255.255.255.255. - static IP address + static IP address - If your ISP provides you with a static IP address and - hostname, you can enter it. Otherwise, we simply let the - peer assign whatever IP address it sees fit. + If the ISP has assigned a static IP address and + hostname, enter it. Otherwise, this information will be provided + during connection setup. - If you do not have any of the required information, contact - your ISP. + If any required information is missing, contact + the ISP. Throughout this section, many of the examples showing the contents of configuration files are numbered by line. These numbers serve to aid in the presentation and discussion only and are not meant to be placed in the actual file. Proper indentation with tab and space characters is also important. ppp uses the configuration files located in /etc/ppp. Examples can be found in /usr/share/examples/ppp/. - Configuring ppp requires that you edit a - number of files, depending on your requirements. What you put - in them depends to some extent on whether your ISP allocates IP - addresses statically (i.e., you get given one IP address, and - always use that one) or dynamically (i.e., your IP address - changes each time you connect to your ISP). + A number of files are edited when configuring + ppp. The edits + depend to some extent on whether the ISP allocates IP + addresses statically or dynamically. - PPP With Static IP Addresses + PPP With Static <acronym>IP</acronym> Addresses PPP - with static IP addresses + with static IP addresses - You will need to edit the - /etc/ppp/ppp.conf configuration file. - It should look similar to the example below. + If the ISP has provided an address that does not change, edit + /etc/ppp/ppp.conf as described + in the example below. Lines that end in a : start in the - first column (beginning of the line)— all other lines + first column (beginning of the line) while all other lines should be indented as shown using spaces or tabs. 1 default: 2 set log Phase Chat LCP IPCP CCP tun command 3 ident user-ppp VERSION (built COMPILATIONDATE) 4 set device /dev/cuau0 5 set speed 115200 6 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \ 7 \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT" 8 set timeout 180 9 enable dns 10 11 provider: 12 set phone "(123) 456 7890" 13 set authname foo 14 set authkey bar 15 set login "TIMEOUT 10 \"\" \"\" gin:--gin: \\U word: \\P col: ppp" 16 set timeout 300 17 set ifaddr x.x.x.x y.y.y.y 255.255.255.255 0.0.0.0 18 add default HISADDR Line 1: Identifies the default entry. Commands in this entry are executed automatically when ppp is run. Line 2: Enables logging parameters. When the configuration is working satisfactorily, this line should be reduced to saying: set log phase tun in order to avoid excessive log file sizes. Line 3: Tells PPP how to identify itself to the peer. PPP identifies itself to the peer if it has any trouble negotiating and setting up the link, providing information that the peers administrator may find useful when investigating such problems. Line 4: Identifies the device to which the modem is connected. COM1 is /dev/cuau0 and COM2 is /dev/cuau1. Line 5: Sets the speed you want to connect at. If 115200 does not work (it should with any reasonably new modem), try 38400 instead. Line 6 & 7: The dial string. PPP uses an expect-send syntax similar to the &man.chat.8; program. Refer to the manual page for information on the features of this language. Note that this command continues onto the next line for readability. Any command in ppp.conf may do this if the last character on the line is a \ character. Line 8: Sets the idle timeout for the link. 180 seconds is the default, so this line is purely cosmetic. Line 9: Tells PPP to ask the peer to confirm the local resolver settings. If you run a local name server, this line should be commented out or removed. Line 10: A blank line for readability. Blank lines are ignored by PPP. Line 11: Identifies an entry for a provider called provider. This could be changed - to the name of your ISP so - that later you can use the to start + to the name of the ISP so + that can be used to start the connection. Line 12: Sets the phone number for this provider. Multiple phone numbers may be specified using the colon (:) or pipe character (|) as a separator. The difference between the two separators is described - in &man.ppp.8;. To summarize, if you want to rotate - through the numbers, use a colon. If you want to + in &man.ppp.8;. To summarize, to rotate + through the numbers, use a colon. To always attempt to dial the first number first and only use the other numbers if the first number fails, use the pipe character. Always quote the entire set of phone numbers as shown. - You must enclose the phone number in quotation + The phone number must be enclosed in quotation marks (") if there is any intention on using spaces in the phone number. This can cause a simple, yet subtle error. Line 13 & 14: Identifies the user name and password. When connecting using a &unix; style login prompt, these values are referred to by the set login command using the \U and \P variables. When connecting using PAP or CHAP, these values are used at authentication time. Line 15: - If you are using - PAPPAP or - CHAPCHAP, + If + PAP or + CHAP are used, there will be no login at this point, and this line should be commented out or removed. See for further details. The login string is of the same chat-like syntax as the dial string. In this example, the string works for a service whose login session looks like this: J. Random Provider login: foo password: bar protocol: ppp - You will need to alter this script to suit your - own needs. When you write this script for the first - time, you should ensure that you have enabled - chat logging so you can determine if + Alter this script to suit your + own needs. When writing this script for the first + time, ensure that + chat logging is enabled to help determine if the conversation is going as expected. Line 16: Sets the default idle timeouttimeout (in seconds) for the connection. Here, the connection will be closed automatically after 300 - seconds of inactivity. If you never want to + seconds of inactivity. To prevent a timeout timeout, set this value to zero or use the command line switch. Line 17: Sets the interface addresses. The string x.x.x.x should be - replaced by the IP address that your - providerISP - has allocated to you. The string + replaced by the IP address that the + ISP + has allocated. The string y.y.y.y should be - replaced by the IP address that your ISP indicated - for their gateway (the machine to which you - connect). If your ISP has not given you a gateway + replaced by the IP address of the + gateway. If the ISP has not provided a gateway address, use 10.0.0.2/0. If you need - to use a guessed address, make sure - that you create an entry in + role="netmask">10.0.0.2/0. When + using a guessed address, + create an entry in /etc/ppp/ppp.linkup as per the instructions in . If this line is omitted, ppp cannot run in mode. Line 18: - Adds a default route to your ISP's gateway. The + Adds a default route to the gateway. The special word HISADDR is replaced with the gateway address specified on line 17. It is important that this line appears after line 17, otherwise HISADDR will not yet be initialized. - If you do not wish to run ppp in - , this line should be moved + When + is not used, this line should be moved to the ppp.linkup file. It is not necessary to add an entry to - ppp.linkup when you have a static - IP address and are running ppp in - mode as your routing table entries are already correct - before you connect. You may however wish to create an - entry to invoke programs after connection. This is + ppp.linkup when using a static + IP address and when running ppp in + mode as the routing table entries are already correct. + However, an + entry can be created to invoke programs after connection. This is explained later with the sendmail example. Example configuration files can be found in the /usr/share/examples/ppp/ directory. - <acronym>PPP</acronym> With Dynamic IP + <title><acronym>PPP</acronym> With Dynamic <acronym>IP</acronym> Addresses PPP - with dynamic IP addresses + with dynamic IP addresses IPCP - If your service provider does not assign static IP - addresses, ppp can be configured to + If the IP + address changes whenever a connection is made, configure ppp to negotiate the local and remote addresses. This is done by - guessing an IP address and allowing - ppp to set it up correctly using the IP + guessing an IP address and allowing + ppp to set it up correctly using the IP Configuration Protocol (IPCP) after connecting. The ppp.conf configuration is the same as that described in , with the following change: 17 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 0.0.0.0 Again, do not include the line number, it is just for reference. Indentation of at least one space is required. Line 17: The number after the / character is the number of bits of the address that - ppp will insist on. You may wish to use IP numbers - more appropriate to your circumstances, but the + ppp will insist on. Other IP addresses + can be used, but the above example will always work. The last argument (0.0.0.0) tells PPP to start negotiations using address 0.0.0.0 rather than 10.0.0.1 and is - necessary for some ISPs. Do not use + necessary for some ISPs. Do not use 0.0.0.0 as the first argument to set ifaddr as it prevents PPP from setting up an initial route in mode. - If you are not running in mode, - you will need to create an entry in - /etc/ppp/ppp.linkup. - ppp.linkup is used after a connection + When not running in mode, + create an entry in + /etc/ppp/ppp.linkup as this file + is used after a connection has been established. At this point, ppp will have assigned the interface addresses and it will now be possible to add the routing table entries: 1 provider: 2 add default HISADDR Line 1: On establishing a connection, ppp will look for an entry in ppp.linkup according to the following rules: First, try to match the same label as we used in ppp.conf. If - that fails, look for an entry for the IP address of - our gateway. This entry is a four-octet IP style + that fails, look for an entry for the IP address of + our gateway. This entry is a four-octet IP style label. If we still have not found an entry, look for the MYADDR entry. Line 2: This line tells ppp to add a default route that points to HISADDR. HISADDR will be replaced with the - IP number of the gateway as negotiated by the + IP number of the gateway as negotiated by the IPCP. See the pmdemand entry in the files /usr/share/examples/ppp/ppp.conf.sample and /usr/share/examples/ppp/ppp.linkup.sample for a detailed example. Receiving Incoming Calls PPP receiving incoming calls - When you configure ppp to + When configuring ppp to receive incoming calls on a machine connected to a LAN, - you must decide if you wish to forward packets to the LAN. - If you do, you should allocate the peer an IP number from - your LAN's subnet, and use the command enable - proxy in your - /etc/ppp/ppp.conf file. You should - also confirm that the /etc/rc.conf - file contains the following: + decide if packets should be forwarded to the LAN. + If so, allocate the peer an IP address from + the LAN's subnet, and use enable + proxy in the + /etc/ppp/ppp.conf. + Alsom confirm that /etc/rc.conf + contains the following line: gateway_enable="YES" Which getty? provides a good description on enabling dial-up services using &man.getty.8;. An alternative to getty is mgetty (from comms/mgetty+sendfax port), a smarter version of getty designed with dial-up lines in mind. The advantages of using mgetty is that it actively talks to modems, meaning if port is turned off in - /etc/ttys then your modem will not + /etc/ttys then the modem will not answer the phone. Later versions of mgetty (from 0.99beta onwards) also support the automatic detection of - PPP streams, allowing your clients - script-less access to your server. + PPP streams, allowing clients + scriptless access to the server. Refer to for more information on mgetty. <application>PPP</application> Permissions The ppp command must normally be - run as the root user. If however, - you wish to allow ppp to run in - server mode as a normal user by executing - ppp as described below, that user + run as the root user. + To instead allow ppp to run in + server mode as a normal user, that user must be given permission to run ppp by adding them to the network group in /etc/group. - You will also need to give them access to one or more + The user also needs access to one or more sections of the configuration file using the allow command: allow users fred mary If this command is used in the default section, it gives the specified users access to everything. - <acronym>PPP</acronym> Shells for Dynamic IP + <title><acronym>PPP</acronym> Shells for Dynamic <acronym>IP</acronym> Users PPP shells Create a file called /etc/ppp/ppp-shell containing the following: #!/bin/sh IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'` CALLEDAS="$IDENT" TTY=`tty` if [ x$IDENT = xdialup ]; then IDENT=`basename $TTY` fi echo "PPP for $CALLEDAS on $TTY" echo "Starting PPP for $IDENT" exec /usr/sbin/ppp -direct $IDENT This script should be executable. Now make a symbolic link called ppp-dialup to this script using the following commands: &prompt.root; ln -s ppp-shell /etc/ppp/ppp-dialup - You should use this script as the - shell for all of your dialup users. + Use this script as the + shell for all of dial-up users. This is an example from /etc/passwd - for a dialup PPP user with username - pchilds (remember do not directly - edit the password file, use &man.vipw.8;). + for a dial-up PPP: pchilds:*:1011:300:Peter Childs PPP:/home/ppp:/etc/ppp/ppp-dialup Create a /home/ppp directory that is world readable containing the following 0 byte files: -r--r--r-- 1 root wheel 0 May 27 02:23 .hushlogin -r--r--r-- 1 root wheel 0 May 27 02:22 .rhosts which prevents /etc/motd from being displayed. - <acronym>PPP</acronym> Shells for Static IP + <title><acronym>PPP</acronym> Shells for Static <acronym>IP</acronym> Users PPP shells Create the ppp-shell file as above, and for each account with statically assigned - IPs create a symbolic link to + IPs create a symbolic link to ppp-shell. - For example, if you have three dialup customers, + For example, to route /24 CIDR + networks for the dial-up customers fred, sam, - and mary, that you route /24 CIDR - networks for, you would type the following: + and mary, type: &prompt.root; ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-fred &prompt.root; ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-sam &prompt.root; ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-mary - Each of these users dialup accounts should have + Each of these users dial-up accounts should have their shell set to the symbolic link created above (for example, mary's shell should be /etc/ppp/ppp-mary). Setting Up <filename>ppp.conf</filename> for - Dynamic IP Users + Dynamic IP Users The /etc/ppp/ppp.conf file should contain something along the lines of: default: set debug phase lcp chat set timeout 0 ttyu0: set ifaddr 203.14.100.1 203.14.100.20 255.255.255.255 enable proxy ttyu1: set ifaddr 203.14.100.1 203.14.100.21 255.255.255.255 enable proxy The indenting is important. The default: section is loaded - for each session. For each dialup line enabled in + for each session. For each dial-up line enabled in /etc/ttys create an entry similar to the one for ttyu0: above. Each - line should get a unique IP address from your pool of - IP addresses for dynamic users. + line should get a unique IP address from the pool of + IP addresses for dynamic users. Setting Up <filename>ppp.conf</filename> for - Static IP Users + Static IP Users Along with the contents of the sample /usr/share/examples/ppp/ppp.conf - above you should add a section for each of the - statically assigned dialup users. We will continue with - our fred, sam, - and mary example. + above, add a section for each of the + statically assigned dial-up users:. fred: set ifaddr 203.14.100.1 203.14.101.1 255.255.255.255 sam: set ifaddr 203.14.100.1 203.14.102.1 255.255.255.255 mary: set ifaddr 203.14.100.1 203.14.103.1 255.255.255.255 The file /etc/ppp/ppp.linkup should also contain routing information for each static - IP user if required. The line below would add a route + IP user if required. The line below would add a route for the 203.14.101.0/24 network via the client's ppp link. fred: add 203.14.101.0 netmask 255.255.255.0 HISADDR sam: add 203.14.102.0 netmask 255.255.255.0 HISADDR mary: add 203.14.103.0 netmask 255.255.255.0 HISADDR <command>mgetty</command> and AutoPPP mgetty AutoPPP LCP By default the comms/mgetty+sendfax port comes with the AUTO_PPP option enabled allowing mgetty to detect the LCP phase of PPP connections and automatically spawn off a ppp shell. However, since the default login/password sequence does not occur it is necessary to authenticate users using either PAP or CHAP. This section assumes the user has successfully compiled, and installed the comms/mgetty+sendfax port on his system. - Make sure your + Ensure that /usr/local/etc/mgetty+sendfax/login.config - file has the following in it: + has the following: /AutoPPP/ - - /etc/ppp/ppp-pap-dialup - This will tell mgetty to run the - ppp-pap-dialup script for detected + This tells mgetty to run + ppp-pap-dialup for detected PPP connections. - Create a file called + Create an executable file called /etc/ppp/ppp-pap-dialup containing - the following (the file should be executable): + the following: #!/bin/sh exec /usr/sbin/ppp -direct pap$IDENT - For each dialup line enabled in + For each dial-up line enabled in /etc/ttys, create a corresponding entry in /etc/ppp/ppp.conf. This will happily co-exist with the definitions we created above. pap: enable pap set ifaddr 203.14.100.1 203.14.100.20-203.14.100.40 enable proxy Each user logging in with this method will need to have a username/password in /etc/ppp/ppp.secret file, or alternatively add the following option to authenticate users via PAP from the /etc/passwd file. enable passwdauth - If you wish to assign some users a static IP number, - you can specify the number as the third argument in + To assign some users a static IP number, + specify the number as the third argument in /etc/ppp/ppp.secret. See /usr/share/examples/ppp/ppp.secret.sample for examples. MS Extensions DNS NetBIOS PPP Microsoft extensions It is possible to configure PPP to supply DNS and NetBIOS nameserver addresses on demand. To enable these extensions with PPP version 1.x, the following lines might be added to the relevant section of /etc/ppp/ppp.conf. enable msext set ns 203.14.100.1 203.14.100.2 set nbns 203.14.100.5 And for PPP version 2 and above: accept dns set dns 203.14.100.1 203.14.100.2 set nbns 203.14.100.5 This will tell the clients the primary and secondary name server addresses, and a NetBIOS nameserver host. In version 2 and above, if the set dns line is omitted, PPP will use the values found in /etc/resolv.conf. PAP and CHAP Authentication PAP CHAP - Some ISPs set their system up so that the - authentication part of your connection is done using + Some ISPs set their system up so that the + authentication part of the connection is done using either of the PAP or CHAP authentication mechanisms. If - this is the case, your ISP will not give a - login: prompt when you connect, but will + this is the case, the ISP will not give a + login: prompt at connection, but will start talking PPP immediately. PAP is less secure than CHAP, but security is not normally an issue here as passwords, although being sent as plain text with PAP, are being transmitted down a serial line only. There is not much room for crackers to eavesdrop. Referring back to or , the following alterations must be made: 13 set authname MyUserName 14 set authkey MyPassword 15 set login Line 13: - This line specifies your PAP/CHAP user name. - You will need to insert the correct value for + This line specifies the PAP/CHAP user name. + Insert the correct value for MyUserName. Line 14: - This line specifies your PAP/CHAP + This line specifies the PAP/CHAP passwordpassword. - You will need to insert the correct value for + Insert the correct value for MyPassword. You may want to add an additional line, such as: 16 accept PAP or 16 accept CHAP to make it obvious that this is the intention, but PAP and CHAP are both accepted by default. Line 15: - Your ISP will not normally require that you log - into the server if you are using PAP or CHAP. You - must therefore disable your set login + The ISP will not normally require a login + to the server when using PAP or CHAP. + Therefore, disable the set login string. - Changing Your <command>ppp</command> Configuration + <title>Changing the <command>ppp</command> Configuration on the Fly It is possible to talk to the ppp program while it is running in the background, but only if a suitable diagnostic port has been set up. To do - this, add the following line to your configuration: + this, add the following line to the configuration: set server /var/run/ppp-tun%d DiagnosticPassword 0177 This will tell PPP to listen to the specified &unix; domain socket, asking clients for the specified password before allowing access. The %d in the name is replaced with the tun device number that is in use. Once a socket has been set up, the &man.pppctl.8; program may be used in scripts that wish to manipulate the running program. Using <acronym>PPP</acronym> Network Address Translation Capability PPPNAT PPP has ability to use internal NAT without kernel diverting capabilities. This functionality may be enabled by the following line in /etc/ppp/ppp.conf: nat enable yes Alternatively, NAT may be enabled by command-line option -nat. There is also /etc/rc.conf knob named ppp_nat, which is enabled by default. - If you use this feature, you may also find useful + When using this feature, it may be useful to include the following /etc/ppp/ppp.conf options to enable incoming connections forwarding: nat port tcp 10.0.0.2:ftp ftp nat port tcp 10.0.0.2:http http or do not trust the outside at all nat deny_incoming yes Final System Configuration PPPconfiguration - You now have ppp configured, but - there are a few more things to do before it is ready to - work. They all involve editing the - /etc/rc.conf file. + While ppp is now configured, + some edits still need to be made to + /etc/rc.conf. Working from the top down in this file, make sure the - hostname= line is set, e.g.: + hostname= line is set: hostname="foo.example.com" - If your ISP has supplied you with a static IP address - and name, it is probably best that you use this name as your + If the ISP has supplied a static IP address + and name, use this name as the host name. Look for the network_interfaces - variable. If you want to configure your system to dial your - ISP on demand, make sure the tun0 + variable. To configure the system to dial the + ISP on demand, make sure the tun0 device is added to the list, otherwise remove it. network_interfaces="lo0 tun0" ifconfig_tun0= The ifconfig_tun0 variable should be empty, and a file called /etc/start_if.tun0 should be created. This file should contain the line: ppp -auto mysystem This script is executed at network configuration time, - starting your ppp daemon in automatic mode. If you have - a LAN for which this machine is a gateway, you may also - wish to use the switch. Refer + starting the ppp daemon in automatic mode. If + this machine acts as a gateway, consider including + . Refer to the manual page for further details. Make sure that the router program is set to - NO with the following line in your + NO with the following line in /etc/rc.conf: router_enable="NO" routed It is important that the routed daemon is not started, as routed tends to delete the default routing table entries created by ppp. It is probably a good idea to ensure that the sendmail_flags line does not include the option, otherwise sendmail will attempt to do a network lookup every now and then, possibly causing your machine to dial out. You may try: sendmail_flags="-bd" sendmail - The downside of this is that you must force - sendmail to re-examine the mail queue - whenever the ppp link is up by typing: - - &prompt.root; /usr/sbin/sendmail -q - - You may wish to use the !bg command - in ppp.linkup to do this - automatically: + The downside is that + sendmail is forced to re-examine the mail queue + whenever the ppp link. To automate this, include !bg + in ppp.linkup: 1 provider: 2 delete ALL 3 add 0 0 HISADDR 4 !bg sendmail -bd -q30m SMTP - If you do not like this, it is possible to set up a + An alternative is to set up a dfilter to block SMTP traffic. Refer to the sample files for further details. All that is left is to reboot the machine. After - rebooting, you can now either type: + rebooting, either type: &prompt.root; ppp and then dial provider to start the - PPP session, or, if you want + PPP session, or, to configure ppp to establish sessions automatically - when there is outbound traffic (and you have not created the - start_if.tun0 script), type: + when there is outbound traffic and + start_if.tun0 does not exist, type: &prompt.root; ppp -auto provider Summary To recap, the following steps are necessary when setting up ppp for the first time: Client side: Ensure that the tun device - is built into your kernel. + is built into the kernel. Ensure that the tunN device file is available in the /dev directory. Create an entry in /etc/ppp/ppp.conf. The pmdemand example should suffice - for most ISPs. + for most ISPs. - If you have a dynamic IP address, create an entry in + When using a dynamic IP address, create an entry in /etc/ppp/ppp.linkup. Update your /etc/rc.conf file. Create a start_if.tun0 script - if you require demand dialing. + if demand dialing is required. Server side: Ensure that the tun device - is built into your kernel. + is built into the kernel. Ensure that the tunN device file is available in the /dev directory. Create an entry in /etc/passwd (using the &man.vipw.8; program). Create a profile in this users home directory that runs ppp -direct direct-server or similar. Create an entry in /etc/ppp/ppp.conf. The direct-server example should suffice. Create an entry in /etc/ppp/ppp.linkup. - Update your /etc/rc.conf - file. + Update /etc/rc.conf. Troubleshooting <acronym>PPP</acronym> Connections PPP troubleshooting This section covers a few issues which may arise when - using PPP over a modem connection. For - instance, perhaps you need to know exactly what prompts the - system you are dialing into will present. Some + using PPP over a modem connection. Some ISPs present the - ssword prompt, and others will present - password; if the ppp + ssword prompt while others present + password. If the ppp script is not written accordingly, the login attempt will fail. The most common way to debug ppp - connections is by connecting manually. The following - information will walk you through a manual connection step by - step. + connections is by connecting manually as described in this + section. Check the Device Nodes When using a custom kernel, make sure to include the - following line in your kernel configuration file: + following line in the kernel configuration file: device uart The uart device is already included in the GENERIC kernel, so no additional steps are necessary in this case. Just check the dmesg output for the modem device with: &prompt.root; dmesg | grep uart - You should get some pertinent output about the + This should display some pertinent output about the uart devices. These are the COM - ports we need. If your modem acts like a standard serial - port then you should see it listed on + ports we need. If the modem acts like a standard serial + port, it should be listed on uart1, or - COM2. If so, you are not required - to rebuild the kernel. When matching up sio modem is on - uart1 or - COM2 if you are in DOS, then your + COM2. If so, + a kernel rebuild is not required. When matching up, if the modem is on + uart1, the modem device would be /dev/cuau1. Connecting Manually Connecting to the Internet by manually controlling ppp is quick, easy, and a great way to - debug a connection or just get information on how your + debug a connection or just get information on how the ISP treats ppp client connections. Lets start PPP from the command line. Note that in all of our examples we will use example as the hostname of the - machine running PPP. You start - ppp by just typing + machine running PPP. To start ppp: &prompt.root; ppp - We have now started ppp. - ppp ON example> set device /dev/cuau1 - We set our modem device, in this case it is + This second command sets the modem device to cuau1. ppp ON example> set speed 115200 - Set the connection speed, in this case we - are using 115,200 kbps. + This sets the connection speed to + 115,200 kbps. ppp ON example> enable dns - Tell ppp to configure our + This tells ppp to configure the resolver and add the nameserver lines to /etc/resolv.conf. If - ppp cannot determine our hostname, we can - set one manually later. + ppp cannot determine the hostname, it can + manually be set later. ppp ON example> term - Switch to terminal mode so that we can + This switches to terminal mode in order to manually control the modem. deflink: Entering terminal mode on /dev/cuau1 type '~h' for help at OK atdt123456789 Use at to initialize the modem, - then use atdt and the number for your + then use atdt and the number for the ISP to begin the dial in process. CONNECT Confirmation of the connection, if we are going to have any connection problems, unrelated to hardware, here is where we will attempt to resolve them. ISP Login:myusername - Here you are prompted for a username, return the + At this prompt, return the prompt with the username that was provided by the ISP. ISP Pass:mypassword - This time we are prompted for a password, just + At this prompt, reply with the password that was provided by the ISP. Just like logging into &os;, the password will not echo. Shell or PPP:ppp - Depending on your ISP this prompt - may never appear. Here we are being asked if we wish to - use a shell on the provider, or to start - ppp. In this example, we have chosen - to use ppp as we want an Internet + Depending on the ISP, this prompt + might not appear. If it does, it is asking whether to + use a shell on the provider or to start + ppp. In this example, + ppp was selected in order to establish an Internet connection. Ppp ON example> Notice that in this example the first has been capitalized. This shows that we have successfully connected to the ISP. PPp ON example> We have successfully authenticated with our ISP and are waiting for the assigned IP address. PPP ON example> We have made an agreement on an IP address and successfully completed our connection. PPP ON example>add default HISADDR Here we add our default route, we need to do this before we can talk to the outside world as currently the only established connection is with the peer. If this fails due to - existing routes you can put a bang character + existing routes, put a bang character ! in front of the . - Alternatively, you can set this before making the actual + Alternatively, set this before making the actual connection and it will negotiate a new route accordingly. If everything went good we should now have an active connection to the Internet, which could be thrown into the background using CTRL - z If you notice the - PPP return to ppp then - we have lost our connection. This is good to know because it - shows our connection status. Capital P's show that we have a + z If + PPP returns to ppp then + the connection has bee lost. This is good to know because it + shows the connection status. Capital P's represent a connection to the ISP and lowercase p's - show that the connection has been lost for whatever reason. - ppp only has these 2 states. + show that the connection has been lost. Debugging - If you have a direct line and cannot seem to make a - connection, then turn hardware flow - CTS/RTS to off with the . This is mainly the case if you are - connected to some PPP capable + If a + connection cannot be established, turn hardware flow + CTS/RTS to off using . This is mainly the case when + connected to some PPP-capable terminal servers, where PPP hangs - when it tries to write data to your communication link, so - it would be waiting for a CTS, or Clear - To Send signal which may never come. If you use this option - however, you should also use the - option, which may be required to defeat hardware dependent + when it tries to write data to the communication link, and + waits for a Clear + To Send (CTS) signal which may never come. When using this option, + include + as it may be required to defeat hardware dependent on passing certain characters from end to end, most of the - time XON/XOFF. See the &man.ppp.8; manual page for more - information on this option, and how it is used. + time XON/XOFF. Refer to &man.ppp.8; for more + information on this option and how it is used. - If you have an older modem, you may need to use the + An older modem may need . Parity is set at none - be default, but is used for error checking (with a large - increase in traffic) on older modems and some - ISPs. You may need this option for - the Compuserve ISP. + be default, but is used for error checkingm with a large + increase in traffic, on older modems. PPP may not return to the command mode, which is usually a negotiation error where - the ISP is waiting for your side to start - negotiating. At this point, using the ~p - command will force ppp to start sending the configuration + the ISP is waiting for + negotiating to begin. At this point, using ~p + will force ppp to start sending the configuration information. - If you never obtain a login prompt, then most likely you - need to use PAP or - CHAP authentication instead of the - &unix; style in the example above. To use - PAP or CHAP just add + If a login prompt never appears, + PAP or + CHAP authentication is most likely required. + To use + PAP or CHAP, add the following options to PPP before going into terminal mode: ppp ON example> set authname myusername Where myusername should be replaced with the username that was assigned by the ISP. ppp ON example> set authkey mypassword Where mypassword should be replaced with the password that was assigned by the ISP. - If you connect fine, but cannot seem to find any domain - name, try to use &man.ping.8; with an IP - address and see if you can get any return information. If - you experience 100 percent (100%) packet loss, then it is - most likely that you were not assigned a default route. - Double check that the option was set during the connection. If you - can connect to a remote IP address then + If a connection is established, but cannot seem to find any domain + name, try to &man.ping.8; an IP + address. If + there is 100 percent (100%) packet loss, it is + likely that a default route was not assigned. + Double check that was set during the connection. If a + connection can be made to a remote IP address, it is possible that a resolver address has not been added - to the /etc/resolv.conf. This file + to /etc/resolv.conf. This file should look like: domain example.com nameserver x.x.x.x nameserver y.y.y.y Where x.x.x.x and y.y.y.y should be replaced with - the IP address of your - ISP's DNS servers. This information may - or may not have been provided when you signed up, but a - quick call to your ISP should remedy - that. + the IP address of the + ISP's DNS servers. - You could also have &man.syslog.3; provide a logging - function for your PPP connection. - Just add: + To configure &man.syslog.3; to provide logging + for the PPP connection, make sure + this line exists in /etc/syslog.conf: !ppp *.* /var/log/ppp.log - to /etc/syslog.conf. In most - cases, this functionality already exists. Using <acronym>PPP</acronym> over Ethernet (PPPoE) PPP over Ethernet This section describes how to set up PPP over Ethernet (PPPoE). Here is an example of a working ppp.conf: default: set log Phase tun command # you can add more detailed logging if you wish set ifaddr 10.0.0.1/0 10.0.0.2/0 name_of_service_provider: set device PPPoE:xl1 # replace xl1 with your Ethernet device set authname YOURLOGINNAME set authkey YOURPASSWORD set dial set login add default HISADDR - As root, you can run: + As root, run: &prompt.root; ppp -ddial name_of_service_provider Starting <application>ppp</application> at Boot - Add the following to your - /etc/rc.conf file: + Add the following to + /etc/rc.conf: ppp_enable="YES" ppp_mode="ddial" ppp_nat="YES" # if you want to enable nat for your local network, otherwise NO ppp_profile="name_of_service_provider" Using a PPPoE Service Tag Sometimes it will be necessary to use a service tag to - establish your connection. Service tags are used to + establish the connection. Service tags are used to distinguish between different PPPoE servers attached to a given network. - You should have been given any required service tag - information in the documentation provided by your ISP. If - you cannot locate it there, ask your ISP's tech support - personnel. + Any required service tag + information should be in the documentation provided by the ISP. - As a last resort, you could try installing the As a last resort, one could try installing the net/rr-pppoe package or port. Bear in mind however, this may de-program your modem and render it useless, so think twice before doing it. Simply - install the program shipped with the modem by your provider. + install the program shipped with the modem. Then, access the System menu from the - program. The name of your profile should be listed there. It + program. The name of the profile should be listed there. It is usually ISP. The profile name (service tag) will be used in the PPPoE configuration entry in ppp.conf as the provider part of the set device command (see the &man.ppp.8; manual page for full details). It should look like this: set device PPPoE:xl1:ISP Do not forget to change xl1 - to the proper device for your Ethernet card. + to the proper device for the Ethernet card. Do not forget to change ISP - to the profile you have just found above. + to the profile. For additional information, refer to Cheaper Broadband with &os; on DSL by Renaud Waldura. PPPoE with a &tm.3com; <trademark class="registered">HomeConnect</trademark> ADSL Modem Dual Link - This modem does not follow RFC 2516 - (A Method for transmitting PPP - over Ethernet (PPPoE), written by L. Mamakos, K. - Lidl, J. Evarts, D. Carrel, D. Simone, and R. Wheeler). - Instead, different packet type codes have been used for the - Ethernet frames. Please complain to 3Com if you think it - should comply with the PPPoE specification. + This modem does not follow the PPPoE specification defined in RFC 2516. In order to make &os; capable of communicating with this device, a sysctl must be set. This can be done automatically at boot time by updating /etc/sysctl.conf: net.graph.nonstandard_pppoe=1 or can be done immediately with the command: &prompt.root; sysctl net.graph.nonstandard_pppoe=1 Unfortunately, because this is a system-wide setting, it is not possible to talk to a normal PPPoE client or server and a &tm.3com; HomeConnect ADSL Modem at the same time. Using <application>PPP</application> over ATM (PPPoA) PPP over ATM PPPoA The following describes how to set up PPP over ATM (PPPoA). PPPoA is a popular choice among European DSL providers. Using mpd - You can use mpd to connect to a - variety of services, in particular PPTP services. You can - find mpd in the Ports Collection, - net/mpd5. Many ADSL + The mpd application can be used to connect to a + variety of services, in particular PPTP services. It can be installed using the + net/mpd5 package or port. Many ADSL modems require that a PPTP tunnel is created between the modem - and computer, one such modem is the Alcatel &speedtouch; - Home. + and computer. - First you must install the port, and then you can - configure mpd to suit your - requirements and provider settings. The port places a set + Once installed, + configure mpd to suit the + provider's settings. The port places a set of sample configuration files which are well documented in PREFIX/etc/mpd/. - Note here that PREFIX means the - directory into which your ports are installed, this defaults - to /usr/local/. A + class="directory">/usr/local/etc/mpd/. + A complete guide to configure mpd - is available in HTML format once the port has been installed. - It is placed in PREFIX/share/doc/mpd/. + is available in HTML format in /usr/ports/share/doc/mpd/. Here is a sample configuration for connecting to an ADSL service with mpd. The configuration is spread over two files, first the mpd.conf: This example of the mpd.conf file only works with mpd 4.x. default: load adsl adsl: new -i ng0 adsl adsl set bundle authname username set bundle password password set bundle disable multilink set link no pap acfcomp protocomp set link disable chap set link accept chap set link keep-alive 30 10 set ipcp no vjcomp set ipcp ranges 0.0.0.0/0 0.0.0.0/0 set iface route default set iface disable on-demand set iface enable proxy-arp set iface idle 0 open - The username used to authenticate with your ISP. + The username used to authenticate with your ISP. - The password used to authenticate with your ISP. + The password used to authenticate with your ISP. The mpd.links file contains information - about the link, or links, you wish to establish. An example + about the link, or links, to establish. An example mpd.links to accompany the above example is given beneath: adsl: set link type pptp set pptp mode active set pptp enable originate outcall set pptp self 10.0.0.1 set pptp peer 10.0.0.138 - The IP address of your &os; computer which you will be - using mpd from. + The IP address of &os; computer running + mpd. - The IP address of your ADSL modem. For the Alcatel - &speedtouch; Home this address defaults to The IP address of the ADSL modem. The Alcatel + &speedtouch; Home defaults to 10.0.0.138. It is possible to initialize the connection easily by issuing the following command as root: &prompt.root; mpd -b adsl - You can see the status of the connection with the following - command: + To view the status of the connection: &prompt.user; ifconfig ng0 ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> mtu 1500 inet 216.136.204.117 --> 204.152.186.171 netmask 0xffffffff Using mpd is the recommended way to connect to an ADSL service with &os;. Using pptpclient It is also possible to use &os; to connect to other PPPoA services using net/pptpclient. To use net/pptpclient - to connect to a DSL service, install the port or package and - edit your /etc/ppp/ppp.conf. You will - need to be root to perform both of these - operations. An example section of ppp.conf + to connect to a DSL service, install the port or package, then + edit /etc/ppp/ppp.conf. + An example section of ppp.conf is given below. For further information on - ppp.conf options consult the - ppp manual page, &man.ppp.8;. + ppp.conf options consult &man.ppp.8;. adsl: set log phase chat lcp ipcp ccp tun command set timeout 0 enable dns set authname username set authkey password set ifaddr 0 0 add default HISADDR - The username of your account with the DSL + The username for the DSL provider. The password for your account. - Because you must put your account's password in the - ppp.conf file in plain text form you - should make sure than nobody can read the contents of this - file. The following series of commands will make sure the - file is only readable by the root - account. Refer to the manual pages for &man.chmod.1; and - &man.chown.8; for further information. + Since the account's password is added to + ppp.confin plain text form, + make sure nobody can read the contents of this + file: &prompt.root; chown root:wheel /etc/ppp/ppp.conf &prompt.root; chmod 600 /etc/ppp/ppp.conf This will open a tunnel for a PPP - session to your DSL router. Ethernet DSL modems have a - preconfigured LAN IP address which you connect to. In the - case of the Alcatel &speedtouch; Home this address is 10.0.0.138. Your router - documentation should tell you which address your device + session to the DSL router. Ethernet DSL modems have a + preconfigured LAN IP address to connect to. In the + case of the Alcatel &speedtouch; Home, this address is 10.0.0.138. The router's + documentation should list the address the device uses. To open the tunnel and start a PPP - session execute the following command: + session: &prompt.root; pptp address adsl - You may wish to add an ampersand (&) - to the end of the previous command because - pptp will not return your prompt - to you otherwise. + If an ampersand (&) is added + to the end of this command, + pptp will return the prompt. A tun virtual tunnel device will be created for interaction between the pptp and - ppp processes. Once you have been - returned to your prompt, or the + ppp processes. Once the + prompt is returned, or the pptp process has confirmed a - connection you can examine the tunnel like so: + connection, examine the tunnel: &prompt.user; ifconfig tun0 tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500 inet 216.136.204.21 --> 204.152.186.171 netmask 0xffffff00 Opened by PID 918 - If you are unable to connect, check the configuration of - your router, which is usually accessible via - telnet or with a web browser. If - you still cannot connect you should examine the output of the - pptp command and the contents of the - ppp log file, + If the connection fails, check the configuration of + the router, which is usually accessible using + a web browser. Also, examine the output of + pptp and the contents of the + log file, /var/log/ppp.log for clues.