Dear all, since I'm connected to a fastweb client network (WOW- FI) and I'm facing the common problem of disconnection after 15 min i post my solution here.
I paste all my configuration so that you can check it and compare with your config.
BusyBox v1.15.3 (2011-11-24 02:38:24 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
Backfire (10.03.1, r29592) ------------------------
* 1/3 shot Kahlua In a shot glass, layer Kahlua
* 1/3 shot Bailey's on the bottom, then Bailey's,
* 1/3 shot Vodka then Vodka.
---------------------------------------------------
root@OpenWrt:~# cat /etc/config/network
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'proto' 'static'
option 'ipaddr' '192.168.2.254'
option 'netmask' '255.255.255.0'
option 'ifname' 'eth0'
config 'interface' 'wwan'
option 'proto' 'dhcp'
option 'hostname' 'BananaJoe'
root@OpenWrt:~# cat /etc/config/dhcp
config 'dnsmasq'
option 'domainneeded' '1'
option 'boguspriv' '1'
option 'filterwin2k' '0'
option 'localise_queries' '1'
option 'rebind_protection' '1'
option 'rebind_localhost' '1'
option 'local' '/lan/'
option 'domain' 'lan'
option 'expandhosts' '1'
option 'nonegcache' '0'
option 'authoritative' '1'
option 'readethers' '1'
option 'leasefile' '/tmp/dhcp.leases'
option 'resolvfile' '/tmp/resolv.conf.auto'
config 'dhcp' 'lan'
option 'interface' 'lan'
option 'start' '100'
option 'limit' '150'
option 'leasetime' '12h'
config 'dhcp' 'wan'
option 'interface' 'wan'
option 'ignore' '1'
root@OpenWrt:~# cat /etc/config/wireless
config 'wifi-device' 'wifi0'
option 'type' 'atheros'
# option 'diversity' '0'
# option 'txpower' '10'
option 'channel' '1'
config 'wifi-iface'
option 'ssid' 'WOW FI - FASTWEB'
option 'device' 'wifi0'
option 'mode' 'sta'
option 'bssid' '12:13:31:F3:37:F0' #prende malino
option 'network' 'wwan'
option 'encryption' 'wpa2+ccmp'
option 'eap_type' 'peap'
option 'auth' 'MSCHAPV2'
option 'identity' 'myIdentity'
option 'password' 'myPwd'
root@OpenWrt:~# cat /etc/config/firewall
config 'defaults'
option 'input' 'DROP'
option 'output' 'DROP'
option 'drop_invalid' '1'
option 'forward' 'DROP'
config 'zone'
option 'name' 'lan'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'network' 'lan'
option 'forward' 'ACCEPT'
config 'zone'
option 'name' 'wan'
option 'masq' '1'
option 'output' 'ACCEPT'
option 'input' 'DROP'
option 'forward' 'DROP'
option 'network' 'wwan'
config 'rule'
option 'name' 'Allow-DHCP-Renew'
option 'src' 'wan'
option 'proto' 'udp'
option 'dest_port' '68'
option 'target' 'ACCEPT'
option 'family' 'ipv4'
config 'rule'
option 'name' 'Allow-Ping'
option 'src' 'wan'
option 'proto' 'icmp'
option 'icmp_type' 'echo-request'
option 'family' 'ipv4'
option 'target' 'ACCEPT'
config 'rule'
option 'name' 'Allow-DHCPv6'
option 'src' 'wan'
option 'proto' 'udp'
option 'src_ip' 'fe80::/10'
option 'src_port' '547'
option 'dest_ip' 'fe80::/10'
option 'dest_port' '546'
option 'family' 'ipv6'
option 'target' 'ACCEPT'
config 'rule'
option 'name' 'Allow-ICMPv6-Input'
option 'src' 'wan'
option 'proto' 'icmp'
list 'icmp_type' 'echo-request'
list 'icmp_type' 'destination-unreachable'
list 'icmp_type' 'packet-too-big'
list 'icmp_type' 'time-exceeded'
list 'icmp_type' 'bad-header'
list 'icmp_type' 'unknown-header-type'
list 'icmp_type' 'router-solicitation'
list 'icmp_type' 'neighbour-solicitation'
option 'limit' '1000/sec'
option 'family' 'ipv6'
option 'target' 'ACCEPT'
config 'rule'
option 'name' 'Allow-ICMPv6-Forward'
option 'src' 'wan'
option 'dest' '*'
option 'proto' 'icmp'
list 'icmp_type' 'echo-request'
list 'icmp_type' 'destination-unreachable'
list 'icmp_type' 'packet-too-big'
list 'icmp_type' 'time-exceeded'
list 'icmp_type' 'bad-header'
list 'icmp_type' 'unknown-header-type'
option 'limit' '1000/sec'
option 'family' 'ipv6'
option 'target' 'ACCEPT'
config 'include'
option 'path' '/etc/firewall.user'
config 'forwarding'
option 'dest' 'wan'
option 'src' 'lan'
and now the script for reconnecting
root@OpenWrt:~# cat restartConnection.sh
#!/bin/sh
downCounter=0
rebootCounter=0
maxDown=3
intCheck() {
ping -c1 openwrt.org &>/dev/null
if [ $? -eq 0 ]; then
return 0
else
ping -c1 www.google.com &>/dev/null
if [ $? -eq 0 ]; then
return 0
else
return 1
fi
fi
}
updateCounter() {
if intCheck; then
downCounter=0
rebootCounter=0
maxDown=3
else
downCounter=$(expr $downCounter + 1)
touch /root/wifiRebootsCounter.log
fi
}
act() {
downCounter=0
rebootCounter=$(expr $rebootCounter + 1)
maxDown=$(expr $maxDown + 1)
echo $rebootCounter > /root/wifiRebootsCounter.log
if [ $rebootCounter -gt 25 ]; then
reboot
echo $(date) >> /root/fonRebootsCounter.log
fi
# ifup wwan #which is better?
wifi
sleep 40
}
while [ 1 ]; do
updateCounter
sleep 5
if [ $downCounter -gt $maxDown ]; then act; fi
done
root@OpenWrt:~# cat /etc/init.d/restartConnectionService
#!/bin/sh /etc/rc.common
#
# Giulio Benetti - giulio.benetti@gmail.com
START=98
STOP=10
start() {
echo "starting restart service"
/root/restartConnection.sh &
}
stop() {
echo "STOPPING restart service"
killall restartConnection.sh
}
root@OpenWrt:~# ls -l /etc/rc.d/
lrwxrwxrwx 1 root root 34 Mar 21 20:17 K10restartConnectionService -> ../init.d/restartConnectionService
lrwxrwxrwx 1 root root 34 Mar 21 20:17 S98restartConnectionService -> ../init.d/restartConnectionService
In the last part i listed only the two symbolic links i'm interested to.
As you can see the tool check both openwrt.org and google.com with ping and, if it fails, touch a file, counts up to a certain number and reset the wifi.
After a some attempts it also reboots the fonera.
I'd like to pose just a couple of questions to the experts of the forum:
- Is it better to use the wifi or the ifup wwan command to restart the wifi?
- Do you have any suggestion for the whole scheme?
Hope it helps and thank you in advance.
Regards