2718.us blog » alix http://2718.us/blog Miscellaneous Technological Geekery Tue, 18 May 2010 02:42:55 +0000 en hourly 1 http://wordpress.org/?v=3.0.4 Pulsing the Alix LEDs http://2718.us/blog/2008/05/25/pulsing-the-alix-leds/ http://2718.us/blog/2008/05/25/pulsing-the-alix-leds/#comments Mon, 26 May 2008 01:11:07 +0000 2718.us http://2718.us/blog/?p=41 Now that all my traffic to and from the internet is running happily through my Alix box (and it had no trouble with a few hours of sustained maxing-out of my 6Mbps down/768kbps up DSL line in both directions), and since my first test unslung-NSLU2 “slug” seems to be stably doing its job as a backup DNS/DHCP server, it’s time to do the fun little things, like wonder, “Hey, the Alix has 3 LEDs on the front.  What could I do with those?”

Well, first I learned from a mailing list archive post that under OpenBSD, the LEDs are easily controlled with gpioctl (using 0 and 1 for off and on):

# one-time setup to get 0 and 1 to mean what we expect
  1. gpioctl -q -c 6 out iout
  2. gpioctl -q -c 25 out iout
  3. gpioctl -q -c 27 out iout
  4.  
  5. gpioctl -q 6 [0/1]    # for the left-most LED
  6. gpioctl -q 25 [0/1]   # for the middle LED
  7. gpioctl -q 27 [0/1]   # for the right-most LED

That’s pretty easy, but it’s just on and off (though it does require privileged access to control the GPIO pins).  Poking around on the web today, though, I found Jordan Sissel’s blog post on making the Soekris net4501′s LEDs do the Apple-style pulsing fade-in-outHis C program didn’t work straight away on my Alix, perhaps because he was working on FreeBSD and I’m using OpenBSD, but with a little digging in the OpenBSD source code for gpioctl, I was able to cobble together some C code to replace his “led” function that set the state of the LED as well as the device initialization.  With a little tweaking to make the code feel more like my own and to make the LED pulse just once (the original code pulsed indefinitely), I arrived at pulse_led2_once.c (which still must be run as root to work, since it uses the GPIO interface).

NOTE:  This file is provided “as is” and is not guaranteed to do anything at all, including not guaranteed to be safe to run.  It worked for me, YMMV.  I’ve posted my modifications having asked Jordan Sissel first; I’d appreciate it if you’d let me know if you wanted to post modifications to my code.  AFAIK, my inclusion of OpenBSD source was done in compliance with the copyright notice in their source file, reproduced as requested by the code I used.

]]>
http://2718.us/blog/2008/05/25/pulsing-the-alix-leds/feed/ 1
Small *nix Devices http://2718.us/blog/2008/05/22/small-nix-devices/ http://2718.us/blog/2008/05/22/small-nix-devices/#comments Thu, 22 May 2008 07:35:22 +0000 2718.us http://2718.us/blog/?p=38 Today, not only did the NSLU2 that I bought on eBay arrive, but the red anodized aluminum case for my Alix arrived, too.  Getting the NSLU2 to run “unslung” from a 1GB flash drive was a royal pain.  If I do a second one, I’ll have to verify my technique, but it seems that the direction to format the drive before reflashing is just a mess (since it’s nearly impossible to get the Linksys firmware to format a flash drive), but once the firmware is reflashed to non-stock, it’s easy to format the flash drive, then run the script to move the boot stuffs off to the flash drive, where there’s room to install stuff.  The problem is that the device seems to be spending about 90% of its time completely hung and non-responsive (telnet and ssh freeze ior maybe just hang, web interface unresponsive, intermittent “thrashing,” if you can call it that, of the flash drive) for reasons I can’t quite figure out.  It may not turn out to be as useful as I’d hoped, but even if it doesn’t do what I want, it will have been an interesting experiment.  Plus, I realized it’s the only linux box i’ve got on hand (my other machines are various Macs and OpenBSD boxes and a few PCs).

Speaking of OpenBSD boxes, the Alix seems to be much closer to usable than I’d expected now, having restarted from a newer pre-built flashdist image.  The hokey thing I’d forgotten about is how few of the standard basic *nix command programs are in the base flashdist, so I end up copying over program after program from another running OpenBSD box.  I’m hoping to get BIND and dhcpd up and running soon, get pf all set up for router/NAT/firewall use, and try it out with a DSL modem before the weekend is up.

And, with a little luck, by the end of the weekend, all these various devices will be self-updating the various common config files (BIND zones, dhcpd.conf, etc.) from a common server.  I’ve already got a shell script that can check for an update to itself and replace itself with the newer version; I just have to make it check for and retrieve updates for the actual config files.

]]>
http://2718.us/blog/2008/05/22/small-nix-devices/feed/ 1
Trying for more than Just a Home Network http://2718.us/blog/2008/05/17/trying-for-more-than-just-a-home-network/ http://2718.us/blog/2008/05/17/trying-for-more-than-just-a-home-network/#comments Sat, 17 May 2008 20:50:59 +0000 2718.us http://2718.us/blog/?p=35 The OpenBSD router machines I installed at my place and my parents’ have been failing and I’ve been doing band-aid fixes of little things as they break, but it’s annoying.  My new idea is to use hardware routers, but to install one or more “slug” NSLU2 devices, unslung, inside each network to provide DNS and DHCP (more than one should easily give redundancy).  At $50-60 on eBay and potentially running some variant of Linux from a small USB flash drive, it should be reasonable to set up two identically-configured “slugs” so that if one goes bad, the other can handle the load until the bad one can be replaced.  My first NSLU2 for testing should arrive in the middle of this coming week.  Details on the previous setup and history after the cut.

Since the point where both my parents and I had DSL, I’ve been fiddling with ideas of how to make it easier to share files across our two networks, easier for me to debug issues on their computers, and, well, just more technologically cool.  About a year and a half ago, I replaced the D-Link routers at both sites with a matched pair of used Dell business machines I’d bought on eBay, outfitted with OpenBSD (by far the best OS for trying to run a secure gateway).  This seemed to fit the bill, as it enabled me to more easily connect to my home network from elsewhere without opening up any of my internal machines directly to the outside world, it allowed me to similarly access my parents’ network without exposing any of their internal machines, and (at the peak of its working-ness) we had an encrypted VPN unifying the two sites so I could connect to shared drives on their machines and print to their color laser printer as if all those devices were on my own network.

But somewhere along the way, things started to go south.  A few months ago, the gateway router Dell box on my end died–just wouldn’t power up anymore.  I swapped in an old D-Link hardware router to keep my internet access up and I’ve been working on an Alix unit to replace it, but getting OpenBSD properly tweaked to run off a compact flash card took some time and I still haven’t quite gotten that install happy with PPPoE DSL connections, so it’s still not in place.

Now, making things worse, the machine at my parents’ place isn’t working quite right.  After an extended power failure that wore through the UPS, the machine appears to start up (even sounds right when I stood there and watched it “boot”), but it never shows up on the network, much less makes the DSL connection and joins the network to the DSL.  This led to a similar swap-in of a spare hardware router unit at their place.  Unfortunately, things got messier for them.

These OpenBSD machines I’d been using as routers on both ends had also been running DHCP and DNS for the internal networks and while my internal network had a second OpenBSD box that was able to step in and take over the DNS (it was already serving as a secondary DNS server) and the DHCP (it had been doing DHCP before I got the other machines), my parents’ network had no such machine.  Suddenly, lots of things stopped working correctly.  Printing over the network didn’t work because the IP printing port in Windows was trying to use the (former) FQDN of the printer, or maybe even its old IP address.  This is what got me looking at the slug.

]]>
http://2718.us/blog/2008/05/17/trying-for-more-than-just-a-home-network/feed/ 0