Sunday 12 July 2009

For Dummies: Howto create a new Freifunk mesh network

Introduction


Freifunk is a very cool version of Open WRT that allows you to create a mesh network of routers. You can simply connect additional routers to extend the network, and it pretty much takes care of itself.

Unfortunately documentation, at least in English, is somewhat lacking...

We are using it here in Afghanistan to make Mesh networks for schools as part of One Laptop Per Child. It avoids the need to cable between the classrooms and holds the possibility to extend the school network around the school.

This has been tested on my Ubuntu 8.10 Machine with a D-Link DIR 300 Router. This was the one we had recommended to use (it's price to hardware specs ratio is pretty good). However it should in theory work with any other router that supports Openwrt. If you are not using a dir 300 then obviously the dir 300 flash script does not apply - it should be flashed the normal tftp way the same as open wrt.

Getting Started

  1. Install tftp on your machine - from the command line run:

    $sudo apt-get install tftp-hpa

  2. Download the Dir 300 Flash script (dir300-flash-0.9.9.tar.gz) to any directory on your machine from http://x-alina.freifunk-potsdam.de/downloads/dir300-flash/

    $wget http://x-alina.freifunk-potsdam.de/downloads/dir300-flash/dir300-flash-0.9.9.tar.gz
    $tar -xzf dir300-flash-0.9.9.tar.gz

    This should result in a folder called dir300-flash

  3. Download into the newly extracted dir300-flash folder the firmware files. Download openwrt-atheros-root.squashfs and openwrt-atheros-vmlinux.lzma from http://dev.luci.freifunk-halle.net/freifunk-snapshots/atheros/ - or the e

Flashing the router

  1. cd into the dir300-flash directory that was created.

  2. Plugin the ethernet cable to the WAN socket on the back of the router to your computer's first ethernet interface (eth0)

  3. ./dir300-flash.sh

  4. Wait for the script to complete. Make sure that the router will not get unplugged during this time.

Configuration

For this let's assume that we are creating a Mesh under a private IP range (e.g. 192.168.25.x) .

  1. Unplug the cable between your computer and the router from the WAN port on the back of the router and put it into one of the four LAN ports.

  2. Open your browser and go to 192.168.1.1



  3. Username is root, password at this stage is blank

  4. Select Freifunk → Freifunkassistent



  5. Check the boxes to activate Freifunk and OLSR


  6. The IP address comes from putting Freifunknetz + Subnetz (Projekt) + Knoten together. For the moment I am using

    Freifunknetz = 192.168
    Subnetz (Projekt) = 25
    Knoten = 18


  7. If this is the router that will be connected to the Internet or wider network then check the box 'Eigenen Internetzugang freigeben'


  8. Click submit, then save and apply. This will take some time and there might be some errors in your browser. Don't worry...


  9. Under essid enter the normal essid that you want – this should be the same amongst all routers.


  10. Under Netzprefix enter the same as per Freifunknetz – 192.168 for example


  11. Click save and apply


  12. Click Network → Wifi → Wifi0 then choose a channel. Of course make sure to use the same channel with the different routers.


  13. Click Network → Interfaces → Wifi0 and change the netmask to 255.255.255.0


  14. Put a sticker on this router and then put it somewhere to the side. Repeat the procedure with another router giving it a different Knoten (node) number.


  15. Make sure that both routers are powered on and within range of each other. Wait a few minutes...


  16. Click status → OLSR → Routen. You should see the other router's IP listed here


  17. From your client computer try to ping the IP of the other router that is now connected through the mesh – e.g. ping 192.168.25.18


Troubleshooting / Additional Notes

  • Make sure that you do allow enough time for OLSR to determine routes before checking to see if it knows about other routers on your mesh
  • Encryption may well not work! As far as I have heard it causes some issues... I will check this out a little later...
  • It can be possible to run multiple wireless networks from one router - however when I tested this and added an AP network as well that didn't co-operate.

We are using Freifunk to create a wireless backbone – one can use one router as an access point then connect it to other routers running Freifunk that form the backbone – this is still under testing but seems to be co-operating as of right now. Each AP has a traffic control system on it – thus hopefully preventing the mesh backbone from being overloaded...




Thursday 18 June 2009

Step By Step Installing Greenstone 2.82 on Ubuntu 8.10 (Quickstart)

These instructions are designed for those that are completely new to Greenstone (as I was) and would to try it out. This will guide you from blank to having a library that will be accessible through your Apache HTTP server.

1.

I read elsewhere that the sun-java6 package version of java was not going to work. I think this was only for compilation on Ubuntu - I have tested it with the package version and it worked fine.

apt-get install sun-java6-jdk apache2
2.

First Download Greenstone from: http://prdownloads.sourceforge.net/greenstone/Greenstone-2.82-linux – Select For Linux under 'Latest Distribution'
3.

Make the file executable and start the installer:

chmod a+x Greenstone-2.82-linux
./Greenstone-2.82-linux

4.

Most of what's in the installer is pretty self explanatory and one can happily go clicking next through the installer...

5.

You will need to edit your apache configuration to be able to access the new digital library. I made a virtual host called greenstone by adding a line to /etc/hosts

127.0.0.1 greenstone

Then make a new virtual host in apache by creating a file /etc/apache2/sites-available/greenstone for example:


ServerName greenstone

#Greenstone 2 script:

ScriptAlias /greenstone/cgi-bin "/usr/local/Greenstone2b/cgi-bin"

Options None

AllowOverride None

Alias /greenstone "/usr/local/Greenstone2b/"

Options Indexes MultiViews FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all



6

a2ensite greenstone && /etc/init.d/apache2 restart



7

Go with your web browser to: http://greenstone/greenstone/cgi-bin/library.cgi



8

Now it's time to try and add a content – go to this page with your browser. It should provide some info about the java version installed and at the bottom Installation OK - http://greenstone/greenstone/cgi-bin/gliserver.pl?cmd=check-installation


9

A message will come after a little while like Could not connect to local library server after 20 seconds – click no . Then it will prompt for a URL. Enter http://greenstone/greenstone/cgi-bin/gliserver.pl . I found that if you use the library.cgi address as it suggests then the collections do not build.

10. You can now make your collection by simply adding files, going through the tabs and then going to build collection. When you refresh your browser on the library page, your new collection should appear.

Friday 7 November 2008

VServer VPN with vtun

Suppose you are using linux-vserver to create a network of vservers, some with public IP addresses and some with only a private IP. You might well want them to be able to communicate with each other via a VPN in a relatively transparent fashion...

Not so fast... there are various issues thrown up becaues we can't use 127.0.0.1 - however it can be sorted out:

1. Install vtun on one vserver to use as the server, and on one vserver to use as the client. Make sure that both servers have the capabilities CAP_SYS_ADMIN, CAP_MKNOD, CAP_NET_ADMIN,CAP_NET_RAW . Make a new interface in /etc//interfaces with the VPN IP and the name "tun0" in dev

Restart the VServer

2.On both the client and the server edit /etc/ssh/sshd_config and add:

GatewayPorts yes

This is important because we need to be able to specify the IP address to use for a 'local IP' address intead of 192.168.1.1 Restart sshd.

3. on the server start vtund:

vtund -s -f /etc/vtund-server.conf

If you don't have configs yet see: http://www.linuxjournal.com/article/6675

4.on the client use ssh to create a tunnel:

ssh -L CLIENTIP:5000:SERVERIP:5000

Where 5000 is the port number being used on the server as per the config file

5. on the client run vtund

vtund -f /etc/vtund-client.conf my_tunnel CLIENT_HOSTNAME

And presto - if it all worked one should have an interface tun0 on both machines that can be used to transparently pass data between them.

Sunday 22 July 2007

Dust

Dust is a numero uno pain - we just had a laptop here overheat and die due to dust. And I'm sure hundreds, possibly thousands more are dieing out here in Kabul. And vacuum cleaners, even our 2KW with an attachment, just was not powerful enough.

Solution Idea 1 - The weekly filtered blower. If we used that canned air stuff we'd be spending $hundreds a month on these cans. So we just picked up a car blower and put a filter of some kind over the intake (sponge, foam bed material or tissue paper) to blow the dust out.

Solution Idea 2 - The USB cooling pad with filters over the fans. This seems to work - so costs something like $15 per laptop.

Solution Idea 3 - Raising the laptop and putting a filter directly over the intake. This though resulted in CPU temperature raises. Bad news...

Anyhow - under Ubuntu Linux use the command

$acpi -t

To see the temperature. Different laptops are measuring thermals at different points, but from what I can read when it gets over 60 this is time to worry.