Setting up Dial-On-Demand with Linux-Mandrake 7.x

In my quest to ease the pain of going from my Win95 box to the Linux machine, I wanted to set up the PPP section so that everytime I ran Netscape (or any other program that would need to go out on the web), the computer would automatically dial out and connect to my ISP, just like Win95 does.  I finally managed to accomplish this feat, but it took reading a couple HOWTOs, with a few other people pointing me in the right direction.  

One of my pet peeves with Linux and its documentation is the real lack of practical examples.  Stuff like this should be built-in, but is not.  Anyway, hopefully this page will give you the practical examples necessary to make this whole thing work, and work well.  This was done specifically on a machine running Linux Mandrake 7.1, but should apply to any recent distribution that has the new PPPd with demand dialing.

The first step is to get PPP working.  If you want to do things the graphical way, use LINUXCONF and edit PPP in the network section.  Enter in your username and password, and the number to dial.  Next, you need to put in a DNS server or two in the file /etc/ppp/resolv.conf.  It seems that sometimes this may not be picked up by the PPP negotiations, and if you have no DNS happening, you will connect, but not be able to enter in any web site names.  Usually, it's best to contact your ISP and use the DNS servers they have, as they are the closest to you, and should give you the quickest service.  Below is listed my file, which will work for anyone (but may not be as quick, because it may take a long time to reach these servers from your ISP).

This should be the contents of your /etc/resolv.conf:


(Replace the IP numbers with your local ISP's DNS servers)

Ok, now that we have that in place, go to a console as root and type in:

cp /etc/resolv.conf /etc/ppp/resolv.conf

This makes a copy of our file in the /etc/ppp directory.  Now type in the following:

ifup ppp0

The sucker should dial out, and connect.  If not, then it's time to go back into linuxconf and verify your settings.  There may be some problems with the scripts in /etc/ppp - check it out.  This part worked for me the first time - hopefully it did for you also.  Now, nuke it by:

ifdown ppp0

Now let's get to setting it up to dial on demand!

First, we need to determine if your ISP goes directly into PPP and does PAP authentication, or whether they do text authentication.  The best way to figure this out is to fire up a terminal program and dial manually into the ISP.  In Linux, you can use a program called minicom.  In Windows, you can use Hyper Term.  At this point we are just looking to see what happens when you connect, so don't worry about the details of baud rate, etc... Just dial the number, and watch your screen. 

If you get a Username (and then password) prompt, you are doing text authentication.   If you just see a bunch of special characters coming through in little spurts, it is going for PPP right away.  Write down the exact text prompts you see, and go ahead and enter in your username and password for grins.  It should say something about "Starting PPP".  You may now disconnect.  If this doesn't work, check with your ISP for the syntax of the username... sometimes it should just be "username", other times it may be "".

CD to /etc/ppp, and use your favorite editor to create a file called chat-isp.  (I use PICO, which is included in the PINE package.  A more powerful, yet not to obscure editor is Joe's Editor, which is called by JOE <filename>.)

This should be the contents of the file /etc/ppp/chat-isp:

ABORT "Username/Password Incorrect"
"" "at"
OK "atz&d2&c1&k3"
OK "atdt5551234"

If your ISP goes directly to PPP, this is all you need.  If it does text authentication, then continue on with the following:

"name:" "^Uusername"
"word:" "\qpassword"

There are obviously a few things that need to be tweaked in this file.  The first is your modem's init string.  Second, the ISP's phone number.  Lastly, your username and password (for text authentication).  Let's look at those specific lines:

OK "atz&d2&c1&k3" <--- Resets modem - put init strings here
OK "atdt5551234" <-- Put your ISP’s telephone number here
"name:" "^Uusername" <-- Username goes here after the ^U
"word:" "\qpassword" <-- Password goes here after the \q

Note that this assumes your ISP's modem answers, and gives a prompt "Username:".  Your ISP may be different, and use something like "LOGIN:".  If this is the case, then you will need to modify the script, or it will never work.  Remember in one of the first steps, you used a term program to call the ISP manually.  What were the login prompts?  You need to enter the trailing text here so pppd knows what to look for, and then enter the appropriate response.   My ISP replies with "Starting PPP...", so the last line of the script looks for the letters "PPP" in that message.  Modify it if your ISP says something different.

Now, let's edit another file that probably already exists.  It is named "options".

This should be your /etc/ppp/options file:

bsdcomp 15
holdoff 12
idle 300

The "noauth" gets rid of the "Peer is not authorized" messages that plagued me for quite a while.  However!  Your ISP may require authentication, especially if it is not done in text mode.  If they are using PPP authentication, then remove the "noauth".

The is the default "hook" gateway the system uses to call up the demand dialing.  This IP gets changed to your ISP's IP when you connect, so it is just a bogus number that hopefully won't get in the way of any of your existing networks.

The "holdoff 12" sets the time between dialing attempts to 12 seconds.   The "idle 300" sets the idle inactivity timer to drop the connection after 5 minutes, which is 300 seconds.  Modify as necessary.

If you are dialing into a Windows NT server, you will need to add two more lines:

name "workgroup\\username"
remote-name "servername"

This helps the authentication handshake with the appropriate values.

Ok, the next step is to create a directory called "peers" inside your /etc/ppp directory, and CD to it.  At a console prompt, type:

md peers

cd peers

Now use your favorite editor, and create a file called "isp".

This should be your /etc/ppp/peers/isp:

ttyS1 115200 crtscts
connect '/usr/sbin/chat -v -f /etc/ppp/chat-isp'

Line 1 of this script defines the serial port your modem is connected to.  In this case, it is COM2, which is ttyS1 in Linux-speak.  If your modem is on COM1, then it would be ttyS0.  COM4 I believe would be ttyS3.  Next, we have the default baud rate.  Most modems now can handle full 115k.  If you have a old modem, or one without a 16550 UART, then you may want to back this down to 38400 or so.  The "crtscts" tells it to use hardware flow control.  This is a good idea for the majority of modems, and was turned on in the sample init string in the previous file.

If your ISP is using PPP for authentication, you need to mess with one more file: /etc/ppp/chap-secrets  or /etc/ppp/pap-secrets.  For example, I've got a linux box that has to dial in to a Windows 2000 machine.  It uses CHAP authentication over PPP.  So my chap-secrets file contains this:

# Secrets for authentication using CHAP
# client          server       secret    IP addresses
domain\\username  servername  password

Note that each field is actually separated by tabs, and there is nothing entered in the fourth column for IP address.  Replace domain, username, servername, and password with the appropriate fields.

You're just about done!  In fact, you can go ahead and try it now by entering in:

pppd call isp

Now try this:


...And you should hear it dial out.  Note that you may want to add in "M1L2" at the end of the modem's init string to turn on the modem speaker so you can hear when it goes to dial.  To stop the daemon, type this in:

killall pppd

If it doesn't work, take a look at your /var/log/messages file, and see what's going on.  If this file is too big, you can always use the tail command to see the last few lines like so:

tail /var/log/messages

It may take a little debugging, especially if your ISP is doing some funky stuff.  

Ok, now the last part is to make this process start up automatically whenever you boot.   Use your favorite editor to edit the file /etc/rc.d/rc.local      Go to the very bottom of the file, and add in:

pppd call isp

Save it out, and you're done!  Next time you boot, you'll have dial-on-demand working, hopefully!

I tried to make this as clear as possible.  You should be able to cut and paste in the sample files here with no problems (and no added tabs, spaces, etc...).  If you have any comments or suggestions, feel free to contact me.

Bob Puff   Version 10/01/01    Hit Counter

Another site with great docs and links is


07/10/00, From Gene Zesch, on the Mandrake Expert list:

Excellent set of instructions.
As for as a quick check of modem traffic, I suggest kmodem which will
dock a little flashing icon on the taskbar just like in that GUI for
DOS. Get it from

I've found it works well in Mandrake.


07/10/00, From Civileme, on the Mandrake Expert list:

<Scratches head> Did someone change kpppload? I used to run
it to see the load all the time WITHOUT using Kppp to set up
the modem.

KNETLoad also can be set to view the ppp interface. and parks
neatly on the panel


Some people have reported having problems connecting to systems that do not respond with text prompts.  Here is a suggestion from the Mandrake list from Dennis Robertson.  It appears to be basically equivalent to the procedure described above, only removing the parts from the chat-isp script that look for the specific prompts.   Further experimentation will be done - this is a work in progress!

Bob and List,

I had similar problems to the above but the how-to helped clarify the thinking
in our LUG. Our guru, Marco Grigull, came up with the following how-to which
works on all systems here. It is based on using PAP.

Open Linuxconf -> Networking -> PPP/SLIP/PLIP
Click add.
On the Hardware tab verify modem settings and enter the following PPP Options:
ipcp-accept-local ipcp-accept-remote noauth demand idle 300(or whatever).
On the Communication tab enter the phone number to dial. Delete all entries under Chat in the Expect and Send rows.
On the Networking tab check Activate at boot time. Uncheck Restart link when connection fails(optional). Enter:
Local IP address:
Remote IP address:
On the PAP tab enter username and password.
Accept and quit all the way out of Linuxconf.
In a term type: ifup ppp0 & (or 1 or whatever).
Dial on Demand is running.

Now, in Mutt, when I hit y to send I will get an automatic connection.

Another user reported a problem of not having the machine dial out when he first started the pppd daemon.  Here is Sean Middleditch's 07/13/00 response:

Um, no. This is dail-on demand. It SHOULDN'T do anything. The pppd daemon should just run in the background.  You can check this with:
ps -ax | grep pppd
If it's not there, THEN you have a problem. Otherwise, try to ping an external server (like ping,
and the connection will be brought up. If not, you then have a problem. The connection will be brought down if the link is idle for the specified amount of time.

BTW, as a note, for those of you that want to be able to bring down the link at any time:
Go grab the latest pppd (search on freshmeat), and install the daemon binary from that. Then, change the holdoff line in
/etc/ppp/options to 0. Now, if you send a SIGHUP to pppd, it will close the link, but leave the line up. If holdoff isn't 0, it will dial back in, however (SIGHUP actually means close the link, then reconnect). For some reason, the version of pppd that came with Mandrake 7.1 (2.3.11) will misbehave if you set holdoff to 0 (i.e., it waits about 5 minutes then dials in: why, I don't know). This is nice for those of you that need a way to quickly close the connection, but want to leave the daemon running. I'd suggest a simple setuid root app that signals pppd, and then set its group to pppusers and its permission to 750. That makes life even easier. ^,^

Here is a message posted to the Linux-Mandrake list from Balaji Ramani on 11/22/00:
I had pppd working in 7.1. Never tried it on 7.2 as I moved to DSL. But
here are the necessary file that I used. Hope it helps you.

The timeout for the chat script is given by the line TIMEOUT <value>.
Initially we use a timeout of 3 seconds and later switch to a 45 seconds
timeout for the modem to connect to the other end.

--- cut here ---
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.

exec /usr/sbin/chat -v \
ABORT '\nBUSY\r' \
'' \rAT \
'OK-+++\c-OK' ATZ \
--- cut here ---

--- cut here ---
--- cut here ---

--- cut here ---
# Secrets for authentication using PAP
# client server secret IP addresses
--- cut here ---

--- cut here ---
# Script to initiate a ppp connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
# These are the parameters. Change as needed.
TELEPHONE=555-1212 # The telephone number for the connection

NETMASK= # The proper netmask if needed
# Export them so that they will be available at 'ppp-on-dialer' time.
# This is the location of the script which dials the phone and logs
# in. Please use the absolute file name as the $PATH variable is not
# used on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)
# Initiate the connection
# I put most of the common options on this command. Please, don't
# forget the 'lock' option or some programs such as mgetty will not
# work. The asyncmap and escape will permit the PPP link to work with
# a telnet or rlogin connection. You are welcome to make any changes
# as desired. Don't use the 'defaultroute' option if you currently
# have a default route to an ethernet gateway.
exec /usr/sbin/pppd debug lock -chap modem crtscts /dev/modem 115200 \
netmask $NETMASK defaultroute connect $DIALER_SCRIPT
--- cut here ---