Schlagwort-Archive: raspberry pi

Create a guest WLAN with OpenWrt

It’s enough to do it like this tutorial says:
https://wiki.openwrt.org/doc/recipes/guest-wlan-webinterface

If you want a log of the surfing history for maybe avoid being held responsibly for the things your guest does (Störerhaftung) you can log the DNS queries:
https://superuser.com/questions/632898/how-to-log-all-dns-requests-made-through-openwrt-router/897413#897413

Now you need a rsyslog server that collects those logs:
https://kimkil.nietsniehu.net/raspberry-pi-as-a-log-server-with-rsyslog-2/

Raspberry Pi reset wireless lan to solve problems with no connection

I found a script on http://askubuntu.com/a/593589 which tried to reset the wlan interface in various ways. I modified that script a little with and installed in on cron and let it execute each minute (*/1 * * * * /root/bin/resetWifi.sh)

resetWifi.sh:


#!/bin/bash
# program to check wifi and reset if not running
if [[ ! -z "$(ps waux | grep $0)" ]]; then exit 0; fi
exec 2>&1 1> >(tee -a $HOME/wificheck.log)
GATEWAY=192.168.1.1
IWCONFIG_BIN=$(which iwconfig)
RFKILL_BIN=$(which rfkill)
PING_BIN=$(which ping)
DEVICE=$(iwconfig 2>/dev/null | grep 802 | awk '{print $1}')
function isPingWorking {
        if ${PING_BIN} -c 1 ${GATEWAY} >/dev/null 2>&1 ; then
                exit 0
        else
                echo "didn't work :("
        fi
}
while true; do
        isPingWorking
        # Failed, try to reset wifi - sometimes works ok
        date
        ifdown ${DEVICE}
        sleep 1
        ifup ${DEVICE}
        sleep 10
        isPingWorking
        echo "turn wlan stick power off... "
        ${IWCONFIG_BIN} ${DEVICE} txpower off
        sleep 3
        ${IWCONFIG_BIN} ${DEVICE} txpower auto
        isPingWorking
        echo "use rfkill to reenable wlan stick... "
        ${RFKILL_BIN} list
        ${RFKILL_BIN} block wifi
        sleep 3
        ${RFKILL_BIN} unblock wifi
        isPingWorking
done
exit 0

Test if you have rfkill installed. The other bins should be available on most default installations.