Troisdorf-Server-howto: Unterschied zwischen den Versionen

Aus Freifunk Rheinland e.V.
Zur Navigation springen Zur Suche springen
K (Bermerkungen)
 
(14 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 5: Zeile 5:
= Installation =
= Installation =


Grundlage: Debian 7  
Grundlage: Debian 7 (Wheezy) oder Debian 8 (Jessy)


Edit /etc/apt/sources.list
Edit /etc/apt/sources.list
Zeile 25: Zeile 25:


Install Batman, batctl and alfred
Install Batman, batctl and alfred
 
mkdir /opt/freifunk
  cd /srv
  cd $_
 
  git clone git://git.open-mesh.org/batman-adv.git
  git clone git://git.open-mesh.org/batman-adv.git
  cd batman-adv
  cd batman-adv
git checkout v2015.1
  make
  make
  make install
  make install
Zeile 37: Zeile 38:
  git clone http://git.open-mesh.org/batctl.git
  git clone http://git.open-mesh.org/batctl.git
  cd batctl
  cd batctl
git checkout v2015.1
  make
  make
  make install
  make install
Zeile 44: Zeile 46:
  git clone http://git.open-mesh.org/alfred.git
  git clone http://git.open-mesh.org/alfred.git
  cd alfred
  cd alfred
git checkout v2014.4.0
  make  
  make  
  make install
  make install


= Configuration: =
= Configuration =


== Fastd ==
== Fastd ==
Zeile 64: Zeile 67:
  mkdir /etc/fastd/servers/tro
  mkdir /etc/fastd/servers/tro


Add your Secret:
Add your Secret to /etc/fastd/tro/secret.conf:
  nano /etc/fastd/tro/secret.conf
  # /etc/fastd/tro/secret.conf
  secret "SECRETKEY";
  secret "SECRETKEY";


fastd Config:
fastd Config /etc/fastd/tro/fastd.conf:
nano /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.


  bind *SERVERIP*:53840;
# /etc/fastd/tro/fastd.conf
  bind [*IPv6IP*]:53840; #Only if available  
  bind 0.0.0.0:53842;
  # bind [*IPv6IP*]:53842; #Only if available  
  include "secret.conf";
  include "secret.conf";
  include peers from "/etc/fastd/servers/tro";
  include peers from "/etc/fastd/servers/tro";
Zeile 81: Zeile 90:
  method "salsa2012+gmac";
  method "salsa2012+gmac";
  method "xsalsa20-poly1305";
  method "xsalsa20-poly1305";
  mtu 1406;
  mtu 1312;
   
   
  on up "
  on up "
Zeile 92: Zeile 101:
   batctl -m bat0 gw client
   batctl -m bat0 gw client
   ip link set up dev bat0
   ip link set up dev bat0
   ip addr add 10.188.0.XXX/16 broadcast 10.188.255.255 dev bat0 #Change IP to a available Address in the mesh network
   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
   ip -6 addr add fda0:747e:ab29:7405::XXX/64 dev bat0 #Change IP to a available Address in the mesh network
   ";
   ";


Add the fastd servers:
cd /opt/freifunk
git clone https://github.com/Freifunk-Troisdorf/fastd-server.git
cp fastd-server/* /etc/fastd/servers/tro/.


Add Server connection:
== Manueller Start der Dienste ==
nano /etc/fastd/servers/tro/SERVERNAME
 
key "PUBLIC KEY OF SERVER";
remote "IP OR DNS OF SERVER" port 53840;
 
////////////////////////////Availabe Servers//////////////////////////////////////
 
key "7142f897f4e55d2c19207aa59db92ec54d7517cf558d5ecaef33689234952a4b";
remote "wupper0v6.freifunk-troisdorf.de" port 53840;
 
key "c3fe61335a6c92d2557cdaf93db2b80e7e5b9704290ccdb0ad34ee01c56b9116";
remote "wupper1v6.freifunk-troisdorf.de" port 53840;


//////////////////////////////////////////////////////////////////////////////////
fastd -c /etc/fastd/tro/fastd.conf --log-level debug > /var/log/fastd.log # Option 1 mit Debugging-Log
/etc/init.d/fastd start # Option 2 via OpenRC
alfred -i bat0 > /dev/null 2>&1 &
batadv-vis -i bat0 -s > /dev/null 2>&1 &


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.
== Automatischer Start der Dienste ==


nano ~/fastdreboot.sh
Ich habe bei meinen Servern das Problem, das die Dienste nicht in Richtiger Reihenfolge geladen werden und deswegen nichts funktioniert. Deswegen habe ich noch ein Skript, welches beim Rebooten ausgeführt wird und die Dienste Richtig startet.


# File: ~/fastdreboot.sh
  #!/bin/sh
  #!/bin/sh
sleep 60 && /etc/init.d/fastd restart && \
sleep 60 && /etc/init.d/fastd restart && \
     (\
     (\
     killall alfred
     killall alfred

Aktuelle Version vom 2. September 2015, 22:04 Uhr

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 (Wheezy) oder Debian 8 (Jessy)

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

mkdir /opt/freifunk
cd $_

git clone git://git.open-mesh.org/batman-adv.git
cd batman-adv
git checkout v2015.1
make
make install

cd ../

git clone http://git.open-mesh.org/batctl.git
cd batctl
git checkout v2015.1
make
make install

cd ../

git clone http://git.open-mesh.org/alfred.git
cd alfred
git checkout v2014.4.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 the fastd servers:

cd /opt/freifunk
git clone https://github.com/Freifunk-Troisdorf/fastd-server.git
cp fastd-server/* /etc/fastd/servers/tro/.

Manueller Start der Dienste

fastd -c /etc/fastd/tro/fastd.conf --log-level debug > /var/log/fastd.log # Option 1 mit Debugging-Log
/etc/init.d/fastd start # Option 2 via OpenRC
alfred -i bat0 > /dev/null 2>&1 &
batadv-vis -i bat0 -s > /dev/null 2>&1 &

Automatischer Start der Dienste

Ich habe bei meinen Servern das Problem, das die Dienste nicht in Richtiger Reihenfolge geladen werden und deswegen nichts funktioniert. Deswegen habe ich noch ein Skript, welches beim Rebooten ausgeführt wird und die Dienste Richtig startet.

# File: ~/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.