I have encountered a problem with my network setup. I have three Raspberry Pi 3s running Raspbian, a Windows 7 PC, and a Mac. I have the Raspberry Pis configured to automatically startup an ad-hoc network named "PiNetwork" on the built-in wireless card. I can then connect to the ad-hoc network on my Windows 7 PC and ping/ssh all of the Raspberry Pis. I can do the same on my Mac.

When I want to close the connection to the Pis from my Mac so that I can surf the internet, I simply click "Disconnect from PiNetwork" in the Network Manager. Doing this closes the connection to the Pis from the Mac, but the Pis can still talk to each other, and I can rejoin the network from the Mac if I want to.

If I try to close the connection to the Pis from my PC however, I choose PiNetwork in the wifi list and click the "Disconnect" button. Doing this closes the connection between the PC and Pis, but ALSO closes all of the ad-hoc connections. The Pis can no longer talk to each either, and nobody can reconnect to the network without restarting the Pis. This same problem occurs when the Windows PC is shutdown (properly) or restarted while connected to "PiNetwork". It does not occur however if I just pull the PC's power cord from the wall outlet.

I cannot seem to find a solution to this problem, and no other documentation that I have read has contained any helpful information.

My /etc/network/interfaces file for the ad-hoc network looks like this for the Pis. All devices are on the same subnet (XXX.YYY.Z), network, netmask, SSID, mode, channel, and key. The only thing that I change is the IP address for each Pi.

iface eth0 inet dhcp  

allow-hotplug wlan0  
iface wlan0 inet static  
    address XXX.YYY.Z.IP  
    network XXX.YYY.Z.0  
    wireless-essid PiNetwork  
    wireless-mode ad-hoc  
    wireless-channel 5  
    wireless-power off  
    wireless-key *************  

iface default inet dhcp  
  • Hmmm. You'd probably have to dig into the nature of the protocol to figure the possibilities out here. I think it happens at the data-link layer so wireshark probably won't help; dunno what tools there are to parallel that down there for wireless. It could be a naughty giant or just a silly elf. ;\ – goldilocks Jun 20 '16 at 20:07
  • Put another way, presuming no one comes along here with an explanation, you'd be better off tackling this at first from a slightly different angle: What, in general, could cause multiple nodes on an ad-hoc network to disconnect when one node in particular disconnects? – goldilocks Jun 20 '16 at 20:10
  • Overlapping use of channels and frequencies is one possibility although why the Mac or something else doesn't create this issue complicates that theory. Also, the fact that you say it happens when the PC is shutdown. – goldilocks Jun 20 '16 at 20:15
  • Why do you have iface default inet dhcp if you are assigning static? Is the Windows machine providing DHCP? If you want help post output of ifconfig BEFORE and AFTER - and don't try to be coy about actual IP - no one cares. – Milliways Jun 21 '16 at 0:06

Your Answer

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

Browse other questions tagged or ask your own question.