From owner-freebsd-doc Thu Jul 27 17:09:28 1995 Return-Path: doc-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id RAA15045 for doc-outgoing; Thu, 27 Jul 1995 17:09:28 -0700 Received: from time.cdrom.com (time.cdrom.com [192.216.222.226]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id RAA15036 for ; Thu, 27 Jul 1995 17:09:22 -0700 Received: from localhost (localhost [127.0.0.1]) by time.cdrom.com (8.6.11/8.6.9) with SMTP id RAA03550 for ; Thu, 27 Jul 1995 17:08:30 -0700 To: doc@freebsd.org Subject: Nik Clayton: Draft iijppp FAQ Date: Thu, 27 Jul 1995 17:08:30 -0700 Message-ID: <3548.806890110@time.cdrom.com> From: "Jordan K. Hubbard" Sender: doc-owner@freebsd.org Precedence: bulk You guys have seen this, yes? I've seen no comments - we all think it's perfect, do we? :-) Jordan ------- Forwarded Message Return-Path: nik@blueberry.co.uk Received: from freefall.cdrom.com (freefall.cdrom.com [192.216.222.4]) by time.cdrom.com (8.6.11/8.6.9) with ESMTP id PAA00882 for ; Sun, 23 Jul 1995 15:18:20 -0700 Received: from elbereth.blueberry.co.uk (surfs-up.demon.co.uk [158.152.128.94]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id PAA15688 for ; Sun, 23 Jul 1995 15:18:20 -0700 Received: (from nik@localhost) by elbereth.blueberry.co.uk (8.6.11/8.6.9) id XAA01048 for faq@freebsd.org; Sun, 23 Jul 1995 23:20:09 GMT From: Nik Clayton Message-Id: <199507232320.XAA01048@elbereth.blueberry.co.uk> Subject: Draft iijppp FAQ To: faq@freebsd.org Date: Sun, 23 Jul 1995 23:20:09 +0000 () X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 14103 What follows is a draft FAQ for iijppp and FreeBSD 2.0.5. If anyone could cast an experienced eye over it, suggest improvements, and in particular volunteer to write a section on dynamically allocated IP addressess... I'm not subscribed to the faq mailing list (yet) so I'd appreciate it if any comments we're cc'd to me as well as to the list. N $Id: iijppp.faq,v 1.1 1995/07/23 21:58:15 nik Exp nik $ $Log: iijppp.faq,v $ # Revision 1.1 1995/07/23 21:58:15 nik # Initial revision # Introduction ~~~~~~~~~~~~ This FAQ/HowTo is intended to get you up and running with iijppp, also known as the 'user level ppp' for FreeBSD 2.0.5 (and above). I hope this document turns into a collaborative effort, largely because I am not really much of an authority on PPP. I've got it working, and want to pass on details of what I did so that other people can get it working. But I'm not 100% clear on some details, so I hope that by writing this and haveing others flesh out some of the information I'm going to learn something as well. Anything that I'm explicitly unsure about I've marked with an asterisk ``*'' in the first column. Unless otherwise stated, all commands shown below should be executed as ``root''. What is IIJPPP? ~~~~~~~~~~~~~~~ From the man page (``man ppp'') This is a user process PPP software package. Normally, PPP is implemented as a part of the kernel (e.g. as managed by pppd) and it's thus somewhat hard to debug and/or modify its behavior. However, in this implementation PPP is done as a user process with the help of the tunnel device driver (tun). In essence, this means that rather than running a PPP daemon, the ``ppp'' program can be run as and when desired. No PPP interface needs to be compiled into the kernel, as the program can use the generic ``tunnel'' device to to get data into and out of the kernel. From here on in I'm going to refer to iijppp as ``ppp'', unless I need to distinguish between it and any other PPP client/server software. Before you start ~~~~~~~~~~~~~~~~ This document assumes you're in roughly this position: You have an account with an Internet Service Provider (ISP) which lets you use PPP. Further, you have a modem (or other device) connected and configured correctly which allows you to connect to your ISP. You are going to need the following information to hand: o IP address of your ISP's gateway o Your ISP's netmask setting o IP adresses of one or more nameservers o If your ISP allocates you a static IP address and/or hostname then you will need that as well. If not, you will need to know from what range of IP addresses your allocated IP address will fall in. If you do not have any of this information then contact your ISP and make sure they provide it to you. As well as this, you may need the files required to recompile your kernel. Check the ``Kernel compiling'' FAQ for more information on how to acquire these. In addition, I've assumed that because your connection to the Internet is not full time you are not running a name server (``named''). Building a ppp ready kernel ~~~~~~~~~~~~~~~~~~~~~~~~~~~ As the description states, ``ppp'' uses the kernel ``tun'' device. It is necessary to make sure that your kernel has support for this device compiled in. To check this, go to your kernel compile directory (probably /sys/i386/conf) and examine your kernel configuration file. It needs to have the line pseudo-device tun 1 in it somewhere. The stock GENERIC kernel has this as standard, so if you have not installed a custom kernel you don't have to change anything. If your kernel configuration file does not have this line in it then you should add the line, re-compile and then re-install the kernel. Boot from this new kernel. Check the tun device ~~~~~~~~~~~~~~~~~~~~ My experiences with ppp have only been with one ``tun'' device (tun0). If you have used more (i.e., a number other than `1' in the pseudo-device line in the kernel configuration file) then alter all references to ``tun0'' below to reflect whichever device number you are using. The easiest way to make sure that the tun0 device is configured correctly is to re-make it. To this end, execute the following commands, # cd /dev # ./MAKEDEV tun0 PPP Configuration ~~~~~~~~~~~~~~~~~ The meat of the problem. Confusingly, it appears that both iijppp and pppd (the kernel level implementation of PPP) both assume configuration files kept in /etc/ppp. However, the sample configuration files provided are good for iijppp, so keep them around for reference. The easiest way to do this is, # cd /etc # mv ppp ppp.orig # mkdir ppp Configuring ppp requires that you edit somewhere between one and three 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 can be different during different PPP sessions). However, there are a few things that you should do first, regardless of whether you are using static or dynamic IP addresses. a) Configure the resolver(5) The resolver is the part of the networking system that turns IP addresses into hostnames. It can be configured to look for maps that describe IP to hostname mappings in one of two places. The first is a file called /etc/hosts (``hosts'' in section 5 of the manual). The second is the Internet Domain Name Service, a distributed data base, the discussion of which is beyond the realm of this document. The resolver is a set of system calls that do the mappings, and you have to tell them where to get their information from. You do this by editing the file /etc/host.conf. Do *not* call this file /etc/hosts.conf (note the extra ``s'') as the results can be confusing. This file should contain the following two lines, hosts bind which instruct the resolver to look in the file /etc/hosts first, and then to consult the DNS if the name was not found in the /etc/hosts file. It's probably a good idea to make sure you are not running the ``named'' service. Check your /etc/sysconfig file for the line that refers to ``namedflags'', and make sure the line reads namedflags="NO" b) Create the /etc/hosts(5) file This file should contain the IP addresses and names of machines on your network. At a bare minimum it should contain entries for the machine which will be running ppp. Assuming that you're machine is called foo.bar.com with the IP address 10.0.0.1, /etc/hosts should contain 127.0.0.0 localhost 10.0.0.1 foo.bar.com foo The first line defines the alias ``localhost'' as a synonym for the current machine. Regardless of your own IP address, the IP address for this line should always be 127.0.0.1. The second line maps the name ``foo.bar.com'' (and the shorthand ``foo'') to the IP address 10.0.0.1. If your provider allocates you a static IP address then use this in place of 10.0.0.1. * What should they do if they are allocated an IP address dynamically? c) Create the /etc/resolv.conf file /etc/resolv.conf contains some extra information required when you are not running a nameserver. It points the resolver routines at real nameservers, and specifies some other information. At the very least, /etc/resolv.conf should contain one line with a nameserver which can be queried. You should enter this as an IP address. My /etc/resolv.conf contains nameserver 158.152.1.193 nameserver 158.152.1.65 Which are Demon Internet's two nameservers. Add as many ``nameserver'' lines as your ISP provides nameservers. PPP and static IP addresses ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Probably the easiest to configure for. You will need to create three files in the /etc/ppp directory. The first of these is ppp.conf. It should look similar to the example below. Note that lines that end in a ``:'' start in column 1, all other lines should be indented as shown. /etc/ppp/ppp.conf 1 default: 2 set device /dev/cuaa0 3 set speed 9600 4 disable lqr 5 deny lqr 6 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATE1Q0 OK-AT-OK \\dATDT\\T TIMEOUT 40 CONNECT" 7 provider: 8 set phone 01234567890 9 set login "TIMEOUT 10 gin:-BREAK-gin: foo word: bar col: ppp" 10 set timeout 120 11 set ifaddr x.x.x.x y.y.y.y Don't include the line numbers, they're just for this discussion. Line # Purpose ------------------------------------------------------------------------ 1 Identifies the default entry. Commands in this entry are executed automatically when ppp is run. 2 Identifies the device that has the modem hanging from it. COM1: is /dev/cuaa0 and COM2: is /dev/cuaa1 3 Sets the speed you want to connect at. * 4 and 5 Don't know exactly what effect these lines have 6 Dial string commands. iijppp uses the chat(8) language. Check the manual page for information on the features of this language. 7 Identifies an entry for a provider called ``provider''. 8 Sets the phone number for this provider. Don't include any spaces in the phone number. 9 Set's the login string sequence. In this example, the string is for a service who's login session looks like J. Random Provider login: foo password: bar protocol: ppp You will need to alter this script to suit your own needs. It is written in the chat(8) language. 10 Sets the default timeout (in seconds) for the connection. So the connectioned will be closed automatically after 120 seconds of inactivity. 11 Sets the interface addresses. The string x.x.x.x should be replaced by the IP address that your provider allocates you. The string y.y.y.y should be replaced by the IP address that your ISP indicated for their gateway. Now you have to edit the file ppp.linkup /etc/ppp/ppp.linkup x.x.x.x: add 0 0 HISADDR Replace x.x.x.x with your IP address as before. This file is used to automatically add a default route from your ISP (who's address is automatically inserted with the HISADDR macro) to you. Finally, you can create the file /etc/ppp/ppp.secret, which sets some passwords to prevent people messing around with ppp on your system. You may or may not want to do this, depending on how many people have access to your ppp system. PPP and Dynamic IP configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Don't have a clue how to do this. Could someone who does submit something to go in here? Final system configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~ You now have PPP configured, but there's a few more things to do before it's ready to work. They all involve editing the /etc/sysconfig file. Working from the top down in this file, make sure the ``hostname='' line is set, e.g., hostname=foo.bar.com Look for the network_interfaces variable, and make sure the tun0 device is added to the list. My line looks like network_interfaces="lo0 tun0 ep0" but I have an ethernet card (ep0) to configure as well. Now add an ifconfig line for the tun0 device. It should look something like ifconfig_tun0="inet foo.bar.com y.y.y.y netmask 0xffffffff" as before, change ``foo.bar.com'' to be your hostname, y.y.y.y is the IP address of your providers gateway, and 0xffffffff is the netmask they provided you with (in hexadecimal). Two command values for the netmask are 255.255.255.255 = 0xffffffff 255.255.255.0 = 0xffffff00 Set the routed flags to ``-s'' with the line routedflags=-s It's probably worth your while ensuring that the ``sendmail_flags'' line does not include the ``-q'' option, otherwise sendmail will attempt to do a network lookup every now and then, possibly causing your machine to dial out. My sendmail line looks like sendmail_flags="-bd" The upshot of this is that I must force sendmail to re-examine the mailqueue whenever I have the PPP link up, by typing # /usr/sbin/sendmail -q That should be about all you need to do to get PPP working with a static IP address. All that's left is to reboot the machine. During startup the tun0 device should be detected, and two lines like the following should be printed, tun0: flags=51 mtu 1500 inet x.x.x.x --> y.y.y.y netmask 0xffffffff At this point, it should all be working. You can now either type # ppp and then ``dial provider'' to start the PPP session, or, if you want ppp to establish sessions automatically when there is outbound traffic, type # ppp -auto provider This line could be added to your /etc/rc.local file. Acknowledgements ~~~~~~~~~~~~~~~~ Rob Snow who proved to be a mine of useful information when I was first experimenting with iijppp. Anyone else who can provide any more information to go in this FAQ, particularly in the area of dynamically allocated IP addresses, on which I know next to nothing. - -- - --+=[ Nik Clayton System Administration, Blueberry Design Ltd, ]=+-- - --+=[ nik@blueberry.co.uk 1/9 Chelsea Harbour Design Centre ]=+-- - --+=[ root@blueberry.co.uk London, SW10 0XE. Tel: 0171 351 3313 ]=+-- "It's two o'clock in the morning . . . do you know where your stack pointer is?" ------- End of Forwarded Message