Troisdorf-Server-howto

Aus Freifunk Rheinland e.V.
Zur Navigation springen Zur Suche springen

Bemerkungen

Server die sich im Mesh mit diesem Howto anmelden, werden in der Map nur mit der MAC Adresse angezeigt. Bitte meldet euch und Teilt und den Namen des Servers mit, damit dieser in die Aliases.json eingetragen werden kann.

Installation

Grundlage: Debian 7

Edit /etc/apt/sources.list

nano  /etc/apt/sources.list 

and add this:

deb http://repo.universe-factory.net/debian/ sid main
deb http://http.debian.net/debian wheezy-backports main

Add Keys:

gpg --keyserver pgpkeys.mit.edu --recv-key  16EF3F64CB201D9C
gpg -a --export 16EF3F64CB201D9C | apt-key add -

Update and install:

apt-get update
apt-get install git make gcc build-essential linux-headers-$(uname -r) pkg-config libgps-dev libnl-3-dev libjansson-dev fastd

Install Batman, batctl and alfred

cd /tmp

git clone git://git.open-mesh.org/batman-adv.git
cd batman-adv
git checkout v2014.3.0
make
make install

cd ../

git clone http://git.open-mesh.org/batctl.git
cd batctl
git checkout v2014.3.0
make
make install

cd ../

git clone http://git.open-mesh.org/alfred.git
cd alfred
git checkout v2014.3.0
make 
make install

Configuration:

Fastd

Only on Virtual Servers:

rm /dev/random
ln -s /dev/urandom /dev/random

Generate fastd Keys

fastd --generate-key

Save your fastd Keys anywhere

Add Directories

mkdir /etc/fastd/tro
mkdir /etc/fastd/servers
mkdir /etc/fastd/servers/tro

Add your Secret to /etc/fastd/tro/secret.conf:

# /etc/fastd/tro/secret.conf
secret "SECRETKEY";

fastd Config /etc/fastd/tro/fastd.conf:

First, random mac address has to be calculated on the linux console via:

echo $RANDOM|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')

The 02 for the first octet just sets the "locally assigned" bit, which makes it obvious that it's not a vendor-provided MAC address, and guarantees that you won't collide with a real NIC's MAC address.

# /etc/fastd/tro/fastd.conf
bind 0.0.0.0:53842;
# bind [*IPv6IP*]:53842; #Only if available 
include "secret.conf";
include peers from "/etc/fastd/servers/tro";
interface "fastd-tro";
log level info;
method "aes128-gcm";
method "salsa2012+umac";
method "salsa2012+gmac";
method "xsalsa20-poly1305";
mtu 1312;

on up "
 modprobe batman-adv
 ip link set address xx:xx:xx:xx:xx dev fastd-tro #Change MAC to Random MAC Address
 ip link set up dev fastd-tro
 batctl -m bat0 if add fastd-tro
 batctl -m bat0 it 5000
 batctl -m bat0 bl enable
 batctl -m bat0 gw client
 ip link set up dev bat0
 ip addr add 10.188.1.XXX/16 broadcast 10.188.255.255 dev bat0 #Change IP to a available Address in the mesh network
 ip -6 addr add fda0:747e:ab29:7405::XXX/64 dev bat0 #Change IP to a available Address in the mesh network
 ";


Add Server connection:

nano /etc/fastd/servers/tro/SERVERNAME
key "PUBLIC KEY OF SERVER";
remote "IP OR DNS OF SERVER" port 53842;

////////////////////////////Availabe Servers//////////////////////////////////////

key "7142f897f4e55d2c19207aa59db92ec54d7517cf558d5ecaef33689234952a4b";

remote "wupper0v6.freifunk-troisdorf.de" port 53842;

key "c3fe61335a6c92d2557cdaf93db2b80e7e5b9704290ccdb0ad34ee01c56b9116";

remote "wupper1v6.freifunk-troisdorf.de" port 53842;

//////////////////////////////////////////////////////////////////////////////////

Ich habe bei meinen Servern das Problem, das die Dienste nicht in Richtiger Rheienfolge geladen werden und desswegen nichts funktioniert. Desswegen habe ich noch ein script, welches beim rebooten ausgeführt wird und die Dienste Richtig startet.

nano ~/fastdreboot.sh
#!/bin/sh
sleep 60 && /etc/init.d/fastd restart && \
   (\
   killall alfred
   killall batadv-vis
   sleep 5 && alfred -i bat0 > /dev/null 2>&1 & \
   sleep 15 && batadv-vis -i bat0 -s > /dev/null 2>&1 & \
   )


Dieses einfach nach dem Reboot ausführen.