Originally written May 5th, 2017
I strongly suggest using GL-Inet Routers for all your OpenWRT needs!
Start with a clean OpenWRT with only default packages installed. Make sure your router has a connection to the internet, as we'll need to install some packages.
Remove the default wpad-mini package.
Install the required packages. This may seem like alot, but most is for OLSR. wpad and authsae is for WPA2 over Ad-Hoc
Login to your router's web GUI. In the top navigation bar, select "Network", then click the "WiFi" option.
You'll see on clean installs that the wifi will show "Disabled". Click the "Enable" button. This enables the WiFi.
Now, go back to SSH, and open the file /etc/config/wireless.
You will see a section titled "config wifi-iface". Delete that entire configuration and replace it with the following:
Change Option SSID to your desired Ad-Hoc SSID. Note, this MUST be identical on all devices attempting to join the network.
Change option key to your password. Again, this value MUST be the same on all the devices or they will not mesh.
Now in terminal run the "wifi" command. Refresh the Web GUI page to make sure it looks like this:
Now we need to configure OLSR.
First we need to create an OLSR interface. Go back to Network > Wifi. Click the "Edit" button next to the SSID information.
Under "Device Configuration", click the "Advanced" tab.
Scroll down to "Interface Configuration".
Look for the "Network" options. Put a checkbox in the option next to "create", and enter a new interface name. For simplicity sake, I reccomed leaving it named "mesh".
Click Save & Apply.
Now we need to setup a static IP for the device. Go to the "Network" tab, and click "Interfaces". You'll now see a "MESH" Interface. Click the edit button next to it.
On the next page, change the "Protocol" dropdown menu from "Unmanaged" to "Static Address".
Now click the "Switch Protocol" button.
You'll be brough to a new page. Enter an IPv4 address. Note: this IP should be in the range that your other nodes will be on. For simplicity sake, I will be using 192.168.10.0/24. So in this field, I will put 192.168.10.2.
If using a /24 (standard), set the IPv4 netmask to 255.255.255.0.
Leave the IPv4 Gateway blank.
Leave all other options blank.
Click save and apply.
Now we need to configure OLSR to listen for other nodes on this interface.
Go to Services > OLSR IPv4.
The first thing we need to do is enable the "jsoninfo" plugin so we can manage OLSR via the web interface. Go to the "Plugins" tab, and click the checkmark next to "olsrd_jsoninfo.so.0.0"
Click save and apply.
Return to Services > OLSR IPv4 from the navbar. Scroll to the bottom of the page.
You will see an "Interfaces" section. There will be one entry. Click the "Edit" button on this entry.
You will be brought to a page. Locate the "Network" option. Click the "mesh" interface for the network option.
Leave all other options as is, and click save and apply.
Now we need to allow OLSR through the firewall. Go to The Network option > Firewall.
Under general settings, change Forward from "Reject" to "Accept".
We should be done at this point. Go to the "Status" > "OLSR" Tab to view more info.
If all is done right, we should see a number next to "Neighbors".
NOTE: For routers with internet access, we need to change one other option to allow that router to broadcast to the network that it has internet access. Go back to "Services" > "OLSR IPv4".
Click the HNA Announcements tab.
You will be brought to a new page. Click the "Add" button.
In both boxes, put the value "0.0.0.0". Only do this on the router with internet access or the other routers will cease to route.
Click save and apply. Test on a different router that it can access the internet.
I have only successfully configured this setup on Atheros/Qualcomm chips. I have been unsuccessful with any form of MediaTek chips regarding WPA2 and Ad-Hoc.
I reccomend using Gl-Inet routers for best performance with OpenWRT
Some of us have found that using a router that is currently connected as a client to another access point causes this configuration to fail. It is advised to not have the router connected as a WiFi client to another access point with this configuration.