Open-Mesh! Let the games Begin!

Being so preoccupied with other wi-fi architectures and deployments, I failed to catch up to the meshing Craze. Yes its true that for speedy wifi nets you need the directional antennas, the best and fastest SBCs or X86s, various optimizations and tens of other detains. On the other hand when you move closer to the ground, you different issues. To deliver signal to users you really need something better, more clever than a dozen of WDS devices. The truth is that mesh configs with OLSR and BATMAN really shine in Hotspot conditions and outperform older solutions.

The friendliest Meshing solution that I have seen so far is the one that is provided by Open-Mesh. Open-Mesh creates ultra low-cost zero-config, plug & play wireless mesh network solutions that spread an Internet connection throughout a hotel, apartment, neighborhood, village, coffee shop, shopping mall, campground, marina and just about anywhere else you can imagine. It has also a very friendly and intuitive Dashboard that helps you keep track of all your devices and monitor their performance and health. Its not the most powerful solution provided by openWRT firmwares, but is the most user friendly i have seen, it’s open, it’s complete and comparatively it’s dirty cheap!

I was lucky these days to get my hands on some of those for a local community project. A project that will eventual make use of the AWMN Backbone to deliver Internet and AWMN access to as many wifi devices as we can reach.

Here is some code of My customizations utilizing the Custom.sh option of the dashboard

Custom.sh

#!/bin/sh 

#iptables -D FORWARD 7
#iptables -D FORWARD 13
#iptables -D FORWARD 19

/usr/sbin/iptables -D FORWARD -i ath0 -s 101.0.0.0/8 -d 10.0.0.0/8 -j DROP
/usr/sbin/iptables -D FORWARD -i ath1 -s 101.0.0.0/8 -d 10.0.0.0/8 -j DROP
/usr/sbin/iptables -D FORWARD -i ath2 -s 101.0.0.0/8 -d 10.0.0.0/8 -j DROP

curSSID=$(iwconfig  ath3 | grep ath3  | awk -F'"' '{ print $2 }')
homeSSIDprop=$(cat /etc/config/system | grep hostname | awk -F"'" '{ print $4 }')
thrdif=$(ifconfig | grep ath3  | awk '{ print $1 }')

#### Setup an extra AP for Personal Use with Mac Address as WPA Key" #####

if [ "$thrdif" != ath3 ];then
 rm -f /var/run/hostapd-ath3
 rm -f /var/run/ath3
 rm -f /tmp/hostapd-ath3.conf
 rm -f /tmp/home_pool
 ath3Conf=/tmp/hostapd-ath3.conf
 homedhcpool=/tmp/home_pool
 #homemac=$(ifconfig ath0 | grep Link | awk '{ print $5 }')
 #homeSSID=$(grep $homemac /etc/update/nodes | awk '{ print $3 }')
 homeSSID=$(cat /etc/config/system | grep hostname | awk -F"'" '{ print $4 }')
 homemaclan=$(ifconfig eth0 | grep Link | awk '{ print $5 }')
 home_key=$(echo $homemaclan | awk -F: '{ print $1 $2 $3 $4 $5 $6 }')
 #home_ip=$(ifconfig ath2 | grep inet | awk -F: '{ print $2 }' | awk '{ print $1 }')
 #home_mask=$(ifconfig ath2 | grep inet | awk -F: '{ print $4 }' | awk '{ print $1 }')

 echo "172.16.55.10,172.16.55.250,255.255.255.0,2h" >> $homedhcpool

 echo "ctrl_interface=/var/run/hostapd-ath3" >> $ath3Conf
 echo "driver=madwifi" >> $ath3Conf
 echo "interface=ath3" >> $ath3Conf
 echo "channel=11" >> $ath3Conf
 echo "ssid=$homeSSID" >> $ath3Conf
 echo "debug=0" >> $ath3Conf
 echo "wpa=1" >> $ath3Conf
 echo "wpa_pairwise=TKIP" >> $ath3Conf
 echo "country_code=392" >> $ath3Conf
 echo "wpa_passphrase=$home_key" >> $ath3Conf

 ifconfig ath3 down
 wlanconfig ath3 destroy
 rm /var/run/ath3
 wlanconfig ath3 create wlandev wifi0 wlanmode ap
 hostapd -B -P /var/run/ath3 /tmp/hostapd-ath3.conf
 ifconfig ath3 172.16.55.1 netmask 255.255.255.0 up
fi

#### Check if the NodeName has Changed #####
if [ "$curSSID" != "$homeSSIDprop" ];then

 homeSSIDprop=$(cat /etc/config/system | grep hostname | awk -F"'" '{ print $4 }')
 iwconfig ath3 essid on
 iwconfig ath3 essid "$homeSSIDprop" txpower auto

fi

wget -N http://www.Lucy.net/dhcpd.sh

chmod 0755 dhcpd.sh

./dhcpd.sh stop 

./dhcpd.sh start

rm -f /etc/update/custom.md5

dhcpd.sh

#!/bin/sh /etc/rc.common
# RO.B.IN - 2007 by Antonio Anselmi <a.anselmi-at-oltrelinux-dot-com>
# /init.d/dhcpd
# Nettraptor-moded

START=76
. /etc/rob-functions.sh

dnsmasq_header() {
 echo "bogus-priv" > $DNSMASQ_CONF

 NXDOMAIN_IP=$(nslookup www.jriugrkbfdkjhg.com 208.67.222.222 |tail -2 |grep -i 'address' |awk '{print $3}')
 [ -n "$NXDOMAIN_IP" ] && echo "bogus-nxdomain=$NXDOMAIN_IP" >> $DNSMASQ_CONF

 echo "filterwin2k" >> $DNSMASQ_CONF
 echo "dhcp-leasefile=/tmp/dhcp.leases" >> $DNSMASQ_CONF
 echo "dhcp-authoritative" >> $DNSMASQ_CONF

 LOCAL_DOMAIN=$(uci get management.enable.local_domain)
 [ -n "$LOCAL_DOMAIN" ] && echo "domain=$LOCAL_DOMAIN" >> $DNSMASQ_CONF
}

dnsmasq_body() {   �
 case $1 in
 2) #public AP + private AP
 customDNS_IP=$(uci get general.services.name_srv)
 ap1_ipaddr=$(uci get node.general.IP_ap |awk -F / '{print $1}')
 ap2_ipaddr=$(uci get node.general.IP_Myap |awk -F / '{print $1}')
 RANGE_PUBLIC=$(cat /tmp/public_pool)
 RANGE_PRIVATE=$(cat /tmp/private_pool)
 RANGE_HOME=$(cat /tmp/home_pool)

 echo "dhcp-range=public,$RANGE_PUBLIC" >> $DNSMASQ_CONF
 echo "dhcp-option=public,3,$ap1_ipaddr" >> $DNSMASQ_CONF
 echo "dhcp-option=public,6,$customDNS_IP" >> $DNSMASQ_CONF
 echo "dhcp-range=private,$RANGE_PRIVATE" >> $DNSMASQ_CONF
 echo "dhcp-option=private,3,$ap2_ipaddr" >> $DNSMASQ_CONF
 echo "dhcp-option=private,6,$ap2_ipaddr" >> $DNSMASQ_CONF
 echo "dhcp-range=home,$RANGE_HOME" >> $DNSMASQ_CONF
 echo "dhcp-option=home,3,172.16.55.1" >> $DNSMASQ_CONF
 echo "dhcp-option=home,6,$customDNS_IP" >> $DNSMASQ_CONF
 ;;

 1) #public AP only
 customDNS_IP=$(uci get general.services.name_srv)
 ap1_ipaddr=$(uci get node.general.IP_ap |awk -F / '{print $1}')
 RANGE_PUBLIC=$(cat /tmp/public_pool)

 echo "dhcp-range=$RANGE_PUBLIC" >> $DNSMASQ_CONF
 echo "dhcp-option=3,$ap1_ipaddr" >> $DNSMASQ_CONF
 echo "dhcp-option=6,$customDNS_IP" >> $DNSMASQ_CONF
 ;;

 0) #private AP only
 ap2_ipaddr=$(uci get node.general.IP_Myap |awk -F / '{print $1}')
 RANGE_PRIVATE=$(cat /tmp/private_pool)

 echo "dhcp-range=$RANGE_PRIVATE" >> $DNSMASQ_CONF
 echo "dhcp-option=3,$ap2_ipaddr" >> $DNSMASQ_CONF
 echo "dhcp-option=6,$ap2_ipaddr" >> $DNSMASQ_CONF
 ;;
 esac
}

start () {
 cp_HANDLER=$(uci get cp_switch.main.which_handler)
 has_dhcpd=$(uci get cp_switch."handler_${cp_HANDLER}".has_dhcpd)   �
 Myap_up=$(uci get mesh.Myap.up)
 AP1_IFACE=$(IFNAME public)
 AP2_IFACE="ath2"
 APhome_IFACE="ath3"
 MESH_IFACE="ath0"
 DNSMASQ_CONF=/tmp/dnsmasq.conf
 DNSMASQ_OPTIONS=" --resolv-file=/etc/resolv.conf"

 IFACES=
 if [ 1 -eq "$has_dhcpd" ] ; then
 #we want dnsmasq to provide only DNS service on chilli_controlled_interface (C_IFACE)
 C_IFACE=$(uci get cp_switch.main.iface)
 DNSMASQ_OPTIONS="${DNSMASQ_OPTIONS} no-dhcp-interface=${C_IFACE}"
 [ 1 -eq "$Myap_up" ] && { IFACES=",${AP2_IFACE}"; k_dnsmasqConf=0;}
 else
 IFACES=",${AP1_IFACE}"
 k_dnsmasqConf=1
 [ 1 -eq "$Myap_up" ] && { IFACES=",${AP1_IFACE}, ${AP2_IFACE}, ${APhome_IFACE}"; k_dnsmasqConf=2;}
 fi        

 if [ 1 -eq "$(uci get node.general.node)" ]; then
 # Don't bind to the wan interfaces or dhcp server conflicts will occur
 # on networks where more than one gateway is connected to an uplink
 # gateway running a dhcp server.  Ironically, binding to wan interfaces
 # on networks with redundant gateways decreases the reliability of the
 # network as the number of redundant gateways increases.
 WAN_IFACE=$(uci get node.general.wanPort)
 DNSMASQ_OPTIONS="${DNSMASQ_OPTIONS} -I $MESH_IFACE -I $WAN_IFACE $IFACES"   �
 else
 DNSMASQ_OPTIONS="${DNSMASQ_OPTIONS} -I $MESH_IFACE $IFACES"   �
 fi

 dnsmasq_header
 dnsmasq_body $k_dnsmasqConf
 echo $DNSMASQ_OPTIONS > /tmp/dnsmasq.args

 dnsmasq -C $DNSMASQ_CONF $DNSMASQ_OPTIONS
}

stop () {
 killall -9 dnsmasq
}
#

Comments are closed.