1

Okay, I am very much a NEWBIE when it comes to these type of connections. So, I searched on this website on how to be able to do this and I came across two promising questions and answers. However, they don't seem to be helping. First, I tried the following question's answer. Ad-hoc setup for pi 3 All I see is a tooltip saying the following for both PI 3 but with different ip address. With this setup, I can't make PIs talk to each other. I don't even know if they see each other even though they are supposed to be on the same network SSID (thayanet). I can't even PING from each other.

Wlan0 tooltip

Then, I tried the second question I found - Connect to Raspberry PI 3 over Wi-Fi direct This question also didn't help me. Once I made the changes wpa_supplicant.conf file, it spit out all sorts of errors such as unsupported drivers, failed to add interface wlan0, etc...

I simply want to setup a Ad-Hoc connection for my two PIs. So, they can communicate with each other. Any help is appreciated.

UPDATE Once I set up ad-hoc on one PI, the other PI sees that network. Now, how do I use this network setup. I try to connect the non-ad-hoc PI to ad-hoc PI and it won't connect.

ThN
  • 1,042
  • 6
  • 19
  • 33
  • 1
    You **NEED** to list what **YOU** actually did, not post links to tutorials. There is one obvious issue wlan0 has a [Link-local address](https://en.wikipedia.org/wiki/Link-local_address) – Milliways Mar 30 '17 at 23:15
  • @Milliways I did exactly what those answers said. So, if anything that's what I would be listing here. I didn't deviate from those questions' answers in any way shape or form. – ThN Mar 31 '17 at 12:35

2 Answers2

5

You can simply use the iwconfig tools on the both your Pis to join to an ad-hoc network.

use the following:

sudo iwconfig wlan0 mode ad-hoc channel 01 essid my-net

You can use your Link-Local addresses to interact with the pis in general.

A smart way to know your local network Pis can be to use:

ping -I wlan0 224.0.0.1

It is a Multicast Address which will give your pings from the Pis which have the same ad-hoc parameters.

This should most definitely give you the 169.254.x.x address of the Pi within the ad-hoc network.

Networking upon next boot

In best case use the following in your (both Pis) /etc/rc.local file:

sudo nano /etc/rc.local

iwconfig wlan0 mode ad-hoc essid my-net channel 01
exit 0

and add brcmfmac in to your /etc/modules file for availability of chipset on boot.

For further help I have a GitHub repository which can set up Pis (any model 2 or 3) in Ad-Hoc mode with IPv6 Link Local Addresses.

Shan-Desai
  • 1,463
  • 2
  • 12
  • 28
  • 2
    Can you clarify if you mean to run the identical `sudo iwconfig ...`command on both Raspberry Pis please? Also, can you clarify what the `xx` stand for and where OP is supposed to get the actual values from? Thank you. – Mark Setchell Mar 31 '17 at 14:54
  • Good point I will edit the answer. – Shan-Desai Mar 31 '17 at 14:55
  • @Shan-Desai Your answer is great so far. However, once non-ad-hoc PI connects to the ad-hoc pi successfully, I can't ping the ad-hoc PI from the other pi or vice versa. I keep getting Destination not reachable. I did the `ping -I wlan0 mypis-ip` But I see the network green LED on both PIs blinking once every seconds. – ThN Mar 31 '17 at 15:09
  • Thank you for the improvements - I have upvoted your answer. There is no mention of how to enable/disable a wifi password or how to set the encryption by the way. – Mark Setchell Mar 31 '17 at 15:21
  • Sadly that is not what I have figured out as of yet. WPA supplicant and its features are lacking and will research on it soon. About the connectivity you might have to restart your `avahi-daemon` `sudo avahi-daemon -r` – Shan-Desai Mar 31 '17 at 15:40
  • @Shan-Desai I ran your adhoc script. It executed as expected and I tried to do the same as before. Both of my PIs connected. However, I can't seem to PING from either one. So, how do I test the wifi or adhoc connection. Thanks. – ThN Mar 31 '17 at 16:08
0

I've successfully done it using link-local networking.

Wiki page: https://en.wikipedia.org/wiki/Link-local_address

Some googling will let you know what needs to be set up. Since there is no DHCP server, each Pi needs a set static address (although it may auto-config and get it's own), and then be configured to access the other Pi via Wifi. I am not sure how to do this, I have only linked mine via Ethernet, but I am sure it's not terribly different.