THIS BLOG HAS MOVED!

I recently moved this blog to my new self-hosted domain. This domain is kept up and running for archival purposes.

The new site is at https://demiblog.tk

 

Advertisements

Revive a Cisco IDS into a capable OpenBSD computer!

Even though Cisco equipment is very capable, it tends to become End-of-Life before you can say “planned obsolescence”. Websites become bigger, bandwidths increase, and as a side effect of those “improvements”, routers, firewalls, and in this case, intrusion prevention systems get old quicker and quicker.

Apparently, this was also the case for the Cisco IDS-4215 Intrusion Detection Sensor that I was given a few months ago.

I’m not too proud to admit that at first, I didn’t care about the machine itself, but rather about the add-on PCI network card with 4 Fast Ethernet interfaces. The sensor has obviously seen better days, as it had a broken front panel and needed some cleaning, but upon a closer inspection under the hood  (which is held closed by the 4 screws on top), this IDS consists of an embedded Celeron PC with two onboard Ethernet cards, a 2.5″ IDE hard disk, a CF card, and 2 PCI expansion slots (more on them later). Oh, and don’t forget the nasty server-grade fan, which pushed very little air for the noise it was making.

First off, the fan needed immediate replacing with a sleeve-bearing 80mm Cooler master. The whole fan assembly can be unscrewed with ease, and after that, the new fan can be slid in. The fan connector is 2-pin, labeled JP6 on the motherboard. I cut off the connector from the original fan and soldered it to the new one. The results are aesthetically pleasing, and most importantly working correctly. To prevent the power cables from entering the fan blades, twist the connector once or twice, and the cable torsion will keep them in the air, not touching the fan.

Storage-wise, the IDS has a 256 MB CompactFlash card, probably as a boot drive, and a 40 GB IDE hard drive for data. I replaced the hard drive with a 120 GB one, as I had one on hand, but held on to the CF card, as I used it in the installation process.

Processing is done by a passively cooled Celeron in a PGA370 socket, paired with two sticks of USA-made RAM, totaling to 512MB.

Onboard network is done by two Intel 82559 PRO/100 Fast Ethernet cards, which can be (and in my case also were) expanded with PCI expansion card(s). Apart from that, the board also has one USB 1.1 port and a standard Cisco RS232 console connector. It has no onboard video or audio, which is expected for an embedded network appliance.

Installing OpenBSD

So, how do you get around installing an operating system on a computer which has no video output nor console redirection? For Windows and most Linux distros, you can’t, but OpenBSD, an *nix-like OS, does it beautifully, because it uses console out-of-the-box! So, let’s get started with the installation.

You can grab the newest OpenBSD from one of it’s worldwide mirrors. I prefer https://cdn.openbsd.org, as it’s hosted on a world-wide CDN as the name suggests. Navigate to the OpenBSD folder, and then to the latest version, 6.4 at the time this article was written. Select the target architecture, which is i386, and download the miniroot.fs image. Use an image flasher like Etcher to flash the image to the CF card, and insert it into the appropriate slot in the IDS. Then slide the disk caddy over it, and screw it in. plug in the console, Ethernet 0, and power. Then open a terminal emulator like PuTTY on the serial port connected to the console at 9600 baud. Turn the IDS on.

The console should come alive and you can begin the installation process. User input is in bold, my comments are in Italic bold.

CISCO SYSTEMS IDS-4215
Embedded BIOS Version 5.1.7 03/02/04 11:20:35.01
Compiled by dnshep
Evaluating Run Options ...
Check for Valid Disk Image
Using drive 0, partition 3.
Loading...........
probing: pc0 com0 com1 mem[632K 511M a20=on]
disk: fd0 hd0+ hd1+
>> OpenBSD/i386 BOOT 3.34

Here, we need to tell OpenBSD to use the console at 9600 baud.
boot> stty com0 9600
boot> set tty com0
switching console to com0
> OpenBSD/i386 BOOT 3.34
boot> <hit Enter>
cannot open hd0a:/etc/random.seed: No such file or directory
booting hd0a:/bsd: 3111423+1360896+3362824+0+454656=0x7ea1e4
entry point at 0x2000d4

Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 6.4 (RAMDISK_CD) #916: Thu Oct 11 14:00:12 MDT 2018
    deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/RAMDISK_CD


Kernel boot messages omitted for simplicity

Welcome to the OpenBSD/i386 6.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
fd1 at fdc0 drive 1: density unknown
i
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN.  You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.

Terminal type? [vt220] <Enter>
System hostname? (short form, e.g. 'foo') delta


In this sections, we configure the network interfaces.
Available network interfaces are: fxp0 fxp1 fxp2 fxp3 fxp4 fxp5 vlan0.
Which network interface do you wish to configure? (or 'done') [fxp0]
IPv4 address for fxp0? (or 'dhcp' or 'none') [dhcp] <Enter>
fxp0: no lease.... got lease
fxp0: bound to 192.168.64.120 from 192.168.64.1 (64:6e:ea:45:4e:c2)
IPv6 address for fxp0? (or 'autoconf' or 'none') [none] <Enter>
Available network interfaces are: fxp0 fxp1 fxp2 fxp3 fxp4 fxp5 vlan0.
Which network interface do you wish to configure? (or 'done') [done] <Enter>
Using DNS domainname Home
Using DNS nameservers at 192.168.64.1


Here, we configure the password and login options
Password for root account? (will not echo) <enter the password>
Password for root account? (again) <repeat the password>
Start sshd(8) by default? [yes] <Enter>
Change the default console to com0? [yes] <Enter>
Available speeds are: 9600 19200 38400 57600 115200.
Which speed should com0 use? (or 'done') [9600] <Enter>
Setup a user? (enter a lower-case loginname, or 'no') [no] <Enter>
Since no user was setup, root logins via sshd(8) might be useful.
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no] yes
What timezone are you in? ('?' for list) [Europe/Ljubljana] <Enter>

Available disks are: wd0 wd1.
Which disk is the root disk? ('?' for details) [wd0] ?

Here, we see two disks, wd0 being the CF card and wd1 being the actual HDD
wd0: STI Flash 7.4.0  (0.2G)
wd1: WDC WD1200BEVE-00WZT0  (111.8G)
Available disks are: wd0 wd1.
Which disk is the root disk? ('?' for details) [wd0] wd1
Disk: wd1       geometry: 14593/255/63 [234441648 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused
*3: A6      0   1   2 -  14592 254  63 [          64:   234436481 ] OpenBSD

I usually use the whole disk just to be sure.
Use (W)hole disk, use the (O)penBSD area or (E)dit the MBR? [OpenBSD] w
Setting OpenBSD MBR partition to whole wd1...done.
The auto-allocated layout for wd1 is:
#                size           offset  fstype [fsize bsize   cpg]
  a:          1024.0M               64  4.2BSD   2048 16384     1 # /
  b:           767.6M          2097216    swap
  c:        114473.5M                0  unused
  d:          4096.0M          3669184  4.2BSD   2048 16384     1 # /tmp
  e:          5119.1M         12057760  4.2BSD   2048 16384     1 # /var
  f:          2048.0M         22541696  4.2BSD   2048 16384     1 # /usr
  g:          1024.0M         26736000  4.2BSD   2048 16384     1 # /usr/X11R6
  h:         16667.3M         28833152  4.2BSD   2048 16384     1 # /usr/local
  i:          2048.0M         62967840  4.2BSD   2048 16384     1 # /usr/src
  j:          6144.0M         67162144  4.2BSD   2048 16384     1 # /usr/obj
  k:         75533.0M         79745056  4.2BSD   2048 16384     1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] a
/dev/rwd1a: 1024.0MB in 2097152 sectors of 512 bytes
6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1k: 75533.0MB in 154691488 sectors of 512 bytes
374 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1d: 4096.0MB in 8388576 sectors of 512 bytes
21 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1f: 2048.0MB in 4194304 sectors of 512 bytes
11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1g: 1024.0MB in 2097152 sectors of 512 bytes
6 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1h: 16667.3MB in 34134688 sectors of 512 bytes
83 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1j: 6144.0MB in 12582912 sectors of 512 bytes
31 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1i: 2048.0MB in 4194304 sectors of 512 bytes
11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
/dev/rwd1e: 5119.1MB in 10483936 sectors of 512 bytes
26 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
Available disks are: wd0.
Which disk do you wish to initialize? (or 'done') [done]
/dev/wd1a (b6d12e2ee02e892e.a) on /mnt type ffs (rw, asynchronous, local)
/dev/wd1k (b6d12e2ee02e892e.k) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd1d (b6d12e2ee02e892e.d) on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd1f (b6d12e2ee02e892e.f) on /mnt/usr type ffs (rw, asynchronous, local, nodev)
/dev/wd1g (b6d12e2ee02e892e.g) on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev)
/dev/wd1h (b6d12e2ee02e892e.h) on /mnt/usr/local type ffs (rw, asynchronous, local, nodev)
/dev/wd1j (b6d12e2ee02e892e.j) on /mnt/usr/obj type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd1i (b6d12e2ee02e892e.i) on /mnt/usr/src type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/wd1e (b6d12e2ee02e892e.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid)

Let's install the sets!
Location of sets? (disk http or 'done') [http]
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]<Enter>
HTTP Server? (hostname, list#, 'done' or '?') [www.obsd.si] cdn.openbsd.org
Server directory? [pub/OpenBSD/6.4/i386] <Enter>

Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
    [X] bsd           [X] comp64.tgz    [X] xbase64.tgz   [X] xserv64.tgz
    [X] bsd.rd        [X] man64.tgz     [X] xshare64.tgz
    [X] base64.tgz    [X] game64.tgz    [X] xfont64.tgz
Set name(s)? (or 'abort' or 'done') [done] <Enter>

At this point, the installation will start. 
This may take a while, depending on your internet speed

Get/Verify SHA256.sig   100% |**************************|  1963       00:00
Signature Verified
Get/Verify bsd          100% |**************************| 12978 KB    00:05
Get/Verify bsd.rd       100% |**************************|  8571 KB    00:03
Get/Verify base64.tgz   100% |**************************|   152 MB    00:52
Get/Verify comp64.tgz   100% |**************************| 59013 KB    00:22
Get/Verify man64.tgz    100% |**************************|  7087 KB    00:03
Get/Verify game64.tgz   100% |**************************|  2628 KB    00:01
Get/Verify xbase64.tgz  100% |**************************| 16481 KB    00:06
Get/Verify xshare64.tgz 100% |**************************|  4432 KB    00:02
Get/Verify xfont64.tgz  100% |**************************| 39342 KB    00:13
Get/Verify xserv64.tgz  100% |**************************| 11573 KB    00:05
Installing bsd          100% |**************************| 12978 KB    00:01
Installing bsd.rd       100% |**************************|  8571 KB    00:00
Installing base64.tgz   100% |**************************|   152 MB    00:38
Extracting etc.tgz      100% |**************************|   259 KB    00:00
Installing comp64.tgz   100% |**************************| 59013 KB    00:21
Installing man64.tgz    100% |**************************|  7087 KB    00:04
Installing game64.tgz   100% |**************************|  2628 KB    00:00
Installing xbase64.tgz  100% |**************************| 16481 KB    00:05
Extracting xetc.tgz     100% |**************************|  6963       00:00
Installing xshare64.tgz 100% |**************************|  4432 KB    00:04
Installing xfont64.tgz  100% |**************************| 39342 KB    00:11
Installing xserv64.tgz  100% |**************************| 11573 KB    00:03
Location of sets? (disk http or 'done') [done] <Enter>
Saving configuration files... done.
Making all device nodes... done.
Relinking to create unique kernel... done.

CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the 'mail' command.

Exit to (S)hell, (H)alt or (R)eboot? [reboot] h
syncing disks... done

The operating system has halted.
Please press any key to reboot.

When you reach this point, kill the power, reopen the IDS and remove the CF card, as we don’t need it anymore. Close the IDS up.

That’s it! The IDS is now a fully capable OpenBSD computer.

Caveats

Even though these IDSes are awesome, they have some caveats that can take a lot of your time trying to get around them.

  • These machines have no ACPI, and as a consequence, have no power management. They can’t shut down from software and they can’t do Wake on LAN, obviously. A graceful shutdown is performed by halting the machine, and then turning the power switch off.
  • The PCI bus has problems with interrupt allocation, making it impossible to use both of the expansion slots. I am not too familiar with device drivers in OpenBSD, but the issue is probably solvable. If anyone knows how to troubleshoot such problems, please contact me and I will update this guide.

Additional improvements…

  • It is possible to upgrade the RAM, HDD, and even the CPU, just make sure that the power consumption stays under 50W.
  • I swapped the 4-interface Fast Ethernet card for a gigabit one. You can put any PCI card inside this machine, however, only one of the slots will ever work (at least for now, see caveats)
  • If preferred, OpenBSD can be installed on a (bigger) CF card to give the machine a speed boost. Instead, the HDD must be used as the installation drive, and the CF card as the target. However, I found out that the speed boost is pretty minuscule and simply isn’t worth the time to set up.

Run an outdated cluster with diskless OpenBSD and cute little green boxes (part 2)

In the first part, we became familiar with the hardware we’ll be working on and gathered the needed information. In this part, we focus on making PXE work up to the point we’re able to get to the boot loader and load a kernel.

Now, we connect a Cisco console cable into the designated console port on the modified Cisco IDS. I connected the internet to fxp0 port, and the cluster part to the fxp1 port. Baud rate is 9600, as this is Cisco equipment.

Log into OpenBSD and install the Nano editor by running

login: root
Password:
Last unsuccessful login: Mon Dec 31 15:51:16 on tty00
OpenBSD 6.4 (GENERIC) #926: Thu Oct 11 13:43:06 MDT 2018

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Please use the sendbug(1) utility to report bugs in the system.
Before reporting a bug, please try to reproduce it with the latest
version of the code.  With bug reports, please try to ensure that
enough information to reproduce the problem is enclosed, and if a
known fix for it exists, include that as well.

You have new mail.
delta# pkg_add nano
quirks-3.16 signed on 2018-10-13T13:42:51Z
quirks-3.16: ok
nano-3.1:libiconv-1.14p3: ok
nano-3.1:gettext-0.19.8.1p1: ok
nano-3.1: ok
delta#

This will help us with easier editing of configuration files, because the by-default installed vi editor can be confusing to newbies.

First, we configure the /etc/hosts file that will map hostnames of our clients to their IPs. Open the file by running “nano /etc/hosts” and add the following lines to the end of the file:

192.168.10.11 earth
192.168.10.12 wind
192.168.10.13 fire

The file now looks like this:

127.0.0.1 localhost
::1 localhost

192.168.10.11 earth
192.168.10.12 wind
192.168.10.13 fire

Exit nano by pressing Ctrl-x and then y, then Enter.

The next file we will edit is /etc/ethers that contains the MAC adresses and maps them to their hostnames:

00:00:24:C4:55:78 earth
00:00:24:C4:56:18 wind
00:00:24:C4:56:14 fire

Then run these comands, enabling RARP daemon to run on the fxp1 interface

delta# rcctl enable rarpd
delta# rcctl set rarpd flags fxp1
delta# rcctl start rarpd

Then create a new directory /var/tftpboot and enter it

delta# mkdir /var/tftpboot
delta# cd /var/tftpboot/

Then download the bootloader and kernels by running

delta# ftp https://cdn.openbsd.org/OpenBSD/6.4/i386/pxeboot
Trying 151.101.14.217...
Requesting https://cdn.openbsd.org/OpenBSD/6.4/i386/pxeboot
100% |**************************************************| 91700       00:00
91700 bytes received in 0.18 seconds (490.03 KB/s)
delta# ftp https://cdn.openbsd.org/OpenBSD/6.4/i386/bsd
Trying 151.101.14.217...
Requesting https://cdn.openbsd.org/OpenBSD/6.4/i386/bsd
100% |**************************************************| 12978 KB    00:03    ^[[A
13289940 bytes received in 3.96 seconds (3.20 MB/s)
delta# ftp https://cdn.openbsd.org/OpenBSD/6.4/i386/bsd.rd
Trying 151.101.14.217...
Requesting https://cdn.openbsd.org/OpenBSD/6.4/i386/bsd.rd
100% |**************************************************|  8571 KB    00:03
8777021 bytes received in 3.42 seconds (2.45 MB/s)
delta#

Then we create the instructions for the bootloader to use the console instead of the non-existent video card and boot the ramdisk kernel just to prove the system works.

delta# mkdir etc
delta# nano etc/boot.conf

Edit the file to say:

stty com0 19200
set tty com0
boot bsd.rd

Save the file and run:

delta# rcctl enable tftpd
delta# rcctl set tftpd flags /var/tftpboot

Now, we will configure the DHCP server. Edit /etc/dhcpd.conf to say:

subnet 192.168.10.0 netmask 255.255.255.0 {
        group {
        filename "pxeboot";
        next-server 192.168.10.1;

        host earth {
        fixed-address 192.168.10.11;
        hardware ethernet 00:00:24:C4:55:78;
        }

        host wind {
        fixed-address 192.168.10.12;
        hardware ethernet 00:00:24:C4:56:18;
        }

        host fire {
        fixed-address 192.168.10.13;
        hardware ethernet 00:00:24:C4:56:14;
        }
}}

And /etc/hostname.fxp1 (the interface facing the clients) to say:

inet 192.168.10.1

Reboot by running ‘reboot’ and when machine reboots, everything should work correctly.

Now we switch the console port to the first Soekris, change the baudrate to 19200 and turn on the power…

POST: 0123456789bcefghipajklnopq,,,tvwxy

comBIOS ver. 1.28  20050527  Copyright (C) 2000-2005 Soekris Engineering.

net45xx

0064 Mbyte Memory                        CPU 80486 133 Mhz


Slot   Vend Dev  ClassRev Cmd  Stat CL LT HT  Base1    Base2   Int
-------------------------------------------------------------------
0:00:0 1022 3000 06000000 0006 2280 00 00 00 00000000 00000000
0:18:0 100B 0020 02000000 0107 0290 00 3F 00 0000E001 A0000000 10

 1 Seconds to automatic boot.   Press Ctrl-P for entering Monitor.

NSC DP83815/DP83816 Fast Ethernet UNDI, v1.03
Copyright (C) 2002, 2003 National Semiconductor Corporation
All rights reserved.

Pre-boot eXecution Environment  PXE-2.0 (build 082)
Copyright (C) 1997-2000  Intel Corporation


CLIENT MAC ADDR: 00 00 24 C4 55 78
CLIENT IP: 192.168.10.11  MASK: 255.255.255.0  DHCP IP: 192.168.10.1
probing: pc0 com0 com1 pci pxe![2.1] mem[639K 63M a20=on]
disk:
net: mac 00:00:24:c4:55:78, ip 192.168.10.11, server 192.168.10.1
>> OpenBSD/i386 PXEBOOT 3.30
>> OpenBSD/i386 PXEBOOT 3.30
booting tftp:bsd.rd: 3111423+1360896+3362824+0+454656 [363995+98+289392+283301]=0x8ced6c
entry point at 0x2000d4

Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 6.4 (RAMDISK_CD) #916: Thu Oct 11 14:00:12 MDT 2018
    deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/compile/RAMDISK_CD
real mem  = 66646016 (63MB)
avail mem = 56418304 (53MB)
mainbus0 at root
bios0 at mainbus0: date 20/50/27, BIOS32 rev. 0 @ 0xf7840
pcibios0 at bios0: rev 2.0 @ 0xf0000/0x10000
pcibios0: pcibios_get_intr_routing - function not supported
pcibios0: PCI IRQ Routing information unavailable.
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc8000/0x9000
cpu0 at mainbus0: (uniprocessor)
cpu0: AMD Am486DX4 W/B or Am5x86 W/B 150 ("AuthenticAMD" 486-class), 04-09-04
cpu0: FPU
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "AMD ElanSC520 PCI" rev 0x00
sis0 at pci0 dev 18 function 0 "NS DP83815 10/100" rev 0x00, DP83816A: irq 10, address 00:00:24:c4:55:78
nsphyter0 at sis0 phy 0: DP83815 10/100 PHY, rev. 1
isa0 at mainbus0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
wdc1 at isa0 port 0x170/8 irq 15
wd0 at wdc1 channel 0 drive 0: <064MB ATA Flash Disk>
wd0: 1-sector PIO, LBA, 61MB, 125056 sectors
wd0(wdc1:0:0): using BIOS timings
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
softraid0 at root
scsibus0 at softraid0: 256 targets
PXE boot MAC address 00:00:24:c4:55:78, interface sis0
root on rd0a swap on rd0b dump on rd0b
WARNING: clock time much less than file system time
WARNING: using file system time
WARNING: CHECK AND RESET THE DATE!
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/i386 6.4 installation program.
Starting non-interactive mode in 5 seconds...
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
sis0: bound to 192.168.10.11 from 192.168.10.1 (00:1a:a2:a4:64:bb)

Yay! As you can see, we have the PXE portion sorted out, enabling us to boot a working install kernel for OpenBSD.

This concludes part 2, tune in next time, when I will show you how to boot from a preinstalled NFS share.

Run an outdated cluster with diskless OpenBSD and cute little green boxes

Does anyone remember Soekris Engineering, the company that made network hardware and somehow also audiophile equipment? The first part of the company has unfortunately closed down in April 2017, while the latter still persists today. However, we won’t be focusing on high-fidelity audio in this guide, but rather on squeezing the last bits of life out of their old products.

A brief history of SoekrisIMG_0966.JPG

In the early 2000s, if you wanted to build an access point based on Linux (or any *nix), Soekris net- series of boards was the most commonly used and praised choice. In Wireless Hacks (2003) by Rob Flickenger, he describes Soekris boards as a “popular choice among do-it-yourself networkers” and stating that they work well as wireless access points. Unfortunately, as respected as those products were, the sales of them declined, their main competition being Asian products along other European manufacturers like PC Engines, which is still around today. Another nail in the coffin was when AMD stopped producing Elan and Geode line of low-power SoCs and CPUs needed to make the boards, and the once dominant manufacturer finally kicked the bucket, announcing that the remaining stock can be bought from their company in Denmark, Soekris Europe.

The net4526

IMG_0960.JPGIMG_0977.JPGIMG_0976.JPG

The boards that I have are 3 AP-oriented net4526 models, indicated by their small footprint and the lack of multiple Ethernet ports.  Processing is provided by an AMD Elan SC520 System-on-Chip clocked at either 100 or 133 MHz, paired with 64 MB of onboard SDRAM. Storage is sparse at most, varying from 16 to 128 MB soldered CF, with my boards having 64MB. Expansion-wise, the boards I have have 2 miniPCI slots, a few GPIO pins, and that’s about it. Networking is provided by the onboard 10/100 Mbit Ethernet card. Like the Cisco IDS I featured in my last article, they don’t have no user interface except for the serial console clocked at 19200 baud, with a surprisingly capable and customizable BIOS that supports VGA redirection. Power can be provided either via PoE (Power over Ethernet) or through a standard barrel jack with a wide voltage range accepting from 11 to 56 volts.

The cluster

So, now that we know what these green boxes have to offer, let’s talk about what we’ll do with them! The idea is to run them diskless, booting from PXE and using a network-attached NFS filesystem with OpenBSD. To do that, we need a DHCP, TFTP, Bootparam server, a router, a NAS, but what if we combine them into a single machine running OpenBSD? It’s definitely possible, and I will show you how.

The cluster master will be *drum roll* the Cisco IDS from the previous article. It’s got a more-than sufficient hard drive and 6 network interfaces which are more than enough considering that we need only two. One is connected to my home LAN with access to the internet, and the other connected to the Soekris boards, named Earth, Wind and Fire after everybody’s favorite band. The network topology is simple and looks like this:

IMG_0981.JPGThe repurposed IDS acts in this case as a router, DNS server and stateful firewall, but also as all the servers needed to provide diskless booting to the three boards. This versatility is why I love OpenBSD so much.

Gathering MAC adresses (also, PXE 101)

If you’ve read the diskless(8) man page of OpenBSD, you know that the first step in the diskless boot process is handled by the network card’s Preboot eXecution Environment, commonly known as PXE. When PXE starts, it asks the local DHCP server for a lease. Hopefully, if everything is right, the server replies with an IP address lease containing a filename and an IP adress of a TFTP server on the local network containing the mentioned filename. The card downloads the file pointed to by the DHCP server and executes it.

Ergo, for the PXE boot to work correctly, we need a DHCP server which can distiguish between individual clients using their MAC address, and a TFTP server which will serve them the initial boot files.IMG_0982.JPG

Time to dig into the hardware! As usual when dealing with serial consoles, we need an adapter. My motherboard already has onboard serial, so I connect it to that and fire up a terminal emulator at 19200 baud (could also be a different baudrate, depends), then connect it to the first Soekris and turn the power on.

POST: 0123456789bcefghipajklnopq,,,tvwxy

comBIOS ver. 1.28  20050527  Copyright (C) 2000-2005 Soekris Engineering.

net45xx

0064 Mbyte Memory                        CPU 80486 133 Mhz


Slot   Vend Dev  ClassRev Cmd  Stat CL LT HT  Base1    Base2   Int
-------------------------------------------------------------------
0:00:0 1022 3000 06000000 0006 2280 00 00 00 00000000 00000000
0:18:0 100B 0020 02000000 0107 0290 00 3F 00 0000E001 A0000000 10

 3 Seconds to automatic boot.   Press Ctrl-P for entering Monitor.
Hit CTRL-P here
comBIOS Monitor.   Press ? for help.

> ?
comBIOS Monitor Commands

boot [drive][:partition] INT19 Boot
reboot                   cold boot
download                 download a file using XMODEM/CRC
flashupdate              update flash BIOS with downloaded file
time [HH:MM:SS]          show or set time
date [YYYY/MM/DD]        show or set date
d[b|w|d] [adr]           dump memory bytes/words/dwords
e[b|w|d] adr value [...] enter bytes/words/dwords
i[b|w|d] port            input from 8/16/32-bit port
o[b|w|d] port value      output to 8/16/32-bit port
run adr                  execute code at adr
cmosread [adr]           read CMOS RAM data
cmoswrite adr byte [...] write CMOS RAM data
cmoschecksum             update CMOS RAM Checksum
set parameter=value      set system parameter to value
show [parameter]         show one or all system parameters
?/help                   show this help

> show

ConSpeed = 19200
ConLock = Enabled
ConMute = Disabled
BIOSentry = Enabled
PCIROMS = Enabled
PXEBoot = Enabled
FLASH = Secondary
BootDelay = 5
FastBoot = Disabled
BootPartition = Disabled
BootDrive = 80 81 F0 FF
ShowPCI = Enabled
Reset = Hard
> set pxeboot=enabled

> set bootdrive=F0 sets it to boot from the network

> show

ConSpeed = 19200
ConLock = Enabled
ConMute = Disabled
BIOSentry = Enabled
PCIROMS = Enabled
PXEBoot = Enabled
FLASH = Secondary
BootDelay = 5
FastBoot = Disabled
BootPartition = Disabled
BootDrive = 00 F0 FF FF
ShowPCI = Enabled
Reset = Hard

>

So, to recap, we need to enter the serial console, and enable PXE then set the bios to boot first from the PXE. Power cycle the machine and wait for the PXE prompt.

comBIOS ver. 1.28  20050527  Copyright (C) 2000-2005 Soekris Engineering.

net45xx

0064 Mbyte Memory                        CPU 80486 133 Mhz


Slot   Vend Dev  ClassRev Cmd  Stat CL LT HT  Base1    Base2   Int
-------------------------------------------------------------------
0:00:0 1022 3000 06000000 0006 2280 00 00 00 00000000 00000000
0:18:0 100B 0020 02000000 0107 0290 00 3F 00 0000E001 A0000000 10

 1 Seconds to automatic boot.   Press Ctrl-P for entering Monitor.
00:00:24:C4
NSC DP83815/DP83816 Fast Ethernet UNDI, v1.03
00:00:24:C4
Copyright (C) 2002, 2003 National Semiconductor Corporation
All rights reserved.

Pre-boot eXecution Environment PXE-2.0 (build 082)
Copyright (C) 1997-2000 Intel Corporation


CLIENT MAC ADDR: 00 00 24 C4 55 78

The line we are interested in is in bold. Write the address down.

Now we repeat this same procedure for all of the machines we have. At the end, we have 3 MAC addresses, for each machine one.

Earth - 00:00:24:C4:55:78
Wind  - 00:00:24:C4:56:18
Fire  - 00:00:24:C4:56:14

This concludes part 1 of the outdated cluster. Tune in next time for part two, where we will set up everything needed to get into the bootloader over PXE!

P.S. Happy New Year!

The Matchbox Screamer – Part One

Recently, I’ve ran across a lot of TDA7231 chips in my workshop and figured out I’d use them for something. That something turned out to be a stereo 1.6W audio amplifier, which I named the Matchbox Screamer. Here’s the circuit diagram:

schematic

The circuit is based on the example circuit in the datasheet and is designed to operate voltage-independent. The voltage range is 1.8-15 V, with which also varies the output power. That means it can be powered from basically whatever you desire, from li-ion batteries, to USB, to 9V batteries.

I still have to etch the PCB for the thing and will post an update when I build and test it.