Diskless Folding@Home with OpenWrt and network booting

I like the OpenWrt platform. I also like Folding@Home, since it's for a good cause. I figured I should set up a tftp server to enable my computers to boot the Folding@Home Diskless program, a small linux distribution, automatically starting Folding@Home for me, over the network. This way, I could also save the progress of each client to a central place. I followed this howto, only adapting it to OpenWrt.

Requirements: You need a router running OpenWrt, and enough storage on the router to store the boot image and the progress of each client.

Now, I assume you have all these things set up already. My external harddrive for my router is mounted at /mnt/hdd and my local network is 192.168.2.0/24, adjust the commands below to fit your configuration.

Before doing anything else, log in to your router.

Installing programs

Lucky us, we only need to install one program  on the router.

opkg install unzip

Download and install the Folding@Home image

cd /mnt/hdd
mkdir folding
cd folding
wget http://reilly.homeip.net/folding/diskless.zip
unzip diskless.zip

Configure the Folding@Home client

If you want to run Folding@Home for a specific team and for a specific username, you need to edit the file default in the pxelinux.cfg directory. Change the USER= and TEAM= variables. If you don't want to compute big workunits, you should change BIG=big to BIG=no. My default looks like this:

DEFAULT fold DEFAULT64 fold64 TIMEOUT 150 PROMPT 1 DISPLAY fold.txt
LABEL fold KERNEL kernel32 APPEND initrd=initrd USER=bredsaal TEAM=91280 PASSKEY= BIG=no MEM= ADVMETHODS=yes SMPCPUS=4 BACKUP=3 REBOOT=enabled INSTALL=yes BENCHMARK=no BLANK=0 SAMBA=2 GROUP=DISKLESS PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PASS= INTF= IP= MASK= GATEWAY= DNS= TFTP= SHELL=yes
LABEL fold64 KERNEL kernel64 APPEND initrd=initrd USER=bredsaal TEAM=91280 PASSKEY= BIG=no MEM= ADVMETHODS=yes SMPCPUS=4 BACKUP=15 REBOOT=enabled INSTALL=yes BENCHMARK=no BLANK=0 SAMBA=2 GROUP=DISKLESS PROXY_HOST= PROXY_PORT= PROXY_USER= PROXY_PASS= INTF= IP= MASK= GATEWAY= DNS= TFTP= SHELL=yes

Configure dnsmasq

Now, dnsmasq is a DNS server really, but it's also a DHCP server and just as important, it can function as a TFTP server, which we need to serve files over the network. Add the following three lines to /etc/dnsmasq.conf:

enable-tftp
tftp-root=/mnt/hdd/folding
dhcp-boot=pxelinux.0

and restart dnsmasq: /etc/init.d/dnsmasq restart

Finishing touches

The last thing needed is some files that the Folding@Home clients will save their progress to. Each computer must have three files, for each instance that is running on that computer:

cd /mnt/hdd/folding
touch backup.$IP.A.$Instance
touch backup.$IP.B.$Instance
touch latest.$IP.$Instance`

Of course, you have to replace $IP with the IP address of the computer and $Instance with the instance (after the computer have booted, you can see how many instances there is running on that computer).

If you did everything right, you should be able to boot the folding CD over network! :-)


Written by Jannich Brendle man 14 februar 2011 In How to

tags: folding@homeOpenWrtpostaweek2011pxeboot

Related posts

social