Two Linux systems on ad-hoc wifi can’t ping eachother

Posted on

Problem :

I have two Raspberry Pi machines with D-link DWA-121 Wi-Fi adapters and I’m trying to set up an ad-hoc network between them.

I have followed this configuration example in /etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
  wireless-channel 1
  wireless-essid wnet
  wireless-mode ad-hoc

I used a vanilla Raspbian 2015-01-31 and the settings are the same for both, except for the last digit of the IP address, but I can’t ping between them. The strange thing is that if I connect an Android device to the same network then it can ping both of them. Also both Raspberry Pi machines can ping the Android device, but not eachother.

This is the output of ifconfig, iwconfig and route:

pi@CCV2XA:~$ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 6c:19:8f:b7:52:a1
          inet addr:  Bcast:  Mask:
          RX packets:105 errors:0 dropped:7 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6852 (6.6 KiB)  TX bytes:816 (816.0 B)

pi@CCV2XA:~$ iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:"wnet"  Nickname:"<WIFI@REALTEK>"
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: 02:11:87:B2:93: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

pi@CCV2XA:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     0      0        0 wlan0

Have I forgotten something in the IP setup?

Solution :

There appears to be a bug in the Realtek 8192cu Linux driver. The same configuration works if a different adapter is used on one of the machines.