DISCLAIMER:
This worked for me. Your mileage may vary!
OBJECTIVES:
To install PPP and POP/IMAP services on a Red Hat Linux 5.1 server for
dial-in users.
TOOLS:
Red Hat Linux 5.1 CDs
ASSUMPTIONS:
You have a PC with basic installation of Red Hat Linux 5.1 with
a Linux kernel that supports IP forwarding.
STEP 1: Install "mgetty" (if not yet installed) from Red Hat 5.1 CD #1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# mount -t iso9660 /dev/hdb /mnt/cdrom(It is assumed that your CD-ROM drive is device /dev/hdb, if not change it accordingly)
# cd /mnt/cdrom/RedHat/RPMS
# rpm -Uvh mgetty*This will install mgetty and all its cousins, but who cares!! If you hate extended family, have your way and replace "mgetty*" with "mgetty-1.1.14-2.i386.rpm".
# For US Robotics Sportster 28.8 with speaker off port ttyS1 init-chat "" ATZ OK AT&F1M0E1Q0S0=0 OK answer-chat "" ATA CONNECT \c \r # For Practical Peripheral 14.4 with fax disabled and prolonged # carrier wait time (90 sec) port ttyC15 init-chat "" ATZ OK AT&F1M0E1Q0S0=0S7=90+FCLASS=0 OK answer-chat "" ATA CONNECT \c \rNotes:
/AutoPPP/ - a_ppp /etc/ppp/ppploginIf you wish to have users' login names (rather than "a_ppp") to appear in the /var/run/utmp and /var/log/wtmp log files, then the above line should be:
/AutoPPP/ - - /etc/ppp/ppplogin
7:2345:respawn:/sbin/mgetty -x 3 ttyS1 8:2345:respawn:/sbin/mgetty -x 3 ttyC15[the first number (7,8) is arbitrary (in fact I have seen in some cases "s1", "s2", etc, used instead). Just give a different number for each port. And why not you go by the order!!? Me wonders!]
# init qNOTE: If you spawn "mgetty" on a serial port with no modem connected to it, or the modem is not switched ON, you'll get lots of error messages in "/var/log/messages" or/and in the other mgetty ("/var/log/log_mg.ttyXX") log files. In fact those error messages may continuosly pop up on your screen. Quite annoying, eh? To avoid this annoyance, each serial port that has no modem connected to it should have its corresponding lines commented out in /etc/inittab and in /etc/mgetty+sendfax/mgetty.config files.
STEP 2: Install PPP (if not installed) from Red Hat 5.1 CD #1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# rpm -Uvh /mnt/cdrom/RedHat/RPMS/ppp*
-detach crtscts netmask 255.255.255.0 asyncmap 0 modem proxyarpNOTES:
#!/bin/sh mesg n stty -echo /usr/sbin/pppd silent auth -chap +pap loginMake the file executable using command:
# chmod +x /etc/ppp/ppploginNOTE: We're going to use PAP authentication BUT using the ordinary /etc/passwd password file. That's what "+pap login" means.
myhost:ppp01where "myhost" is the hostname of the PPP server - change it accordingly to the actual hostname of your Linux box. If you're more forgetful than you can REMEMBER to admit, remind yourself of the hostname of your server using the "hostname" command.
# hostnameThe word "ppp01" used above is just an arbitrarily chosen name for the virtual host associated with one of the PPP dial-in lines and its corresponding IP address as defined in /etc/hosts file (to be discussed later). In another /etc/ppp/options.ttyXX file, you may wish to type in the following line:
myhost:ppp02That is, here you define a different PPP hostname, "ppp02". Use a different hostname for each serial port. You can choose any names that your lil' old heart desires! They don't have to be ppp01, ppp02, ppp03, etc. They can be "junkie", "newbie", "noname", whatever!
# Secrets for authentication using PAP # client server secret IP addresses * * "" 10.0.0.3 * * "" 10.0.0.4This says: no PAP secrets (passwords) set for any client from anywhere in the world with the shown IP address. We don't need to use PAP secrets if we will be using /etc/passwd instead. If you are REALLY not paranoid, you can have just one following line that will serve all the IP addresses (yours and your neighbour's!):
# Secrets for authentication using PAP # client server secret IP addresses * * "" *
# chmod u+s /usr/sbin/pppd
10.0.0.3 ppp01 ppp01.mydomain.com 10.0.0.4 ppp02 ppp02.mydomain.comNOTE: Replace "mydomain.com" with the actual domain name of your PPP server. Just in case you're confused, I assume your PPP server is "myhost.mydomain.com".
STEP 3: Install POP/IMAP servers (if not installed) from Red Hat 5.1 CD #1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# rpm -Uvh /mnt/cdrom/RedHat/RPMS/imap*
# kill -HUP `cat /var/run/inetd.pid`
STEP 4: Enable IP fowarding
~~~~~~~~~~~~~~~~~~~~~~~~~~~
FORWARD_IPV4=yes
# echo "1" > /proc/net/ip_forwardor by rebooting the system.
STEP 5: Test the server
~~~~~~~~~~~~~~~~~~~~~~~
jodoe:tdgsHjBn/hkg.:509:509:John Doe:/home/jodoe:/bin/bash jadoe:t8j/MonJd9kxy:510:510:Jane Doe:/home/jadoe:/etc/ppp/ppploginIn this example, John Doe will have both PPP and shell access, while Jane Doe will only have PPP access. If you have just started to wonder how John Doe may have PPP access, the answer lies with the /AutoPPP/ configuration in "mgetty" - it does the magic. Any user that will dial in and talk PPP, mgetty will give him/her the /etc/ppp/ppplogin program.
So, if John Doe dials-in using Windows 95 dial-up adaptor which is set up to make a PPP connection, mgetty will give John Doe PPP access. If he dials in with any other communication software e.g HyperTerminal, (with no PPP negotiation) he will be given the normal login shell. This will never happen for Jane Doe. She will always be welcome by the "/etc/ppp/ppplogin" program.
In fact "mgetty" allows you to use the same modem lines for various protocols. For example, your UUCP clients (if you have any) may use the same modem lines as your PPP clients! Of course, you have to give your UUCP clients "/var/spool/uucppublic" home directory and "/usr/sbin/uucico" login program.
Now dial-up the server and wait for connection. Test out web browsing, and POP mail sending and receiving. If it doesn't work... something is wrong somewhere ;-)
REFERENCES:
1. PPP-HOWTO 2. NET-3-HOWTO 3. "Using Linux", Bill Ball, published by Que (around US$30 - highly recommended) 4. mgetty documentation