Mesh networking on OpenWRT 15.05 with OLSR: Difference between revisions
(43 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Overview= | |||
This guide covers configuration of OpenWRT to create a mesh network based on OLSR. | |||
=Preliminaries= | =Preliminaries= | ||
Line 11: | Line 11: | ||
OpenWRT 15.05 Chaos Calmer is installed with defaults. | OpenWRT 15.05 Chaos Calmer is installed with defaults. | ||
Target device | Target device has 8Mb flash memory minimum. | ||
===Hardware=== | ===Hardware=== | ||
This will work on EmonWRT3 and ModWRT devices. | |||
If using WR703N router it must be modified with upgraded flash memory. The default unit does not have sufficient memory. | |||
=Setup a Node= | =Setup a Node= | ||
This is for setting up a simple node that has no access to the outside but can connect to other nodes. Most unit in the network will have this configuration. | This is for setting up a simple node that has no direct access to the outside www but can connect to other nodes. Most unit in the network will have this configuration. | ||
We will use here | We will use here | ||
Line 32: | Line 32: | ||
opkg update | opkg update | ||
opkg install luci-app-olsr luci-app-olsr-services luci-app-olsr-viz luci-lib-json | opkg install luci-app-olsr luci-app-olsr-services luci-app-olsr-viz luci-lib-json | ||
opkg install olsrd olsrd-mod-arprefresh olsrd-mod-bmf olsrd-mod-dot-draw olsrd-mod-dyn-gw olsrd-mod-dyn-gw-plain olsrd-mod-httpinfo olsrd-mod-mdns | opkg install olsrd olsrd-mod-arprefresh olsrd-mod-bmf olsrd-mod-dot-draw olsrd-mod-dyn-gw olsrd-mod-dyn-gw-plain olsrd-mod-httpinfo olsrd-mod-mdns | ||
Line 42: | Line 42: | ||
Make sure the interface is not bridging the wifi. | Make sure the interface is not bridging the wifi. | ||
* | * Go to '''Network''' | '''Interfaces''' click on '''Edit''' on the LAN interfaces. Then in '''Physical Settings''' untick '''create a bridge over specified interface(s)'''. | ||
* Make sure '''Ethernet Adapter: "eth0" (lan)''' is ticked on. | * Make sure '''Ethernet Adapter: "eth0" (lan)''' is ticked on. | ||
Line 52: | Line 52: | ||
==-3- Setup wifi mesh interface== | ==-3- Setup wifi mesh interface== | ||
Go to '''Network''' | '''Wifi''' click on '''Edit''' on the only wifi interface that should be there.<br> | |||
Find '''Interface Configuration''' at the bottom of the page and setup the following:<br> | |||
'''ESSID''': OLSR<br> | '''ESSID''': OLSR<br> | ||
Note: ESSID must be the same on all nodes.<br> | |||
'''Mode''': Ad-Hoc<br> | '''Mode''': Ad-Hoc<br> | ||
'''Network''': tick '''create''' and enter 'mesh'<br> | '''Network''': untick '''lan''' tick '''create''' and enter 'mesh'<br> | ||
click <br> | click <br> | ||
Line 64: | Line 65: | ||
[[File:Mesh_xyz02.png]] | [[File:Mesh_xyz02.png]] | ||
If the wifi interface is disabled enable it clicking on '''Enable'''. | |||
Go to '''Network''' | '''Interfaces''' click on '''Edit''' on the interface MESH.<br> | |||
Setup these parameters below:<br> | Setup these parameters below:<br> | ||
'''Protocol''': Static address (click the '''Switch Protocol''' button now).<br> | '''Protocol''': Static address (click the '''Switch Protocol''' button now).<br> | ||
Line 70: | Line 73: | ||
Set IPv4 address above as 10.10.10.x with x being the number of your node. 2 in our example here.<br> | Set IPv4 address above as 10.10.10.x with x being the number of your node. 2 in our example here.<br> | ||
'''IPv4 netmask''': 255.255.255.0<br> | '''IPv4 netmask''': 255.255.255.0<br> | ||
'''Use custom DNS servers''': 8.8.8.8<br> | |||
Go to '''Firewall Settings''' tab | Go to '''Firewall Settings''' tab.<br> | ||
Tick on '''unspecified -or- create:''' and enter 'mesh'<br> | Tick on '''unspecified -or- create:''' and enter 'mesh'<br> | ||
click <br> | click <br> | ||
[[File:save_n_apply.png]] | [[File:save_n_apply.png]] | ||
Go to '''Network'''| '''Firewall''' | ==-4- Setup Firewall== | ||
Go to '''Network'''| '''Firewall'''.<br> | |||
Find the '''Zones''' section at the bottom of the page.<br> | |||
Remove the '''wan (empty) =>REJECT''' entry.<br> | |||
For entry '''mesh''' change '''Forward''' as '''accept'''.<br> | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
It should look like this below. | |||
[[File:Mesh_xyz06.png]] | |||
==-5- Setup OLSR== | |||
Go to '''Services''' | '''OLSR IPv4'''.<br> | |||
Find the '''Interfaces''' section at the bottom of the page.<br> | |||
Click on the '''Edit''' button of the only entry that is here.<br> | |||
For parameter '''Network''' Select entry '''mesh'''.<br> | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
Select tab '''Plugins''' at the top.<br> | |||
Tick on '''olsr_jsoninfo.so.0.0'''.<br> | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
==-6- Testing== | |||
===Visualisation=== | |||
Go to '''Status''' | '''OLSR''' | |||
The page will show the number of interfaces and neighbours. | |||
The '''OLSR-Viz''' tab provide a nice graphical visualisation of the full network. | |||
=Setup the Gateway - Node with internet access= | |||
Setup the device as a normal node as described above. | |||
Go to '''Network''' | '''Interfaces'''.<br> | |||
Click on '''Edit''' for '''LAN'''.<bR> | |||
Change '''Protocol''' to '''DHCP client'''. Click '''Switch Protocol''' now.<br> | |||
In '''Hostname to send when requesting DHCP''' enter MESH01 (or anything that you prefer). | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
You should now connect this unit to your office router. You can acccess web interface and ssh using hostname as MESH01. | |||
Go to ''' Services''' | '''OLSR IPv4'''.<br> | |||
Select '''HNA Announcements''' tab. <br> | |||
Click '''Add'''.<br> | |||
Enter:<bR> | |||
'''Network address''': 0.0.0.0<br> | |||
'''Netmask''': 0.0.0.0<br> | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
Go to '''Network''' | '''Firewall'''<br> | |||
In '''General Settings''' change '''Forward''' as '''accept'''.<br> | |||
Find '''Zones''' at the bottom of the page.<br> | |||
Click on '''Edit''' for '''lan'''.<br> | |||
Tick on '''Masquerading'''.<br> | |||
Tick on '''MSS clamping'''.<br> | |||
Find the '''Inter-Zone Forwarding''' at the bottom of the page.<br> | |||
Tick on all '''Allow forward to destination''' entries.<br> | |||
click <br> | |||
[[File:save_n_apply.png]] | |||
Firewall zones should look like this below.<br> | |||
[[File:Mesh_xyz03.png]] | |||
=Wifi Encryption= | =Wifi Encryption= | ||
Remove and install packages as below: | |||
opkg remove wpad-mini | opkg remove wpad-mini | ||
opkg update | opkg update | ||
opkg install wpad authsae | opkg install wpad authsae | ||
Now run these commands below to setup the encryption: | |||
uci set wireless.@wifi-iface[0].encryption='psk2/aes' | |||
uci set wireless.@wifi-iface[0].key='password' | |||
Replace ''password'' with anything you prefer. | |||
Reboot the device and apply the same to all units with same password. |
Latest revision as of 11:54, 26 July 2018
Overview
This guide covers configuration of OpenWRT to create a mesh network based on OLSR.
Preliminaries
Access with command like via ssh is required. Use Putty or any other terminal.
Software
OpenWRT 15.05 Chaos Calmer is installed with defaults. Target device has 8Mb flash memory minimum.
Hardware
This will work on EmonWRT3 and ModWRT devices.
If using WR703N router it must be modified with upgraded flash memory. The default unit does not have sufficient memory.
Setup a Node
This is for setting up a simple node that has no direct access to the outside www but can connect to other nodes. Most unit in the network will have this configuration.
We will use here
- Wired - Static IP 192.168.2.1 (for configuration access only)
- Wifi - Ad-hoc wifi with Static IP 10.10.10.xx (for comms with other nodes).
-1- Install packages
Install the required packages with the command below:
opkg update opkg install luci-app-olsr luci-app-olsr-services luci-app-olsr-viz luci-lib-json opkg install olsrd olsrd-mod-arprefresh olsrd-mod-bmf olsrd-mod-dot-draw olsrd-mod-dyn-gw olsrd-mod-dyn-gw-plain olsrd-mod-httpinfo olsrd-mod-mdns opkg install olsrd-mod-nameservice olsrd-mod-p2pd olsrd-mod-pgraph olsrd-mod-secure olsrd-mod-txtinfo olsrd-mod-watchdog olsrd-mod-quagga opkg install wireless-tools
-2- Setup Wired LAN
Make sure the wired interface LAN is setup with static IP address. For our example we will use 192.168.2.1 (if you opt for another ip address then avoid the internet access subnet - like 192.168.1.0 for home routers.)
Make sure the interface is not bridging the wifi.
- Go to Network | Interfaces click on Edit on the LAN interfaces. Then in Physical Settings untick create a bridge over specified interface(s).
- Make sure Ethernet Adapter: "eth0" (lan) is ticked on.
You should now configure this unit by connecting a computer directly to this node with an ethernet cable.
The Lan interface should look like this below.
-3- Setup wifi mesh interface
Go to Network | Wifi click on Edit on the only wifi interface that should be there.
Find Interface Configuration at the bottom of the page and setup the following:
ESSID: OLSR
Note: ESSID must be the same on all nodes.
Mode: Ad-Hoc
Network: untick lan tick create and enter 'mesh'
The wifi interface should look like this below:
If the wifi interface is disabled enable it clicking on Enable.
Go to Network | Interfaces click on Edit on the interface MESH.
Setup these parameters below:
Protocol: Static address (click the Switch Protocol button now).
IPv4 address: 10.10.10.2
Set IPv4 address above as 10.10.10.x with x being the number of your node. 2 in our example here.
IPv4 netmask: 255.255.255.0
Use custom DNS servers: 8.8.8.8
Go to Firewall Settings tab.
Tick on unspecified -or- create: and enter 'mesh'
click
-4- Setup Firewall
Go to Network| Firewall.
Find the Zones section at the bottom of the page.
Remove the wan (empty) =>REJECT entry.
For entry mesh change Forward as accept.
click
It should look like this below.
-5- Setup OLSR
Go to Services | OLSR IPv4.
Find the Interfaces section at the bottom of the page.
Click on the Edit button of the only entry that is here.
For parameter Network Select entry mesh.
click
Select tab Plugins at the top.
Tick on olsr_jsoninfo.so.0.0.
click
-6- Testing
Visualisation
Go to Status | OLSR The page will show the number of interfaces and neighbours.
The OLSR-Viz tab provide a nice graphical visualisation of the full network.
Setup the Gateway - Node with internet access
Setup the device as a normal node as described above.
Go to Network | Interfaces.
Click on Edit for LAN.
Change Protocol to DHCP client. Click Switch Protocol now.
In Hostname to send when requesting DHCP enter MESH01 (or anything that you prefer).
click
You should now connect this unit to your office router. You can acccess web interface and ssh using hostname as MESH01.
Go to Services | OLSR IPv4.
Select HNA Announcements tab.
Click Add.
Enter:
Network address: 0.0.0.0
Netmask: 0.0.0.0
click
Go to Network | Firewall
In General Settings change Forward as accept.
Find Zones at the bottom of the page.
Click on Edit for lan.
Tick on Masquerading.
Tick on MSS clamping.
Find the Inter-Zone Forwarding at the bottom of the page.
Tick on all Allow forward to destination entries.
click
Firewall zones should look like this below.
Wifi Encryption
Remove and install packages as below:
opkg remove wpad-mini opkg update opkg install wpad authsae
Now run these commands below to setup the encryption:
uci set wireless.@wifi-iface[0].encryption='psk2/aes' uci set wireless.@wifi-iface[0].key='password'
Replace password with anything you prefer.
Reboot the device and apply the same to all units with same password.