Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wireless mesh networking on Raspberry Pi using batman-adv protocol

So I'm trying to setup a wireless mesh network using Raspberry Pi's, with the Edimax EW-7811Un WLAN Adapter and the batman-adv protocol.

I've tried following the basic setup guides from:

  • http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide
  • http://mindofdes.blogspot.co.uk/2013/02/raspberry-pi-raspbian-wireless-and.html

Unfortunately, when I get to the point where I need to ping one node from the other, I get

Destination Host Unreachable.

Running the batctl o command displays

'no batman nodes in range'

However, when running iwconfig, both nodes appear to be associated with the network I've setup, and when running iwlist wlan0 scan, the network I've setup appear as cells on both nodes.

I'm now at a loss as to how to proceed. I have read some articles on issues with ad-hoc support for Linux WLAN adapter drivers. My adapter is using the RTL8192CU driver. Could this be the cause of the issue?

P.S. I have looked at the following post, but this was no help, unfortunately.

Edit: contents of /etc/network/interfaces:

Both currently setup nodes have the same contents:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Edit: contents of /etc/wpa_supplicant/wpa_supplicant.conf for both nodes:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

Edit: ifconfig, iwconfig, and route for both nodes:

Node 1

ifconfig

wlan0    Link encap: Ethernet  HWaddr 80:1f:02:9b:bc:6c
         inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0  errors:0  dropped:1  overruns:0  frame:0
         TX packets:0  errors:0  dropped:0  overruns:0  carrier:0
         collisions:0  txqueuelen:1000
         RX bytes:0  (0.0 B)  TX bytes: 0  (0.0 B)

iwconfig

wlan0    IEEE 802.11bg  ESSID:"pi-ad-hoc" Nickname:"<WIFI@REALTEK>"
         Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 02:11:87:A1:CD:FF
         Bit Rate:54 Mb/s   Sensitivity:0/0
         Retry:off    RTS thr:off    Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality=2/100  Signal level=2/100  Noise level=0/100
         Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0  Missed beacon:0

route

Kernel IP routing table
Destination    Gateway        Genmask        Flags  Metric  Ref    Use  Iface
192.168.2.0    *              255.255.255.0  U      0       0        0  wlan0

Node 2

ifconfig

wlan0    Link encap:Ethernet  HWaddr 80:1f:02:da:2e:ee
         inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0  errors:0  dropped:0  overruns:0  frame:0
         TX packets:6  errors:0  dropped:0  overruns:0  carrier:0
         collisions:0  txqueuelen:1000
         RX bytes:0  (0.0 B)  TX bytes:0  (0.0 B)

iwconfig

wlan0    IEEE 802.11bg ESSID:"pi-ad-hoc"  Nickname:"<WIFI@REALTEK>"
         Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 02:11:87:2F:D6:FF
         Bit Rate:54 Mb/s   Sensitivity:0/0
         Retry:off  RTS thr:off  Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality=2/100  Signal level=2/100  Noise level=0/100
         Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0  Missed beacon:0

route

Kernel IP routing table
Destination    Gateway        Genmask        Flags  Metric  Ref     Use   Iface
192.168.2.0    *              255.255.255.0  U      0       0         0   wlan0
like image 882
Rich Avatar asked May 02 '14 22:05

Rich


People also ask

How do I create a mesh network on my Raspberry Pi?

create a mesh network using Raspberry Pis. connect the mesh to an existing network, understanding the difference between routing and bridging network traffic. enable non-mesh devices to use the mesh to connect to the Internet. create a sensor application on a mesh node which securely communicates with a cloud ...

What is Batman protocol?

B.A.T.M.A.N. is a proactive routing protocol for Wireless Ad-hoc Mesh Networks, including (but not limited to) Mobile Ad-hoc Networks (MANETs). The protocol proactively maintains information about the existence of all nodes in the mesh that are accessible via single-hop or multi-hop communication links.

Can you create a network on a Raspberry Pi?

The Raspberry Pi Foundation has released PiServer, a tool which allows users to easily set up a network of Raspberry Pi computers.

What is ad hoc mesh network?

A wireless mesh network (WMN) is a particular type of mobile ad hoc network (MANET), which aims to provide ubiquitous high bandwidth access for a large number of users. A pure MANET is dynamically formed by mobile devices without the requirement of any existing infrastructure or prior network configuration.


2 Answers

You try to setup an adhoc network. However I suggest to start with a simpler approach -- Wifi Access Point and then switch over to adhoc network.

From my point of view it is easier to connect the raspi to a wireless accesspoint. Because the accesspoint will hand over the IP adresses through DHCP. Where in adhoc mode you have to care about the IPs yourself (as far as I know).

Therefore the config for the accespoint based solution would be like

/etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

(which is by the way pretty much like yours already)

and then the /etc/wpa_supplicant/wpa_supplicant.conf which connects to a WPA2 accesspoint

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="KBBL"
        psk=af2a9daa6cadd3434ad96db48173a04acddb04e6a8c5adf52ae78ef13XXXX
        key_mgmt=WPA-PSK
        scan_ssid=1
        proto=RSN
        pairwise=CCMP
        group=CCMP
}

Please note that the psk key needs to be generated by

$wpa_passphrase "KBBL" "YOUR_KEY"

which results in something like

network={
        ssid="KBBL"
        #psk="YOUR_KEY"
        psk=29af596e046ad450eeddd6752432d5dbd26575960b9024e5cbb99e945cdafa4e
}

just copy and paste the psk

Then reboot! I sometimes have trouble when just changing the network wifi settings on the fly. While after reboot everything is fine. Also the wifi network takes some time. At my place something between 20-40secs.

Btw. I also had trouble when trying to setup wifi without encryption or WEP encryption so I suggest to use WPA2 or WPA. Please also note that the WPA configuration of the wpa_supplicant is much different from this of WPA2. So you might start using the above example for WPA2.

like image 26
tswaehn Avatar answered Oct 01 '22 12:10

tswaehn


I can confirm, that this is an issue of the latest rtl8192cu driver. I was using an older version of that driver for edimax wlan adapters with batman working (almost) fine. But I found, that under certain circumstances (with heavy load), the connection failed. Then I upgraded to the latest version of that driver (date: September 11th 2013) but found that batman wasn't working any longer (in the exact same configuration as with the older driver). The symptoms were exactly as you described in your post.

Edit: My post was deleted, saying that I don't give an answer to the question. I disagree with that: this IS an answer to the original post. The only question in the original post was this: "My adapter is using the RTL8192CU driver. Could this be the cause of the issue?"

Again: I can confirm that using this (latest) driver causes the issue. This driver is incompatible with batman. The issue has nothing to do with the configuration file. Try to look for an older driver or -better - use a wlan adapter with a different chipset.

like image 136
Ratz Fatz Avatar answered Oct 01 '22 12:10

Ratz Fatz