phwizard
Posts: 5
Joined: Sat Jun 27, 2015 10:08 am

Mesh (ad-hoc) network chipset RTL8188CUS, kernel 3.18.11-v7+

Sun Aug 16, 2015 5:59 am

Please help - being stuck here for quite a while after trying a hundred things.

Trying to build a mesh network of at least 2 x RPi's.
Able to connect both Pis and a laptop into an ad-hoc network and can ping each Pi from laptop and back. But can't ping one RPi from another.

USB dongle and chipset same on both Pi's, lsusb rendering identical result:

Code: Select all

Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un, 802.11n Wireless Adapter [Realtek RTL8188CUS].
Driver used is 8192cu and not the faulty rtl8192cu one, lsmod renders:

Code: Select all

8192cu
Raspbian, kernel, 3.18.11-v7+.
Got some latest packages from /jessie/ branch to install wpa_supplicant 2.0 hoping it would help but it didn’t so now trying as a non-secure network but it still doesn’t work.

RPi1 ip addr = 10.10.10.19
RPi2 ip addr = 10.10.10.2
Laptop ip addr = 10.10.10.5

I managed successfully to get both RPis onto same Channel, Cell # and Address - with some configurations it’s enough to execute “sudo iwlist wlan0 scan” on both, with others it required running a script. Anyway, this doesn’t affect the result - laptop can ping both RPis even when they are on diffferent Cells, both RPis can ping back. Neither of RPi’s can ping the other RPi even when on identical cell and channel.

From laptop I can see my “pi-ad-hoc” in Wi-Fi networks list under “Devices”.

Once I join it from laptop using IP=10.10.10.5, netmask=255.255.255.0 I can successfully ping both RPi’s simultaneously.

I tried installing and running a custom hostapd compatible with realtek chipsets on both RPis. In that case on laptop “pi-ad-hoc” network moves from Devices to “proper” networks list where all the nearby access points are listed.
With hostapd situation is the same - I can still ping RPi from my laptop, only difference is that laptop can only ping one RPi at a time in this configuration - the one which did “sudo iwlist wlan0 scan” the latest. So it seems with hostapd one of the Pis takes over as AP in Master mode not allowing mesh / ad-hoc mode.
Some outputs from hostapd indicate RPis do detect each other’s presence (but still no ping), outputs provided below.

I also tried installing routing systems for mesh networking such as babeld and olsrd. In ad-hoc configuration they don't work. Once I restore standard /etc/network/interfaces and connect all 3 devices to my internet router with DHCP, then olsrd can discover other nodes fine but obviously then it's not a mesh network topology.

cat /etc/network/interfaces:

Code: Select all

auto lo
iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 10.10.10.19
broadcast 10.10.10.255
netmask 255.255.255.0
wireless-essid pi-ad-hoc
wireless-mode ad-hoc
ifconfig:

Code: Select all

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:128 errors:0 dropped:0 overruns:0 frame:0
          TX packets:128 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:10368 (10.1 KiB)  TX bytes:10368 (10.1 KiB)

wlan0     Link encap:Ethernet  HWaddr 74:da:38:3a:28:ba  
          inet addr:10.10.10.19  Bcast:10.10.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:2 overruns:0 frame:0
          TX packets:177 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:

Code: Select all

wlan0     IEEE 802.11bg  ESSID:"pi-ad-hoc"  Nickname:"<[email protected]>"
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 02:11:87:F3:8F:FF   
          Bit Rate:54 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=100/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
ping 10.10.10.2 (RPi #2):

Code: Select all

PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
From 10.10.10.19 icmp_seq=1 Destination Host Unreachable
From 10.10.10.19 icmp_seq=2 Destination Host Unreachable
...
--- 10.10.10.2 ping statistics ---
18 packets transmitted, 0 received, +15 errors, 100% packet loss, time 16999ms
pipe 4
ping 10.10.10.5 (laptop):

Code: Select all

PING 10.10.10.5 (10.10.10.5) 56(84) bytes of data.
64 bytes from 10.10.10.5: icmp_req=1 ttl=64 time=13.0 ms
64 bytes from 10.10.10.5: icmp_req=2 ttl=64 time=2.37 ms
64 bytes from 10.10.10.5: icmp_req=3 ttl=64 time=1.10 ms
...
--- 10.10.10.5 ping statistics ---
15 packets transmitted, 15 received, 0% packet loss, time 14020ms
rtt min/avg/max/mdev = 0.972/2.233/13.030/3.053 ms
ping broadcast ("ping -b 10.10.10.255"):

Code: Select all

PING 10.10.10.255 (10.10.10.255) 56(84) bytes of data.
--- 10.10.10.255 ping statistics ---
32 packets transmitted, 0 received, 100% packet loss, time 31008ms
lsusb:

Code: Select all

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 005: ID 1a2c:0c21  
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
lsmod:

Code: Select all

Module                  Size  Used by
iptable_filter          1268  0 
ip_tables              11526  1 iptable_filter
x_tables               13674  2 ip_tables,iptable_filter
snd_bcm2835            18850  0 
snd_pcm                75388  1 snd_bcm2835
snd_seq                53078  0 
snd_seq_device          5628  1 snd_seq
snd_timer              17784  2 snd_pcm,snd_seq
snd                    51667  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
8192cu                528429  0 
evdev                   9950  2 
joydev                  8903  0 
uio_pdrv_genirq         2958  0 
uio                     8119  1 uio_pdrv_genirq
route:

Code: Select all

route
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.10.0      *               255.255.255.0   U     0      0        0 wlan0

route -n:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 wlan0
traceroute RPi2:

Code: Select all

traceroute to 10.10.10.2 (10.10.10.2), 30 hops max, 60 byte packets
 1  10.10.10.19 (10.10.10.19)  2995.618 ms !H  2995.411 ms !H  2995.359 ms !H
traceroute laptop:

Code: Select all

traceroute to 10.10.10.5 (10.10.10.5), 30 hops max, 60 byte packets
 1  10.10.10.5 (10.10.10.5)  187.154 ms  187.249 ms  187.524 ms
ip addr show:

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether b8:27:eb:6c:8e:77 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 74:da:38:3a:28:ba brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.19/24 brd 10.10.10.255 scope global wlan0
       valid_lft forever preferred_lft forever
iw list:
nothing (empty string)

iw dev wlan0 link:

Code: Select all

Not connected.
sudo iw dev wlan0 scan:

Code: Select all

command failed: No such device (-19)
HOSTAPD
Also below some results with hostapd running on both Pis.

On RPi1 hostapd says:

Code: Select all

Using interface wlan0 with hwaddr 74:da:38:3a:28:ba and ssid ‘pi-ad-hoc'
+rtl871x_get_sta_wpaie, e4:ce:8f:3c:88:44 is sta’s address
wlan0: STA e4:ce:8f:3c:88:44 IEEE 802.11: associated
wlan0: STA e4:ce:8f:3c:88:44 RADIUS: starting accounting session 55CEDB4E-0000000
IEEE 802.1X: Ignore STA - 802.1X not enabled or forced for WPS
wlan 0: Station e4:ce:8f:3c:88:44 has been active 0s ago
wlan 0: Station e4:ce:8f:3c:88:44 has been active 0s ago
wlan 0: Station e4:ce:8f:3c:88:44 has been active 0s ago
It seems it's detecting RPi2 as 'e4:ce:8f:3c:88:44' (?)

On RPi2 hostapd says nothing about sta/stations similar to RPi1 but shows:

Code: Select all

Wireless event: cmd=0x8b19 len=8
Wireless event: cmd=0x8b19 len=8
Wireless event: cmd=0x8b19 len=8
Wireless event: cmd=0x8b19 len=8
I thought about diving deeper into hostapd configuration learning online hostapd should support mesh mode and also trying to config locally administered mac addresses as per this tutorial http://wiki.stocksy.co.uk/wiki/Multiple ... th_hostapd but then many folks here were able to get ad-hoc / mesh running with simply putting correct settings in /etc/network/interfaces so I'm suspecting something is wrong at a more basic level.

Have lately installed the "iw" utility and outputs are suspicious (no connection / can't detect device) at the same time ifconfig, iwconfig and iwlist wlan0 scan work totally fine and display everything up, also can ping laptop and back so maybe it's something with "iw". Also not sure how to read the results of traceroute RPi #2 above as it seems to be getting something, however host is unreachable.

Any suggestions would be really appreciated.

phwizard
Posts: 5
Joined: Sat Jun 27, 2015 10:08 am

Re: Mesh (ad-hoc) network chipset RTL8188CUS, kernel 3.18.11

Tue Aug 18, 2015 5:23 am

UPD:

I was finally able to ping from RPi1 to RPi2 after adding static ARP entries as suggested in this thread:
viewtopic.php?f=36&t=111953&p=767802

sudo arp -s <RPi[N] IP address> <RPi[N] Mac address>

Can ping the other Pi and traceroute from both shows other Pi as a 1-hop neighbour. This is in "device" ad-hoc network mode, still doesn't work if I run hostapd on both Pis. Anyway this is great and works for my case.

Ideally though I'd prefer mesh net to have a discovery mechanism so new nodes can join without having to be added into ARP table. OLSRD still doesn't show any neighbours when it's running. Will try out NetworkManager, Batman-adv, Babeld and others.

pirateuser
Posts: 1
Joined: Fri Nov 11, 2016 1:50 pm

Re: Mesh (ad-hoc) network chipset RTL8188CUS, kernel 3.18.11

Fri Nov 11, 2016 1:58 pm

Hello @phwizard ;
Thanks for the post . We had the same problem with our raspberries, we could ping them from the pc but it's impossible to ping from a Raspberry pi. We are currently working on mesh networks and we want to implement a routing protocol, we've seen that you tried them, does it work and which one did you choose?

Thanks

Return to “Troubleshooting”