Setting Up a PPP Server
Setting Up a PPP Server
The preceding sections describe how your Linux PC can establish a PPP link with another system that offers PPP service. After a PPP link is set up, both ends of the PPP link behave as peers. Before a PPP link is established, you can think of the end that initiates the dial-up connection as the client because that system asks for the connection. The other end provides the PPP connection when needed, so it's the PPP server.
If you want to enable other people to connect to your Linux PC by using PPP over a dial-up modem, log in as root and perform these steps:
-
Search through the CD-ROMs to locate the
mgettyRPM. Insert each CD-ROM and mount using themount /dev/cdromcommand (or, if you are running GNOME, wait for themagicdevprocess to mount the CD). Then type the following commands to see if the CD contains themgettyRPM file:cd /mnt/cdrom/RedHat/RPMS ls -l mgetty*.rpm
-
After you find the
mgettyRPM, install it with the following command:rpm -ivh mgetty*.rpm
-
At the end of the
/etc/mgetty+sendfax/mgetty.configfile, add the following lines for the serial port connected to a modem for dial-in users (this example assumes that the modem is connected to the second serial port, COM2):# For US Robotics Sportster 56K with speaker off port ttyS1 init-chat "" ATZ OK AT&F1M0E1Q0S0=0 OK answer-chat "" ATA CONNECT \c \r
The AT&F1 modem command sets hardware flow-control mode on many modems. For other modems use appropriate initializations in the init-chat line. Note that the serial port device names may change depending on your serial communications hardware (for example, multiport serial boards would have their own device names).
-
Edit the text file
/etc/mgetty+sendfax/login.configand search for the line that starts with/AutoPPP/. Uncomment it by deleting the#character at the beginning of the line. Edit the line so that it looks like this:/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/options
As the last part of that line shows, automatic PPP startup involves running pppd with the options listed in the file
/etc/ppp/options. -
Edit the file
/etc/ppp/optionsand make sure that it contains the following lines:asyncmap 0 auth crtscts -detach lock login modem ms-dns 192.168.0.1 #put the IP address of the DNS server here proxyarp refuse-chap require-pap
Here is what these options mean:
-
asyncmap 0-Causes pppd not to set up and use escape control sequences
-
auth-Causes pppd to require the peer to authenticate itself
-
crtscts-Causes pppd to use hardware flow control
-
-detach-Causes pppd not to become a background process (which pppd will do if a serial device is specified)
-
lock-Creates a lock file so that pppd can have exclusive access to the particular modem
-
login-Causes pppd to use the system password file to authenticate the peer using PAP
-
ms-dns DNS_IP-Specifies the IP address of the name server that pppd can send to the system that dials in
-
proxyarp-Causes the other end of the PPP connection to appear as if it is on the LAN with this system
-
refuse-chap-Causes pppd to not use CHAP for authentication
-
require-pap-Causes pppd to use PAP for authentication
-
-
Open the
/etc/ppp/pap-secretsfile in a text editor and locate the following lines:# Secrets for authentication using PAP # client server secret IP addresses Then add the following line just below these two lines: * * "" *That basically says that pppd won't use any secrets (because it uses the system password file instead).
-
To set up a specific IP address for each serial port, create a file for that serial port with the name
/etc/ppp/options.ttyXXwherettyXXis the serial port device name. In that file list the local IP address and the remote end's IP address, separated by a colon. For example, if for thettyS1serial port, the local IP address is 192.168.0.100, and the remote IP address is 192.168.0.200, then add the following line to the file/etc/ppp/options.ttyS1:192.168.0.100:192.168.0.200
-
Open the
/etc/inittabfile in a text editor and add a line of the following form (this example assumes that the modem is on the second serial port,ttyS1):s1:235:respawn:/sbin/mgetty -D -x 3 ttyS1
The
-Doption tellsmgettyto treat the modem as a data modem, not fax. The-x 3option turns on logging-the log file is/tmp/log_mg.ttyS1(for modem device/dev/ttyS1). -
Connect the modems to the serial ports, turn them on, and then make init reload the
/etc/inittabfile (thereby running themgettycommand) with the following command:init q
Now, you can test this PPP server setup by dialing in from another PC. You will need to have your CentOS Linux system connected to a modem, that, in turn, is connected to the phone line. You should turn on the modem, then you or a friend can dial in to that modem and establish a PPP connection using the user name and password of any existing user on the CentOS Linux system.