1996-05-16 23:18:28 +00:00
|
|
|
<!-- $Id: userppp.sgml,v 1.6 1996/01/31 14:26:20 mpp Exp $ -->
|
1995-07-29 13:08:02 +00:00
|
|
|
<!-- The FreeBSD Documentation Project -->
|
|
|
|
|
|
|
|
<sect>Setting up user PPP<label id="userppp">
|
|
|
|
|
|
|
|
<p><em>Contributed by &a.nik;<newline>
|
|
|
|
28 July 1995</em>.
|
|
|
|
|
|
|
|
<!-- This FAQ/HowTo is intended to get you up and running with
|
|
|
|
iijppp, also known as the <em>user level ppp</em> for FreeBSD 2.0.5
|
|
|
|
(and above).
|
|
|
|
|
|
|
|
I hope this document turns into a collaborative effort, largely
|
1996-05-16 23:18:28 +00:00
|
|
|
because I am not really much of an authority on PPP. I have got
|
1995-07-29 13:08:02 +00:00
|
|
|
it working, and want to pass on details of what I did so that
|
1996-05-16 23:18:28 +00:00
|
|
|
other people can get it working. But I am not 100% clear on some
|
1996-01-31 14:26:20 +00:00
|
|
|
details, so I hope that by writing this and having others
|
1996-05-16 23:18:28 +00:00
|
|
|
flesh out some of the information I am going to learn something
|
1995-07-29 13:08:02 +00:00
|
|
|
as well.
|
|
|
|
-->
|
|
|
|
|
1996-01-31 14:26:20 +00:00
|
|
|
<p>User PPP was introduced to FreeBSD in release 2.0.5 as an
|
|
|
|
addition to the existing kernel implementation of PPP. So,
|
1995-07-29 13:08:02 +00:00
|
|
|
what is different about this new PPP that warrants its
|
|
|
|
addition? To quote from the manual page:
|
|
|
|
|
|
|
|
<quote>
|
|
|
|
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
|
1996-05-16 23:18:28 +00:00
|
|
|
it is thus somewhat hard to debug and/or modify its behavior. However,
|
1995-07-29 13:08:02 +00:00
|
|
|
in this implementation PPP is done as a user process with the help of
|
|
|
|
the tunnel device driver (tun).
|
|
|
|
</quote>
|
|
|
|
|
|
|
|
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 out, user ppp will be referred to as simply as ppp unless a
|
|
|
|
distinction need to be made be it and any other PPP client/server software.
|
|
|
|
Unless otherwise stated, all commands in this section should be
|
|
|
|
executed as root.
|
|
|
|
|
|
|
|
Parts in this section marked with an asterisk (*) are
|
|
|
|
incomplete. Comments and suggestions are appreciated and
|
|
|
|
should be submitted to &a.nik;.
|
|
|
|
Thanks to Rob Snow <rsnow@txdirect.net> who proved to be a mine of
|
|
|
|
useful information when I was first experimenting with user ppp.
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>Before you start</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
<p>This document assumes you are in roughly this position:
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
<itemize>
|
|
|
|
<item>IP address of your ISP's gateway
|
|
|
|
|
|
|
|
<item>Your ISP's netmask setting
|
|
|
|
|
1996-01-31 14:26:20 +00:00
|
|
|
<item>IP addresses of one or more nameservers
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<item>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.
|
|
|
|
</itemize>
|
|
|
|
|
|
|
|
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 <ref id="kernelconfig" name="Kernel
|
|
|
|
Configuration"> for more information on how to acquire these.
|
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
In addition, I have assumed that because your connection to the Internet is
|
1995-07-29 13:08:02 +00:00
|
|
|
not full time you are not running a name server (<tt>named(8)</tt>).
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>Building a ppp ready kernel</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>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
|
|
|
|
<tscreen><verb>
|
|
|
|
pseudo-device tun 1
|
|
|
|
</verb></tscreen>
|
|
|
|
in it somewhere. The stock GENERIC kernel has this as standard, so if you
|
1996-05-16 23:18:28 +00:00
|
|
|
have not installed a custom kernel you do not have to change anything.
|
1995-07-29 13:08:02 +00:00
|
|
|
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.
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>Check the tun device</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>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
|
1995-12-04 17:58:52 +00:00
|
|
|
to re-make it. To this end, execute the following commands:
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
# cd /dev
|
|
|
|
# ./MAKEDEV tun0
|
|
|
|
</verb></tscreen>
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>PPP Configuration</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>The meat of the problem.
|
|
|
|
|
|
|
|
Confusingly, it appears that both user ppp 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
|
1995-12-04 17:58:52 +00:00
|
|
|
user ppp, so keep them around for reference. The easiest way to do this is:
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
# cd /etc
|
|
|
|
# mv ppp ppp.orig
|
|
|
|
# mkdir ppp
|
|
|
|
</verb></tscreen>
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect2><heading>Configure the resolver(5)</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>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.
|
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
The first is a file called <tt>/etc/hosts</tt> (<tt>man 5 hosts</tt>).
|
|
|
|
The second is the Internet Domain Name Service, a distributed
|
1995-07-29 13:08:02 +00:00
|
|
|
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
|
1995-12-04 17:58:52 +00:00
|
|
|
from. You do this by editing the file <tt>/etc/host.conf</tt>. Do
|
|
|
|
<bf>not</bf> call this file <tt>/etc/hosts.conf</tt> (note the extra
|
1995-07-29 13:08:02 +00:00
|
|
|
``s'') as the results can be confusing.
|
|
|
|
|
|
|
|
This file should contain the following two lines,
|
|
|
|
<tscreen><verb>
|
|
|
|
hosts
|
|
|
|
bind
|
|
|
|
</verb></tscreen>
|
1995-12-04 17:58:52 +00:00
|
|
|
which instruct the resolver to look in the file <tt>/etc/hosts</tt> first,
|
|
|
|
and then to consult the DNS if the name was not found in the
|
|
|
|
<tt>/etc/hosts</tt> file.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
It is probably a good idea to make sure you are not running the ``named''
|
1995-12-04 17:58:52 +00:00
|
|
|
service. Check your <tt>/etc/sysconfig</tt> file for the line that refers
|
|
|
|
to ``namedflags'', and make sure the line reads
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
namedflags="NO"
|
|
|
|
</verb></tscreen>
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect2><heading>Create the /etc/hosts(5) file</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>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
|
1996-05-16 23:18:28 +00:00
|
|
|
which will be running ppp. Assuming that your machine is called
|
1995-12-04 17:58:52 +00:00
|
|
|
foo.bar.com with the IP address 10.0.0.1, <tt>/etc/hosts</tt> should
|
|
|
|
contain:
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
1995-12-06 22:01:50 +00:00
|
|
|
127.0.0.1 localhost
|
1995-07-29 13:08:02 +00:00
|
|
|
10.0.0.1 foo.bar.com foo
|
|
|
|
</verb></tscreen>
|
|
|
|
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.
|
|
|
|
|
1995-08-19 22:16:06 +00:00
|
|
|
<!-- XXX <em>(* What should they do if they are
|
|
|
|
allocated an IP address dynamically?)</em> -->
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect2><heading>Create the /etc/resolv.conf file</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
<p><tt>/etc/resolv.conf</tt> contains some extra information required when
|
|
|
|
you are not running a nameserver. It points the resolver routines at real
|
1995-07-29 13:08:02 +00:00
|
|
|
nameservers, and specifies some other information.
|
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
At the very least, <tt>/etc/resolv.conf</tt> should contain one line with
|
|
|
|
a nameserver which can be queried. You should enter this as an IP
|
|
|
|
address. My <tt>/etc/resolv.conf</tt> contains:
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
nameserver 158.152.1.193
|
|
|
|
nameserver 158.152.1.65
|
|
|
|
</verb></tscreen>
|
|
|
|
Which are Demon Internet's two nameservers. Add as many ``nameserver''
|
|
|
|
lines as your ISP provides nameservers.
|
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>PPP and static IP addresses</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<p>Probably the easiest to configure for. You will need to create three files
|
1995-12-04 17:58:52 +00:00
|
|
|
in the <tt>/etc/ppp</tt> directory.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
The first of these is <tt>ppp.conf</tt>. 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.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
<tt>/etc/ppp/ppp.conf</tt>
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
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
|
|
|
|
</verb></tscreen>
|
1996-05-16 23:18:28 +00:00
|
|
|
Do not include the line numbers, they are just for this discussion.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<descrip>
|
|
|
|
<tag/Line 1:/ Identifies the default entry. Commands in this entry are
|
|
|
|
executed automatically when ppp is run.
|
|
|
|
|
|
|
|
<tag/Line 2:/ Identifies the device that has the modem hanging from it.
|
1995-12-04 17:58:52 +00:00
|
|
|
COM1: is <tt>/dev/cuaa0</tt> and COM2: is <tt>/dev/cuaa1</tt>.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<tag/Line 3:/ Sets the speed you want to connect at.
|
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
<tag/* Lines 4 and 5:/ Do not know exactly what effect these lines have
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
<tag/Line 6:/ Dial string commands. user ppp uses the <tt>chat(8)</tt>
|
|
|
|
language. Check the manual page for information on the features
|
|
|
|
of this language.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<tag/Line 7:/ Identifies an entry for a provider called ``provider''.
|
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
<tag/Line 8:/ Sets the phone number for this provider. Do not include any
|
1995-07-29 13:08:02 +00:00
|
|
|
spaces in the phone number.
|
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
<tag/Line 9:/ Sets the login string sequence. In this example, the string is
|
1995-07-29 13:08:02 +00:00
|
|
|
for a service who's login session looks like
|
|
|
|
<tscreen><verb>
|
|
|
|
J. Random Provider
|
|
|
|
login: foo
|
|
|
|
password: bar
|
|
|
|
protocol: ppp
|
|
|
|
</verb></tscreen>
|
|
|
|
You will need to alter this script to suit your own needs. It is
|
1995-12-04 17:58:52 +00:00
|
|
|
written in the <tt>chat(8)</tt> language.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
<tag/Line 10:/ Sets the default timeout (in seconds) for the connection. So
|
1996-01-31 14:26:20 +00:00
|
|
|
the connection will be closed automatically after 120 seconds
|
1995-07-29 13:08:02 +00:00
|
|
|
of inactivity.
|
|
|
|
|
|
|
|
<tag/Line 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.
|
|
|
|
</descrip>
|
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
Now you have to edit the file <tt>/etc/ppp/ppp.linkup</tt>:
|
1995-07-29 13:08:02 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
x.x.x.x:
|
|
|
|
add 0 0 HISADDR
|
|
|
|
</verb></tscreen>
|
|
|
|
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.
|
|
|
|
|
1995-12-04 17:58:52 +00:00
|
|
|
Finally, you can create the file <tt>/etc/ppp/ppp.secret</tt>, 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.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>PPP and Dynamic IP configuration</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-08-19 22:16:06 +00:00
|
|
|
<!-- XXX -->
|
|
|
|
<p>If you service provider does not assign static IP numbers,
|
|
|
|
<tt>ppp</tt> can be configured to negotiate the local address. This is
|
|
|
|
done by specifying 0 as the local IP address:
|
|
|
|
<tscreen><verb>
|
|
|
|
set ifaddr 0 0
|
|
|
|
</verb></tscreen>
|
|
|
|
See the <tt>ppp(8)</tt> manual page for more detailed information.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1995-08-29 01:42:52 +00:00
|
|
|
<sect1><heading>Final system configuration</heading>
|
1995-07-29 13:08:02 +00:00
|
|
|
|
1996-05-16 23:18:28 +00:00
|
|
|
<p>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 <tt>/etc/sysconfig</tt>
|
1995-12-04 17:58:52 +00:00
|
|
|
file.
|
1995-07-29 13:08:02 +00:00
|
|
|
|
|
|
|
Working from the top down in this file, make sure the ``hostname='' line
|
|
|
|
is set, e.g.,
|
|
|
|
<tscreen><verb>
|
|
|
|
hostname=foo.bar.com
|
|
|
|
</verb></tscreen>
|
|
|
|
Look for the network_interfaces variable, and make sure the tun0 device is
|
|
|
|
added to the list. My line looks like
|
|
|
|
<tscreen><verb>
|
|
|
|
network_interfaces="lo0 tun0 ep0"
|
|
|
|
</verb></tscreen>
|
|
|
|
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
|
|
|
|
<tscreen><verb>
|
|
|
|
ifconfig_tun0="inet foo.bar.com y.y.y.y netmask 0xffffffff"
|
|
|
|
</verb></tscreen>
|
|
|
|
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 common values for the netmask are
|
|
|
|
<tscreen><verb>
|
|
|
|
255.255.255.255 = 0xffffffff
|
|
|
|
255.255.255.0 = 0xffffff00
|
|
|
|
</verb></tscreen>
|
|
|
|
Set the routed flags to ``-s'' with the line
|
|
|
|
<tscreen><verb>
|
|
|
|
routedflags=-s
|
|
|
|
</verb></tscreen>
|
1996-05-16 23:18:28 +00:00
|
|
|
It is probably worth your while ensuring that the ``sendmail_flags'' line
|
1995-07-29 13:08:02 +00:00
|
|
|
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
|
|
|
|
<tscreen><verb>
|
|
|
|
sendmail_flags="-bd"
|
|
|
|
</verb></tscreen>
|
|
|
|
The upshot of this is that I must force sendmail to re-examine the
|
|
|
|
mailqueue whenever I have the PPP link up, by typing
|
|
|
|
<tscreen><verb>
|
|
|
|
# /usr/sbin/sendmail -q
|
|
|
|
</verb></tscreen>
|
|
|
|
That should be about all you need to do to get PPP working with a static
|
1996-05-16 23:18:28 +00:00
|
|
|
IP address. All that is left is to reboot the machine. During startup the
|
1995-07-29 13:08:02 +00:00
|
|
|
tun0 device should be detected, and two lines like the following should be
|
|
|
|
printed,
|
|
|
|
<tscreen><verb>
|
|
|
|
tun0: flags=51<UP,POINTOPOINT,RUNNING> mtu 1500
|
|
|
|
inet x.x.x.x --> y.y.y.y netmask 0xffffffff
|
|
|
|
</verb></tscreen>
|
|
|
|
At this point, it should all be working. You can now either type
|
|
|
|
<tscreen><verb>
|
|
|
|
# ppp
|
|
|
|
</verb></tscreen>
|
|
|
|
and then ``dial provider'' to start the PPP session, or, if you want ppp
|
|
|
|
to establish sessions automatically when there is outbound traffic, type
|
|
|
|
<tscreen><verb>
|
|
|
|
# ppp -auto provider
|
|
|
|
</verb></tscreen>
|
1995-12-04 17:58:52 +00:00
|
|
|
This line could be added to your <tt>/etc/rc.local</tt> file.
|
1995-07-29 13:08:02 +00:00
|
|
|
|