Difference between revisions of "Mesh/Relay setup"

From Sudo Room
Jump to navigation Jump to search
(Created page with "Relay nodes are Internet connected hosts that allow mesh nodes to talk to each other using batman-adv over the Internet. Mesh nodes connect to relay nodes using a type of laye...")
(No difference)

Revision as of 22:13, 23 December 2013

Relay nodes are Internet connected hosts that allow mesh nodes to talk to each other using batman-adv over the Internet. Mesh nodes connect to relay nodes using a type of layer 2 tunnel called L2TP. The software used to establish these tunnels is called tunneldigger and was developed by wlan slovenija. A relay node is usually a VPS or a dedicated server with a good amount of available bandwidth and cpu.

L2TP tunnels are unencrypted. They are used primarily because they are layer 2 (so they can be used for batman-adv) and are part of the Linux kernel. They code does not take up much space on the space-limited mesh nodes and does not use much cpu.

A relay node needs two pieces of software configured:

  1. B.A.T.M.A.N. Advanced
  2. Tunneldigger Broker

Operating system

Relays must run Linux, since Linux-specific kernel modules are involved.

This guide is intended for Debian 7 (Wheezy). If you are running something else, see the following.

Ubuntu

It seems that some versions (at least version 12.10) don't have any way of installing the required L2TP modules.

To check if your version of Ubuntu has the L2TP modules, run:

sudo aptitude install apt-file
sudo apt-file update
apt-file search l2tp_netlink

If you get no results, or if the only result you get is a package called "user-mode-linux", then your version of Ubuntu does not work with tunneldigger :(

Debian 6 (Squeeze)

If you are running Debian 6, then you should upgrade to Debian 7. There is a comprehensive guide here. The short version is:

sudo aptitude update && sudo aptitude safe-upgrade

Edit your /etc/apt/sources.list from e.g:

deb http://ftp.us.debian.org/debian squeeze main
deb http://security.debian.org/ squeeze/updates main

To:

deb http://ftp.us.debian.org/debian wheezy main
deb http://security.debian.org/ wheezy/updates main

Now upgrade your system:

sudo aptitude update && sudo apt-get dist-upgrade

Notice that it is now recommended to use apt-get instead of aptitude for the dist-upgrade.

Follow the instructions on screen and reboot.

After rebooting you should be running a 3.x kernel. Check which version you're running with:

uname -a

If you are running a 2.x version, then you may be able to solve the problem by editing /etc/grub/menu.lst and finding lines like:

title vmlinuz-2.6.32-5-amd64
  root (hd0,0)
  kernel /boot/vmlinuz-2.6.32-5-amd64 console=hvc0 root=/dev/xvda1 ro
  initrd /boot/initrd.img-2.6.32-5-amd64

and commenting them out like so:

#title vmlinuz-2.6.32-5-amd64
#  root (hd0,0)
#  kernel /boot/vmlinuz-2.6.32-5-amd64 console=hvc0 root=/dev/xvda1 ro
#  initrd /boot/initrd.img-2.6.32-5-amd64

and rebooting.

If you encounter any other problems, refer to the official guide.

Other distros

You are on your own, but if you figure out how to get batman-adv and tunneldigger working on a different distro, then please edit this wiki!

batman-adv

You should already have the batman_adv module. Try loading it:

sudo modprobe batman_adv

If there are no errors, you have the module.

Add batman_adv at the end of /etc/modules to make it auto-load on bootup:

batman_adv

Install the batctl utility:

sudo aptitude install batctl

Tunneldigger broker

Install the broker

You must have the following kernel modules available:

  • l2tp_core
  • l2tp_eth
  • l2tp_netlink

To check:

 modprobe l2tp_core
 modprobe l2tp_eth
 modprobe l2tp_netlink

If there are no errors, you have the modules. If there are errors, then you should install the linux-image-extra package for your kernel. E.g:

 sudo aptitude install linux-image-extra-3.5.0-36-generic

Use apt-cache search linux-image-extra to find the package for you kernel version (hint: You can find your kernel version using: uname -a)

It seems that some Ubuntu version do not include the l2tp_* modules in any packages. See the section on Ubuntu further up this page.

Now add the module names at the end of /etc/modules so they are automatically loaded on boot:

 l2tp_core
 l2tp_eth
 l2tp_netlink

Now install some required packages:

 sudo aptitude install iproute bridge-utils libnetfilter-conntrack3 python-dev libevent-dev ebtables python-pip git

Download tunneldigger with git if you have not already done so:

 cd
 git clone https://github.com/wlanslovenija/tunneldigger.git
 sudo mv tunneldigger /opt
 cd /opt
 sudo chown root.root -R tunneldigger
 cd tunneldigger/broker

Now install the additional required python packages:

 sudo pip install -r requirements.txt

If it doesn't work, change the line:

 construct==2.0.6

to:

 construct==2.06

You may have to remove the python-netfilter line in requirements.txt and install it manually:

 git clone --depth=1 https://github.com/jlaine/python-netfilter.git
 cd python-netfiler
 sudo python setup.py install

If you have a python-netfilter package available to install via apt, then it is likely too old. Don't use it.

If you have any problems with pip, try upgrading it:

 sudo pip install --upgrade pip

You may have to log out and log back in for pip to work after this

Configure the broker

Open l2tp_broker.cfg.

You will want to change the "address=" line to your public IP address, and "interface=" to your public ethernet interface.

Run the broker

Test the broker

Configure the broker to auto-start