From owner-p4-projects@FreeBSD.ORG Fri Aug 15 13:31:50 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6058F1065671; Fri, 15 Aug 2008 13:31:50 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23C7A106566B for ; Fri, 15 Aug 2008 13:31:50 +0000 (UTC) (envelope-from remko@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 00E228FC08 for ; Fri, 15 Aug 2008 13:31:50 +0000 (UTC) (envelope-from remko@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7FDVnEp092098 for ; Fri, 15 Aug 2008 13:31:49 GMT (envelope-from remko@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7FDVn4X092096 for perforce@freebsd.org; Fri, 15 Aug 2008 13:31:49 GMT (envelope-from remko@freebsd.org) Date: Fri, 15 Aug 2008 13:31:49 GMT Message-Id: <200808151331.m7FDVn4X092096@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to remko@freebsd.org using -f From: Remko Lodder To: Perforce Change Reviews Cc: Subject: PERFORCE change 147448 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2008 13:31:50 -0000 http://perforce.freebsd.org/chv.cgi?CH=147448 Change 147448 by remko@remko_nakur on 2008/08/15 13:31:41 Import my WIP for the PPP and SLIP chapter. 13% Affected files ... .. //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/ppp-and-slip/chapter.sgml#3 edit Differences ... ==== //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/ppp-and-slip/chapter.sgml#3 (text+ko) ==== @@ -1,7 +1,7 @@ @@ -10,172 +10,1331 @@ Jim Mock - Herstructureerd, gereorganiseerd en geupdate door + Geherstructureerd, gereorganiseerd en geupdate + door + + + Remko + Lodder + Vertaald door + + - * PPP en SLIP + PPP en SLIP - * Samenvatting + Overzicht + + PPP + + + SLIP + + + &os; heeft een aantal manieren om de ene computer met een + andere te verbinden. Om een netwerk of internet verbinding + op te zetten door een inbel modem, of om anderen toe te + staan dit te doen door de machine heen vereist het gebruik + van PPP en SLIP. Dit hoofdstuk beschrijft het opzetten van + op modems gebaseerde diensten in meer detail. + + Na het lezen van dit hoofdstuk weet u: + + + + Hoe gebruikers PPP opgezet kan worden. + + + Hoe kernel PPP opgezet kan worden. + + + Hoe PPPoE opgezet kan worden (PPP + over Ethernet). + + + Hoe PPPoA opgezet kan worden (PPP + over ATM). + + + Hoe een SLIP server en client opgezet kan worden en + hoe dat geconfigureerd wordt. + + + + + PPP + user PPP + + + PPP + kernel PPP + + + PPP + over Ethernet + + + Voordat dit hoofdstuk gelezen wordt, moet u: + + + + Bekend zijn met basis netwerk terminologie. + + + De basis en doeleinden van een inbel verbinding + en van PPP en/of SLIP. + + + + U kan zich afvragen wat het verschil is tussen gebruiker PPP + en kernel PPP. Het antwoord is simpel: gebruiker PPP verwerkt + inkomend en uitgaande data in het gebruiersland in plaats van + in de kerenl. Dit is duur in dezin van het kopieren van de + data tussen de kernel en het gebruikersland, maar levert een meer + rijke hoeveelheid aan mogelijkheden voor de PPP implementatie. + Gebruikers PPP gebruikt het tun apparaat + om te communiceren met de buitenwereld waar de kernel PPP gebruik + maakt van het ppp apparaat. - + + Voor de rest van dit hoofdstuk, zal gebruiker PPP gerefereerd + worden als ppp tenzij er onderscheid + gemaakt moet worden met andere PPP software zoals + pppd. Tenzij anders vermeld moeten + alle uitgelegde command's in dit hoofdstuk gestart worden als + root. + - - Tom - Rhodes - Geupdate en verbeterd door - + + Tom + Rhodes + Geupdate en uitgebreid door + - - Brian - Somers + + Brian + Somers Origineel bijgedragen door - + Nik Clayton - Met input van - - + Met input van + + Dirk - Frömberg - - - Peter - Childs - + Frömberg + + + Peter + Childs + - * Gebruikers PPP gebruiken + + Gebruik maken van gebruiker PPP - * Gebruikers PPP + Gebruiker PPP - * Aannames Assumptions + Aannames + + Dit document neemt aan dat u het volgende heeft: + + + + ISP + + + PPP + + + Een account bij een Internet Service Provider (ISP) + waarmee verbinding gemaakt wordt door mdidel van + PPP. + + + + U heeft een modem of een ander apparaat verbonden + met uw pc en correct geconfigureerd wat het u mogelijk + maakt om verbinding te maken met uw ISP. + + + + De inbel nummers van uw ISP. + + + + PAP + + + CHAP + + + UNIX + + + login naam + + + wachtwoord + + + Uw loginnaam en wachtwoord (danwel een standaard &unix; + style login en wachtwoord combinatie of een PAP of CHAP + login en password combinatie). + + + + naamserver + + + Het IP adres van één of meerdere naam + servers. Normaal gesproken krijgt u twee IP adressen van + uw ISP om te gebruiken. Als u er echter geen + één gekregen heeft, kunt u het commando + enable dns gebruiken in + ppp.conf en + ppp zal de naam servers voor + u configureren. Deze optie is afhankelijk van de PPP + implementatie van de ISP, welke DNS onderhandeling + moet ondersteunen. + + + + De volgende informatie kan aangeleverd worden door uw + ISP maar is niet volledig noodzakelijk: + + + + Het IP adres van uw ISP's doorgang. De doorgang is + de machine waarmee u verbinding maakt en welke ingesteld + wordt als de standaard route. Als + u deze informatie niet heeft, kunt u een willekeurig + adres verzinnen en zal de ISP PPP server het juiste adres + vertellen zodra u verbinding maakt. + + Dit wordt IP adres wordt door + ppp HISADDR + genoemd. + + + + Het netmasker wat gebruikt moet worden. Als uw ISP + deze niet heeft opgegeven, kan 255.255.255.255 veilig gebruikt + worden. + + + + statisch ip adres + + + Als uw ISP een vast IP adres en hostname levert, kunt + u dit invoeren. In andere gevallen laten bepaalt de + andere kant welk adres er uitgegeven wordt. + + + + Als u niet in bezit bent van de vereiste informatie, moet + u contact opnemen met uw ISP. + + + Door de rest van dit hoofdstuk worden veel van de + voorbeelden van configuratie bestanden genummerd per + regel. Deze nummers dienen alleen als hulp voor de + presentatie en discussie en zijn niet bedoeld om + daadwerkelijk in het echte bestand geplaatst te worden. + Juiste identatie met tabs en spaties zijn ook + belangrijk. + - - * Creeëren van PPP device nodes + Automatische <application>PPP</application> configuratie + + + PPP + configuratie + - - + zowel ppp en pppd + (de implementatie van PPP op kernel niveau) gebruiken de + configuratie bestanden die zich in de + /etc/ppp directory bevinden. Voorbeelden + van gebruiker PPP kunnen gevonden worden in + /usr/share/examples/ppp/. - - * Automatische <application>PPP</application> - configuratie + Het configureren van ppp vereist + dat u een aantal bestanden bewerkt, afhankelijk van uw + eisen. Wat u moet invoeren is deels afhankelijk van wat + uw ISP u aanbied met oog op statische IP adressen (lees u + krijgt een statisch adres welke u altijd gebruikt) of + dynamisch (lees: uw IP adres veranderd elke keer als + u verbinding maakt met uw ISP). - * PPP en statische ip adressen + PPP en statische ip adressen + + + PPP + met statische IP adressen + + + U moet het /etc/ppp/ppp.conf + bewerken. Het zou er dan als volgend uit moeten zien: + + + Regels die eindigen met een : + starten in de eerste kolom (het begin vande regel) + — alle andere regels moeten inspringen zoals + getoond door middel van spaties of tabs. + + + 1 default: +2 set log Phase Chat LCP IPCP CCP tun command +3 ident user-ppp VERSION (built COMPILATIONDATE) +4 set device /dev/cuad0 +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 + + + + Regel 1: + + + Dit identificeert de standaard regel. Commando's + in deze regel worden automatisch gestart zodra + ppp gestart wordt. + + + + + Regel 2: + + + Zet log paramaters aan. Zodra de configuratie + naar verwachting werkt, moet deze regel gereduceerd + worden tot: + + set log phase tun + + om te voorkomen dat er extreem grote log files + komen. + + + + + Regel 3: + + + Vertelt PPP hoe het zichzelf moet identificeren + aan de andere kant. PPP identificeert zichzelf aan + de andere kant, als het problemen heeft met het + onderhandelen en het opzetten van de link en het + leveren van informatie die de beheerders van de andere + kant nuttig kunnen vinden om zulke problemen te + onderzoeken. + + + + + Regel 4: + + + Identificeert het apparaat waaraan de model + verbonden is. COM1 is + /dev/cuad0 + en + COM2 is + /dev/cuad1. + + + + + Regel 5: + + + Stelt de snelheid in waarmee verbinding gemaakt + wordt. Als 115200 niet werkt (wat wel zou moeten + kunnen met elke nieuwe modem), probeert u dan de + instelling van 38400. + + + + + Regels 6 & 7: + + + PPP + gebruiker PPP + + + + De inbel regel. Gebruiker PPP gebruikt een + verwachting-verstuur syntax wat vergelijkbaar is + met het &man.chat.8; programma. Bekijk de handleiding + voor meer informatie over de mogelijkheden van deze + taal. + + Let op dat dit commando doorgaat op de volgende + regel zodat deze leesbaar blijft. Elk commando in + ppp.conf kan dit doen als het + laatste karakter op een regel, het ``\'' karakter + is. + + + + + Regel 8: + + + Stelt de idle timeout in voor een link. 180 + seconden is de standaard, dus deze regel is puur + cosmetisch. + + + + + Regel 9: + + + Vertelt PPP om de andere kant te vragen om een + bevestiging van de lokale opzoek instellingen. Als + u een lokale naam server draait moet deze regel + uitgecommentarieerd worden, of verwijderd. + + + + + Regel 10: + + + Een blanco regel voor de leesbaarheid. Blanco + regels worden genegeerd door PPP. + + + + + Regel 11: + + + Identificeert een sectie voor een provider die + provider genoemd wordt. Dit kan + gewijzigd worden in de naam van uw zodat er later + gebruik gemaakt van worden van de optie + + om de verbinding te starten. + + + + + Regel 12: + + + Stelt het telefoonnummer in voor deze provider. + Meerdere telefoonnummers kunnen gespecificeerd worden + door gebruik te maken van de dubbele punt + (:) of het pipe karakter + (|) als scheidingsteken. Het + verschil tussen de twee scheidingstekens wordt + beschreven in de &man.ppp.8; handleiding. + Om samen te vatten, als u wilt roteren tussen de + nummers gebruikt u dan een dubbelepunt. Als u altijd + het eerste nummer eerst wilt draaien en alleen de + andere nummers wilt draaien als het eerste nummer + faalt, gebruik dan het pipe karakter. Quote altijd + de hele set van telefoonnummers zoals getoond. + + U moet het telefoonnummer citeren met dubbele quotes + (") als er enige intentie is in het + gebruik van spaties in het telefoonummer. Dit kan een + simpele, maar subtiele error creeëren. + + + + + Regels 13 & 14: + + + Identificeert de gebruikersnaam en het + wachtwoord. Wanneer gebruik gemaakt wordt van een + &unix; style login worden deze waarden verwezen + door het set login commando door + gebruik te maken van de \U en \P variabelen. + Wanneer er verbinding gemaakt wordt door PPP en CHAP + worden deze waardes gebruikt tijdens het + authenticeren. + + + + + Regels 15: + + + PAP + CHAP + Als u gebruik maakt van PPP en CHAP, zal er geen + login op dit moment zijn, en moet deze regel + uitgecommentarieerd worden of verwijderd. Zie het + PAP en CHAP + authenticatie hoofdstuk voor meer details. + + De login string is hetzelfde als een chat-achtige + syntax van de inbel string. In dit voorbeeld werkt + de string voro een dienst wiens login sessie als + volgt eruit ziet: + + 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 + the conversation is going as expected. + + + + + Line 16: + + timeout + + Sets the default idle timeout (in seconds) for the + connection. Here, the connection will be closed + automatically after 300 seconds of inactivity. If you + never want to timeout, set this value to zero or use + the command line switch. + + + + + Line 17: + ISP + + Sets the interface addresses. The string + x.x.x.x should be + replaced by the IP address that your provider has + allocated to you. 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 + address, use 10.0.0.2/0. If you need to + use a guessed address, make sure that + you create an entry in + /etc/ppp/ppp.linkup as per the + instructions for PPP and Dynamic IP + addresses. If this line is omitted, + ppp cannot run in + mode. + + + + + Line 18: + + + Adds a default route to your ISP's 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 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 explained later with the sendmail + example. - + Example configuration files can be found in the + /usr/share/examples/ppp/ directory. - * PPP en dynamische ip adressen + PPP and Dynamic IP Addresses + + + PPP + with dynamic IP addresses + + + + IPCP + + + If your service provider does not assign static IP + addresses, ppp can be configured 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 + Configuration Protocol (IPCP) after connecting. The + ppp.conf configuration is the same as + PPP and Static IP + Addresses, with the following change: + + 17 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 + + 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 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 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 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 + 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 + 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. - * Inkomende telefoontjes ontvangen + Receiving Incoming Calls + + + PPP + receiving incoming calls + + + When you configure 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: - + gateway_enable="YES" - - * Welke getty? + + Which getty? + + Configuring FreeBSD for Dial-up + Services provides a good description on enabling + dial-up services using &man.getty.8;. + + An alternative to getty is mgetty, + 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 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. + + Refer to Mgetty and + AutoPPP 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 + 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 + 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. + + + + PPP Shells for Dynamic-IP 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. + 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;). + + 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. + + + + PPP Shells for Static-IP Users + + + PPP shells + + + Create the ppp-shell file as above, + and for each account with statically assigned IPs create a + symbolic link to ppp-shell. + + For example, if you have three dialup customers, + fred, sam, and + mary, that you route /24 CIDR networks + for, you would type the following: + + &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 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 + + The /etc/ppp/ppp.conf file should + contain something along the lines of: + + default: + set debug phase lcp chat + set timeout 0 + +ttyd0: + set ifaddr 203.14.100.1 203.14.100.20 255.255.255.255 + enable proxy + +ttyd1: + 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 + /etc/ttys create an entry similar to + the one for ttyd0: above. Each line + should get a unique IP address from your pool of IP + addresses for dynamic users. + + + + Setting Up <filename>ppp.conf</filename> for 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. + + 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 + 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 - - * <application>PPP</application> permissies + + <command>mgetty</command> and AutoPPP + + + mgetty + + + + AutoPPP + + + + LCP + + + Configuring and compiling mgetty + with the AUTO_PPP option enabled + allows 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 + configured, compiled, and installed a version of + mgetty with the + AUTO_PPP option (v0.99beta or + later). + + Make sure your + /usr/local/etc/mgetty+sendfax/login.config + file has the following in it: + + /AutoPPP/ - - /etc/ppp/ppp-pap-dialup + >>> TRUNCATED FOR MAIL (1000 lines) <<<