Tue Mar 4 20:47:34 CET 2008

fonera repeater

# the atheros chipset in the fonera allows difinition of master +
# client on the same channel. works pretty well. something like:

REMOTE_ESSID="essid remote ap 00:01:02:03:04:05"
LOCAL_ESSID="essid local"




# this assumes there's no default route
# i.e. start it from the management interface

# we're going to introduce a new default route, so kill the old one
OLDGW=`route -n |grep ^0|grep eth0|awk '{print $2}'`
[ -z "$OLDGW" ] || route del default gw $OLDGW

# kill old stuff
wlanconfig ath0 destroy
wlanconfig ath1 destroy
killall -9 dnsmasq
killall -9 udhcpc

# ap
wlanconfig ath0 create wlandev wifi0 wlanmode ap
iwconfig ath0 $LOCAL_ESSID
iwconfig ath0 channel $CHAN
ifconfig ath0 $LOCAL_NET.1 netmask up
dnsmasq -i ath0 -F $LOCAL_NET.2,$LOCAL_NET.31

# station
wlanconfig ath1 create wlandev wifi0 wlanmode sta nosbeacon

iwconfig ath1 $REMOTE_ESSID

# prevent resolv.conf updates
killall udhcpc
echo "nameserver $REMOTE_NS" >/tmp/resolv.conf
ifconfig ath1 $REMOTE_IP netmask up
route add default gw $REMOTE_GW
iptables -t nat -A POSTROUTING -o ath1 -j MASQUERADE