Adding DHCP, 100BaseT To Your Linux Gateway
The next step in linking your LAN and the Internet
By Trevor Marshall
October 11, 1999
My column in August explained how you could use an old 486 machine as a gateway between your LAN and the Internet. This month, I am going to explore how to add DHCP and 100BaseT network cards to that gateway.
But first we need to understand a little bit more about the way that Linux interfaces to your hardware.
Each Linux distribution includes dozens of software modules that support the most common pieces of PC hardware. They are supplied in C source code and are typically compiled into a kernel when it is "built." But the Linux Router Project (LRP) software diskette does not come with a C compiler, or with a complete set of Linux kernel source code.
Luckily, Linux lets you link separately compiled modules into a pre-compiled kernel using the boot-time program "insmod," and this gives LRP the flexibility we need.
The script that calls insmod is "/etc/init.d/modutils" and the list of modules to be loaded is found in the file "/etc/modules."
All the modules associated with the LRP kernel are contained within a "tarball," an archive created with the Unix utility TAR that has been compressed to a .gz format to save download time. The tarball for the kernel I used on my LRP gateway disk is at ftp://ftp.linuxrouter.org/linux-router/dists/2.9.4/kernel/2.0.36pre15-1.tar.gz.
Download it (about 1.5 Mbytes) and use WinZip 7, tar, or any other utility that can handle the .gz format) to unpack it. You can see that it contains 100 module files (each ending in a ".o", and a copy of the kernel. These module files can not only be used to add hardware, but can provide MS-DOS extended FAT compatibility ("vfat.o") and a number of other useful enhancements.
Some modules will not function unless other modules are already in place. We say that "module B is dependent on module A" if module A has to be loaded first. There is a list of dependencies in "modules.dep," and you need to read this file. The disk that I originally distributed, for example, uses the NE2000 NIC interface modules "ne.o" and "ne2k-pci.o", and both require that module "8390.o" has been loaded before them.
But which module does which job? The tarball contains 100 modules, all with cryptic names. How can you find out which one you need?
A good starting point is to check out the Linux Hardware Compatibility how-to. But this document does not contain a direct cross-reference between the module names and their function, and you will often be forced to use a search engine to find out which module matches your requirements. Of course, if you are seriously working with the LRP Linux, you should download a complete set of kernel source and compilation files, since the headers of a module's source code invariably give you a full explanation of what that module does.
There is little dispute that the Digital Equipment 21140 chip used on many 100BaseT cards is among the best of the 100BaseT performers. The driver for this chip is called "tulip.o," and version 0.89 is found in the tarball.
Recently, a number of lower-priced 100BaseT chips have become commonplace. I have found that the Macronix MX98715 also works well with this same tulip driver, although v0.89 has had some Macronix bugs reported, particularly when using multiple Macronix PCI cards in the same chassis.
I also bought a cheap Pentium motherboard that had a built-in 100BaseT interface using the Davicom 9102 chip. Miraculously, there was a Linux driver module on the board's CD-ROM, and that module worked fine when I used it with my LRP configuration. My suspicion, however, is that I was lucky, and I recommend you not to be too adventurous when selecting NICs for your LRP gateway.
Integrating tulip.o Into Your Boot Disk
Use WinZip to extract the module onto a blank MS-DOS floppy. Boot up your LRP, log in as "root," and then exit "lrcfg" by using the "q" command. Now place the disk containing tulip.o into the floppy and mount it using the command
mount -t msdos /dev/fd0 /mnt
Now copy the new module by using
cp /mnt/tulip.o /lib/modules
We need to add tulip to the name of the modules that will be initialized during the next boot. Edit the "/etc/modules" file by using
Remove the lines saying "8390," "ne," and "ne2k-pci," and add in a line saying "tulip." Hit "ctrl-S" to save the modules file and "ctrl-C" to exit. Now change directory to where the modules are stored
chmod 640 *
Execute lrcfg to start up the menu system again and use the "b) Back-up ramdisk" command to backup "5) modules." This builds a new "modules.lrp" file on your floppy following the instructions in "/var/lib/lrpkg/modules."
Reboot the system with your 100BaseT card installed and everything should now work just fine.
DHCP is a network protocol that lets a workstation on a LAN request an IP address upon bootup, and it relieves the system administrator from the task of tracking and administering indvidual fixed IPs for each computer on the network. In many cases, it also lets more than 253 computers be connected to each LAN, as many of them -- the laptops, for example -- will probably not all be connected at the same time.
Microsoft Windows enables DHCP arbitration of an IP address as well as designation of a fixed IP address.
The LRP configurator accepts add-on packages (".lrp" files) that are automatically added to the menu system. I have selected a DHCP package that is only about 35K in size. It does not contain the client DHCP code, but only the server code needed for the Windows workstations on your LAN to connect to the LRP gateway. The client DHCP arbitration needed for PPP access to your ISP is already included in your "dialout.lpr" package.
To add the DHCP package, you must edit the "syslinux.cfg" file on your boot diskette. Place your boot diskette in the floppy drive and use
mount -t msdos /dev/fd0 /mnt
You will find a section of the file saying:
LRP=log,local,etc,modules,dialout And you must change it to say: LRP=log,local,etc,modules,dialout,dhcpd Save the file and exit ae. Don't forget:
Download the dhcpd.lrp package and copy it onto your LRP boot diskette.
All that is needed is to make any changes needed in your DHCP control modules. Reboot, execute "lrcfg," and select "4) dhcpd." Then change the default values of the network parameters to match your particular configuration.
In The Event Of Trouble
I have put a complete image of the boot disk containing the tulip driver and the DHCP package onto my website to help anybody that is having trouble figuring out how it all fits together.
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
A list of all 75 papers Trevor has published is available at this link.
All information published at this website is (C)Copyright 1995-2003 Trevor G Marshall.
Link to "Trevors View" image Copyright (C) 1999-2003 CMP Media Inc
All rights are expressly reserved. Click to email webmaster