Eigenen Rechner in das Freifunk-Netz: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Rubo77 (Diskussion | Beiträge) |
Rubo77 (Diskussion | Beiträge) (→Start-Script erstellen: stop option und config-optionen an den Anfang ums leichter mit anderen Netzwerken anzupassen) |
||
Zeile 21: | Zeile 21: | ||
#! /bin/bash | #! /bin/bash | ||
IFACE=wlan0 | IFACE=wlan0 | ||
+ | ESSID=batman.kiel.freifunk.net | ||
+ | CHANNEL=11 | ||
+ | NAME=kiel | ||
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 | ||
Zeile 26: | Zeile 29: | ||
fi | fi | ||
− | echo "stopping network-manager" | + | if [ "$1" = "stop" ]; then |
− | service network-manager stop | + | echo "resuming normal networking..." |
− | echo "pls wait" | + | echo "restart network-manager" |
− | sleep 10 | + | service network-manager restart |
− | echo turn wlan iface off | + | echo "turn wlan iface off" |
− | ifconfig $IFACE down | + | batctl if del $IFACE |
− | echo set maximal transfer unit from standard 1500 to 1528 | + | sleep 10 |
− | ifconfig $IFACE mtu 1528 | + | echo "OK" |
− | echo turn wlan encryption off | + | echo "echo it can take a few minutes until network-manager gets a new route" |
− | iwconfig $IFACE enc off | + | echo |
− | echo start ad-hoc mode | + | exit |
− | iwconfig $IFACE mode ad-hoc essid | + | elif [ "$1" = "restart" ]; then |
− | echo load module into kernel | + | echo "not implemented. call this script first with stop and then with start" |
− | modprobe batman-adv | + | exit |
− | echo adding iface to batman | + | elif [ "$1" = "--help" ]; then |
− | batctl if add $IFACE | + | echo "[start](default) or [stop]" |
− | echo turn wlan iface on | + | echo edit the options in the top section of this script to connect to another network |
− | ifconfig $IFACE up | + | exit |
− | echo turn batman iface on | + | else # "start" |
− | ifconfig bat0 up | + | echo "stopping network-manager" |
− | echo " | + | service network-manager stop |
− | echo "internet starting, this may take some minutes due to latency..." | + | echo "pls wait" |
− | dhclient bat0 | + | sleep 10 |
− | echo "internet connection IP:" | + | echo "turn wlan iface off" |
− | ifconfig|grep Bcast | + | ifconfig $IFACE down |
− | echo | + | echo" set maximal transfer unit from standard 1500 to 1528" |
− | echo "to resume normal networking | + | ifconfig $IFACE mtu 1528 |
− | + | echo "turn wlan encryption off" | |
− | + | iwconfig $IFACE enc off | |
− | echo | + | echo "start ad-hoc mode" |
− | + | iwconfig $IFACE mode ad-hoc essid $ESSID ap 02:ca:ff:ee:ba:be channel $CHANNEL | |
+ | 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" | ||
+ | echo "internet starting, this may take some minutes due to latency..." | ||
+ | dhclient bat0 | ||
+ | echo "internet connection IP:" | ||
+ | ifconfig|grep Bcast | ||
+ | echo | ||
+ | echo "to resume normal networking call this script with option stop" | ||
+ | echo | ||
+ | fi | ||
</pre>''' | </pre>''' | ||
Version vom 6. Dezember 2012, 20:39 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:
#! /bin/bash IFACE=wlan0 ESSID=batman.kiel.freifunk.net CHANNEL=11 NAME=kiel 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" service network-manager 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 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 else # "start" echo "stopping network-manager" service network-manager 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 02:ca:ff:ee:ba:be channel $CHANNEL 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" echo "internet starting, this may take some minutes due to latency..." dhclient bat0 echo "internet connection IP:" ifconfig|grep Bcast 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:
- fastd installation: http://freifunk.in-kiel.de/wiki/Entwicklung/fastd#Debian