PPPD Demand Dialing mini-HOWTO Bruce W. Smith, v1.4, 11 Aug 2000 This document describes how to configure demand dialing using only standard pppd-2.3.11 and a 2.2 kernel. No "diald" software is required. This information is from my experiences setting up pppd demand dialing on a stock Redhat 6.2 system with kernels 2.2.16-3 and pppd 2.3.11-4. This document assumes the following: o You have a reasonably current 2.2.x kernel. o You have a current pppd version and a working dialup connection to an ISP with a dynamic IP address USING the NATIVE "pppd" COMMAND. Shortcuts like KDE's kppp and Gnome's dialer DO NOT COUNT. You MUST be able to connect to your ISP by typing the command "pppd". Documentation on this is covered elsewhere in HOWTO documentation. o You have a working Ethernet LAN installed with IP MASQUERADING. (this may work with the localhost address, but I haven't tried it) o You can do some basic editing of configuration files. o You are backed up and won't sue me if something goes wrong. Make sure all of the above is true BEFORE you attempt demand dialing. ______________________________________________________________________ Step 1. Configuring your kernel. Kernel versions 2.2.2 or later do not require any special patches. Remember that your kernel requires pppd and IP-Masq. support, but you already have that in your kernel because you have both working already or you shouldn't be reading this far yet! The stock Redhat 6.2 kernel works fine without modification. 2.0 kernels require a patch which is no longer required in this documentation. Upgrade! ______________________________________________________________________ Step 2. Configuring pppd. Add the following lines in the file: /etc/conf.modules. alias ppp-compress-21 bsd_comp alias ppp-compress-24 ppp_deflate alias ppp-compress-26 ppp_deflate You need to pass pppd some new options. In my setup, I added these lines to /etc/ppp/options: demand idle 600 ipcp-accept-remote ipcp-accept-local holdoff 10 "demand" means to dial on demand. When you start pppd with this option, it goes to the background as a daemon and does not dial immediately unless a program is trying to access the internet. "idle 600" means to disconnect and hang up the phone line after 600 seconds (10 minutes) of inactivity. You can change the "600" to suit your needs, but start out with a small number so you can verify it works. The "ipcp-accept-*" lines allow the ISP to assign you a dynamic IP address no matter what you tell in the config file or command line. "holdoff 10" will make the pppd daemon wait 10 seconds before it tries to re-initiate the link after it terminates. It does not apply if the lines drops because it was idle. You can adjust the delay to your liking, or leave it out completely. You need to issue the following command as root: echo 1 > /proc/sys/net/ipv4/ip_dynaddr Which saves the first outgoing packets until the dialup link is connected and your dynamic IP is assigned. Otherwise you may get program errors when first connecting. ______________________________________________________________________ Step 3. Starting pppd. Then you have to start pppd with the *LOCAL* Ethernet LAN IP number. So if your Ethernet card has the IP address "192.168.1.1", start pppd under root with the following command: pppd :192.168.1.1 Or you can add the following line to your /etc/ppp/options: 192.168.1.1:192.168.1.1 Start "pppd" without any options. (or with the options you normally supply to pppd) You may be able to make this to work with the IP address 127.0.0.1 (the localhost loopback address) on a system without an ethernet card, but I haven't tried it. If anyone tries this, please let me know your results and I will update this mini-howto. The default route has to be set to ppp0 after pppd is running. This did not work by default for me, so I ran the following 2 commands: route del default route add default ppp0 These commands can be put into a script to start pppd, or appended to the end of /etc/rc.d/rc.local commands to start pppd upon boot: echo 1 > /proc/sys/net/ipv4/ip_dynaddr pppd :192.168.1.1 sleep 3 route del default route add default ppp0 You can now start a program which tries to access the internet and see if your modem dials and connects automatically. Check /var/log/messages for debugging information. Good luck! ______________________________________________________________________ Additional Notes: (thanks to Adam Williams) Some ISP's are lax about sending the ipcp message neccesary to reconfigure the ppp interface when demand dialing is used. PPP version earlier than 2.3.9 did not allow a "demand" option and a "noipdefault" option to be in the same options file. Thus PPP would recommend to the ISP that it should keep it's current IP address, and some ISP's would ignore this and leave it with the incorrect local IP address, resulting in a broken routing table. With 2.3.9 both "demand" and "noipdefault" can be included in the options file, and with that configuration PPP will not make a recommendation about what it's IP address should be, but will blindly accept the ISP's assignment, resulting in a more reliable connection. Both tar packs and RPMS of PPPD can be downloaded from the official PPPD FTP server: ftp://cs.anu.edu.au/pub/software/ppp/