C.4. CF Installation Steps

C.4.1. Obtain the Target Machine

You should obtain your target machine, first. Many of these machines do not have their compact flash drives on hard drive A. You will have to determine which disk drive the compact flash appears as.

Obviously, get a Compact Flash card. IPCop supports 128, 256 and 512 MByte compact flash cards as well as 1, 2 and 4 GByte cards. The larger the compact flash you use, the more logs can be retained.

The flash version of IPCop uses a 64 MByte ram disk to hold logs until they are compressed and moved to your compact flash for long-term storage. The ram disk is also used for the web proxy cache. Determine how much memory you will need to hold the ram disk and IPCop run time memory. 128 MByte is probably enough.

Since this is an Open Source Project, unaffiliated with any commercial entity, we will not recommend a computer. There have been some discussions on this topic on the IPCop mailing lists. Please go to the IPCop Mailing Lists Page and search the archives for discussions on compact flash installations.

If you are going to use an image from the Internet download it and skip to the discussion of writing the compact flash, otherwise continue with the discussion of installing IPCop on a staging machine installing IPCop on a staging machine.

C.4.2. Install IPCop On a Staging Machine

The next thing that's required is a running IPCop system with at least a 500 MByte hard drive. Preferably this is the target machine or an identical machine.

The staging machine can also be a different system or a virtual operating system. In this case you need to be aware of potential hardware differences.

While an existing IPCop machine can be used, all logs should be deleted. mkflash will try to copy all the existing logs and snort cache files to the flash image it's creating. This will easily fill your flash image. Remember, the log and snort cache files will be on a separate ram disk, while your compact flash based system is running.

Install IPCop on your staging computer. A CD-ROM install is probably the easiest since most simulators allow an ISO file to be used directly.

C.4.3. Get mkflash and Associated Files

The files necessary to create a compact flash image are kept in the IPCop CVS archive on SourceForge.net. To get them, go to the IPCop CVS view page for mkflash and download the files displayed using your web browser.

The logrotate.conf file and mkflash script are both required.

A default settings file, settings.8139 is provided for your use. It shows how you can stage on one system and build a flash for a LEX system with three RTL8139 NICs by placing the file in your /root directory. It will be used to configure the flash image with the correct ethernet settings for the LEX.

C.4.4. Upload mkflash

Make sure you have enabled ssh on your staging machine. Transfer the files you've just downloaded to root's home directory on the staging machine. Check the IPCop Administration Manual for a discussion on how to enable ssh and transfer files to IPCop.

C.4.5. Run mkflash

Log into the staging machine as root. The mkflash shell script will not have been marked as executable when you transferred it to the staging machine. To make it executable, issue:

# chmod u+x mkflash

Now run mkflash. You must specify the size of your compact flash and the hard drive you compact flash will wind up on as parameters on the command line. For example, to create a 128 MByte image that will wind up as hdc, enter:

# ./mkflash 128 hdc

When mkflash completes, a file named /tmp/nnnflash.img will be on your staging machine, where nnn is the flash size. Use scp or pscp on Windows to transfer the nnnflash.img file to another computer to write your compact flash.

C.4.6. Write the Compact Flash

Connect your compact flash writer to your workstation and insert your compact flash.

C.4.6.1. Writing a Compact Flash Under *nix

If your workstation is running *nix, you will have to determine which physical hard drive your compact flash writer appears as.

Issue a df to see which currently connected physical devices are mounted and contain file systems. Do not use any of these as a target for the dd, below. For example, if you see several file systems on /dev/hdan do not use /dev/hda as an output target of the dd command.

Try mounting other physical disks to see what your writer appears as, including /dev/hdn1 and /dev/sdn1. Once you've figured out its address umount the device.

Issue the following command:

# dd if=nnnflash.img of=/dev/hdn

The creation of your compact flash may take a few minutes.

Once the dd returns, mount /dev/hdn1 and verify that the first IPCop partition is visible by issuing an ls command. Then umount the disk.

C.4.6.2. Writing a Compact Flash Under Windows

There are several programs available under Windows for creating a compact flash image. One such is physdiskwrite.

Use such a program to write your compact flash. This may take a while.

C.4.7. Install Your New Image and Boot

You're finally ready to plug your compact flash into your target machine. Boot it. If you get error messages about the kernel being unable to find the root file system, your disk drive does not match the one the compact flash image was created to use.

C.4.8. Run the setup Command

Unfortunately, the NIC and/or modem configuration on your target machine is probably different from the staging machine. If you've downloaded your compact flash image from the Internet the same will be true.

To fix problems like this, and to reset your passwords, log in to your target machine as root. Run the setup command to change IPCop's configuration as desired.