the djb way

services, services!

ppp (user ppp)

Protocol: system daemon
Standard Port: N/A

One of the big advantages of the BSD systems for dial-up users is ppp, also known as user ppp. User ppp is a lot easier to configure, debug, and operate than the usual pppd (also known as kernel ppp). Our Radio Email project in West Africa made extensive use of user ppp on FreeBSD systems to control HF radio modems, on both the client and server sides of the peer connections.

Normally ppp(8) is started from the command-line, either directly or with a simple wrapper script. With this setup as a daemontools service, we also start and shut down ppp from the command line, only using the familiar svc interface instead.

First, the local service directory:

# mkdir -p /var/svc.d/ppp/log

Then the run script for /var/svc.d/ppp/run:

# ppp/run

exec 2>&1
echo "*** Starting ppp..."
exec \
    /usr/sbin/ppp -foreground ${SYSTEM}

### that's all, folks!

In the invocation of ppp here, we use the -foreground option so that daemontools supervise may control it. The $SYSTEM variable is set to the relevant stanza in /etc/ppp/ppp.conf for the peer we are dialing.

Here's the usual run script for the logger in /var/svc.d/ppp/log/run:

# ppp/log/run
exec setuidgid multilog multilog t /var/multilog/ppp

### that's all, folks!

Prepare the log directory in /var/multilog:

# mkdir -p /var/multilog/ppp
# chown multilog:nofiles /var/multilog/ppp

The ppp program itself logs via syslog, so this multilog doesn't do much except show when the service was started.

We set this service down by default, allowing us to bring it up on demand:

# touch /var/svc.d/ppp/down

That's about all there is to it. Make this link into /service and the service will be available:

# ln -s /var/svc.d/ppp /service/ppp

Bring the link up:

# svc -u /service/ppp

Use ifconfig(8) to check the link:

$ ifconfig tun0
tun0: flags=8011<UP,POINTOPOINT,MULTICAST> mtu 1500
         inet --> netmask 0xffffff00

Close it down when you're done:

# svc -d /service/ppp

about freenet

The example above shows the setup of our OpenBSD laptop in Kampala, used to dial-up into the freenet service. Freenet is a free Internet dial-up connection provided by the major Ugandan telephone utility, UTL. It is free in the sense that users don't need an account, or pay any recurring ISP service charges.

Users do pay the normal telephone connection charges, though, about $3.00(USD) per hour. So frequent usage over the course of the month can end up to be quite expensive.

Otherwise, the service is reliable and throughput is good.

Those living in Kampala may be interested in seeing this /etc/ppp/ppp.conf --no bells and whistles-- that makes the connection:

# /etc/ppp/ppp.conf
# user ppp configuration
# wcm, 2003.08.01 - 2003.08.01
# ===
 allow users wcm
 set log Phase Chat LCP IPCP CCP tun command
 ### pcmcia modem:
 set device /dev/cua02
 set speed 115200
 disable ipv6cp

### "freenet" in kampala:
 allow users wcm
 set phone 04001000
 set authname freenet
 set authkey freenet
 set timeout 480
 set ifaddr
 add default HISADDR
 ###enable dns

As you can see, nothing tricky. The username and password are both freenet. We specify them here and don't worry about pap/chap.

Our laptop runs its own dnscache. Otherwise, if you uncomment the enable dns option, the connection will create an /etc/resolv.conf for you automatically, with the freenet nameservers.

Or, if you prefer, simply configure /etc/resolv.conf with the freenet name servers:

lookup file bind


ppp is not just for dialup services. Even with a DSL account, a daemontools ppp service can be used to setup a connection with many ISPs. See "DSL in Portland" for an example using PPPoE.

Copyright © 2002, 2003, Wayne Marshall.
All rights reserved.

Last edit 2003.12.31, wcm.