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 ModemAttach 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 kudzuKudzu 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
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 ServiceMgetty 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.
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 OptionsWhen 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.
ms-dns 18.104.22.168 #replace 22.214.171.124 with DNS address Primary
ms-dns 126.96.36.199 #replace 188.8.131.52 with DNS address Slave
netmask 255.255.255.0 #The netmask of the LAN the server is connected to
Add Users To pap-secretsIn 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.
Client (User) Server Secret (password) IP
billy * billy123 *
bob * abc123 *
Or to select all users:
* * "" *
Create Linux UsersNow, 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 RoutingWe now want Linux to be a router and allow packets to flow through it. This is called packet forwarding.
Add The following or change the existing entry
net.ipv4.ip_forward = 1
Comit the change
sysctl -e -p /etc/sysctl.conf
Start MgettyTell the init to re-read its config file (/etc/inittab) and start up mgetty on the modems.
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