zen.org Communal Weblog

November 21, 2009

Our network is driven by a teeny, tiny box

Filed under: — brendan @ 12:52 GMT


Earlier this year I got a SheevaPlug, a little box with some Flash memory and an ARM processor running Linux. It’s so friggin’ awesome! (Technical term.) My main motivation for getting it, aside from a cool toy, was its much lower power consumption compared to the Mac Mini.

For a few years now our Mini had been doing most of the maintenance efforts for our home network, including: DHCP; DNS; running the No-IP client so I can SSH in via our dynamic DSL connection with its random addresses; acting as a printer server; and work as a local NTP server (still to do). (My email folders were also on the Mini thru an IMAP server, but I’ve moved that onto my desktop for the moment.)

The SheevaPlug is now doing all of it. In particular, I’m finding name lookups for Web browsing is vastly faster than when the Mini was doing the effort.

This list offers the details of what I’ve done to use the SheevaPlug. I’ll add to it (to mirror my local ChangeLog) as we make any other tweaks or fixes. It’s not a lot of effort and the end result is great.

(Note: I still need to finish fixing the formatting of this for readability.)

      Accessing the box
      After initial power-on, logged in as root with the default password nosoup4u. Then I changed the root password to something I’m used to typing.
      General Usability

    1. As noted on “SheevaPlug”, edit /etc/dhcp3/dhclient.conf and comment out the the line

      #OFF#supersede domain-name-servers 127.0.0.1;

    2. Ran dhclient eth0
    3. Make sure APT will work by doing: mkdir -p /var/cache/apt/archives/partial
    4. Install ntpdate with apt-get install ntpdate.
    5. Edit /etc/rc.local and comment out the line

      #date 012618002009

      and add

      ntpdate ntp.maths.tcd.ie

    6. Edit /etc/hostname and change the name from ‘debian‘ to ‘inara‘.
    7. I should note the boot sequence for the SheevaPlug still specifies a different subnet:

      Nov 14 13:52:19 inara kernel: Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none

    8. * /etc/rc.local: Comment out
      #OFF#insmod /boot/fat.ko
      #OFF#insmod /boot/vfat.ko
      and add
      chmod 1777 /tmp /var/tmp
    9. Edit /etc/fstab and add the lines

      tmpfs /var/log tmpfs defaults 0 0
      tmpfs /tmp tmpfs defaults 0 0

      to make the most frequent activity not actually write anything out to the flash memory. Too many writes to flash can accelerate its demise.

    10. Also change the root partition in /etc/fstab to specify noatime to also reduce unnecessary “disk” writes:

      rootfs / rootfs rw,noatime 0 0

    11. Install wget (to download stuff), sysstat (to see how things are running), and rsync (to download/upload stuff) with : sudo apt-get install wget sysstat rsync
      Network Time Support

    1. Update the list of packages, then install NTP: sudo apt-get update && sudo apt-get install ntp
    2. Edit /etc/ntp.conf and change the server line to be the Trinity College server: server ntp.maths.tcd.ie
    3. As suggested on “New Plugger How To”, ran dpkg-reconfigure tzdata
      and selected Europe -> Dublin.
      Logging in over the USB serial port

    1. Follow the instructions at “Setting Up Serial Console Under Linux”
    2. On my desktop (running Ubuntu 9.04), ran
      * On homer:
      sudo /sbin/modprobe -q ftdi-sio product=0x9e8f vendor=0x9e88
      sudo apt-get install cu
      sudo chown uucp /dev/ttyUSB1
      so I can then log into the SheevaPlug over a serial line with
      * sudo cu -s 115200 -l /dev/ttyUSB1
      This is really helpful when you make a typo and the box is no longer getting on your network properly!
      Network Connection

    1. Edited /etc/network/interfaces and changed it from doing DHCP to a static address:

      auto eth0
      #iface eth0 inet dhcp
      # /usr/share/doc/ifupdown/examples for more information.
      iface eth0 inet static
      address 192.168.20.8
      network 192.168.20.0
      netmask 255.255.255.0
      broadcast 192.168.20.255
      gateway 192.168.20.1

      DHCP Server

    1. Installed the DHCP server with: apt-get install dhcp3-server
    2. Copied the /etc/dhcpd.conf file over from the Mini.
      DNS Server

    1. Install BIND with: apt-get install bind9
    2. Edit /etc/bind/named.conf.local and add

      options {
      // use this to get faster lookups that we cache:
      forward first;
      forwarders {
      // Eircom:
      // BACKUP plan when DoS attacks hit eircom (2009-09-02)
      159.134.237.6;
      159.134.248.17;
      // as per http://broadbandsupport.eircom.net/ under Broadband Settings:
      // 213.94.190.194;
      // 213.94.190.236;
      // Try going straight to the Netopia box
      // 192.168.20.1;
      };
      allow-query { localhost; 192.168.20.0/24; };
      allow-transfer { localhost; };

      };
      zone “20.168.192.in-addr.arpa” IN {
      type master;
      file “192.168.20”;
      };
      zone “network.home” IN {
      type master;
      notify no;
      file “network.home”;
      };

    3. Add files /etc/bind/192.168.20 and /etc/bind/network.home from the Mini.
      No-IP Client

    1. Get GCC off the CD that comes with the SheevaPlug box in SheevaPlug_Host_SWsupportPackageLinuxHost.zip.
    2. Extract gcc.tar.bz2 from it, then extract files from that.
    3. Download No-IP.
    4. Extract the noip sources; may be in a directory noip-2.1.9-1.
    5. Expecting ‘gcc’ and ‘noip-2.1.9-1’ are in the same directory, edit the makefile to have

      CC=../gcc/bin/arm-none-linux-gnueabi-gcc -O3

    6. Do ‘cd noip-2.1.9-1’ and ‘make’, then copy the binary to /usr/local/bin/noip2.
    7. Run “/usr/local/bin/noip2 -C” and answer its questions; you’ll need to have registered on no-ip.com to have a username and password to use with this free client.
    8. Create the file /etc/init.d/noip2 using the example at http://www.togaware.com/linux/survivor/No_IP.html.
    9. Do “chmod 755 /etc/init.d/noip2” and then “update-rc.d noip2 defaults” so it’ll run when you boot.
Certain people may not get medical insurance and thus forced to pay for the expensive prescription pills or research how to buy generic medications online. Generic drugs are as safe as other branded counterparts. Only reputable pharmacy produces them such as German Remedies. With this in head one can buy zyrtec uk in generic online drugstore including free shipping anywhere in the world

Powered by WordPress