A Simple Internet Gateway For Your LAN
All your computers can access the Internet with only one ISP and one phone line
By Trevor Marshall
August 09, 1999
Ever wanted a simple gateway that would hook up your home or work LAN to an Internet ISP? You would not be alone. In fact, the most frequent request I get from readers is to describe a simple gateway to the Internet that can use a standard dial-up ISP and some discarded PC hardware.
Unfortunately, it is much harder to create a demand-dialing PPP connection than simply to hook up an ADSL line or a cable modem. So this is not normally a good project for a novice.
However, for the last several months I have watched the evolution ofthe Linux Router Project (LRP), an open source effort to strip down Linux to the point where it can boot from a single floppy and run from a RAMdisk. Its lack of complexity certainly qualifies the LRP as a simple project.
But the LRP also has an active support mailing list, currently running at about 30 messages a day, which is monitored by both developers and experienced end users. This support virtually guarantees success for both newbie and expert alike.
The LRP has produced an extensive archive containing exactly the modules that an Internet gateway needs: masquerading, Dial-on-Demand, DNS services, and Web Servers. All of which boot from a floppy or ROM and run from a RAMdisk.
If we could put together an LRP boot disk with just those modules that are required for a simple gateway, and use the LRP configuration menu editor to control the data that is needed to customize the dialing setups for different ISPs, then the configuration of a Demand Dialing ISP Gateway changes from being a very difficult task to being a simple one.
Somehow, I was able to fit all the modules we needed onto a single 1.4-meg floppy, with room to spare for upcoming additional software, such as the Web server. So with a single floppy and a single floppy drive, you can now put together the gateway that will connect your LAN to the Internet backbone and allow all your computers to surf the Web through the one account and the one phone line.
The hardware you will need is a 386, 486, or Pentium motherboard; a 1.4-meg floppy disk drive; an NE2000 compatible network card; and a suitable modem at COM2. While 8 Mbytes of RAM is sufficient, 16 Mbytes will give you room for later expansion. A monitor and keyboard will be necessary for you to customize the software distribution to dial your specific ISP, but are not needed in normal use.
While a 120-MHz Pentium provides more speed than you will ever need, and the 486 is a little lethargic on boot but runs the gateway software fine, a 386 should only be used if you have nothing else lying around.
I have put together a zip file containing an image of the floppy disk with all the modules you will need to set up the simple gateway. There is no DNS or Web server in this first version, but I will add them in the coming months. You can download the archive from my website by clicking on this link.
The LRP system lets different hardware be supported; in particular, modules for different network cards can be merged with my distribution. I will describe how to do this in a future article, but for this first disk, I have chosen to use the sub-$15 NE2000 adapter. If you have an ISA-based adapter, then use its setup utility to disable "Plug-and- Play" and set its base address to 0x300, IRQ=10. The PCI versions of the NE2000 work in full "Plug-and-Play" mode with the drivers I have selected.
I would recommend that you test your initial setup with an external modem attached to your COM2 port so that you can see the front panel lights flash when the gateway initiates the connection with your ISP. A slow one is OK.
Unpack the zip file into an empty directory on your Windows or DOS system and then run "rawrite.exe". It will prompt you to enter the disk image filename (trevors.bin) and the destination floppy to write the image onto.
Remove the completed floppy, pop it into your gateway hardware, and boot the computer. Don't bother about the messages scrolling by on the monitor, you can look at them later by giving the Linux command 'dmesg | more'.
At the "login:" prompt enter root and the "lrcfg" program will automatically run, giving you a menu of system setup parameters. Choose number 1, Network Settings and then 1, Network Configuration auto. There are a set of parameters that will need to be adjusted to suit your LAN's base IP address. I have used the C block 192.168.1.X with the gateway at 192.168.1.1 but you can enter any parameters for IF0_IPADDR that matches with your LAN. If you don't understand my explanation, please read this more detailed discussion on how to set up Windows machines on a LAN. Then look further down this file, and replace the DNS server IP addresses with those supplied by your ISP. Hit Ctl-S then \<return\> and exit with Ctl-C.
Now select "q" to take you back to the main menu and select "3", "Package Settings", and then "3", "Dialout". The user name your ISP gave you needs to be typed into "2", "Port and Username setup" to completely replace the text \<type the user name your ISP gave you here \>, also removing the angle brackets, then save the file and exit as you did before.
Into selection "3", the "Modem CHATscript" you will need to enter the ISP's modem phone number, your user name, and your password. Selections "4" and "5" need only the entry of your ISP password.
At this point, quit back to the main menu and select "b", "Back-up ramdisk". You have changed files in both the "etc" and "dialout" modules, and you must back each of them up to your floppy.
Barring problems, that's all there is to it.
Write-protect the floppy and reboot your system (hit the RESET button -- it's OK). When it has booted up, log in, exit from "lrcfg" and use dmesg | more to look through the boot-up messages to make sure there were no fatal configuration errors. Then type
and the modem should start up and dial into the ISP. When the connection has been made, you will see "ping" producing a series of result lines showing that communication has been established.
The most common problem you may encounter is a non-standard login sequence used by your ISP. I have tested the distribution configuration with Earthlink, and it works fine. If you need to use another provider and the modem will not startup your PPP connection, then you will need to edit the chatscript as described at this URL. Look at the debug logs in /var/log/ppp.log (you can hit Alt-F2 to log into another simultaneous console to watch the dialer's progress) and try to pick a key phrase in your ISP's startup dialog to replace the "MTU" that Earthlink emits.
I have been running a 486 gateway connected to a LAN comprising six assorted Macintosh and Windows workstations for some time now. I use a 56K dial-up modem into Earthlink and all the users can browse smoothly, unless someone saturates the modem with a download. The TCP/IP packets from each workstation seem to interleave nicely, and each user gets the impression that they are browsing at the full 56K modem speed. Your mileage may vary, of course, but please share your own impressions and the solutions to any problems you may find, on my Linux self-help bulletin board.
Acknowledgements: Thanks to Mike Arnold for implementing the dial-out library, and to Ryan Weiss for helping me solve a pesky problem just before deadline.
Trevor Marshall is an engineering management consultant, with interests ranging from RF and Hardware design to Linux internals, Internet infrastructure, MPEG, and Digital Video. He started his career in the '70s, designing the Maplin Electronic Music Synthesizers. When the Microcomputer came along, he got sidetracked into computer software, programming the 2650, 8080, Z80, Z8000, 8048, 8306, 6805, 80x86, and Power PC families. Along the way, he also picked up a little expertise in RF system design, biomedical engineering, and the printing industry. His web site is www.trevormarshall.com. Page 1 of 1