Install batman-adv on Raspberry Pi

Posted by dimidu 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Install batman-adv on Raspberry Pi
October 09, 2012 08:18PM
Hi
I want meshing Raspberry Pi with mesh network (freifunk) first, and then run PB on Raspberry Pi inside mesh network (bat0)

i do as here http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide
On all nodes, install batman-adv, load the module and enter the following commands:

ifconfig wlan0 mtu 1528
iwconfig wlan0 mode ad-hoc essid my-mesh-network ap 02:12:34:56:78:9A channel 1
batctl if add wlan0
ifconfig wlan0 up
ifconfig bat0 up

I had install batmand, batctl, downloaded modules from [www.netlore.co.uk] loaded module.
sudo modprobe badman-adv - ok
sudo ifconfig wlan0 down
sudo fconfig wlan0 mtu 1528
but when I do sudo iwconfig wlan0 mode ad-hoc essid my-mesh-network ap 02:12:34:56:78:9A channel 1
i get error:
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Device or resource busy.

I think, must disable network-manager, but not not found on RPi.
Re: Install batman-adv on Raspberry Pi
October 10, 2012 04:24AM
Using network-manager together with manual configuration of network-interfaces is always a very bad idea!

you should check, If you wlan-card is capable of running "adhoc" mode: [linuxwireless.org]
Re: Install batman-adv on Raspberry Pi
October 10, 2012 05:44AM
I have usb-wlan RT5370.
It is not in the list am linuxwirelees.org but
pi@raspberrypi ~ $ sudo iw phy
Wiphy phy0
	Band 1:
		Capabilities: 0x172
			HT20/HT40
			Static SM Power Save
			RX Greenfield
			RX HT20 SGI
			RX HT40 SGI
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 2 usec (0x04)
		HT RX MCS rate indexes supported: 0-7, 32
		TX unequal modulation not supported
		HT TX Max spatial streams: 1
		HT TX MCS rate indexes supported may differ
		Frequencies:
			* 2412 MHz [1] (20.0 dBm)
			* 2417 MHz [2] (20.0 dBm)
			* 2422 MHz [3] (20.0 dBm)
			* 2427 MHz [4] (20.0 dBm)
			* 2432 MHz [5] (20.0 dBm)
			* 2437 MHz [6] (20.0 dBm)
			* 2442 MHz [7] (20.0 dBm)
			* 2447 MHz [8] (20.0 dBm)
			* 2452 MHz [9] (20.0 dBm)
			* 2457 MHz [10] (20.0 dBm)
			* 2462 MHz [11] (20.0 dBm)
			* 2467 MHz [12] (20.0 dBm) (passive scanning, no IBSS)
			* 2472 MHz [13] (20.0 dBm) (passive scanning, no IBSS)
			* 2484 MHz [14] (20.0 dBm) (passive scanning, no IBSS)
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps (short preamble supported)
			* 5.5 Mbps (short preamble supported)
			* 11.0 Mbps (short preamble supported)
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
	max # scan SSIDs: 4
	max scan IEs length: 2257 bytes
	Coverage class: 0 (up to 0m)
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP (00-0f-ac:4)
	Available Antennas: TX 0 RX 0
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * WDS
		 * monitor
		 * mesh point
	software interface modes (can always be added):
		 * AP/VLAN
		 * monitor
	interface combinations are not supported
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * new_beacon
		 * new_station
		 * new_mpath
		 * set_mesh_params
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * remain_on_channel
		 * set_tx_bitrate_mask
		 * action
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * set_wds_peer
		 * connect
		 * disconnect
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0xd0
		 * managed: 0x40 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0

How do Idisable network-manager?
Thanks!



Edited 1 time(s). Last edit at 10/10/2012 06:27AM by dimidu.
Re: Install batman-adv on Raspberry Pi
October 10, 2012 07:29AM
The following worked on a ubuntu maschine, maybe it helps on raspberian too!
sudo service network-manager stop

Try to remove the wlan0 device and create a adhoc-wlan0 device via iw:

  sudo ifconfig wlan0 down
  sudo iw dev wlan0 del 
  sudo iw phy phy0 interface add wlan0 type adhoc 
  sudo ifconfig wlan0 mtu xxxx

Are you sure about batman-adv ?

You can find help in my shell-script for piratebox-mesh feature. There are lot of stuff, which may help you.: [github.com]

Matthias
Re: Install batman-adv on Raspberry Pi
October 10, 2012 09:16PM
Thanks!
I got it. Raspbian has no service network-manager.
I must apt-get instal iw too.
Re: Install batman-adv on Raspberry Pi
October 11, 2012 06:13PM
So it works in you freifunk network?
Re: Install batman-adv on Raspberry Pi
October 12, 2012 08:39PM
Yes. RPi connect to router when both network has same name.
Re: Install batman-adv on Raspberry Pi
October 13, 2012 08:07PM
Hi,
cool. Darf ich fragen wo in NRW du wohnst? so grob?
Schade, dass wir hier in Wiesbaden nicht so ein Freifunk-Netz haben...

Schon Erfahrungen gemacht? Würde mich echt interessieren, wie es ankommt smiling smiley

liebe Grüße aus Wiesbaden
Matthias



Sorry, for some german words here smiling smiley
Re: Install batman-adv on Raspberry Pi
October 18, 2012 06:02PM
Hi
I live in Duisburg.
We got freifunk images from http://fnordeingang.de/wiki/Freifunk_Images

Freifunk runing ok. To me on wr703n. I want now runing PB on wr703n with Freifunk. PB must runing on Freifunk-cloud at bat0
Re: Install batman-adv on Raspberry Pi
October 18, 2012 06:04PM
Do you need any help?
Re: Install batman-adv on Raspberry Pi
October 18, 2012 06:43PM
Yes, I write late, when i trying.
Thanks
Re: Install batman-adv on Raspberry Pi
October 18, 2012 10:57PM
Hi!
I trying install PB on RPi with Freifunk.
First I have got Freifunk on RPi: now RPi connected over batman-adv with my freifunk-router(wr703n)

on router:

batctl o
[B.A.T.M.A.N. adv 2012.2.0, MainIF/MAC: wlan0-1/16:e6:e4:e3:95:a9 (bat0)]
  Originator      last-seen (#/255)           Nexthop [outgoingIF]:   Potential nexthops ...
92:f6:52:a7:77:69    2.190s   (116) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (116)
fa:d1:11:a0:5f:e7    0.920s   (102) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (102)
fa:0b:b4:65:48:cf    1.550s   (117) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (117)
       test.du.ff    0.190s   (254)        test.du.ff [   wlan0-1]:        test.du.ff (254)
92:f6:52:dc:52:a7    1.860s   ( 99) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf ( 99)

test.du.ff - this is host name of RPi.( I had done entry in router's /etc/bat-hosts - mac-adress of RPi - 7c:dd:90:1c:db:3b)

Now I can ping from router to RPi with MAC or hostname:
batctl p 7c:dd:90:1c:db:3b
PING 7c:dd:90:1c:db:3b (7c:dd:90:1c:db:3b) 20(48) bytes of data
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=1 ttl=50 time=1.19 ms
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=2 ttl=50 time=1.11 ms
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=3 ttl=50 time=1.25 ms
^C--- 7c:dd:90:1c:db:3b ping statistics ---
3 packets transmitted, 3 received, 0% packet loss
rtt min/avg/max/mdev = 1.109/1.183/1.252/0.058 ms

batctl p test.du.ff
PING test.du.ff (7c:dd:90:1c:db:3b) 20(48) bytes of data
20 bytes from test.du.ff icmp_seq=1 ttl=50 time=1.77 ms
20 bytes from test.du.ff icmp_seq=2 ttl=50 time=1.85 ms
20 bytes from test.du.ff icmp_seq=3 ttl=50 time=0.81 ms
20 bytes from test.du.ff icmp_seq=4 ttl=50 time=0.90 ms
^C--- test.du.ff ping statistics ---
4 packets transmitted, 4 received, 0% packet loss
rtt min/avg/max/mdev = 0.810/1.332/1.848/0.479 ms

Second I had install PB on RPi as tutorial (over lan) - full install(but not started PirateBox), then I had changed /opt/piratebox/conf/piratebox.conf
DO_IFCONFIG="yes"
DO_IW="no"
USE_APN="no"

USE_DNSMASQ="yes"
INTERFACE="bat0"
DNSMASQ_INTERFACE="bat0"
Then starting Piratebox.
Thats runing but not right
sudo /etc/init.d/piratebox start
ln: failed to create symbolic link `/opt/piratebox/www/board/board': File exists
ln: failed to create symbolic link `/opt/piratebox/www/Shared/Shared': File exists
[....] Starting script piratebox :
Generating hosts file .... 
Generating dnsmasq.conf .....
Empty tmp folder
rm: cannot remove `/opt/piratebox/tmp/': Is a directory
[....]   Setting up wlan:Bringing up wifi interface bat0 
Setting up bat0
[ ok ] Starting dnsmasq... :.
[ ok ] Starting droopy...:.
[ ok ] Starting lighttpd...:.

Here is ifconfig bat0 on RPi:
ifconfig bat0
bat0      Link encap:Ethernet  HWaddr ee:cb:59:b5:b5:a0  
          inet addr:192.168.77.1  Bcast:192.168.77.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1168 errors:0 dropped:914 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:398701 (389.3 Kicool smiley  TX bytes:0 (0.0 cool smiley

This is not good thats bat0 has IP 192.168.77.1

Here is bat0 on router:
ifconfig bat0
bat0      Link encap:Ethernet  HWaddr 7E:C5:B7:0D:7A:05  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1441 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1077 errors:0 dropped:101 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:264187 (257.9 Kicool smiley  TX bytes:257160 (251.1 Kicool smiley

In Freifun-cloud possible runing server, here is tutorial (sorry, only german):http://wiki.freifunk.net/Freifunk_Wuppertal/Firmware#Interne_Dienste
I need right settings on pitatebox.conf
Thanks!
Re: Install batman-adv on Raspberry Pi
October 19, 2012 04:26AM
Set
DO_IFCONFIG="yes"

to "no"

winking smiley
Re: Install batman-adv on Raspberry Pi
October 19, 2012 04:27AM
Set
DO_IFCONFIG="yes" 
USE_DNSMASQ="yes"

to "no"

winking smiley
Re: Install batman-adv on Raspberry Pi
October 19, 2012 05:06PM
Is done,
PB run on RPi but I don't know how I can connect to server from Freifunk-cloud.
I can ping from router with RPi's MAC or with test.du.ff but I have no idea what I do now.
Re: Install batman-adv on Raspberry Pi
October 19, 2012 05:11PM
oh, uploading does not work with the different domain.
change /opt/piratebox/www/redirect.html & index.html

There you have to exchange piratebox.lan with your domain in the FF-cloud.
Re: Install batman-adv on Raspberry Pi
October 19, 2012 06:11PM
What I have change in redirect and index.html? piratebox.lan to my domen?
I had done all but no succses. May be I must setting firewall,

pi@raspberrypi ~ $ ifconfig bat0
bat0      Link encap:Ethernet  HWaddr ee:cb:59:b5:b5:a0  
          inet addr:10.71.1.77  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9236 errors:0 dropped:8376 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3640479 (3.4 Micool smiley  TX bytes:0 (0.0 cool smiley
Is no normall that TX bytes:0 (0.0 cool smiley is
on my router:
ifconfig
bat0      Link encap:Ethernet  HWaddr 7E:C5:B7:0D:7A:05  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13429 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4318 errors:0 dropped:152 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2568595 (2.4 Micool smiley  TX bytes:1541993 (1.4 Micool smiley

Re: Install batman-adv on Raspberry Pi
October 19, 2012 07:48PM
What do you want to achieve with your raspberryPI PirateBox on freifunk-network?
I think we have to discuss about the wanted results
Re: Install batman-adv on Raspberry Pi
October 19, 2012 08:03PM
I want only PirateBox runing within FF-cloud.
Re: Install batman-adv on Raspberry Pi
October 19, 2012 08:06PM
What should the piratebox do?
What are you expecting? Always redirect every connected node to the piratebox?

The piratebox it built of one webserver and one python script. AccessPoint, DNS&DHCP and other stuff are normal function like in a normal router.
For your case, you activated (like described) the webserver&python script only.

You are not getting any IP from that machine... or do you want to giveaway IPs via DHCP in your managed FF-network?

So, I'm not really getting the point, where the exact problem is.

-----

edit: Can you describe how exactly your test/network setup is?



Edited 1 time(s). Last edit at 10/19/2012 08:18PM by Matthias.
Re: Install batman-adv on Raspberry Pi
October 19, 2012 09:11PM
In FF-network every FF-router doing 2 wlan-network: 1 ad-hoc network - with the network every node connect to neighbors noden and getting mesh-network. 2 - public AP, with the network everybody can connect to mesh-network with netbook or mobile. Every connected client get IP4 and IP6.
If at least one node has Internet Accses then whole FF-cloud has that.
I want every client who going to "test.du.ff" accses PirateBox and can sharing files and chating.
Re: Install batman-adv on Raspberry Pi
October 20, 2012 06:28AM
Indead, It seems not like a piratebox-problem.
Maybe something with the batman driver went wrong.

Which batman-adv Version do you run on your raspberry (check dmsg) and which version does your network run?
I encountered incompatibilities, when I played around with it.
Re: Install batman-adv on Raspberry Pi
October 20, 2012 07:39AM
Router - 2012.2.0
RPi - 2011.4.0 (compatibility version 14)
Re: Install batman-adv on Raspberry Pi
October 20, 2012 07:43AM
Hi, yes this is fine refering to open-mesh.org

refering to a post above, your RPi does see other clients- Do other clients see the RPi in their "batctl o"-list?
Re: Install batman-adv on Raspberry Pi
October 20, 2012 08:09AM
Yes RPi can see over clients and over clients can see RPi.
pi@raspberrypi ~ $ sudo batctl o
[B.A.T.M.A.N. adv 2011.4.0, MainIF/MAC: wlan0/7c:dd:90:1c:db:3b (bat0)]
  Originator      last-seen (#/255)           Nexthop [outgoingIF]:   Potential nexthops ...
92:f6:52:a7:77:69    1.020s   ( 98) 16:e6:e4:e3:95:a9 [     wlan0]: 16:e6:e4:e3:95:a9 ( 98)
fa:d1:11:a0:5f:e7    0.900s   ( 82) 16:e6:e4:e3:95:a9 [     wlan0]: 16:e6:e4:e3:95:a9 ( 82)
16:e6:e4:e3:95:a9    0.460s   (251) 16:e6:e4:e3:95:a9 [     wlan0]: 16:e6:e4:e3:95:a9 (251)
92:f6:52:dc:52:a7    1.020s   ( 85) 16:e6:e4:e3:95:a9 [     wlan0]: 16:e6:e4:e3:95:a9 ( 85)

Router:
root@meinode1:~# batctl o
[B.A.T.M.A.N. adv 2012.2.0, MainIF/MAC: wlan0-1/16:e6:e4:e3:95:a9 (bat0)]
  Originator      last-seen (#/255)           Nexthop [outgoingIF]:   Potential nexthops ...
92:f6:52:a7:77:69    2.180s   (108) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (108)
fa:d1:11:a0:5f:e7    0.100s   (105) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (105)
fa:0b:b4:65:48:cf    2.080s   (124) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (124)
       test.du.ff    0.760s   (246)        test.du.ff [   wlan0-1]:        test.du.ff (246)
92:f6:52:dc:52:a7    0.180s   (104) fa:0b:b4:65:48:cf [      n2n2]: fa:0b:b4:65:48:cf (104)

Re: Install batman-adv on Raspberry Pi
October 20, 2012 08:11AM
and
ping 10.71.1.77

from router to rpi works?


Do you want RPI to give away IP adresses with a fake DNS (with redirect)?



Edited 1 time(s). Last edit at 10/20/2012 08:11AM by Matthias.
Re: Install batman-adv on Raspberry Pi
October 20, 2012 08:18AM
I can ping only MAC adress or bat host name:
root@meinode1:~# batctl p 7c:dd:90:1c:db:3b
PING 7c:dd:90:1c:db:3b (7c:dd:90:1c:db:3b) 20(48) bytes of data
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=1 ttl=50 time=0.79 ms
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=2 ttl=50 time=0.92 ms
20 bytes from 7c:dd:90:1c:db:3b icmp_seq=3 ttl=50 time=0.77 ms
^C--- 7c:dd:90:1c:db:3b ping statistics ---
3 packets transmitted, 3 received, 0% packet loss
rtt min/avg/max/mdev = 0.769/0.827/0.921/0.067 ms
root@meinode1:~# batctl p test.du.ff
PING test.du.ff (7c:dd:90:1c:db:3b) 20(48) bytes of data
20 bytes from test.du.ff icmp_seq=1 ttl=50 time=1.82 ms
20 bytes from test.du.ff icmp_seq=2 ttl=50 time=1.19 ms
20 bytes from test.du.ff icmp_seq=3 ttl=50 time=0.86 ms
20 bytes from test.du.ff icmp_seq=4 ttl=50 time=2.72 ms
^C--- test.du.ff ping statistics ---
4 packets transmitted, 4 received, 0% packet loss
rtt min/avg/max/mdev = 0.861/1.646/2.717/0.708 ms

Re: Install batman-adv on Raspberry Pi
October 20, 2012 08:20AM
no, please try the ip address!
Ping via batctl is on another Network layer then the normal ping. I want to know if the ping reaches the RPI

btw: you can use tcpdump on RPI @bat0 interface for seeing incoming packets.

btw2: you can contact me on icq 28593989 or jabber: kurvenjunkie@jabber.ccc.de
Re: Install batman-adv on Raspberry Pi
October 20, 2012 03:36PM
Yes! I can ping 10.71.1.77 from router or from my nettop connected to FF-cloud.
And when i take in brouser 10.71.1.77 I get start site PirateBox for 1 sec. and then I get redirect to blank page test.du.ff

I had changed in piratebox.conf, index.html and redirect.html test.du.ff to 10.71.1.77 and deleted entry at router's bat-hosts but result is always the same.
When I connected to FF with Android-phone and go to 10.71.1.77 I get PB startpage, chat is working, but when I upload a files, I get filenames in /Shared as tmpB4QP_1 or tmpxJgxTi

When I connected to FF with anover ubuntu-PC and go to 10.71.1.77 I get PB start page and the page is blink - always redirect to 10.71.1.77
Re: Install batman-adv on Raspberry Pi
October 20, 2012 06:11PM
I had solved redirect to test.du.ff while changed /etc/hosts localhost test.du.ff to 127.0.0.1
Now I can see PirateBox page from FF-cloud when I go to 10.71.1.77 every secunde I get redirect - the page is blink.