The Silly Software Company

Silly Software Company
-=oOo=-

A poor man's way of doing things is still a way to get things done


Old PC becomes router

part 2 : Installing Debian Linux from a network source


The easiest way to install Linux is by booting a Linux installation CD : set the BIOS to boot from CD-ROM, insert the Linux setup CD, restart the machine. The computer will boot from CD-ROM and start the setup program.

However ... we're trying to convert an old PC into a router here. Old PC ... like mid 1990's ? Probably, that machine knows how to boot of a boot disk (A:) or a hard drive (C:) and nothing else. Forget booting from a CD-ROM.

Or forget CD-ROM altogether. What if that old PC does not have a CD-ROM drive at all. Of course, you cold still 'borrow' one from an other computer and put it back afterwards, ...

The 'workaround' explored here is, in my opinion, quite elegant : install from a source on a network. If your computer is going to be networked (or maybe you are reading this in preparation of building a Linux Router), it will have a network adapter. And that's all you need.

What follows is based on a Debian 3.0 installation with kernel 2.4 (for iptables support). Debian is very good for this type of installation, and can easily be kept up to date by downloading updated files. Other distributions, such as SUSE, can also be installed from a network, but I found it a lot harder to get it right - especially for newer versions. SUSE (and Redhat probably as well) focus on CD distributions nowadays. I added some experiments with SUSE here.

You need a bootable medium

You need a bootable medium. That's just a complicated way of saying : you need to boot Linux from ... something. For an installation, you'd typically boot from a bootable setup CD. But we're doing it the poor folks way, so without a CD-ROM drive in the PC.

It's also possible to boot entiry off a network server, without any other boot medium than a bootable network card. here.

We fall back to the good old boot disks. You can get the disk images at Debian.org, where you can also find an installation manual. For this installation, I suggest you take the bf24 disk set : it uses kernel 2.4, which supports iptables and netfilter that we will use for NAT and stateful packet filtering. It includes 4 disks with drivers (modules), including network adapter modules for a collection of network cards. The disk images are in dists/stable/main/disks-i386/ directory, e.g. at (http://) ftp.is.debian.org/debian/dists/stable/main/disks-i386/current/images-1.44/

To create the boot disks, rawrite2 is extremely handy. You can find rawrite2 in the /tools or /utils directory on a Linux setup CD or (in those directories) at the site where you found the disk images. After downloading rawrite and the disk images, type rawrite2 at a DOS prompt, type in the name of the image you want to put to disk, and follow the instructions at the prompt. You'll create 6 diskettes : rescue.bin and root.bin for booting and initial setup, and 4 driver disks : driver-1.bin, driver-2.bin, driver-3.bin, driver-4.bin, which will supply drivers. You need all 4 driver disks : they will be loaded onto a RAM drive during installation, after which you'll be able to select the drivers you need.

When you've created the 6 disks, insert the disk rescue.bin in the floppy drive of the computer that you want to set up, turn it on, and watch Debian Linux boot. Follow the instructions and insert additional disks when prompted.

Follow the setup prompts according to your preferences. Refer to the installation manual if you need specific help, eg. with partitioning. As this is just an old PC, presumably with a small (500MB max ?) hard disk, you don'n need a complicated partition scheme. 10MB /boot, 64 or 128 swap and the rest for / will do. More than 1 swap partition - for additional virtual memory - is possible.

When it's time to select drivers, you will need to know the make and model of your hardware, in particular the network cards. A guide to network cards and the drivers (modules) they use can be found in the Linux Ethernet Howto. Check it.

If you have other file systems on your computer, like a DOS partition with some NIC configuration tools, you may want to add a driver for the FAT (ms-dos) file system as well. This way, you'll be able to approach this partition from Linux. Other modules may be required according to your hardware, but if it's just a run of the mill old PC, you probably don't need anything else than what's included by default already. Browse through the list anyway, and see if anything applies to your hardware. You have taken inventory of your hardware before starting the setup, haven't you ?

Do have a look at the /net drivers, and install at least iptables and the NAT modules. You'll need those later, for firewalling.

select installation source

Here is where you select where "the rest" - the software and system files that where not on the disks - will come from. If you've started this floppy disk setup because you have a CD-ROM but your PC can't boot from it, you can switch to CD here. If you've copied the CD to the hard disk, eg. a DOS partition, you can try that. etc. but we were going for the networked installation ...

So, you select ftp (or http), and select a location. The setup 'knows' a number of servers in all the countries listed, and you can select 1 or more servers. Debian setup will test to see if it can connect, and reach the directories with the installation files. If all is well (and it usually is), the setup procedure will download, unpack, and install a minimal system. Congratulations, you now have installed Debian Linux.

Then, at some point, you'll be asked if you want to run tasksel and/or dselect to add additional software. You don't. For a router, you have everything you need right now.

When setting up the router and adding additional features to your firewall, you may need additional modules from the /net section, but you can always add those later. Simply run the command

		/usr/sbin/base-config
	

and you'll be back at the setup procedure, where you can select to insert additional modules. the insmod command could do that to, I guess, but I haven't tried that yet.

So, you've got a working Debian Linux. All you need to do now is tell it to become a router and a firewall.


Koen Noens
October 2004