1

I have a problem with RPi and WiFi channel changing. As I discovered these days - RPi determines channel only during boot procces. And this is an issue. If I log in to my AP (mikrotik) and change frequency to any another - RPi always disapear and does not appear anymore untill one of bellow items becomes true:

  1. Restoring frequency/channel that was actual on RPi boot time
  2. RPi reboot.

Details:

RPi: 2 model B

OS: Raspbian Jessie

WiFi: 2.4Ghz 801.11n with SSID hidden

I want to fix this issue and make able autoreestablishing WiFi connection without rebooting RPi, because I use "Channel: auto" on my AP and don't want to disable the feature.

Please help me to fix.

---------------- Additional info ---------------------

cat /etc/network/interfaces | egrep -v "^\#"


source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

cat /etc/wpa_supplicant/wpa_supplicant.conf
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
   ssid="SSID"
   psk="PWD"

   bssid=XX:XX:XX:XX:XX:XX

   scan_ssid=1
   proto=WPA2          # can be RSN (for WPA2) or WPA (for WPA1)
   key_mgmt=WPA-PSK    # can be WPA-PSK or WPA_EAP (for enterprise networks)
   pairwise=CCMP       # can be CCMP( for WPA2) or TKIP (for WPA1), or both
   auth_alg=OPEN       # can be OPEN, LEAP and SHARED
}
Hitchman
  • 11
  • 1
  • 4

3 Answers3

0

Looks like the Pi is having re-connection issues. There is a similar thread on automatically reconnecting to wifi here which should solve the problem by forcing the wifi adapter to reconnect to the router if it looses a connection

karan
  • 454
  • 2
  • 7
0

"RPi determines channel only during boot procces" is not true!

Any problem is due to the network configuration (which you have not specified). If connection is lost the OS should attempt to re-connect if correctly configured.

You are using a doubly obsolete unsupported OS. The current Raspbian have much improved networking, which avoid most of the difficulties Wheezy had.

Install Stretch - this has vastly more robust networking!

Milliways
  • 62,573
  • 32
  • 113
  • 225
0

So.. I wasted a couple of hours to troubleshoot an issue.

I definitely see that raspbian does not "see" new frequency when it changes.

At the moment when AP switched to the new frequency I see that RPi seats on old one yet.

I checked it several times with iwconfig and wpa_cli -i wlan0 status.

I did some kind of workaround.

Wrote a script and added it to cron. Now RPi successfully reconnects even if channel switched.

Hope this will be helpful for somebody

#!/bin/bash

IP=x.x.x.x

PACKETS=4

LOGFILE=/home/username/wifimon.log

count=$(ping -c $PACKETS -W 2 -n -B -s 0 -i 1 -l 1 -q $IP | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')

if [ $count == 0 ]; then
  echo "Connectivity test failed. Let's try to reconnect to WiFi AP."

  echo "[$(date)] Connectivity test failed. Let's try to reconnect to WiFi AP." >> $LOGFILE

  /sbin/wpa_cli -i wlan0 reconfigure
else
  echo "Connectivity test passed. Packet(s) received: $count."
fi

Hitchman
  • 11
  • 1
  • 4