setup

   |ap| ~-~-~- wlan ~-~-~- | server | ~-~powerline~-~ |ap|


/etc/networking/interfaces

   # This file describes the network interfaces available on your system
   # and how to activate them. For more information, see interfaces(5).
   # The loopback network interface
   auto lo
   iface lo inet loopback
   # The primary network interface
   auto eth0
   iface eth0 inet static
   address 192.168.3.1
   netmask 255.255.255.0
   gateway 192.168.3.1
   dns-nameservers 192.168.2.1

wpa_supplicant_keep-alive

i added this to /root/wpa_supplicant_keep-alive & > /var/log/wpa_supplicant_keep-alive:

   #!/bin/bash
   #
   # script to keepalive the wpa_supplicant connection
   #
   iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
   echo 1 > /proc/sys/net/ipv4/ip_forward
   ip=192.168.2.1
   while [ true ]; do
       echo "---------------------------------------------"
       echo "starting wpa_supplicant and dhclient"
       echo "---------------------------------------------"
       wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 & > /dev/null
       pid_wpa=$!
       echo "$(date): wpa_supplicant pid $pid_wpa"

       ip a add 192.168.2.200/24 dev wlan0
       ip r add via 192.168.2.1
       while [ true ]; do
           sleep 5
           ping -c 4 $ip > /dev/null
           result=$?
           if [ $result == 1 ]; then
              echo "$(date): none of the 4 ping requests to $ip were successful"
              break;
           #else
           #   echo "ping to $ip is working"
           fi
       done
       echo "$(date): killing wpa_supplicant as ping seems to be down"
       echo "kill -9 $pid_wpa"
       kill -9 $pid_wpa
       sleep 1
   done

dhcpd.conf

   ddns-update-style none;
   default-lease-time 6000;
   max-lease-time 7200;
   log-facility local7;


   subnet 192.168.3.0 netmask 255.255.255.0 {
      range 192.168.3.100 192.168.3.200;
      option domain-name-servers 192.168.2.1;
      option routers 192.168.3.1;
   }
Powered by MediaWiki