[HOWTO] Installing OpenWrt on Caswell CAD-0208

Hello community!

I am continuing my research in applied network archeology and related wizarding sciences... :smile: Today's ancient device to be bent to OpenWrt's will is Caswell CAD-0208.

This HOWTO is intended for the relatively new users who have some experience with general computing and system administration but still need a little friendly handholding in some OpenWrt-specific matters.

If you decide to go through with this procedure (which is not very difficult), I would suggest reading through this entire HOWTO before beginning the process and then referring to it as you go along.

Introduction

Caswell CAD-0208 (also known as AppNeta m30 and probably by a few other names) is a four-port network appliance. I believe it was designed to work as a network monitor in VoIP applications, so certain hardware choices its designers made are not exactly mainstream and will require attention (more on that later).

In terms of administrative access, it's pretty spartan; the only option is the RJ-45 console.

Under the hood, we have an Intel Atom D510 processor (invisible in the photo, since it is located on the bottom side of the main board), a stick or RAM (my unit came with strangely generous 4 GB, so I wonder whether this was an upgrade done by the previous owner), a CF card slot (in the photo above, the CF card is removed), an Intel 82583V Ethernet controller, and an Intel 6230 Wi-Fi controller. Also present: a set of SATA ports (data and power) and internal space sufficient to install a SATA SSD or a 2.5-inch hard drive. There are four standoffs obviously intended for some sort of SATA device, but no mounting tray. Those adept at bending sheet metal should be able to fabricate such a tray (or an equivalent set of brackets) in a short order. In this HOWTO, however, we will stick to the CF card.

Power-wise, the device expects 12V / 3.33 A over a 5.5-mm barrel connector.

Note that the Wi-Fi card installed in the unit cannot work in access point mode, so I will not attempt to configure it here. In other words, we're going to set up a wired-only unit.

The 4 GB CF card that came with the unit appeared to be dead on arrival, so I had to dive into my parts bin, where I found a 128 MB CF card, which will be just perfect for our needs.

There were two hardware accessories that I needed for this install, (1) a console cable (I used the kind that connects the RJ-45 console port to a USB port on the administrator's computer), and (2) a USB adapter for the CF card. Also needed: a computer running Linux.

Overcoming the Initial Weirdness

When you first get your hands on a CAD-0208, you notice that the four Ethernet ports are grouped into two pairs. Ports E0 and E1 are collectively marked Bypass 1, ports E2 and E3, as Bypass 2. This is because each pair can be set up to provide bypass connectivity. For our needs, this is not necessary, so we're going to make sure that bypasses do not interfere with our setup. To do that, we'll have to dive into the BIOS.

While the CAD-0208 is off, connect it to the administrator's computer with a console cable. Then, start a console connection at 19200 bits per second (bps). In my case, this was done with a command-line utility called screen:

sudo screen /dev/ttyUSB0 19200

You can also use Putty or any other console utility, just set the correct connection speed.

Next, turn on the CAD-0208 and press the Tab key repeatedly until you get the main BIOS screen. Once there, press the right arrow key once; this will get you to the Advanced screen that will look like this:

  Main    Advanced    PCIPnP    Boot    Security    Chipset    Exit
********************************************************************************
* Advanced Settings                                   * Configure CPU.         *
* *************************************************** *                        *
* WARNING: Setting wrong values in below sections     *                        *
*          may cause system to malfunction.           *                        *
*                                                     *                        *
* * CPU Configuration                                 *                        *
* * IDE Configuration                                 *                        *
* * SuperIO Configuration                             *                        *
* * Hardware Health Configuration                     *                        *
* * ACPI Configuration                                *                        *
* * AHCI Configuration                                *                        *
* * ASF Configuration                                 *                        *
* * MPS Configuration                                 * *    Select Screen     *
* * PCI Express Configuration                         * **    Select Item      *
* * Smbios Configuration                              * Enter Go to Sub Screen *
* * Remote Access Configuration                       * F1    General Help     *
* * Trusted Computing                                 * F10   Save and Exit    *
* * USB Configuration                                 * ESC   Exit             *
* Bypass A Power On setting      [Normal]             *                        *
* Bypass B Power On setting      [Normal]             *                        *
********************************************************************************
            v02.61 (C)Copyright 1985-2006, American Megatrends, Inc.

Verify that both Bypass A Power On setting and Bypass B Power On setting in the bottom part of the screen are set to Normal. If not, use arrow keys and Enter to navigate to those fields and set them to Normal. Incidentally, if you've already noticed that in the BIOS, the bypasses are labeled A and B, while on the exterior of the device they are marked 1 and 2, congratulations! you're probably obsessive-compulsive. :smile:

If you had to change anything, use the right arrow key to get to the Exit screen, then select the Save and Exit option. (You could conceivably use F10 for that, but console connections often ignore function keys.)

At this point, you can turn the CAD-0208 off for a bit; we need to go get the software.

Getting the Software

Head to OpenWrt downloads site:

https://downloads.openwrt.org/

Find the Stable Release section and click on the version number (as of this writing, 22.03.2). Scroll toward the bottom of the page and click on x86. Then, click on generic.

Note: I don't know what possessed me to choose generic. It's entirely possible 64 would work, and work better. Oh well, if you do wizarding science, you should expect an occasional bewitching... :smile:

From there, download your installation image, either generic-squashfs-combined.img.gz or generic-ext4-combined.img.gz. I downloaded the ext4 image. Let me take a quick detour here and explain why.

Either image, when written onto a disk, results in a disk with two partitions, a boot partition and a root partition. The boot partition has ext2 file system in both cases and thus is writable on virtually all Linux systems. The root partition has either ext4 file system (also writable on virtually all Linux systems) or a squashfs file system (which is usually not writable on Linux systems). This is important because we will need to add one important file to our system disk (more on that below). So if you download the ext4 image, you can put that important file anywhere you want (I put it in the /root directory on the root partition, which is the home directory of the root user). If you download the squashfs image, you can put this file only somewhere on the boot partition, as the root partition will not be available for writing. There's nothing wrong with that, but the root partition is much larger (as of this writing, 104 MB vs 16 MB), so there's more room for the extra stuff...

Now, what's that important file I keep talking about? The CAD-0208 requires a driver for the Ethernet card. That driver is not included in the OpenWrt image, so we'll have to get it separately.

Right now, you're still on the download page for the x86 generic platform. Scroll down the page and click on packages/. This will take you to a list of packages available for your version of OpenWrt on your platform, Use your browser's in-page search function (Ctrl-F or whatever your case may be) to look for kmod-e1000e. (In my case, this netted me a file named kmod-e1000e_5.10.146-1_i386_pentium4.ipk.) Download this file to your computer.

Next, use your favorite image writing tool (dd, Etcher, what have you) to write the image you downloaded onto the CF card. When that is done, your Linux computer should be able to detect the two partitions on the card. Take a peek into each. One is going to contain only one directory called boot. This is the boot partition, The other will have a bunch of files and directories at the top level. That would be the root partition, Find the directory called root and copy your *.ipk file there. Chances are, you will get an Access denied error on the first try, so copy the file as root.

That's it for preparations. Time to install and configure OpenWrt.

Installation

Turn off the CAD-0208 and open the case. On CAD-0208, the top cover and the face place are combined into one piece. That piece is held in place by four Philips head screws, two on the bottom of the device near the front and one on each side, also near the front. Once you remove the four screws, the top/front cover easily slides forward, away from the device, exposing the main board. Install the CF card into its slot and close the cover. There's no need to put the screws back yet, but it makes sense to keep the cover on; it helps in cooling the processor (the unit has a small fan blowing air side to side, so putting the cover back on creates a tunnel for the air to flow through).

Connect the CAD-0208 to the administrator's computer with a console cable. Then, start a console connection at 38400 bps. In my case, again, this was done with screen:

sudo screen /dev/ttyUSB0 38400

And again, you can use Putty or any other console utility, just set the correct connection speed.

At first, you will see some garbage output (that would be the BIOS stuff that requires 19200 bps connection speed; you saw it before), but eventually, you should see the OpenWrt startup output. When you see the message asking you to press Enter to activate the console, do so. You will be shown the OpenWrt logo and taken to the command prompt.

Remember, right now, your CAD-0208 has no networking of any kind. To see if this is the case, you can run:

ip a

The only interface you will see would be lo (the loopback). This is clearly not what we want, so let's install the driver for the Ethernet card. Navigate to where you put that important file you downloaded. In my case, it was:

cd /root

You can run ls to verify that the *.ipk file is indeed there. Next, install it. Type opkg install kmod- and hit Tab; the shell will autocomplete the name. Hit Enter. OpenWrt will install the package. Once that happens, there will also be system messages about ports eth0, eth1, eth2, and eth3 doing various things.

Now let's configure the device.

Configuration

First, you need to decide how you want to configure the CAD-0208. I wanted to bridge ports eth0, eth1, and eth2 info a single LAN and designate eth3 as a WAN port. To that end, I ran:

vi /etc/config/network

This opened the network configuration file for editing. If you're familiar with vi, you can skip this paragraph. If not, vi takes a bit of getting used to. When you first start it, vi works read-only. To switch to the editing (or insert) mode, press i on the keyboard (i for insert). When you're done editing, press Esc; this will return you to the read-only mode. To exit, you need to be in the read-only mode. Type :x to save and exit or :q to exit without saving. This is the minimum vi skillset you will need.

Now back to regular programming... The first two sections of the network config file were config interface 'loopback' and config globals 'globals'; I left them unchanged, and then wrote the remainder of the file as follows:

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'
        list ports 'eth1'
        list ports 'eth2'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth3'
        option proto 'dhcp'

It's almost self-explanatory. First, we define a bridge called br-lan and assign three physical ports to it. Then, we define a LAN interface, associate it with the newly defined bridge, and assign an IP address and netmask to it (elsewhere, a DHCP server for the LAN interface is already configured with sensible defaults, so we don't have to do anything here). Finally, we define a WAN interface, assign a physical port to it, and tell OpenWrt to ask for an IP address from an upstream device. If your upstream router expects a device with a fixed IP address, read up on option proto 'static' and option ipaddr.

When you're done editing, save and exit (Esc, then :x), To verify that the changes were saved, you can do:

cat /etc/config/network

To apply the new network configuration, you can restart the networking to apply the new configuration:

/etc/init.d/network reload

but I chose to reboot the whole thing instead:

reboot

Once you verified that everything works correctly, put the four screws back where they belong.

Housekeeping Tasks

At this point, there is one thing that you really should do and one thing that you may consider doing.

What you really should do is to set the root password, as right now, you have none. Type passwd in the command line and follow the prompts.

What you may consider doing is expanding the size of the root partition. When OpenWrt image is written on a disk, two partitions are created, and their sizes are fixed. As of this writing, the sizes of the two partitions are approximately 16 MB and 104 MB. This means that even on our tiny 128 MB CF card, we still have a few megabytes of usable space left, which we can absorb into the root partition. This might help if, for example, you plan to introduce additional packages to your setup some time down the road. In the interest of shameless self-promotion, here's a link to a HOWTO I wrote specifically on this topic:

[HOWTO] Resizing root partition on x86 (November 2022 edition)

Concluding Notes

If everything went well, you now have a working four-port wired router/firewall. What you don't have is wireless networking. The wireless card installed on the device (Intel 6230) cannot be used in access point mode, but it should be possible (with some extra configuration not covered here) to use the CAD-0208 as a bridge, to connect wired devices to an existing wireless network. It should also be possible to replace this card with a card that does support the access point mode. The currently installed card is half-size, but it appears that the slot it sits in would accept a full-size card as well. This, in combination with active cooling, means that you can potentially have AC or even AX wireless networking on this unit.

...And a Big Fat Postscript

In the Getting the Software section, I admitted to the mistake of using the generic image when a 64 image might be more appropriate. Upon reflection, however, this mistake was embarrassingly easy to fix:

cd /tmp
wget https://downloads.openwrt.org/releases/22.03.2/targets/x86/64/openwrt-22.03.2-x86-64-generic-squashfs-combined.img.gz
sysupgrade openwrt-22.03.2-x86-64-generic-squashfs-combined.img.gz

I did this over a console connection, but it could be done over SSH just as easily.

The first command (cd) changed the working directory to /tmp, where all kinds of temporary data are stored.

The second command (wget) downloaded the installation image for the 64 target. This time around, I thought I'd try a squashfs image for a change. How did I find the URL for the download? Same way I described in the Getting the Software section, except I went to the 64 target instead of the generic target.

The third command (sysupgrade) performed a system upgrade using the downloaded file as installation source.

The upgrade completed without a hitch. Once everything copied over, the router restarted. All system-level settings, including the root password I set, were preserved, so no additional configuration was required. Even the kmod-e1000e package, which I installed separately, somehow persisted.

Note: I don't know why kmod-e1000e persisted. There are at least two possible reasons, (1) OpenWrt downloaded and installed the target-appropriate version of kmod-e1000e as a part of sysupgrade, or (2) I just lucked out, and kmod-e1000e was included in the 64 installation package, even though it is not present in the generic package. If anyone has a clue, please respond below.

Once the router restarted, it began to output garbage over the console connection. Or, rather, it began to operate at 115200 bps connection speed. As the router was rebooting, I ended the console session and started another one at 115200 bps. This fixed things instantly. An important takeaway: if you're learning from my mistakes and decide to do things correctly on the first try, install 64-bit version of OpenWrt over a 115200 bps connection.

A few additional non-kmod packages I installed, however, have been lost in sysupgrade and had to be reinstalled manually.

Check (and probably replace) the BIOS battery on any newly acquired old x86 hardware.

e1000e is included in x86-64 builds. It's a very common chip. Some e1000e chips have a bug/ incompatibility with Linux that requires turning off TCP optimization.

I'm guessing that when the power is off, the bypass relays close and connect the ports together by hardware. This can cause problems like one of your LAN devices DHCP leasing the only public IP address from the ISP modem.

2 Likes

Thank you for the clarification! I do realize that e1000e NICs are very common, and I thought it was strange that kmod-e1000e wasn't present in the x86-generic image...

Great advice on the CMOS battery, too! :smile:

Is there a reason you don't place these "howtos" in the Wiki?

Several:

  • Inappropriate style (I write up adventures in networking, rather than compose serious documentation)
  • Occasionally non-standard hardware (as in, "I threw out the old honkin' 320 GB hard drive that came with the unit and put in a 16 GB SSD instead")
  • Narrow scope (what I do is definitely device-specific and probably version-specific; in this HOWTO, for example, there's a section on dealing with the bypasses, which is applicable only to this deice and its clones; although I suppose this could in fact be useful on a device page; maybe I should make a device page for the CAD-0208 after all)
  • Divergent target audiences (the wiki, to me, looks like it's written for experienced users, while I try to write for a curious newbie; hence, endless detours into what console cables are or how to use vi)
  • Complete lack of connection to the developers (for example, I just admitted that I don't understand the details of how sysupgrade works; were I writing for the wiki, I would feel obligated to ask a developer for clarification, rather than put forward guesses)

In a perfect world, I'd love to get involved with the OpenWrt documentation team. Right now, however, I can't contribute consistently. So I contribute what I can when I can. Google can find it on the forum just as easily as on the wiki (in fact, right now, this thread is Google's number one result for "OpenWrt Caswell")...