I didn't find a set of ppp scripts that did what I wanted, so I wrote my own.

Features

Lacking

Bugs

Download tarball

To be untarred in /etc/ppp. Here it is.

Warning: absolutely no warrantry of any kind at all, though if it fries your modem, e-mail me ;-).

Step by step guide

  1. Get a recent pppd. I am using 2.4.0b2; check linuxcare.com.au for a later one. Compile it and install.
  2. Untar vii-ppp-scripts.tar.gz in /etc/ppp.
    root:/etc/ppp# tar zxvf /incoming/vii-ppp-scripts.tar.gz 
  3. Files and permissions: (script filenames in brackets are where the various paths can be changed).
  4. Add options files for your ISPs in /etc/ppp/peers. The filenames will be your connection names. Choose them well!
    An example file, /etc/peers/onetel for the OneTel.net free ISP in the UK:
    name user@onetel.net.uk
    linkname onetel
    connect '/etc/ppp/dial 08081401877'
    asyncmap 0
    defaultroute
    noauth
    /dev/modem 
    Change "user@onetel.net.uk" to your username (for ISPs other than onetel, this usually doesn't include the @host.net part), the linkname to the name you've chosen for the connection, and the phone number 08081401877 to the ISP's dialup number.
  5. If you're using PAP (and you probably are): add your password to /etc/ppp/pap-secrets as described in the pppd man page: here is an example for "user@onetel.net.uk" at OneTel:
    # Secrets for authentication using PAP
    # client   server      secret                  IP addresses
    user@onetel.net.uk  onetel   marmite 
    (You can leave the IP addresses section blank, because the ISP isn't authenticating to you).
  6. If you're not sure if you're using CHAP or PAP you can add "debug" to the pppd options (for example, in /etc/ppp/peers/$(CONNECTION NAME)) to see what the server asks for, or cover your bets by symlinking pap-secrets to chap-secrets, so you can use either.
  7. If you're logging in with a custom chat script instead of using PAP/CHAP, you must give /etc/ppp/dial the name of that chat script as its third argument in the /etc/peers/isp-name file. The first two arguments are passed to the script as -T and -U respectively.
    Warning: the output from your script is logged, first to a file in /tmp with mode 600, and then to the system log file, /var/log/ppp/chat-log (filename in /etc/ppp/dial). You might like to turn off echoing when sending your password.
  8. If you want to calculate call costs, create a script in /etc/ppp/cost/$(CONNECTION NAME) or make a sym link from a generic one. The cost calculating program should take two unix times (integer number of seconds since first of 1970, time_t datatype in C) as arguments and output a string representing the cost to stdout. (See /etc/ppp/ppp-connect for filenames, /etc/ppp/internal-cleanup for the actual call, and look in /etc/ppp/cost for examples).
  9. I think that's it. Type /etc/ppp/ppp-connect $(CONNECTION NAME) to connect. Your terminal will not be released, however: press control-c in it to disconnect, or run /etc/ppp/ppp-disconnect from elsewhere. Details of connection cost, etc. will then be displayed.

Final polish

Here's a connect script to put in your path that pops up a new rxvt under X.

You can make a symlink, /etc/ppp/peers/default, to your preferred connection in /etc/ppp/peers so you don't have to give an argument to ppp-connect.

Nameservers

Do you want to run a local named (DNS server) or use the two your ISP probably gives you when the connection comes up?

For option one, make change the dns script to use dns-named-up and dns-named-down. For resolv.conf fiddling, do the same for dns-resolvconf-up and dns-resolvconf-down (default).

Automatically adjusting resolv.conf

The advantage of this method is obviously that you need not run a named daemon.

If you have special nameserver needs, you can make a directory /etc/ppp/peers-resolv.conf/ (see /etc/ppp/dns-resolvconf-up) with resolv.confs for your various connections. For example, a resolv.conf for onetel would be called /etc/ppp/peers-resolv.conf/onetel, and is copied to /etc/resolv.conf when you connect to onetel. Any nameservers onetel gives us are prepended to the file.

If there is no /etc/ppp/peers-resolv.conf/$(CONNECTION NAME) then /etc/ppp/peers-resolv.conf/template is used. If that too does not exist, if the ISP gives nameservers they are put in /etc/resolv.conf and all the search and domain entries are carried over, otherwise /etc/resolv.conf is unmodified.

Running BIND (named)

The advantages of this method are that you're not reliant on mis-configured ISP nameservers and you get a system wide DNS cache, so if one program makes a look up, it's available to all others. It is possible to have named query your ISP's DNS caches, but doesn't seem to result in much of speedup for me, therefore it isn't setup by default.

Here's my /etc/named.conf

options {
        directory "/var/named";
	listen-on { 127.0.0.1; };
	allow-query { localhost; };
	allow-transfer { localhost; };
	allow-recursion { localhost; };

	interface-interval 0;
	dump-file "/var/spool/named-state.db";
};

zone "localhost" {
        type master;
        file "private/localhost";
};
zone "0.0.127.in-addr.arpa" {
        type master;
	notify no;
        file "private/127.0.0";
};
zone "." {
        type hint;
        file "root.cache";
};
    

/etc/named.boot points to /var/spool/named-state.db (I hope this means the saved state of the previous session is loaded when named is started, see /etc/ppp/dns-named-down). Note that this file must probably be writable by daemon.daemon, which is the personality named is set to run at in (/etc/ppp/dns-named-up).

Note that the files in /var/named you will have to setup yourself. See the BIND distribution.

Boost that surfing speed!

  1. Set your modem to insane baud:
     
    setserial /dev/modem spd_cust baud_base 460800 divisor 2
    	
    This is the speed at which your computer connects to the modem. It ensures that when modem compression is doing its stuff it isn't slowed up here.
  2. modprobe the ppp_deflate and bsd_comp kernel modules (or enable kernel module autoloading at config time). If your ISP supports them, they'll be used. If so, it's probably a good idea to disable modem compression (see modem-init.chatscript).

Trouble shooting

Slow connection upstream to ISP

Some moronic sysadmins or more usually moronic managers decide to disable all ICMP packets to put a stop to ping flooding. Unfortunately, ICMP isn't just used for pinging (ICMP ECHO) but for a variety of things, including a way of finding out the biggest packet you're able to send down a certain route without fragmenting. To stop trying to do this: (horrible "workaround")

echo 1 > /proc/sys/net/ipv4/ip_no_pmtu_disc
    

Try: man chat, man pppd, man setserial. Read: docs in pppd distribution, PPP-HOWTO, ISP-Hookup-HOWTO, Modem-HOWTO, Serial-HOWTO, NET3-4-HOWTO.

Don't have any problems here. Send me yours.