PhilOSophi: Cloud Wifi Mesh Controller

This is an outline of how i would see my PhilOSophi Cloud Mesh Wifi Controller working.

On the Mesh Node there would be a script that polls the main webserver every X Minuets. The poll would be something like:

wget http://USERNAME:PASSWORD@SERVER.COM/poll.php?mac=MAC_OF_NODE

The file that would be pulled down would be an XML file, containing all the node values, and the date/time of last modification on server.

A script on the node would then parse the XML file and look for last modyfied date/time if it is not equal to the on it already knows about, the script will then go though and configure the mesh node with all values and restart the node.

Once the node comes back up it will have been configured with all the new values from the main server and rejoin the mesh network.

The Format of the XML file would be:

<MeshPlex>
<NodeConfig>
<Node>
<HostName>Router101</HostName>
<LocalLanIP>192.168.101.1</LocalLanIP>
<LocalLanSubnetMask>255.255.255.0</LocalLanSubnetMask>
</Node>
<Mesh>
<MeshIP>10.101.101.101</MeshIP>
<MeshNetMask>255.255.255.0</MeshNetMask>
<MeshAdhocName>olsr.freefi.meshnet</MeshAdhocName>
</Mesh>
<PublicNetwork>
<PublicSSID>openwifi.notts.freefi.meshnet</PublicSSID>
</PublicNetwork>
<OLSR>
<OLSRGatewayBandwidthDown>1024</OLSRGatewayBandwidthDown>
<OLSRGatewayBandwidthUp>1024</OLSRGatewayBandwidthUp>
</OLSR>
<GenericSettings>
<GenericDNS>8.8.8.8 8.8.4.4</GenericDNS>
</GenericSettings>
</NodeConfig>

<LastUpdate>2013-10-19 11:48</LastUpdate>
</MeshPlex>

The Data base on the server would consist of:

NodeMacAddress
NodeHostname
NodeLanIP
NodeLanSubnetMask
NodeMeshIP
NodeMeshSubnetMask
NodeMeshSSID
NodePublicSSID
NodeOLSRGatewayBandWidthDown
NodeOLSRGatewayBandWidthUp
LastSeen

The Server would keep a record of each pull from the Mesh Node and record this in the field “LastSeen” and would display the output of this in a traffic light system, IE:

RED = Not seen in the last >20 Minuets
ORANGE = Seen in the last <20 Minuets
GREEN = Seen in the last <5 Minuets

The Main Page will list all nodes and Actions at the side of the node such as “Delete | Edit | LastSeen”.

The values collected would produce a local node config script like the one below to reconfigure the node should an edit of the node take place.

#!/bin/sh

### This script will Set up a new mesh node
### Simply enter the correct values below
### and run the script.
### Created By Phillip Cooper
### Software Needed, so will install it...

opkg update
opkg install olsrd
opkg install kmod-ipip
opkg install luci-app-olsr
opkg install luci-app-olsr-viz
opkg install olsrd-mod-dyn-gw
opkg install olsrd-mod-dyn-gw-plain
opkg install olsrd-mod-httpinfo
opkg install olsrd-mod-txtinfo

### Script values

### Node Specific
export HOSTNAME="<<HOST_NAME_HERE>>"
export LOCALIP="<<LOCAL_LAN_IP>>"
export MESHIP="<<MESH_IP>>"

### MESH Settings
export MESHNETMASK="<<MESH_SUBNET>>"
export MESHWIFINAME="<<MESH_WIFI_NAME>>"

### Public Network Names
export PUBLIC_ESSID="<<PUBLIC_WIFI_NAME>>"

### MESH Generic
export GENDNS01="8.8.8.8 208.67.222.222 198.153.192.50 8.26.56.26 156.154.70.1 4.2.2.1 4.2.2.3 4.2.2.5 67.138.54.100 8.8.4.4 208.67.220.220 198.153.194.50 8.20.247.20 156.154.71.1 4.2.2.2 4.2.2.4 4.2.2.6 207.225.209.66"
export GENDNS02="8.8.8.8,208.67.222.222,198.153.192.50,8.26.56.26,156.154.70.1,4.2.2.1,4.2.2.3,4.2.2.5,67.138.54.100,8.8.4.4,208.67.220.220,198.153.194.50,8.20.247.20,156.154.71.1,4.2.2.2,4.2.2.4,4.2.2.6,207.225.209.66"

### Mesh OLSR Gateway Bandwidth
export OLSRGATEBWDOWN="1024"
export OLSRGATEBWUP="1024" 

### Ensure of populating /etc/config/wireless with
### autodetected wifi-device entries (radioX)
### to get all list_capab and hwmode correct. Otherwise
### OpenWRT might fail to configure the radio properly.
wifi detect >>/etc/config/wireless

### Clear preexisting wifi-iface sections to avoid conflicts or dups
( for i in `seq 0 9` ; do echo "delete wireless.@wifi-iface[]" ; done ) | uci batch -q

echo "
set system.@system[0]=system
set system.@system[0].hostname=$HOSTNAME
set system.@system[0].zonename='Europe/London'
set system.@system[0].timezone=GMT0BST,M3.5.0/1,M10.5.0
set system.ntp=timeserver
set system.ntp.server=uk.pool.ntp.org uk.pool.ntp.org uk.pool.ntp.org uk.pool.ntp.org
commit" | uci batch

echo "
set network.lan=interface
set network.lan.ifname=eth0.1
set network.lan.type=bridge
set network.lan.proto=static
set network.lan.ipaddr=$LOCALIP
set network.lan.netmask=255.255.255.0
set network.lan.dns=$GENDNS01
commit" | uci batch

echo "
set network.wan=interface
set network.wan.ifname=eth0.2
set network.wan.proto=dhcp
commit" | uci batch

echo "
set network.mnet=interface
set network.mnet.proto=static
set network.mnet.ipaddr=$MESHIP
set network.mnet.netmask=$MESHNETMASK
set network.mnet.dns=$GENDNS01
commit" | uci batch

echo "
set dhcp.lan.dhcp_option=6,$GENDNS02

set wireless.radio0.hwmode=11ng
set wireless.radio0.country=GB
set wireless.radio0.channel=11
set wireless.radio0.htmode 'HT40-'

set wireless.radio1.channel=36
set wireless.radio1.hwmode=11na
set wireless.radio1.country=GB

add wireless wifi-iface
set wireless.@wifi-iface[-1].device=radio0
set wireless.@wifi-iface[-1].encryption=none
set wireless.@wifi-iface[-1].network=lan
set wireless.@wifi-iface[-1].mode=ap
set wireless.@wifi-iface[-1].ssid=$PUBLIC_ESSID
set wireless.@wifi-iface[-1].isolate='1'

add wireless wifi-iface
set wireless.@wifi-iface[-1].device=radio1
set wireless.@wifi-iface[-1].encryption=none
set wireless.@wifi-iface[-1].network=mnet
set wireless.@wifi-iface[-1].mode=adhoc
set wireless.@wifi-iface[-1].ssid=$MESHWIFINAME
set wireless.@wifi-iface[-1].hidden='1'
commit" | uci batch

echo "
set olsrd.@olsrd[0]=olsrd
set olsrd.@olsrd[0].IpVersion=4
set olsrd.@olsrd[0].FIBMetric=flat
set olsrd.@olsrd[0].LinkQualityLevel=2
set olsrd.@olsrd[0].LinkQualityAlgorithm=etx_ff
set olsrd.@olsrd[0].OlsrPort=698
set olsrd.@olsrd[0].Willingness=3
set olsrd.@olsrd[0].NatThreshold=1.0
set olsrd.@olsrd[0].SmartGateway=yes
set olsrd.@olsrd[0].SmartGatewayUplink=ipv4
set olsrd.@olsrd[0].SmartGatewaySpeed='$OLSRGATEBWDOWN $OLSRGATEBWUP'
set olsrd.@LoadPlugin[0]=LoadPlugin
set olsrd.@LoadPlugin[0].library=olsrd_arprefresh.so.0.1
set olsrd.@LoadPlugin[0].ignore=0
set olsrd.@LoadPlugin[1]=LoadPlugin
set olsrd.@LoadPlugin[1].library=olsrd_dyn_gw.so.0.5
set olsrd.@LoadPlugin[1].ignore=0
set olsrd.@LoadPlugin[2]=LoadPlugin
set olsrd.@LoadPlugin[2].library=olsrd_httpinfo.so.0.1
set olsrd.@LoadPlugin[2].port=1978
set olsrd.@LoadPlugin[2].Net=0.0.0.0 0.0.0.0
set olsrd.@LoadPlugin[2].ignore=0
set olsrd.@LoadPlugin[3]=LoadPlugin
set olsrd.@LoadPlugin[3].library=olsrd_nameservice.so.0.3
set olsrd.@LoadPlugin[3].ignore=0
set olsrd.@LoadPlugin[4]=LoadPlugin
set olsrd.@LoadPlugin[4].library=olsrd_txtinfo.so.0.1
set olsrd.@LoadPlugin[4].accept=0.0.0.0
set olsrd.@LoadPlugin[4].ignore=0
set olsrd.@Interface[0]=Interface
set olsrd.@Interface[0].ignore=0
set olsrd.@Interface[0].interface=mnet
set olsrd.@Interface[0].Mode=mesh
set olsrd.@InterfaceDefaults[0]=InterfaceDefaults
set olsrd.@InterfaceDefaults[0].Mode=mesh
set olsrd.@LoadPlugin[5]=LoadPlugin
set olsrd.@LoadPlugin[5].library=olsrd_dyn_gw_plain.so.0.4
set olsrd.@LoadPlugin[5].ignore=0
commit" | uci batch

echo "
set firewall.@zone[0]=zone
set firewall.@zone[0].name=lan
set firewall.@zone[0].network=lan
set firewall.@zone[0].input=ACCEPT
set firewall.@zone[0].output=ACCEPT
set firewall.@zone[0].forward=ACCEPT
set firewall.@zone[1]=zone
set firewall.@zone[1].name=wan
set firewall.@zone[1].network=wan
set firewall.@zone[1].output=ACCEPT
set firewall.@zone[1].masq=1
set firewall.@zone[1].mtu_fix=1
set firewall.@zone[1].input=ACCEPT
set firewall.@zone[1].forward=ACCEPT
set firewall.@forwarding[0]=forwarding
set firewall.@forwarding[0].src=lan
set firewall.@forwarding[0].dest=wan
set firewall.@rule[0]=rule
set firewall.@rule[0].name=Allow-DHCP-Renew
set firewall.@rule[0].src=wan
set firewall.@rule[0].proto=udp
set firewall.@rule[0].dest_port=68
set firewall.@rule[0].target=ACCEPT
set firewall.@rule[0].family=ipv4
set firewall.@rule[1]=rule
set firewall.@rule[1].name=Allow-Ping
set firewall.@rule[1].src=wan
set firewall.@rule[1].proto=icmp
set firewall.@rule[1].icmp_type=echo-request
set firewall.@rule[1].family=ipv4
set firewall.@rule[1].target=ACCEPT
set firewall.@rule[2]=rule
set firewall.@rule[2].name=Allow-DHCPv6
set firewall.@rule[2].src=wan
set firewall.@rule[2].proto=udp
set firewall.@rule[2].src_ip=fe80::/10
set firewall.@rule[2].src_port=547
set firewall.@rule[2].dest_ip=fe80::/10
set firewall.@rule[2].dest_port=546
set firewall.@rule[2].family=ipv6
set firewall.@rule[2].target=ACCEPT
set firewall.@rule[3]=rule
set firewall.@rule[3].name=Allow-ICMPv6-Input
set firewall.@rule[3].src=wan
set firewall.@rule[3].proto=icmp
set firewall.@rule[3].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type router-solicitation neighbour-solicitation router-advertisement neighbour-advertisement
set firewall.@rule[3].limit=1000/sec
set firewall.@rule[3].family=ipv6
set firewall.@rule[3].target=ACCEPT
set firewall.@rule[4]=rule
set firewall.@rule[4].name=Allow-ICMPv6-Forward
set firewall.@rule[4].src=wan
set firewall.@rule[4].dest=*
set firewall.@rule[4].proto=icmp
set firewall.@rule[4].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type
set firewall.@rule[4].limit=1000/sec
set firewall.@rule[4].family=ipv6
set firewall.@rule[4].target=ACCEPT
set firewall.@include[0]=include
set firewall.@include[0].path=/etc/firewall.user
set firewall.@zone[2]=zone
set firewall.@zone[2].input=ACCEPT
set firewall.@zone[2].output=ACCEPT
set firewall.@zone[2].name=MESH
set firewall.@zone[2].network=mnet
set firewall.@zone[2].masq=1
set firewall.@zone[2].mtu_fix=1
set firewall.@zone[2].forward=ACCEPT
set firewall.@forwarding[1]=forwarding
set firewall.@forwarding[1].dest=lan
set firewall.@forwarding[1].src=MESH
set firewall.@forwarding[2]=forwarding
set firewall.@forwarding[2].dest=wan
set firewall.@forwarding[2].src=MESH
set firewall.@forwarding[3]=forwarding
set firewall.@forwarding[3].dest=MESH
set firewall.@forwarding[3].src=lan
set firewall.@forwarding[4]=forwarding
set firewall.@forwarding[4].dest=MESH
set firewall.@forwarding[4].src=wan

set uhttpd.main.listen_http=0.0.0.0:1337
set uhttpd.main.listen_https=0.0.0.0:443

commit" | uci batch
reboot

Screen Captures of the initial layout.

Selection_019

Selection_018

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Comments are closed.