3

I am trying to send some data between 2 raspberry pi's over wifi without them being connected to a network.

I want it to work similar to the way beacons and probe requests work, where a broadcast can be sent out the wireless interface.

the data I want to send will be the hostname of the device and the time the packet was sent.

I've been trying to figure this out for the last few days but I cannot get anything to work without them being on the same network.

Is anybody able to point me in the right direction? I'm not too fussed about what language I use. I have been trying python and C with little success.

Alec Cutler
  • 55
  • 2
  • 6
  • 1
    So, just so I understand, you don't want the raspberry pi's to be connected to ANY network (not even a peer-to-peer connection with each other). Instead, you want the raspberry pi's to broadcast packets into space? – nivix zixer Jul 21 '15 at 02:59
  • yep thats right, i'd like to avoid them having a connection to a network if possible. – Alec Cutler Jul 21 '15 at 03:06
  • 1
    I wonder if you could (ab)use the SSID name of an adhoc network (also you could use the mac address as the device name possibly)? Those packets are broadcasted without first establishing a connection I believe. Not sure if this is a great idea though - I imagine the data rates would be slow and it might confuse other wifi devices in the area – Peter Gibson Jul 21 '15 at 03:14
  • What kind of message are you trying to send ? I think it cannot be UDP or TCP because both of these the routing is defined within a network, so you will not be able to do this without being joined to a network. If you are trying to send raw 802.11 messages then it may be possible, but this will be quite a bit harder than doing a simple socket. – Cobusve Jul 21 '15 at 04:13
  • I am trying to do it with raw 802.11 messages but I am struggling to get it working – Alec Cutler Jul 21 '15 at 05:10
  • 1
    If you want raw 802.11 messages then you probably want to use Monitor mode. However not all chipsets support that, and not all of the drivers that support that support all chipsets. There are enough tutorials for this around the web. If you can't make them work for the builtin raspberry chipset then you might want to use an external dongle instead. – itai Jul 21 '15 at 11:48

1 Answers1

2

Note: This is not really an answer, just some ideas to research, so feel free to edit or comment with corrections.


There are 6 modes a wifi adapter can operate in. From wikipedia:

Master (acting as an access point), Managed (client, also known as station), Ad hoc, Mesh, Repeater, and Monitor mode.

But I believe not all wifi adapters support all modes, so make sure you have suitable hardware.

I would suggest adhoc or mesh would be the most suitable to your purpose. With adhoc mode at least the devices would need to be configured beforehand to use the same SSID and channel. This may not apply to mesh mode.

A quick search yields a few links in regards to using Raspberry Pis in a mesh network:

I would also look at using the Dot11* family of packets in the excellent Python Scapy library (not to be confused with Scrapy). You should be able to craft custom packets and transmit them if the interface is in the right mode. Here's a project that creates fake access points that probably contains good info: https://github.com/rpp0/scapy-fakeap

Community
  • 1
  • 1
Peter Gibson
  • 19,086
  • 7
  • 60
  • 64