Wi-Fi roaming problem when roaming (moved to another AP) MAC overwrighting

There is the problem with connection when a station roams to other AP

the router trying to send to the station something but MAC address of the station on switch still on port 1
and there is no way to know where the current station is until the station send something and the switch
over wrights MAC to other port .and then all ok.
I have an idea to send a prob signal( ping?) to the router from AP where stantion just connected
my idea is to make an interface with the same MAC and send ping and then delete this interface so on the switch MAC will be rewright to curent switch port
it takes really short time to overwright MAC
How to make this interface with sertain MAC send a ping and delete this interface?

Or maybe there is some other way to send a probe to router so switch would know where the station is ?

there is no problem with aplication like WatsApp or other that constantly sends probs but there is problem with others like YouTub SMB etc

Can you describe the actual problem you are experiencing?

When a device roams from one AP to another, it disconnects from the first AP and then connects to the second. Properly tuned, this brief disconnection should be almost undetectable at human time scales.

The switch will update its tables to forward to the appropriate port. This happens really quickly and is, by design, what switches are made to do.

So I'm not sure what problem(s) you're actually experiencing, and what you're asking to be done.

the switch wont rewrights its MAC table until the station (smartphone) sends something.
Using apps like watsapp or any that constantly sends probes no problem but others like web smb they dont make station sends anything , station just wait and web or smb will send information to the wrong port .
It known problem and i need to know realisation to make it work.
So i am thinking about the trick to make the AP which stantion just connected send somthing short from the same MAC as station

most apps use TCP for communications that are not live-streaming, so the packets will be resent if they do not arrive at the destination. For live audio/video streaming (including telecommunications), UDP is used which means some packets may get lost, but usually are of little consequence (usually at most a few dropped frames in a video conference in the roaming scenario under normal conditions).

The switch MAC address table update is very fast. It will happen immeidately when the device associates with an AP (it has to or the device wouldn't be able to be on the network at all). It is, of course, reliant on the device actually making that connection to the network again.

I'm still not understanding what the problem is, and what you expect to be able to do anyway (or how this even involves OpenWrt).

What is the actual practical issue you are experiencing?

I'm not understanding... but if you're talking about 'spoofing' the MAC, that would just break everything.

idk what else i can say , but have you noticed for example in dawn if you have stream or downloading something it wont roam ? why? because it will lost TCP connection in few seconds (how often station would send somthing ? idk TCP with keep alive maybe would do it ), anyway i use roaming for 2 years alredy and i know if i start watching a movie from SMB and then roamed to other AP video will be freeze and i have to reconnect to share and start other , the same when i watch video on telegram or YouTube it is not always but happens sometimes i started with OpenWrt 19 and still the problem exists
anyway i read about it from Cisco forum long ago but Cisco sends some kind of probs so there is no problems at all

The issue with roaming is not on the switch or the router, it's the APs. You may not have a properly optimized configuration. Watch this video for details about how to tune your wifi APs for optimal tuning. This includes making sure the channels are non-overlapping and also that you reduce power levels to the minimum required to cover the desired area for each AP (with only a small region of overlap).

If you share your configs for your two APs, we might be able to determine if there are any obvious issues.

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/wireless

seriusly 2 years i am setiingups roaming tryied dawn usteer but at the end i wright my own roaming system ant it works much better u want configs fine

AP1


config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/ahb/18100000.wmac'
	option channel '1'
	option band '2g'
	option htmode 'HT20'
	option cell_density '0'
	option log_level '1'
	option txpower '18'
	option beacon_int '250'
	option disabled '1'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'rostel'
	option key 'ch240Rml'
	option ieee80211r '1'
	option ft_over_ds '0'
	option mobility_domain '1111'
	option ieee80211k '1'
	option bss_transition '1'
	option wnm_sleep_mode '1'
	option time_advertisement '2'
	option time_zone 'MSK-3'
	option encryption 'psk2+ccmp'
	option dtim_period '3'
	option disassoc_low_ack '0'
	option max_inactivity '1'
	option rrm_neighbor_report '1'
	option rrm_beacon_report '1'
	option ft_psk_generate_local '1'
	option disabled '1'

config wifi-iface 'wifinet1'
	option device 'radio0'
	option mode 'ap'
	option mobility_domain '2222'
	option ssid 'newone'
	option encryption 'psk2'
	option ifname 'wlan2'
	option dtim_period '3'
	option disassoc_low_ack '0'
	option key '1225612256'
	option ieee80211r '1'
	option ft_over_ds '0'
	option ieee80211k '1'
	option time_advertisement '2'
	option time_zone 'MSK-3'
	option bss_transition '1'
	option macaddr 'E2:E1:A9:7D:F8:BB'
	option max_inactivity '1'
	option ft_psk_generate_local '1'
	option network 'guest'
	option disabled '1'


AP2


config wifi-device 'radio0'
	option type 'mac80211'
	option path 'platform/ahb/18100000.wmac'
	option channel '11'
	option band '2g'
	option htmode 'HT20'
	option cell_density '0'
	option log_level '1'
	option txpower '18'
	option beacon_int '250'

config wifi-iface 'default_radio0'
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'rostel'
	option key 'ch240Rml'
	option ieee80211r '1'
	option ft_over_ds '0'
	option mobility_domain '1111'
	option ieee80211k '1'
	option bss_transition '1'
	option wnm_sleep_mode '1'
	option time_advertisement '2'
	option time_zone 'MSK-3'
	option encryption 'psk2+ccmp'
	option dtim_period '3'
	option disassoc_low_ack '0'
	option ifname 'wlan0'
	option max_inactivity '1'
	option rrm_neighbor_report '1'
	option rrm_beacon_report '1'
	option ft_psk_generate_local '1'

config wifi-iface 'wifinet1'
	option device 'radio0'
	option mode 'ap'
	option mobility_domain '2222'
	option ssid 'newone'
	option encryption 'psk2'
	option ifname 'wlan2'
	option dtim_period '3'
	option disassoc_low_ack '0'
	option key '1225612256'
	option ieee80211r '1'
	option ft_over_ds '0'
	option ieee80211k '1'
	option time_advertisement '2'
	option time_zone 'MSK-3'
	option bss_transition '1'
	option macaddr 'E2:E1:A9:7D:F8:AA'
	option max_inactivity '1'
	option ft_psk_generate_local '1'
	option network 'guest'


mykikaconsole.sh

########################### MY KIKA V0.6.2b #################################################################################
#!/bin/ash



######################## READING CONFIG  ##########################################################
for config in log_lvl work_dir tmp_dir threshold periud guest_wlan dummy_ban_time dummy_delay_decision delay_offer delay_chek_roam lowthreshhold
do
eval $config=$(echo -e "$(cat /etc/config/mykikaconfig)" |grep $config | awk -F ' ' '{ print $2 }')
done
############################################################################################
mylog="${tmp_dir}kikalog.log"
allcandidates="${tmp_dir}kikacandidates"
echo -n > $allcandidates
#echo -n >/tmp/mykikachek
dummyst=$(cat ${work_dir}lists/dummies)
neigbors=$(cat ${work_dir}lists/neighbors)
neigborsguest=$(cat ${work_dir}lists/neigborsguest)

echo -e "$(date +"%d.%m.%y %T") AVNG WiFi 802.11rkv system started" >> $mylog



if [ $log_lvl -le 4 ]; then logger -p warn -t MYKICKA "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";fi
if [ $log_lvl -le 4 ]; then logger -p warn -t MYKICKA "|||         log_lvl:$log_lvl      ||   work_dir:$work_dir ||        tmp_dir: $tmp_dir        ||    threshold:$threshold dB   ||       periud:$periud  sec.    |||";fi
if [ $log_lvl -le 4 ]; then logger -p warn -t MYKICKA "|||   guest_wlan:$guest_wlan     ||  dummy_ban_time:$dummy_ban_time ms  ||  dummy_delay_decision:$dummy_delay_decision sec. ||  delay_offer:$delay_offer sec.   ||  delay_chek_roam:$delay_chek_roam sec. |||";fi
if [ $log_lvl -le 4 ]; then logger -p warn -t MYKICKA "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";fi


wlanlist=$(ifconfig | grep wlan | grep -v sta | awk '{ print $1 }')
if [ $log_lvl -le 1 ]; then echo "|||$(date +"%T")  Starting up! .. "; fi
if [ $log_lvl -le 1 ]; then echo "|||$(date +"%T")  Setting neighbors .. "; fi
if [ $log_lvl -le 3 ]; then logger -p warn -t MYKICKA " Setting parametrs $mylog $allcandidates $threshold $periud wlanlist: $wlanlist "  !!;fi

################################################ GETTING NUMBER OF NEIGHBORS #############################
for wlan in $wlanlist
	do
		neigi=$neigbors
		if [ "$wlan" = "$guest_wlan" ]
			then
			neigi=$neigborsguest
		fi
		y=0;
		for i in $neigi; 
			do 
 				y=$((y+1)); 
			done
##########################################################################################################
if [ $y -ne 0 ]
	then
############################################### SETTING NEIGHBORS AND FULL OFFER LIST #####################
OUTPUT="[["
COUNT=0
for ELEMENT in $neigi;
 do
        OUTPUT="$OUTPUT$ELEMENT]"
        COUNT=$((COUNT+1))
        [ $COUNT -eq $y ] && break
        OUTPUT="$OUTPUT,["
done
OUTPUT="$OUTPUT]"
######################
ubus call hostapd.$wlan bss_mgmt_enable "{ 'neighbor_report': true, 'beacon_report': true, 'link_measurements': true, 'bss_transition': true }"
ubus call hostapd.$wlan rrm_nr_set '{ "list":[] }'
ubus call hostapd.$wlan rrm_nr_set '{ "list": '$OUTPUT'}'
if [ $log_lvl -le 1 ]; then echo "|||$wlan neigi:$OUTPUT"; fi
if [ $log_lvl -le 1 ]; then logger -p notice -t MYKICKA "neigbors for:| $wlan: $OUTPUT| ";fi

echo -e "$(date +"%d.%m.%y %T") $wlan neigbors: $OUTPUT " >> $mylog
if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " Setting parametrs: $wlan neigbors: $OUTPUT ";fi
######################################################################################################
offer="["
count=0
	for neighid in $neigi;
		do
		pipa=$(echo "$neighid" |awk -F ',' '{ print $3 }')
  		offer="$offer$pipa"
        	count=$((count+1))
        	[ $count -eq $y ] && break
        	offer="$offer,"
	done
offer="$offer]"
###########
#echo  " $wlan:$offer " 

echo -e "$wlan:$offer" >> $allcandidates
##########################################################################################################################

echo -e "$(date +"%d.%m.%y %T") $wlan candidates:$offer" >> $mylog
if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA "$wlan candidates:$offer ";fi
#########################################################################
if [ $log_lvl -le 1 ]; then echo "|||$wlan candidates:$offer"; fi
#-----------------------------------------------------------------------------------------
###########################################################################################################
fi
	done
##########################################################################################################################################
if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA "End of setup ";fi
if [ $log_lvl -le 4 ]; then logger -p warn -t MYKICKA "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Gatering own rmm !!! ||||||||||||||||||||||||||||||||||||||||||||||||||||||||";fi
##########################################

 /bin/ash /bin/mykika/neigi_reporter.sh $log_lvl &


################################################# END OF SETUP ###########################################################################

##########################################################################################################################################

echo  " |$HOSTNAME mykika started |OK| " 
####################################################### MAIN LOOP #####################################################################################################################################################
while :
do
sleep $periud
######################################################loop for each wlan###########################################################################################################################################
for wlan in $wlanlist
do
if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "MAIN LOOP:||$wlan ||  ";fi

##########################################################################################################
###############################################################################################
	maclist=$(iw $wlan station dump | grep Station | awk '{ print $2 }')
	for mac in $maclist
		do
		rssi=$(iw $wlan station get $mac | grep "signal avg" | awk '{ print $3 }')
		if [ $log_lvl -lt 1 ]; then  echo " ||| $(date +"%T") || $mac || $rssi dB || <-- curently in procces ! ||| "; fi

################################################################################################################
##-----------------------LOW RSSI TRIGGER -------------------------------###  #### ### ### ### ###  # # ####
###############################################################################################################
if [ $rssi -lt $lowthreshhold ]
				then
/bin/ash ${work_dir}execs/kickerdummys.sh $log_lvl $wlan $mac $delay_chek_roam $lowthreshhold $dummy_delay_decision $dummy_ban_time   &


fi


			if [ $rssi -lt $threshold ]
				then
				flag=1
###############################  DUMMY PHONES ####################################################################################################################
				for dymmymac in $dummyst
					do
						if [ "$mac" = "$dymmymac" ]
							then
							flag=0	
#############################################################################################################################								
if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Sending parametrs to Dummy kicker : $mac  $wlan  ||  ";fi
/bin/ash ${work_dir}execs/kickerdummys.sh $log_lvl $wlan $mac $delay_chek_roam $threshold $dummy_delay_decision $dummy_ban_time   &

if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Sending parametrs to Dummy kicker (done) :  $mac $wlan  ";fi
##############################################################################################################################
						fi
					done
if [ $log_lvl -lt 1 ]; then echo "||| ------------------------------------ Y =  $y ------- flag $flag ------------------------------------- |||| ";fi

################################  SMART PHONES ############################################################################################################################################################################################
if [ $flag -eq 1 ]
	then
		if [ $y -ne 0 ]
			then
				offer=$(echo -e "$(cat /tmp/kikacandidates)" |grep $wlan | awk -F ':' '{ print $2 }')
				if [ $log_lvl -lt 1 ]; then echo "|||Candidates for $mac : $offer|||"; fi
#################################################################################################################################################################
if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Sending parametrs to kicker : $offer $mac $y $wlan  ||  ";fi
/bin/ash ${work_dir}execs/kicker.sh $log_lvl $wlan $mac $delay_chek_roam $offer $y $delay_offer $rssi &
if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Sending parametrs to kicker (done) : $offer $mac $y $wlan  ";fi
##########################################################################################################################
			else			  
				ubus call hostapd.$wlan del_client "{'addr':'$mac', 'reason':5, 'deauth':1, 'ban_time':$dummy_ban_time}"
				if [ $log_lvl -le 1 ]; then echo "||| $(date +"%T") || MAC $mac has been kicked cause  no neigbors has been set !  ||| ";fi

		fi	
fi
#############################################################################################################################################################################################################################################

			fi
		done
done	
done
################################################ END OF LOOP ########################################################################################

kicker.sh

#!/bin/ash

log_lvl=$1
wlan=$2
mac=$3
delay_chek_roam=$4
offer=$5
y=$6
delay_offer=$7
rssi=$8

if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Got from mykikaconsole !:|||$log_lvl||$wlan||$mac||$delay_chek_roam||$offer||$y||$delay_offer||  "; fi
x=1
ind=1
while [ $x -le $y ]
	do
 		candidates="["
		stripper=${offer:$ind:38}
		ind=$(( $ind + 39 ))
		candidates=$candidates$stripper]

		ubus call hostapd.$wlan bss_transition_request '{ "addr":"'$mac'", "disassociation_imminent":  true, "disassociation_timer":0, "validity_period":10, "neighbors": '$candidates' , "abridged":1 }'
						
		sleep $delay_offer
		#echo " $(date +"%T") ||List N: $x || $candidates || offer $offer ||| "			
				
		if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "$mac called bss_transition from List N: $x || $candidates ||  "; fi


		x=$(( $x + 1 ))
	done


sleep $delay_chek_roam


	

	macl=$(iw $wlan station dump | grep $mac | awk '{ print $2 }')
stname=$(echo -e "$(cat /tmp/dhcpreporter)" |grep $mac | awk -F ' ' '{ print $3 , $4 }')
	
if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA "Stantion : $mac on $wlan  maclist:  $macl  "; fi

	if [ -z "${macl}" ]
		then
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " =============================================================================================================================================================== "; fi
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " Stantion :|||$stname || $mac on $wlan * MOVED |||(ROAMED)!! with rssi: $rssi dB!"; fi
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " =============================================================================================================================================================== "; fi

		else
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " =============================================================================================================================================================== "; fi
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " Stantion :|||$stname || $mac on $wlan * STILL HERE (DID NOT ROAMED) with rssi: $rssi dB!!"; fi
		if [ $log_lvl -le 3 ]; then logger -p notice -t MYKICKA " =============================================================================================================================================================== "; fi

	fi 




if [ $log_lvl -le 2 ]; then logger -p notice -t MYKICKA " Kicker Finished Its Work !!! : $offer $mac $y $wlan "; fi

exit 0

Passwords are exaples not real
power overlaps supposed to be -45 (Cisco standart)
the problem with switch is not a big problem in many cases no problem but i want make all beter

you sound a bit angry... I'm not sure if I'm just misreading your tone, but I'm trying to help.

The very first thing I'd do is remove all of the 802.11k/r/v stuff. Many devices just don't work well with these features (even though they say the support them).

In fact, I'd recommend simply resetting your devices to defaults and starting with a super simple configuration. Make a backup before doing this (then you can get back to where you were if you want). After resetting your APs:

  • Obviously make sure the network addresses are set properly
  • The DHCP servers must be disabled
  • Set your country code
  • Set the channel (each to a different non-overlapping channel -- 1 and 11 is good for 2.4G)
  • Set the SSID name and password.
  • enable wifi.
  • consider lowering the wifi power a bit (I don't know the physcial configuratoin of your space, so I can't recommend anything specific, but you want just enough power to cover the necessary areas without creating much of an overlap region).

Tuning appropriately at this point is key -- the other standards (k/r/v) won't work well unless your APs are well tuned for traditional roaming.

I don't know what that kika thing is suppsoed to do, but I'm positive it's not required for good quality traditional roaming (you can always add that back later if you want).

Finally, I'm seeing that AP1 is completely disabled... not sure what is going on there, but all stanzas have diabled '1' which means that it isn't doing anything.

oh well dont mind my language i am lerning i am not angry why would i be
i am constatly changing settings and these disabled i just disabled for experiments with VLANs for guest network
kika means it kicks
kika mesures lvls of connected station and if it less than -55dB station goes to kiker and kiker offers neighbors . Anyway works well with 4 type of smartphones
1 Smart devices (wont roam till sees offered AP)
2 Slave device (roams to offer immidiatly even if dont see offered AP wont roam with reson 5 (AP busy) )
3 Very smar devices (wont roam till sees offered AP smoothly roams with reason 5 (AP busy) )
4 Dummis (they just wont roam kick ban only )
anyway i want to say the problem is on switch when roamed
Anyway thanks for advices maybe i will try my idea
i just wanted to know how to make comand create interface with sertan MAC ping and then delete the interface (cause it is not good to have 2 interface with same MAC )

Ok... good :slight_smile: . Just wanted to make sure.

Well, the kika thing is likely a large part of your issue -- or at least I would think it would be. Kicking devices off the network will naturally cause problems, especially if has to wait for another AP to be 'offered'. In some cases, the client will attempt to reconnect to the same AP that just kicked it off, which further delays the reconnection process.

Roaming traditionally works best when the client (sta mode device) can make decisions based on the conditions it sees. Classical roaming is a client side process... the client decides when to change to a new AP.

In my house (and my in-laws), I have 2 APs and the roaming is nearly seamless. This is without any additional things like 802.11k/v/r, and I certainly don't kick any clients off the network. My dad's house has 5 APs -- this required more fine-tuning, but all three houses just rely on basic client-side roaming decisions and everything works flawlessly. The worst we see is a few dropped frames in a facetime call, but even that is pretty rare.

So my recommendation is the KISS principle ("keep it simple, stupid"; no, I'm not calling you stupid :slight_smile: ).

mykika not kiking 3 types of devices offers and roams byitself
only dummies will be kiked with reason 5 and ban time

i think you have smart devices that roams itself when lvl is lower than -75 or about to be
but i work with all kind of devices and some of them really dumb so i have to crate my own system
and it doesnt mater if they expensive or new
old one 5 yo roams the best with offer and kicking smoothly
the new one wich is china cheap X100 smartphone is dumb

Try what I am suggesting. Worst case you restore your existing config. Iā€™m pretty confident you will get better performance based on simple traditional roaming.

once i sat up 3 AP for a person for money on OpenWrt 19 my phone roams good my friends phone roams good but that person has expensive phone and his relatives as well so he stays near an AP but his phone stuck to far AP so he cant even make a call -85dB and it wont roam
and what should i do in this situation..
the person dont care that his phone cant roam with this system so he ask other guy to make roaming and he did on Mikrotik with capsman and the person satisfight
so i make system which can work with all types of phones

The problems you are experiencing (including the one you just talked about in the latest post) are almost certainly related to a sub-optimal tuning and configuration and serious over-complication of the 'solution.'

At this point, I've given you my advice, and I stand by it. I'm pretty good at this stuff. But, now it is up to you to try what I'm suggesting... if it doesn't improve things, you can go back to your original configuration and you won't have lost anything but some time. Or you can spend even more time trying to resolve the issues on what I believe is an overly complex configuration that will more than likely continue to perform poorly and a total waste of time. The choice is, of course, up to you, and I wish you luck.

1 Like

I never use Kika script for my roaming APs.
What I use is Usteer.
Perhaps you might try it and configure to your desired setting.

Here are the docs:

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.