Using a Linux Box as A Dial Up Server

This will essentially turn your computer into a dial up service provider. Follow the steps below, for this install I will be using centos as the distribution but any distribution should do fine.

Attach A Modem

Attach a modem to COM 1 or COM 2. If you have an internal modem, you need to know what COM port it is. You could just activate all the COM ports and see later which one works by viewing the /var/log/messages file. Then turn off the other 3.

Run kudzu

Kudzu is the Linux hardware auto detection that usually runs at boot time. You may reboot the computer or else just type:


Hopefully, kudzu will detect your modem and configure it automatically.

Configure Modem For mgetty

Mgetty is the program that allows you to login after the modems connect. It is activated in the /etc/inittab file. Use vi to add a line after the mingetty lines (halfway into the file).

Physical Port Linux Port /etc/inittab line for turning on mgetty
COM 1 ttyS0
COM 2 ttyS1
COM 3 ttyS2
COM 4 ttyS3

vi /etc/inittab

A sample file will look like

S0:2345:respawn:/sbin/mgetty -D ttyS0
S1:2345:respawn:/sbin/mgetty -D ttyS1
S2:2345:respawn:/sbin/mgetty -D ttyS2
S3:2345:respawn:/sbin/mgetty -D ttyS3

The -D means data only, no fax machines are allowed to connect. The baud rate is automatic. I hope your modem can handle that.

Turn On PPP Dial In Service

Mgetty by default will not invoke PPP, it is commented out in the /etc/mgetty+sendfax/login.config file. We need this service so IP packets can flow across the dial-in connection.

vi /etc/mgetty+sendfax/login.config

Look for a line similiar to:

#/AutoPPP/ - a_ppp /usr/sbin/pppd auth -chap +pap login debug

Change that line so that it reads

/AutoPPP/ - a_ppp /usr/sbin/pppd auth -chap +pap login debug

and remove the first character, the # and save the file. Notice the "debug" option on that line. This logs useful information in /var/log/messages that we will look at later. Also, the "login" option means to authenticate with the /etc/passwd file after "pap" authentication (described below).

Setup PPP Options

When PPP starts up, it reads options from the command line from /etc/mgetty+sendfax/login.config. Then it read more options from the /etc/ppp directory. We will create a new file called options.server where we will put generic options for all modems that dial in. Then we will have an options file for each modem where we can put the IP address we will assign anyone on that modem. That file will be named options.ttyS0 or options.ttyS1.

vi /etc/ppp/options.server

asyncmap 0
ms-dns #replace with DNS address Primary
ms-dns #replace with DNS address Slave

vi /etc/ppp/options.ttyS0 #serverAddress:clientAdress
netmask #The netmask of the LAN the server is connected to

Add Users To pap-secrets

In order to allow dial in, you will have to define users and passwords to authenticate them with. PPP will authenticate them. First, we must add users and passwords to the /etc/ppp/pap-secrets file.

vi /etc/ppp/pap-secrets

Client (User) Server Secret (password) IP
billy * billy123 *
bob * abc123 *

Or to select all users:
* * "" *

Create Linux Users

Now, create some regular linux users that correspond to the /etc/ppp/pap-secrets file. Use the same password that has been entered in that file. If you do not want to do this step then you must remove the "login" option from the command line of ppp kept in /etc/mgetty+sendfax/login.config.

Turn On Routing

We now want Linux to be a router and allow packets to flow through it. This is called packet forwarding.

vi /etc/sysctl.conf

Add The following or change the existing entry

net.ipv4.ip_forward = 1

Comit the change

sysctl -e -p /etc/sysctl.conf

Start Mgetty

Tell the init to re-read its config file (/etc/inittab) and start up mgetty on the modems.

/sbin/telinit q

Your done....have somone dial in...if things dont go as planned have a peek in /var/log/messages for any errors that might have come up and when push comes to shove, google is your friend