ETHERBOOT & DACHSTEIN - Network Boot a LRP firewall |
HOME
to Mail me |
||||||||||||||||||||||||
|
The following is a description of how to network boot a LRP distribution that will be used as a firewall for a small network - tested on the Optus@Home cable network. This is done by booting the LRP image of Dachstein by a boot rom configured Network card, the method should be applicable to any connection setup that Dachstein can be configured for. This HowTo was derived from the material at http://members.optushome.com.au/graybeard/linux/netboot.html. There will be a slight difference in presentation, but the content should be in sync. The multi page version (Docbook format) can be found here.
1. Introduction1.1. What and WhyThis document describes how to boot the Dachstein LRP distribution over a network using Etherboot to perform the boot loading. The benefits of this method include....
Admittedly, the thought of your secure firewall being dependent on a tftp server may seem contradictory but the *stein distributions close all external connections during the bootup sequence. This should be no worse than any of the internal services running already and assumes that you can trust your internal network but, as always, be aware of the risks The reasons for this approach are many, for me it was the extension of a motherboard resuscitation project ( in other words I had the eprom burner already ) but other uses for netbooting come to mind, such as Ken Yaps rundown on booting Tomsrtbt CD Section 6.1 testing your machines memory, also Section 6.2 or the LTSP Project for a terminal project. The Dachstein distribution also comes in a CD version so perhaps with a bit of tweaking this could be configured to allow netbooting. I have used the 1.680 meg floppy image for this exercise. 1.2. Copyright InformationThis document is copyrighted (c) 2000 Glenn McKechnie and is distributed under the terms of the Linux Documentation Project (LDP) license, stated below. Unless otherwise stated, Linux HOWTO documents are copyrighted by their respective authors. Linux HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions. All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at the address given below. In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. If you have any questions, please contact <linux-howto@metalab.unc.edu> 1.2.1. DisclaimerNo liability for the contents of this documents can be accepted. Use the concepts, examples and other content at your own risk. As this is a new edition of this document, there may be errors and inaccuracies, that may of course be damaging to your system. Proceed with caution, and although this is highly unlikely, the author(s) do not take any responsibility for that. All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements. You are strongly recommended to take a backup of your system before major installation and backups at regular intervals. 1.2.2. VersionsThis is the first release in Docbook format. The latest version of this document can obtained from the HowTo directory at my site. The original html version of this document can be viewed at the netboot page. 1.2.3. CreditsNone of this would be possible without the work of the Etherboot and Dachstein authors and their contributors. No names, therefore no ommissions, but still a heartfelt Thank You to all concerned. The wide availability of this and other similarly open source material is tremendous. 1.2.4. FeedbackComments on this Guide may be directed to Glenn McKechnie <graybeard(a)users.sourceforge.net> If you can identify any errors, have suggestions or any material that would improve this page then feel free to contact the current maintainer. Your corrections, additions or experiences can then be included directly into this document. There are no translations of this document but if anyone feels the need then feel free to do so, just be sure to let me know the url for reference purposes. 2. Etherboot - on the clientThe client being the Dachstein LRP machine 2.1. Set up the Cards
Having selected the cards to use, check for a valid driver in the Etherboot or Rom-o-matic databases. If you're lucky the driver will be obvious and you can either fetch and compile the source or use Rom-o-matic which will save you getting into compilation issues if using RedHat. If the card driver is not obvious then do some further research as the driver could well be there but disguised as something else. See Section 7.1 for an example Having selected the driver, the option to download the rom as a floppy image is the best way to start as the process can be debugged first. 2.2. Boot from the internal networkObvious .. yes .. Simple .. No.. Well .. In truth it is simple but it sure had me confused for a bit, but it was late and the coffee was weak ;-) I initially used two 3com 3c509s, I set them up correctly with the DOS configuration program and inserted the eprom into the configured card. On start up the machine was assigned an address via the DHCPD (Section 3.1) server and then magically booted from the tftp (Section 3.2) server, but all from the "wrong" interface. It turns out that I had put the Eprom in eth1 ( the last card to boot up ) but all communication is via eth0 and no matter where the rom is, it will work. While the hardware adjusted for my error, my reasoning lagged a bit, so make good use of those post-it notes, in other words - label them. It is probably mentioned in the documentation somewhere and someday I will read it all properly :-) but if you want to avoid confusing yourself then be aware of that trap. 2.3. Repeat - that's the first cardKnowing that bootup is via eth0 ( the first configured card in the boot up sequence ) we need to confirm which one it is. You can just note the MAC address from Etherboots start up display (eth0) or install Dachstein by the floppy method If you choose to install Dachstein at this point, after configuring the all cards use dmesg or grep the appropriate log file ( /var/log/messages ). Then make sure that you know eth0 from eth1. With this information an important change will also need to be made to the network.conf file. If the extracdach.pl script is used then this will be done for you. Dachstein is configured to assign eth0 to the external network and eth1 for the internal. From the above notes we realize that for etherboot this needs reversing. The extractdach.pl script will reverse these fields within the /etc/network.conf file. If for some reason the conversion script breaks, or it all works until you attach to the modem, then check and make sure the above changes have been done correctly. We want to be listening on the correct interface otherwise we will never find our internal DHCPD nor TFTP server. 3. Etherboot - on the serverThe following configuration needs to be performed on the server 3.1. Setup a working DHCP serverFor this information the Etherboot Userman Setting up a DHCP daemon should be your first read. At the very least you need to set up DHCPD to give an IP address to the machines card. If no filename is given the current Etherboot 5.0.5 defaults to /tftpboot/kernel -- a file called kernel. However it is safer to give a specific filename in /etc/dhcpd.conf so that "kernel" can be reserved for a fall-back netboot using something like tomsrtbt, as described in Section 6.1. Under the chroot environment (-s switch), that path will actually be /tftpboot/tftpboot/kernel. This allows the first /tftpboot to be stripped off under the chroot environment, which then allows etherboot to "find" the file. For the Dachstein/Etherboot setup, this netboot file will be lrp.nb so filename "firewall/lrp.nb"; would be the string to use within the /etc/dhcpd.conf file If you need more info regarding DHCP then the following links should be enough to overwhelm you. If you are using a new distribution such as RedHat 7.2 then be aware that any references to building the package from a tarball should not need to be pursued. The rpms on the distributions installation disk should be easier to set up and will also include the necessary xinetd and init.d scripts. The DHCP Links were found using this google search ... an unsubtle hint ... :-) If it helps, here is an extract from my dhcpd.conf that is specific to netbooting... /etc/dhcpd.conf
3.2. Setup the tftp serverFor RedHat 7.2, one trap is to be aware of the xinetd file for the tftp daemon, this config file will install with the rpm for tftp however a few changes may be necessary. Besides enabling it you may want to turn on logging with "l" and become familiar with how the -s flag works. Other distributions may well be different in their initial setup, so become familiar with them. /etc/xinetd.d/tftp
If the server args are as above (-s = chroot) then make sure the filename argument in /etc/dhcpd.conf is used without including the /tftpboot/ path. In other words -- filename "firewall/lrp.nb" instead of filename "/tftpboot/firewall/lrp.nb". As usual, man tftp for the good oil on why and man chroot if the reasons are still vague. I have changed the permissions by putting /tftpboot in the group nobody and making it searchable only, the same for the directories within. The files ( specifically, lrp.nb ) need to be readable by others for etherboot to load and run. These alterations will be done by the extractdach.pl script and may seriously mess with an existing /tftpboot directories permissions. If you do have an existing setup then you may need to edit the script (if necessary) to suit that, then be prepared for more configuration changes. 4. LRP - DachsteinSo... The netboot works, we can move onto the LRP side of it. 4.1. Extract the LRP imageThe following is a modified version of a file included with the Etherboot distribution, the original file can be found in the contrib/mklrpnb directory. The new file is extractdach.pl and can be viewed here or as the workable perl script in Section 4.2 . There are some variables that need setting up first, so read the source. On the first pass it will extract the lrp files to a base directory ( this is currently /usr/src/LRP/lrp-firewall ), within this newly created directory will be the expanded Dachstein distribution. It is now our working directory and will form the basis of the new distribution. Additionally on the first pass the script will modify /linuxrc so that it does not try to mount and read the non-existent *.lrp files ( these are now transferred over the network in the lrp.nb file). It also creates a /var/lib/lrpkg/package file which is built when using the floppy method. This file allows the configuration files for the packages to be viewed using lrcfg on the netbooted machine. Finally the script changes a boot error message to reflect the fact that this modified distribution cannot do backups, not entirely necessary but ... With this netboot method, all mods are done to the expanded distribution in $dachnew. When the changes are ready to be tested then the extractdach.pl script is run a second ( third, fourth... whatever ) time to build the netbootable images. These images will be in /tftpboot/firewall/ as required by the /etc/dhcpd.conf and /etc/xinetd.d/tftp config files and is set by the extractdach.pl variable $tftpboot The LRP source image can be read by extractdach.pl at any stage, it does not have to be the original version but instead can be a backup copy of an existing (working) install. You will need to transfer this image onto the hard-drive with...
for the 1.680meg image. If the path and filename are not the same as the $image location then copy it over so that the script can do the rest of the work. If you want to be sure you got something from the disk then use the following command to view it under /mnt/floppy...
4.2. The extarctdach.pl script
4.3. How to add extra lrp ModulesThe LRP files have the extension .lrp which are tar.gz files in disguise; so to add a module to your new distribution you need to download the appropriate *.lrp file and rename it to have the extension .tar.gz. Once that's done then extract the enclosed files to the /usr/src/LRP/lrp-firewall directory and update /var/lib/lrpkg/packages as this file contains the names of any modules installed. If you fail to add the entry to packages it will not display in lrcfg. We cannot use the script directly for backup to the tftp server, however it is still useful and the absence of those entries could cause confusion later.
4.4. Run lrcfg and modify the scriptsTime to move on to the second part of the project, or was it the first? On the router - firewall if you accept the default name - you will need to configure the machine to get an assigned IP from your ISP, as well as setting up routing and configuring the firewall. The usual deal when running an LRP machine from floppy, hard drive or whatever, is to execute lrcfg and follow the menus till all the configurations are done. In our case lrcfg will not be quite as useful, there are no backups available from this menu for starters; but it can serve as a useful prompt to work out which files to modify back on the tftp server. If you install the ssh.lrp module this will make available the scp command for the transfer of files between machines. This will assist in keeping the two versions (client and server) synced The firewall script was not my friend but we get along Okay now :-) Back when I was running Eigerstein I wimped it and just ran my own script after the machine booted up, bypassing all that scripting work the LRP team have done. Eventually though I decided to use it, in truth the dynamic IPs we now get with Optus forced the rethink. It was worth the effort to understand it To assist with configuring Dachstein, the README network.txt is invaluable and has a useful section labeled "IP FILTER SETUP" I'll add to this section as needed and may even upload an image suitable for the Optus network, but later........Perhaps the scripts are needed first but this HowTo is primarily about Netbooting the Dachstein/Eigerstein distributions. and if I don't get this page uploaded now it will take another six months to do. 4.5. Serial ConsoleWe've now got the start of a compact setup. To run headless should be the next step to save space and also for convenience. We are also able to get most of our boot messages with a serial console. To do this we set up minicom to run on the internal machine, with a null modem cable between the serial ports; that's between the router and minicom --- not between the.... Ah forget it..;-) The Eigerstein HowTos have a quick rundown on enabling the serial port. You need to replace the kernel that came with the 1.68 meg floppy with one that supports a serial console during boot up, if you want all the console output. Basically.... Rename linux-2.2.19-3-LEAF-normal.zImage.upx to linux and replace the file in $dachorg. Add the serial module to /etc/modules then edit /etc/inittab by adding the appropriate strings to $dachorg/appendstr ( view the extractdach.pl script to find it ) For example purposes only, this is the $dachorg/appendstr that I use ....
along with this in /etc/inittab
additionally you may need to comment out the terminals otherwise you will get the infamous INIT: Id "1" respawning too: fast disabled for 5 minutes message if you elected to remove the video card from the machine.
finally /etc/securetty needs an entry to enable root access to /dev/ttyS1
This will give a serial console on ttyS01 ( com b or async 2 .) When the serial connection is fully enabled everything will be displayed from the moment the bootrom takes control to when shutdown displays "Power down". The only thing missing is the ability to configure the BIOS, a small loss considering the gain. Catching the boot process at the bootrom start-up also allows the menu feature to be used. If you have configured this menu then the netboot can be bypassed and a local drive mounted instead. If you opt for the full serial setup ( replacing the kernel as outlined above ) then you will also need to set the Etherboot options appropriately when configuring it. Using rom-o-matic the following options will need due attention.
There will be NO other console with the above configuration, if you want a keyboard and monitor for the initial setup process then the serial HowTo is your friend. Briefly :- insert console=tty0 into the $dachorg/appendstr string, like so (all on one line though)....
and leave those terminal entries uncommented within the inittab file. If you can score yourself a 16550A uart chip for the serial port then do so. These seem to be rather scarce but are a slightly quicker on throughput as the Serial HowTo explains. However the common 16450 is quite usable considering what we are expecting from it.
The serial cable (null modem) I use is a DTE<=>DTE using 7 wires, but a better description lies at the nullmodem site in the form of the first image, or the one labeled "Common Null-Modem Connection" There are a few terminal clients around, I have used minicom and it's almost satisfactory ;-) One BIG advantage of a serial connection is that when you run something such as tcpdump over the remote link, there is no need to hit yourself with the cluestick afterwards. You did install ssh as well? 4.6. Ditch unneeded cards and checkDepending on the motherboard you may be able to ditch the video card, the floppy and hard drive can go along with the i/o card - unless the serial port is soldered to it. Try it and see! If the only complaint from the BIOS is a series of annoying beeps just disconnect the speaker lead. Removing unnecessary cards will reduce power consumption along with the amount of heat produced.
Braver people than I have disconnected the fan from the computers power-supply unit :-) I was able to get a power supply that used a thermistor circuit in the fans power lead and have used this instead. It works well and the fan operates at a reduced speed, if the box ever gets hot the sensor should detect it and increase the speed (cooling) accordingly. I have back traced the circuit in my supply and it can be found at Section 7.2, but visit the following links to get a better background and also other, perhaps more appropriate, designs.
Obviously the thermistor has to be placed in a position that allows it to perform some speed regulation for the required temperatures, placing it directly on the heatsink or in the bottom corner of the power supply box would be two useless extremes.
5. Eproms5.1. How do you make an eprom for the NIC?The following almost deserves a page of its own but... If you can afford or are able to use the new type of PCI NIC with a flashable rom then you can skip this section and just do the deed. If you are stuck with an ISA or non-flashable type then you will need to continue on.
5.2. Where to get an eprom OR what are they?It depends on the type or size of eprom needed but with that old 386(486) board, the one you saved because you knew it would come in handy one day - in spite of the leaking battery, the chances are good that you'll find one. Check that beneath the sticker on the BIOS chip there is a glass like window, if so then carefully pop the chip (28 pin dip) and you will have an eprom of hopefully the correct size (27c256 seems to be the most common.) Video cards can also be a good supply for eproms (especially the older ones). You will need to pay attention to the existence or otherwise of that "glass window". When the manufacturer settled on their code or perhaps when volumes made it worthwhile, they would change over to PROMs which means no reprogramming allowed. Now that you know what they look like, you'll find them "everywhere" ;-) Or you can buy one (two?) ;-) 5.3. Burning an imageAn Eprom burner? well this might be slightly harder to find. Ask amongst your Electronics friends, build one or if your local then, mail me and we'll work something out. If you want to follow up on my eprom burning offer, I live in Australia. I'll do it for nix - you supply the eprom and postage & handling costs, test your image out first using the methods described on the Etherboot page and remember; all care but no warranty :) There is also a design within the Diskless-HOWTO. That one runs on linux, unlike the others I have not built the Eprom Burners linked to above, so I'm only assuming they will deliver the goods, however I have built this one linked to from here. There is also a forum accessible from that last link. This is a more detailed version that will burn a range of flash Roms as well. I needed that one originally so it was worth my effort. YMMV. 5.4. Erasing the epromsIf you build the eprom burner then it is not much good without an U.V. eraser. You can source a commercial unit or you can wait a fortnight or two for sunlight or fluorescent tubes to work their magic - but then that's not really an option. If you want something in the middle then Mikes site gives the run down on converting one particular brand of torch to use as an eraser. This style of torch is available in Australia at the discount stores, but the globes are not. As luck would have it though there is also a torch sold here that takes tubes that are next size up and these UV tubes are available, so it is a possibility. You could be lucky in your locality! Another option is the barbers fluorescent sterilizing cabinet. The short length UV also goes under the name of Germicidal thus the sterilizing cabinet will work. I should add that it works VERY well; it's what I use, I've never run it at full capacity though (~150 eproms) - for some reason!? Once you have a burner, remember that the Etherboot project is not only about netbooting your firewall, X terminals can consume the rest of your spare time. 5.5. SafetyThe UV source required to erase the eproms is at the short end of the spectrum, which is potentially dangerous to our health. That link is quite informative and not just from a safety aspect so I'd encourage you to read it, other informative links can be found with this or a similar search 6. What Next?You've got an eprom burner, DHCP server, tftp server and knowledge to boot! Don't waste it! Some other possibilities follow.... 6.1. To boot Tomsrtbt via boot-romWhile we are at it, why not? If nothing else it is a neat trick and it can be used to prove the netboot process quickly. Having this well recognized recovery "disk" easily accessible will increase its usefulness.
6.2. Another useful tool is Memtest86Considering we use RAM for our filesystem, we should be confident of its health. Memtest86 provides that solution. Using etherboot to load memtest takes about a second - trying to measure it is pointless, it's running before you know it. This quick startup makes it ideal for testing bad, or a lot of memory as there is no time involved (comparatively) in restarting it. If you are unlucky enough to have to cycle through this process when eliminating chips you may appreciate having one less obstacle in your path. I was using version 2.8 (Section 6.2.1) however Eric W. Biederman has improved the 2.9 version and it is usable for these small memory machines. I recommend that one (Section 6.2.2) for our 486, or low memory machines. The serial options for our serial setup are described below. To get the serial console to work in the first place then read the README packaged with the source, the config.h file also holds the secret to faster baud rates. After initially thinking they would not work I have since found I can run mine at 115200, which suits my existing minicom setup. After you have built it with make, the file memtest needs to be moved to your /tftpboot directory and some means of loading it enabled. Incidentally, I do not have a selection menu on the firewall so if I want to load this I either symlink it or edit /etc/dhcpd.conf and restart the dhcpd daemon. You now get to choose your own method :-) 6.2.1. The older 2.8 versionMemtest is available here To change serial consoles ( my above example is ttyS1 ) then edit test.h and adjust the lines
so that 0x3f8 becomes 0x2f8 ie:-
6.2.2. The newer 2.9 versionMemtest 2.9 is currently available (april 2002) at ftp://download.lnxi.com/pub/src/memtest86/memtest86-2.9.eb1.tgz but will no doubt arrive at the main site in time. To change serial consoles ( my above example is ttyS1 ) then edit serial.h and adjust the lines
so that 0x3f8 becomes 0x2f8 ie:-
With the version from lnxi.com check that line 76 is commented out or removed
7. Bits and PiecesOtherwise known as miscellaneous! 7.1. An example, if the card driver cannot be found....I have used an Eagle systems Intl ISA card which uses the lance driver under Linux quite happily. The Etherboot Drivers list does not ( Okay that's a didn't because it does now ;-) ) list it under the AMD section and the Etherboot driver for lance is for a PCI card. The main chip on the network card is identified as an AM79C960KC 243GB5M © 1992 AMD. Using this we grep the source tree (after compiling the drivers) for the string "79C960" with the following result ...
So the 79C960 is there and as an ISA driver as well. Investigating the associated .lzrom files we can dismiss the lance as it only comes as a PCI driver, Working down the list we eventually try the ne2100 and bingo we have a winner. Of course if you had the manual it would tell you that the Novell ne2100 driver would have worked, but then manuals do not always come with second-hand cards. The NIC page at the Rom-o-matic site or in the distributions src tree etherboot-5.0.5/src/NIC gives confirmation that the above files are indeed lance drivers but do not mention the 79C960 specifically. 7.2. Fan power regulatorThis circuit needs to be read along with Section 4.6 and the warnings displayed there. It is my representation of an existing circuit found with a power supply I had. It is provided as a curiosity and I would expect only the adventurous or knowledgeable would want to pursue it, all the information I can help with is provided with it. In that context, let me know if you get it working :-) Depending on your browser, this fine example of ASCII art may appear to be garbled, to decrypt it you will need to use special tools. In this case vi and only vi. Okay -- the power lies with fixed fonts, so it needs to be viewed with anything that displays in fixed, cutting and pasting into vi will work a treat, as should other plain text editors.
|
Site Links Various ping Stats Connecting to Optus with Linux Troubleshooting the above process Using a floppy based router EtherBooting the Dachstein LRP NIC Throughput Tests Advance Decline for ASX Ping status for Aus and US Linux Related Local sites Manfred Bartz Paul's Metrak site Zak's site Mick's site Barry Park LinuxatHome AtHome Linux - egroup Personal Links Setisearchers distributed.net Link Summary for this page Etherboot Etherboot-NIC-database Romomatic-NIC-database Leaf project Eigerstein Dachstein Diskless HowTo Security Concerns Configuration README Step by Step Configuration Tomsrtbt LTSP Project. Rom-o-matic Setting up a DHCP daemon DHCP mini-HOWTO Linux Networking HOWTO Network Nirvana: extractdach.html extractdach.pl ssh.lrp module network.txt Keeping Fans Quiet Temp Controlled Fan Fan Controller Eigerstein HowTo's serial (normal) kernel small kernel README serial.o module null modem Types of ROMs Eprom Burner1 X terminals Eprom Burner2 Eprom Burner3 Eprom eraser UV hazards UVC search Etherboot Drivers list AMD Etherboot drivers NIC page Memtest86 |