1

I'm trying to setup an ad-hoc network (intranet-only, no internet) of RPi4s (Buster 2019-09-26) using dongles with detachable antennas. I can successfully

  • setup ad-hoc modes on the internal WiFi (both 2GHz and 5GHz) and add babeld on top of it.
  • get internet from a WiFi USB dongle (used MrEngman scripts to install drivers).

But I can't get ad-hoc to work on the dongles though - I set things up same as for wlan0 but packets don't go through. Searching around indicates it's probably the dongle that can't do ad-hoc.

My question is: what is the attribute I should look for in a dongle? So far all were using the rtl8822bu, is that the culprit? How can I check ahead of time if a chipset will work? I don't mind scouring the internet looking for the right dongle, but I'm not sure what makes the right one right or why.

Current setup process in case it's not a hardware issue:

wlan0

Setup interfaces

sudo systemctl stop dhcpcd.service
sudo ifconfig wlan0 down
sudo nano /etc/network/interfaces

Make it look like

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
    address xxx.xxx.xx.xx
    netmask 255.255.255.0
    wireless-channel 44
    wireless-essid my_net
    wireless-mode ad-hoc

Then reboot

sudo ifconfig wlan0 up
sudo reboot

Do this for each Pi, changing the static IP, and you have an ad-hoc network!

wlan1

Connect to the internet using wlan0, plug dongle in, then run

sudo wget http://www.fars-robotics.net/install-wifi -O /usr/bin/install-wifi
sudo chmod +x /usr/bin/install-wifi
sudo install-wifi

You can now connect to the internet through your dongle! Now follow the wlan0 steps but set it up for wlan1 (and add iface wlan0 inet dhcp to the interfaces file).


EDIT

Output from sudo iw list | grep -A 12 -i "valid interface combinations"

    Supported interface modes
        * IBSS
        * managed
        * AP
        * P2P-client
        * P2P-GO
    Band 1:
        Capabilities: 0x1963
            RX LDPC
            HT20/HT40
            Static SM Power Save
            RX HT20 GI
            RX HT40 SGI
--
    Supported interface modes
        * IBSS
        * managed
        * AP
        * P2P-client
        * P2P-GO
        * P2P-device
    Band 1:
        Capabilities: 0x1022
            HT20/HT40
            Static SM Power Save
            RX HT20 GI
            No RX STBC
  • Try sudo iw list | grep -A 12 -i "supported interface modes" – Milliways Jan 13 at 5:13
  • @Milliways not sure how to read this output...throwing it in the question edit. I'll note that quickly scanning through without the grep showed 2 bands, not sure if that matters. – Antoine Zambelli Jan 13 at 10:50
  • What's "MrEngman scripts"? – Dmitry Grigoryev Jan 13 at 12:07
  • @DmitryGrigoryev It's just the install-wifi scripts shown with that wget, they're posted in several places. They find the right drivers for the kernel version. – Antoine Zambelli Jan 13 at 13:57
2
+100

Every device that conform to IEEE 802.11 must support a wireless ad hoc network. In the specification it is called independent basic service set (IBSS). The supported interface modes of your WiFi USB dongle show that it also supports it of course.

So IBSS is the keyword you have to look for your ad hoc network.

You are using old style deprecated Debian ifupdown managed in /etc/network/interfaces that somehow have to coexist with default dhcpcd. This may work with standard well known managed WiFi networks but I haven't found a working IBSS configuration with it. I have looked at IBSS with the straight forward systemd-networkd network management. Maybe you may find some ideas at How to setup an unprotected Ad Hoc (IBSS) Network and if possible with WPA encryption?. At section ♦ For developers and for troubleshooting you will also find a manual setup for testing how it works.

  • I'll definitely look into the nl driver in that answer. The interfaces solution is really simple that's why I used it. If I can't isolate a driver issue I'll try systemd method. – Antoine Zambelli Jan 14 at 1:34
  • Is there a way to stop wpa_supplicant altogether so it doesn't even have a chance to cause a driver issue? Similar to stopping the dhcpcd service? – Antoine Zambelli Jan 14 at 1:37
  • Just to confirm, the first 2 bullets in the linked question systemd and configuring WiFi device should work regardless of the nl driver issue right? That should only be a problem if I do the wpa_supplicant method? Sorry, trying to make sense of all this! – Antoine Zambelli Jan 14 at 13:54
  • @AntoineZambelli To persistent disable wpa_supplicant just execute sudo systemctl disable --now wpa_supplicant.service. I can confirm your assumption. The first bullet is only about disabling ifupdown and dhcpcd and enabling systemd-networkd and has nothing to do with ad-hoc networking. The second bullet configures the on-board WiFi device only by its driver an do not use wpa_supplicant so you do not have any problems with the background driver nl80211 of it. It would be better to ask such things beneath the original linked answer. – Ingo Jan 14 at 19:07
  • I was able to get an ad-hoc network up on the wlan0 interface (built-in WiFi). It works fine, but when I try to setup the same thing with wlan1 (on the dongle) it doesn't work. All the iw checks come back the same, it shows connected to the network, but I can't ping the other Pi. Any changes to make to the "second bullet" method for wlan1? – Antoine Zambelli Jan 17 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.