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:
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:
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 "firstname.lastname@example.org".
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:
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:
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 192.168.255.250 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:
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:
Now use your favorite editor, and create a file called "isp".
This should be your /etc/ppp/peers/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:
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:
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
Another site with great docs and links is http://www.theory.physics.ubc.ca/ppp-linux.html
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
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
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: 10.0.0.1
Remote IP address: 10.0.0.2
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: