Build a Linux-Based Single-Board WAP (Part 2)
Using single-board computers and Linux, you can build robust, secure wireless access points and routers custom-configured to your specs.
Last week we learned all about Soekris hardware and what you need to make it go. Today we'll hook it up and take it for a spin, and then install Pyramid Linux.
Pyramid Linux is maintained by Metrix Communication, LLC. Metrix sells Soekris bundles for wireless networks, including weatherproof enclosures, radio cards, antennas and power-over-Ethernet adapters. Pyramid Linux is Ubuntu-based. It's a free download from the good folks at Metrix, available either as a source tarball or image file. Installed, it occupies about 48 megabytes. Inside that scrawny little Linux are a large number of goodies:
- Web-based graphical administration
- wireless access point
- DHCP server and relay
- caching DNS forwarder
- SSH administration
- excellent wireless support
Plus most of the usual Debian commands and configuration files, with a notable exception: none of the usual Debian package management tools, such as apt-get or dpkg, are present. If you want something that isn't included, you'll have to rebuild the image.
Before we leap into Pyramid fun, let's boot up the Soekris and poke around its innards. You need a null modem serial cable connecting the Soekris board to a PC, and some kind of serial communication program. Don't power up the Soekris board yet. Linux users, grab Minicom and follow me. If it's not already installed, Minicom is only an apt-get install minicom or yum install minicom away.
First find out what physical serial ports you have:
$ setserial -g /dev/ttyS
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: unknown, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
Well that's easy - there is only one. If there is no UART, there is no serial port. Most modern PCs only have one or two. If there is more than one it might take a bit of trial and error to figure out which one your serial cable is connected to.
Now start up Minicom:
# minicom -s
| Filenames and paths
| File transfer protocols
| Serial port setup
| Modem and dialing
| Screen and keyboard
| Save setup as dfl
| Save setup as..
| Exit from Minicom
Select "serial port setup". Your settings should look just like this, except you need to enter your own serial port address:
| A - Serial Device : /dev/ttyS0
| B - Lockfile Location : /var/lock
| C - Callin Program :
| D - Callout Program :
| E - Bps/Par/Bits : 19200 8N1
| F - Hardware Flow Control : No
| G - Software Flow Control : No
| Change which setting?
The default serial port speed of Soekris boards is 19200, 8N1. If you select the wrong speed, you'll see all kinds of gibberish characters when you connect.
Next, select the "Modem and dialing" option, and make sure the "Init string" and "Reset string" settings are blank. Finally, select "Save setup as dfl" to make this the default, and then "Exit". This takes you back to the main Minicom screen:
Welcome to minicom 2.1
OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Nov 5 2005, 15:45:44.
Press CTRL-A Z for help on special keys
Power up the Soekris, and you'll see this:
comBIOS ver. 1.15 20021013 Copyright (C) 2000-2002 Soekris Engineering.
0064 Mbyte Memory CPU 80486 133 Mhz
PXE-M00: BootManage UNDI, PXE-2.0 (build 082)
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 00
0:16:0 168C 0013 02000001 0116 0290 10 3C 00 A0000000 00000000 10
0:17:0 104C AC51 06070000 0107 0210 10 3F 82 A0010000 020000A0 11
0:17:1 104C AC51 06070000 0107 0210 10 3F 82 A0011000 020000A0 11
0:18:0 100B 0020 02000000 0107 0290 00 3F 00 0000E101 A0012000 05
0:19:0 100B 0020 02000000 0107 0290 00 3F 00 0000E201 A0013000 09
1 Seconds to automatic boot. Press Ctrl-P for entering Monitor.
BootManage UNDI, PXE-2.0 (build 082)
BootManage PXE-2.0 PROM 1.0, NATSEC 1.0, SDK 3.0/082 (OEM52)
Copyright (C) 1989,2000 bootix Technology GmbH, D-41466 Neuss.
PXE Software Copyright (C) 1997, 1998, 1999, 2000 Intel Corporation.
Licensed to National Semiconductor
CLIENT MAC ADDR: 00 00 24 C1 1D F0
PXE-E51: No DHCP or proxyDHCP offers were received.
PXE-M0F: Exiting BootManage PXE ROM.
No Boot device available, enter monitor.
comBIOS Monitor. Press ? for help.
So there we are at the comBIOS command prompt. There is no CF card installed, so it automatically entered the BIOS. Otherwise you have to hit Ctrl+P to enter the comBIOS monitor. Let's see what we can do with it by pressing ?:
comBIOS Monitor Commands
boot [drive][:partition] INT19 Boot
reboot cold boot
download download a file using XMODEM
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
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
Ok, not so very much. You should make sure the time and date are set correctly. And perhaps take a moment to enjoy the pleasure of connecting to a real serial console, instead of the poor crippled x86 serial console.
Download the image file from Metrix. Wget users can fetch it with this command:
$ wget http://metrix.net/support/dist/pyramid-1.0b1.img.gz
Copy it to your CF card with these commands, using your own correct image and /dev names:
# gunzip -c pyramid-1.0b1.img.gz | dd of=/dev/hdc bs=16k
3908+0 records in
3908+0 records out
Very good, it's done.
Finding the /dev Number
What if you don't know the /dev/ number of your flash card? The fdisk command tells the tale. A USB-connected device looks like this:
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sdb1 1 984 991747+ 6 FAT16
An IDE CF reader shows up like a PATA hard drive:
Device Boot Start End Blocks Id System
/dev/hdc4 * 1 4 25000 a5 FreeBSD
If you have an IDE CF reader the card must be plugged in before you boot up, or the system won't see it.
(Click for a larger image)
Unplug the Soekris board. Install the CF card and power it up again. You can follow the boot process in Minicom. By default Pyramid assigns an address of 192.168.1.1 to eth0. On the 4521, this is the Ethernet port immediately to the left of the serial port. Enter https://192.168.1.1 in a Web browser on a neighboring PC and login as root, with the password root. You'll be greeted by the tastefully muted Pyramid Web GUI, as in Figure 1.
Naturally the first thing you'll want to do is change the root password. Do this from the "Edit Users" tab in the Web panel.
Come back next week to learn your way around Pyramid Linux, and how to setup a good iptables firewall.