Wireless mesh network

Aus C3D2
Zur Navigation springen Zur Suche springen

Mesh-Geräte im HQ

Wir haben ein gemeinsames Ethernet in dem alle Geräte sind. Das bildet eine sogenannte Broadcast-Domäne, weshalb sich alle User und Server direkt finden können, bspw. durch Broadcast.

Für Mesh-Experimente wird mit Batman-adv genau jenes Layer2 zusammenbridged. In der Praxis bedeutet das dass die Mesh-Geräte bei Trennung vom restlichen Kabelethernet weiterhin Routing unser Netz finden. Achtung: die Wireless-Bandbreite halbiert sich für Traffic über diese.

OpenWRT bauen

OpenWRT kommt by default nicht mit batman-adv. Also folge den Vorbereitungsanweisungen. Du musst auch Package-Feeds installieren.

Wähle Zielplattform, lade Default-Configs:

make menuconfig
make defconfig
make menuconfig

Nun konfiguriere folgende Pakete (Y damit sie fest im Image sind):

  • kmov-batman-adv, batctl
  • ip-full, tcpdump

Bauen je nach Kernzahl:

make -j5 V=s

Nun gibts die Images bspw. unter bin/ar71xx/. Übertrage das richtige mit -sysupgrade.bin nach /tmp auf dem Zielgerät und flashe es mit sysupgrade.

Konfiguration

/etc/config/batman-adv

config 'mesh' 'bat0'
	# Denn es wird von mehreren Geräten mit einem Ethernet zusammenbridged
	option 'bridge_loop_avoidance' 'enabled'
	# Sonst kein IPv6, http://www.open-mesh.org/projects/batman-adv/wiki/DistributedARPTable-technical
	option 'distributed_arp_table' 'disabled'

/etc/config/wireless

config wifi-device  radio0
	option type     mac80211
	option channel  11
	option hwmode	11g
	option htmode	HT20
	# Geblubber von `wifi detect`:
	option path	'platform/ar934x_wmac'

# Offener AP
config wifi-iface
	option device   radio0
	option network  lan
	option mode     ap
	option ssid     C3D2.meshed
	option encryption none

# Adhoc-Interface
config wifi-iface
        option device   radio0
        option ifname   mesh0
        option network  mesh
        option mode     adhoc
        option ssid     batman-adv
        option bssid    '02:CA:FE:CA:CA:40'
        option mcast_rate 18000
        option encryption none

/etc/config/network

# Das ist das Adhoc-Interface direkt (wlan0, aus dem zweiten wifi-iface oben)
# Pakete von lan aus bat0 bekommen noch etwas Overhead.
config interface 'mesh'
	option mtu 1532
	option proto batadv
	option mesh bat0

# Ethernet-Ports (eth1) und das AP-Interface (wlan0-1, aus dem ersten wifi-iface) werden mit bat0 zusammenbridged
config interface 'lan'
	option ifname 'eth1 bat0'
	option force_link '1'
	option type 'bridge'
	option proto 'static'
	# Schau ins [[DNS]]
	option ipaddr '172.22.99.18'
	option netmask '255.255.255.0'
	option gateway '172.22.99.4'

SpaceAPI-Integration

Installiere opkg-Pakete libnetsnmp und snmpd. Mache startbar mit:

cd /etc/rc.d
ln -s ../init.d/snmpd S99snmpd

/etc/config/snmpd

config exec
	option name	wlan0-stations
	option prog	/bin/sh
	option args	'-c "exit `iw dev wlan0-1 station dump|egrep -e ^Station\ |wc -l`"'

Eintragen in Poller

https://github.com/astro/spacemsg/tree/master/spaceapi