Meshenger is a Forban-inspired messaging software used for a speculative broadcast communication project. The starting point is an electronic messaging system running on a wireless mesh network. The messages propagate through the network when devices that come in contact with each other synchronize their content. It is non-hierarchical, every node receives, relays and broadcasts messages.
Using Meshenger. Devices detect each other by continously broadcasting an identifier packet while listening to those of other nodes. As soon as two (or more) nodes detect each other they will try to synchronize the messages on each node.
The users of the network can interface with the nodes to send or receive messages by using the webbrowser of their smartphone or computer. The messages can be received and sent at any time, but they are only synchronized in the network when other nodes are encountered.
Meshenger is supposed to run on an Open-WRT router that has been configured to work in mesh networks (for a configuration how-to see below).
## Configuring a router for Open-WRT and Meshenger
### Flashing and preparing
Meshenger requires routers that both support Open-WRT and *have at least one USB port* [(List of Open-WRT routers here)](http://wiki.openwrt.org/toh/start).
We have used the following models: TP-Link MR-3020, TP-Link TP-WR703n and TP-WR842nd.
Open-WRT have a guide for each supported device that tells how to best flash your specific device with Open-WRT. [(Article on flashing)](http://wiki.openwrt.org/doc/howto/generic.flashing)
You are going to need to have an internet connection to your router, the easiest thing is to hook it up to the router.
Alternatively if you use OSX you can enable internet sharing (make sure to set your OSX machine as the gateway and DNS server for your router in /etc/config/network)
The next section is on how to set up the network interfaces to work with B.A.T.M.A.N the mesh networking protocol. It is more or less a summary of what's written [here.](http://www.open-mesh.org/projects/batman-adv/wiki/Batman-adv-openwrt-config)
For the front-end, the client user interface, we must have a captive portal running. These are the first steps in enableing another wireless interface for the hotspot
Add the following lines in the following config files and restart the network:
`$ vi /etc/config/network`
```
config interface 'hotspot'
option 'iface' 'radio0' #use your excisting wifi device (look in config/wireless below)
option 'proto' 'static'
option 'ipaddr' '192.168.2.1'
option 'netmask' '255.255.255.0'
option 'type' 'bridge'
```
`$ vi /etc/config/wireless`
```
config wifi-iface
option 'device' 'radio0' #use your excisting wifi device, look in the list above.
option 'ssid' 'meshtest1'
option 'network' 'hotspot'
option 'mode' 'ap'
option 'encryption' 'none'
option 'isolate' '1'
```
`$ vi /etc/config/dhcp`
```
config dhcp hotspot
option 'interface' 'hotspot'
option 'start' '100'
option 'limit' '150'
option 'dynamicdhcp' '1'
```
`$ vi /etc/config/firewall` enable handing out dhcp addresses to wifi clients
```
config 'zone'
option 'name' 'hotspot'
option 'input' 'ACCEPT'
option 'forward' 'ACCEPT' #was REJECT
option 'output' 'ACCEPT'
config 'rule'
option 'src' 'hotspot'
option 'dest_port' '53'
option 'proto' 'tcpudp'
option 'target' 'ACCEPT'
config 'rule'
option 'src' 'hotspot'
option 'src_port' '67-68'
option 'dest_port' '67-68'
option 'proto' 'udp'
option 'target' 'ACCEPT'
```
`$ /etc/init.d/network restart`
`$ /etc/init.d/firewall restart`
`$ /etc/init.d/dnsmasq restart`
to serve file, run uhttpd server, for example in home folder:
`$ /usr/sbin/uhttpd -f -p 8080 -h Meshenger/msg`
the website will be available at 192.168.2.1:8080 from meshtest network.
easier is to maybe use the already running uhttpd, used by luci and change the config file?
(to 'catch all' and 'forward all http' requests to correct folder) (/etc/httpd.conf or /etc/config/uhttpd)
make luci work on port 81, freeing port 80 for us (or disable luci completely)
`$ vi /etc/config/uhttpd`
`$ /etc/init.d/uhttpd restart`
this is not ideal ofcourse, but i cant get python to run on localhost port 80 and be accessible...