how can I send raw packets over wifi without a network?

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.


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:

  • http://hackaday.com/2012/11/14/mesh-networking-with-multiple-raspberry-pi-boards/
  • Wireless mesh networking on Raspberry Pi using batman-adv protocol
  • http://www.netlore.co.uk/airmesh/?page=about
  • I would also look at using the Dot11* family of packets in the excellent Python Scapy library (not to be confused with Sc r apy). 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

    链接地址: http://www.djcxy.com/p/84970.html

    上一篇: geting wifi信号水平在c#

    下一篇: 如何在没有网络的情况下通过WiFi发送原始数据包?