Eigenen Rechner in das Freifunk-Netz: Unterschied zwischen den Versionen

Aus Freifunk Kiel
Zur Navigation springen Zur Suche springen
(→‎Start-Script erstellen: cellid und optionen fuer Hamburg ergaenzt)
Zeile 18: Zeile 18:
 
Um sich mit <code>batman.kiel.freifunk.net</code> auf der Schnittstelle wlan0 mit der [[bssid]] <code>02:ca:ff:ee:ba:be</code> zu verbinden erstelle folgendes script und nenne es z.B. '''/usr/local/sbin/freifunk-connect''':
 
Um sich mit <code>batman.kiel.freifunk.net</code> auf der Schnittstelle wlan0 mit der [[bssid]] <code>02:ca:ff:ee:ba:be</code> zu verbinden erstelle folgendes script und nenne es z.B. '''/usr/local/sbin/freifunk-connect''':
  
[http://pastebin.com/X0LMCrMS download script]
+
[http://pastebin.com/a1J1Wx5U download script]
 
'''<pre style="color:#222233">
 
'''<pre style="color:#222233">
#! /bin/bash
+
#!/bin/bash
 
IFACE=wlan0
 
IFACE=wlan0
 
ESSID=batman.kiel.freifunk.net
 
ESSID=batman.kiel.freifunk.net
 
CHANNEL=11
 
CHANNEL=11
 +
CELLID=02:ca:ff:ee:ba:be
 +
NODELINK=http://freifunk.in-kiel.de/ffmap/nodes.html
 +
 +
if [ "$1" = "hh" ]; then
 +
  ESSID=f8:d1:11:87:52:2e
 +
  CHANNEL=1
 +
  CELLID=f8:d1:11:87:52:2e
 +
  NODELINK=http://10.130.10.1/ffhh/nodes.html
 +
fi
 +
 +
if [ "$1" = "--help" ]; then
 +
  echo "[start](default) or [stop]"
 +
  echo to connect to hamburg call this script with option hh
 +
  echo edit the options in the top section of this script to connect to another network
 +
  echo your network devices:
 +
  lspci|grep -i net
 +
  exit
 +
fi
 +
 +
NETWORKMANAGER="service network-manager"
 +
# some distributions have
 +
#NETWORKMANAGER="/etc/init.d/network-manager"
  
 
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
 
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
 
   echo "You must be root to run this script!"; exit 1
 
   echo "You must be root to run this script!"; exit 1
 
fi
 
fi
 +
  
 
if [ "$1" = "stop" ]; then
 
if [ "$1" = "stop" ]; then
 
   echo "resuming normal networking..."
 
   echo "resuming normal networking..."
 
   echo "restart network-manager"
 
   echo "restart network-manager"
   service network-manager restart
+
   $NETWORKMANAGER restart
 
   echo "turn wlan iface off"
 
   echo "turn wlan iface off"
 
   batctl if del $IFACE
 
   batctl if del $IFACE
Zeile 42: Zeile 65:
 
elif [ "$1" = "restart" ]; then
 
elif [ "$1" = "restart" ]; then
 
   echo "not implemented. call this script first with stop and then with start"
 
   echo "not implemented. call this script first with stop and then with start"
  exit
 
elif [ "$1" = "--help" ]; then
 
  echo "[start](default) or [stop]"
 
  echo edit the options in the top section of this script to connect to another network
 
 
   exit
 
   exit
 
else # "start"
 
else # "start"
 
   echo "stopping network-manager"
 
   echo "stopping network-manager"
   service network-manager stop
+
   $NETWORKMANAGER stop
 
   echo "pls wait"
 
   echo "pls wait"
 
   sleep 10
 
   sleep 10
Zeile 59: Zeile 78:
 
   iwconfig $IFACE enc off
 
   iwconfig $IFACE enc off
 
   echo "start ad-hoc mode"
 
   echo "start ad-hoc mode"
   iwconfig $IFACE mode ad-hoc essid $ESSID ap 02:ca:ff:ee:ba:be channel $CHANNEL
+
   iwconfig $IFACE mode ad-hoc essid $ESSID ap $CELLID channel $CHANNEL
 +
  #eigentlich sollte man lieber das hier benutzen, geht aber nicht:
 +
  # iw dev wlan0 ibss join $ESSID 2412 HT40+ fixed-freq $CELLID
 
   echo "load module into kernel"
 
   echo "load module into kernel"
 
   modprobe batman-adv
 
   modprobe batman-adv
Zeile 69: Zeile 90:
 
   ifconfig bat0 up
 
   ifconfig bat0 up
 
   echo "ESSID $ESSID on $IFACE should be ready"
 
   echo "ESSID $ESSID on $IFACE should be ready"
 +
 
 +
  #sollte man eigentlich machen, geht aber nicht:
 +
  #batctl gw client
 +
 
 
   echo "internet starting, this may take some minutes due to latency..."
 
   echo "internet starting, this may take some minutes due to latency..."
 
   dhclient bat0
 
   dhclient bat0
 
   echo "internet connection IP:"
 
   echo "internet connection IP:"
 
   ifconfig|grep Bcast
 
   ifconfig|grep Bcast
 +
  echo you should have an IP like 10.x.x.x
 +
  echo after a minute your node should popup on the nodeGraph here $NODELINK
 
   echo
 
   echo
 
   echo "to resume normal networking call this script with option stop"
 
   echo "to resume normal networking call this script with option stop"

Version vom 7. Dezember 2012, 01:34 Uhr

So einfach kann man seinen Laptop in das Freifunk-Netz als Knoten mit integrieren (Unter Ubuntu 12.04 getestet):

Installation

sudo apt-get install batctl

Kernelmodul laden:

sudo modprobe batman-adv

Version prüfen:

sudo batctl -v

Nicht alle Batmanversionen sind kompatibel - siehe: http://www.open-mesh.org/projects/batman-adv/wiki/Compatversion

Start-Script erstellen

Um sich mit batman.kiel.freifunk.net auf der Schnittstelle wlan0 mit der bssid 02:ca:ff:ee:ba:be zu verbinden erstelle folgendes script und nenne es z.B. /usr/local/sbin/freifunk-connect:

download script

#!/bin/bash
IFACE=wlan0
ESSID=batman.kiel.freifunk.net
CHANNEL=11
CELLID=02:ca:ff:ee:ba:be
NODELINK=http://freifunk.in-kiel.de/ffmap/nodes.html

if [ "$1" = "hh" ]; then
  ESSID=f8:d1:11:87:52:2e
  CHANNEL=1
  CELLID=f8:d1:11:87:52:2e
  NODELINK=http://10.130.10.1/ffhh/nodes.html
fi

if [ "$1" = "--help" ]; then
  echo "[start](default) or [stop]"
  echo to connect to hamburg call this script with option hh
  echo edit the options in the top section of this script to connect to another network
  echo your network devices:
  lspci|grep -i net
  exit
fi

NETWORKMANAGER="service network-manager"
# some distributions have 
#NETWORKMANAGER="/etc/init.d/network-manager"

if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
  echo "You must be root to run this script!"; exit 1
fi


if [ "$1" = "stop" ]; then
  echo "resuming normal networking..."
  echo "restart network-manager"
  $NETWORKMANAGER restart
  echo "turn wlan iface off"
  batctl if del $IFACE
  sleep 10
  echo "OK"
  echo "echo it can take a few minutes until network-manager gets a new route"
  echo
  exit
elif [ "$1" = "restart" ]; then
  echo "not implemented. call this script first with stop and then with start"
  exit
else # "start"
  echo "stopping network-manager"
  $NETWORKMANAGER stop
  echo "pls wait"
  sleep 10
  echo "turn wlan iface off"
  ifconfig $IFACE down
  echo" set maximal transfer unit from standard 1500 to 1528"
  ifconfig $IFACE mtu 1528
  echo "turn wlan encryption off"
  iwconfig $IFACE enc off
  echo "start ad-hoc mode"
  iwconfig $IFACE mode ad-hoc essid $ESSID ap $CELLID channel $CHANNEL
  #eigentlich sollte man lieber das hier benutzen, geht aber nicht: 
  # iw dev wlan0 ibss join $ESSID 2412 HT40+ fixed-freq $CELLID
  echo "load module into kernel"
  modprobe batman-adv
  echo "adding iface to batman"
  batctl if add $IFACE
  echo "turn wlan iface on"
  ifconfig $IFACE up
  echo "turn batman iface on"
  ifconfig bat0 up
  echo "ESSID $ESSID on $IFACE should be ready"
  
  #sollte man eigentlich machen, geht aber nicht:
  #batctl gw client
  
  echo "internet starting, this may take some minutes due to latency..."
  dhclient bat0
  echo "internet connection IP:"
  ifconfig|grep Bcast
  echo you should have an IP like 10.x.x.x
  echo after a minute your node should popup on the nodeGraph here $NODELINK
  echo
  echo "to resume normal networking call this script with option stop"
  echo
fi

Wenn das script ausgeführt wird, dann ist dein Rechner Teil des Freifunk-Netzwerkes und mescht mit. Er kann so also auch als Brücke zwischen zwei Routern fungieren, die zu weit auseinander liegen.

Siehe auch: Askubuntu

Todo

fastd installieren und eine Werbindung vom eigenen Rechner aus aufbauen: