[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

"Linux Gazette...making Linux just a little more fun!"

Setting Up a Linux-based PPP Callback server

By Sunil Thomas Thonikuzhiyil


In a PPP dialin server setup, users dial in through a telephone line and modem to establish a PPP connection with a remote server. It is possible to make a Linux box call back the user who dialed the server. This document describes the step-by-step procedure to set up a Linux-based callback server.


My server runs Debian Potato with kernel 2.4.17. A modem attached to ttyS0 serves as the dial in and callback modem. My client machine runs both Debian Potato and Win98. An external modem is attached to ttyS1. It is assumed that you have installed minimum software needed to dial out to an ISP on both server and client. In addition to this you have to install mgetty+sendfax package on the server.

The idea

The principle behind a callback server may be summarized as follows. First I (the client) dial the telephone number of my callback server's modem. The modem on the server is configured to accept incoming connections. Once the connection is established, the server prompts me back with a welcome message and a login prompt. I login as a special callback user. The modem on the server drops the connection and dials back a specified number attached to my client machine. The modem on my client machine is kept ready to accept the callback connection, and once the connection is established I am again prompted with a login prompt. Now I log in as a normal PPP user and the connection is completed.

Configuring the dialin Server

The first step to achieve the above setup is to configure your server to accept incoming PPP connection.

Here is what I did on the server

1) Create a new user called pppuser

Change the /etc/passwd entry for pppuser to

2) Add a line to your /etc/inittab so that serial port can accept incoming connection.

T0:23:respawn:/sbin/mgetty ttyS0 -D /dev/ttyS0

Restart init by typing 'init q'
This enables the ttyS0 line to accept incoming connections

3) Change directory to /etc/mgetty (This is where configuration files for mgetty is kept. On Redhat distributions it is at /etc/mgetty+sendfax)
Edit login.config and add the following line to it

/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/options

Comment out all other lines

4) Change /etc/ppp/options to the following

	 asyncmap 0
	 ms-dns #put your dns server ip here

5) Create a file options.ttyS0 in /etc/ppp with following content

The two ip addresses above are the address of your server and the address the client should receive from server. Change them according to your IP numbering scheme. If your modem is connected to ttyS1 name the above file as options.ttyS1

6) Change permission of pppd (on some distributions pppd is already suid)
chmod u+s /usr/sbin/pppd

7) Add an alias for ppp

Add the following lines to /etc/profile

 alias ppp=`/usr/sbin/pppd -detach'`

Now try dialing to the server from a client. For this if you are using MS windows, click dial up networking and then select new connection and fill out various fields. Login as pppuser and verify whether your dialin server is working perfectly. Check the connection by pinging the server from client. Also you can verify the ip address assigned to client by typing winipcfg on command prompt.

Configuring callback

Once the dialin server is ready, configuring callback is quite easy

Here is what I did.

1) Create a new user named back.

2) Create an empty file named callback.conf in /ete/mgetty/ . (You can add init strings for your modem in this file if needed. But generally an empty file will do)

3) Add the following line to /ete/mgetty/login.config.

back - - /usr/sbin/callback -S 2561

The number on the above line after -S is the number to be called back. Change it to the phone number attached to your client.

Configuring clients

1) MS Windows 98

Open dialup networking and start a new connection. Fill out the various fields. Right click on the newly-created icon and select properties. Select modem-> Configure->connection->Advanced options.
Add &c0s0=1 to Extra settings
Select options and tick the checkbox to bring the terminal window after dialing.

You can leave the user name and password field empty.

Now start dialing the server. Once the dialing is over a terminal screen will popup and you will be presented with a login screen from the server.

Login as 'back' (the special callback user).

Now the server side modem cuts off the connection, wait for a few seconds and will call you back . Once the callback connection is established you will again be prompted with login prompt. Type login name as pppuser and enter password. Press continue on the terminal screen . Now you will be logged in. Again check your connection by pinging the server.

It is possible to write a script for this but I have not tried it yet. For other versions of Windows the procedure is similar. The important thing to setup is the modem init string ( &c0s0=1)

2) Linux

Configuring Linux client is little more trickier. Here is what I did on my Debian machine running kernel 2.4.17

1) Create /etc/options file with following content

	asyncmap 0

2) Create a file called pppcalback in /etc/ppp/peers/ with following content

    ttyS1 19200 crtscts
    connect '/usr/sbin/chat -v -f /etc/ppp/chat-callback'

3) Create a file called /etc/ppp/chat-callback with following content

	"" ATZ
	OK ATDT2562             # Telephone number of server
	ogin: \q\dback
	ogin: \q\dpppuser
	assword: \q\dpasswordforppuser

Properly change the lines above to reflect login names and passwords for the accounts you have created.(Also refer to your modem's documentation for necessary init strings. May be you will have to replace ATZ with some thing like AT&FX2)

4) Create a script called /usr/bin/pppcall with following contents

   /usr/sbin/pppd -detach call pppcall &

Make this script executable
Now you can dial the server by calling the script pppcall

Related Information

The following documents helped me to figure it out
1) Callback mini howto
2 Linux callback
3) Man pages of pppd
4) Mgetty+Sendfax Archive/Documentation

If you find any problems in setting up callback servers don't hesitate drop me a mail. Comments and suggestions for improvement of this document are most welcome.

Sunil Thomas Thonikuzhiyil

I work as consultant information technology at the Kerala Legislative Assembly Trivandrum India. I have been hooked on Linux since 1996. I have a Masters in Computer Science from Cochin University. I am interested in all sorts of operating systems. In my free time I love to listen to Indian classical music.

Copyright © 2002, Sunil Thomas Thonikuzhiyil.
Copying license
Published in Issue 77 of Linux Gazette, April 2002

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]