Difference between revisions of "Ad-Hoc Network + Raspberry Pi"

From ESE205 Wiki
Jump to navigation Jump to search
m (Ethanshry moved page Creating an Ad-Hoc Network on the Raspberry Pi to Ad-Hoc Network + Raspberry Pi: Fall 2018 Wiki Reworks)
(One intermediate revision by the same user not shown)
Line 21: Line 21:

Latest revision as of 03:31, 17 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 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 /etc/rc.local

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

where address is the IP address you would like to give the Pi.