Difference between revisions of "Ad-Hoc Network + Raspberry Pi"
|Line 21:||Line 21:|
Revision as of 21:30, 16 August 2018
Creating an Ad-Hoc Network
An ad-hoc network can allow you to wirelessly communicate between multiple Raspberry Pis without the use of an external router.
Step 1: Creating the Network
Ensure that the Pi can connect to WiFi. For the model 3+, this is built in. If your Pi is not a 3+, you will need a WiFi dongle.
Run the command
sudo iwconfig wlan0 mode ad-hoc channel 11 essid "mesh"
where "mesh" can be any name (it will be the name of the network).
You will now have to assign the Pi an IP address manually. To do this simply run
sudo ip addr add 192.168.1.34 dev wlan0
using an IP address of your choice.
If you want this network to be created and/or joined on startup, simply add these commands to
Step 2 (Optional): Giving the Raspberry Pi a static IP address
Modify (after saving a copy)
/etc/network/interfaces to make it look like this
iface wlan0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1
where address is the IP address you would like to give the Pi.