fonera as a wireless repeater

I was looking around , in my needs to build a wireless mesh network for an hotel Fon installation , and I found a lot of resources , mainly written in italian to transform la fonera in a wireless repeater. I didn’t found much in english , so I decided to write this post with the aim of make you build your wireless repeater in 5 easy steps.

first step

Get a shell acces to la fonera. To do this you have multiple choices . One of them , besides asking google , is using the search function whithin this blog.

second step

Deactivate chillispot , thinclient and the conncheck function on la fonera. This is done , performing the following commands on the shell prompt:

mv /etc/init.d/N10conncheck /etc/
mv /etc/init.d/N40thinclient /etc/
mv /etc/init.d/N50chillispot /etc/

third step

remove all cronjobs

crontab -e

It will appear a list of cronjobs , it’s enough to cancel everything , using the command “a” (vi insert mode ) positioning the cursor at the end o the lines and hitting the back button on the keyboard. Once blanked the file hit “esc” and type “wq”

fourth step

Modify the /etc/dnsmasq.conf file:

rm /etc/dnsmasq.conf
vi /etc/dnsmasq.conf

dhcp-leasefile=/tmp/dnsmasq.leases
interface=ath0

dhcp-range=192.168.10.50,192.168.10.100,12h
dhcp-option=1,255.255.255.0
dhcp-option=3,192.168.10.1
dhcp-option=6,192.168.10.1

A little explanation to this . We will create in step 5 a script which will bring up a wireless network ath0 who will broadcast the extender SSID. In order to get an ip address a default gateway and a dns server , we need to modify the dnsmasq configuration.

fifth step

Create the init script to set la fonera as a wireless repeater

#!/bin/sh

  1. /etc/ponte

#*******************************************************

  1. this script force router fonera to act as:
  2. - repeater (of an external AP) on ath1, configured via dhcp
  3. - Access Point on ath0 (hard-coded as 192.168.10.1/24) with
  4. SSID "ponte-"
  5. the two subnet are then routed.
  6. You can associate your WiFi-interface to the AP builded on ath0
  7. iwconfig essid 'ponte-'
  8. ifconfig 192.168.10.nnn netmask 255.255.255.0 up
  9. route del default
  10. route add default gw 192.168.10.1
  11. Powering off, fonera returns in standard mode !
  12. The script must be executable and located in /etc
  13. ansanto@interfree.it

#*****************************************************

  1. stop daemons

killall -9 udhcpc

killall dnsmasq

  1. flush netfilter tables

iptables -F
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -F

  1. create new VAPs devices

wlanconfig ath0 destroy

wlanconfig ath1 destroy

# VAP ath0 as Access Point
wlanconfig ath0 create wlandev wifi0 wlanmode ap

# VAP ath1 as station managed
wlanconfig ath1 create wlandev wifi0 wlanmode sta nosbeacon

# nosbeacon disables the use of hardware beacon timers for ath1

  1. (the station should not modify the TSF clock for the AP)
  2. discover external dhcpd settings for ath1

udhcpc -i ath1

# setup ath0 with a proper SSID and IP
iwconfig ath0 essid "repeater"
ifconfig ath0 192.168.10.1 netmask 255.255.255.0 up
killall -9 N50chillispot
killall -9 chilli

  1. insert here some ath parameters

route add default gw 192.168.182.1
dnsmasq

  1. ip_forward is set to 1 by default in fonera configuration
  2. echo 1 > /proc/sys/net/ipv4/ip_forward
  3. forwarding between the two subnets

iptables -t nat -A POSTROUTING -o ath1 -j MASQUERADE

  1. setup eth0 on a wired LAN

#ifconfig eth0 172.16.0.126 netmask 255.255.0.0 up
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

  1. firewall
  2. you can add here your personal netfilter setup
  3. have fun!

The syntax is pretty clear and commented . If you want to personalize the script , you can edit the ifconfig ath0 192.168.10.1 netmask 255.255.255.0 up part , putting the desired ip address for te AP interface. Another tweaking is the desired SSID you want to repeat . If you know the source you want to repeat , you can swap udhcpc -i ath1 with iwconfig ath1 mode managed ap 00:01:02:03:04:05 replacing 00.01.02.03.04.05 with the SSID af the AP you want to repeat .Once finished , name this script as bridge and save it in /etc. Make it executable with chmod +x /etc/bridge and try to launch it with /etc/bridge.

If everything goes well , your fonera will repeat the signal of your first main fonera .To make everything works after reboot place the bridge script in the init.d directory with cp /etc/bridge /etc/init.d/S98bridge and you are done.

Let me know if everithing goes well , and don’t forget always to preserve Fon functionality on your wireless network , activating the chillispot auth and the thinclient script in the main node.

credits

Antonio Anselmi resource page on la fonera.

Paolo Gatti weblog with a lot of resources on la fonera

This post on eftecno.com with a lot of comments , tip and tricks.

update 20/02/2007

German speakers can follow discussion at http://tinyurl.com/39sawm

Advertisements