# WiFi issues using 5Ghz



## rmomota (Oct 22, 2022)

I've got an old DELL Latitude E6410 that would like to keep using and I decided to give FreeBSD 13 a try as a Linux user.
Faced some issues during system setup and configuration, no boot splash and an ugly and non parallel service startup text messages.
The corsair keyboard is detected but only usable when in BIOS mode, with this the function keys are useless, I can live with that.
But what bothers me the most is the WiFi configuration and management.
This laptop has an Intel® Centrino® Ultimate-N 6300 wifi chip and enabled the iwn drivers for wlan0 device with the following flags
ifconfig_wlan0="country PT regdomain ETSI WPA SYNCDHCP"

I did the WPA setup for my 5G network, it detected and got connected and it seems to be working fine.... it just seems but it's not.
What I mean is that the signal strength is very strong, it gets the IP from DHCP and NS resolver configurations but no network traffic at all.
Turned off the interface and on again and wasn't able to connect to the network anymore.
Restarted the system and got connected again, strong signal and no network.
When trying to ping google.com it takes about 20 seconds to reply, so there's something there.
And then after several minutes without editing any configuration I got traffic, I was able to get 40mbps download same speed I usually get with Linux.
Was able to test some Youtube streaming 720p without lag. What was happening, it's great now?
Then suddenly it was gone again.
There was a message in the logs related to some sort of WiFi driver panic error.
Without WiFi I can't go on trying this OS, it's a "game over" kind of problem for me.

Is there any advice on how to properly configure this WiFi chip in FreeBSD 13?

Thanks


----------



## Alain De Vos (Oct 22, 2022)

If the intern WIFI is unstable just put in the cheapest USB-WIFI-dongle you find.


----------



## smithi (Oct 22, 2022)

rmomota said:


> I've got an old DELL Latitude E6410 that would like to keep using and I decided to give FreeBSD 13 a try as a Linux user.



Should go.



rmomota said:


> The corsair keyboard is detected but only usable when in BIOS mode, with this the function keys are useless, I can live with that.



Likely fixable; another topic.



rmomota said:


> But what bothers me the most is the WiFi configuration and management.
> This laptop has an Intel® Centrino® Ultimate-N 6300 wifi chip and enabled the iwn drivers for wlan0 device with the following flags
> ifconfig_wlan0="country PT regdomain ETSI WPA SYNCDHCP"



I take it that you've used
https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-wireless
since it suggests initially using SYNCDHCP.  All other examples there use just DHCP - which works for me with iwn, and I suggest you try that first.



rmomota said:


> I did the WPA setup for my 5G network, it detected and got connected and it seems to be working fine.... it just seems but it's not.
> What I mean is that the signal strength is very strong, it gets the IP from DHCP and NS resolver configurations but no network traffic at all.
> Turned off the interface and on again and wasn't able to connect to the network anymore.
> Restarted the system and got connected again, strong signal and no network.
> ...



Can't say I'm certain, but your symptoms may well indicate reliance on wlan being up on booting, maybe not trying to reconnect soon after then? Perhaps someone can clarify how SYNCDHCP works?



rmomota said:


> There was a message in the logs related to some sort of WiFi driver panic error.



Precise message please. 

Better, enable verbose booting at boot config; to get much greater detail on wifi setup and capabilities, and any error messages later.



rmomota said:


> Without WiFi I can't go on trying this OS, it's a "game over" kind of problem for me.
> 
> Is there any advice on how to properly configure this WiFi chip in FreeBSD 13?
> 
> Thanks



Tonnes, I'm sure, modulo time zone waiting.  Way too soon to give up


----------



## rmomota (Oct 22, 2022)

Thank you for the quick answers.
I'm not yet sure but I think I found the cause.
I've a WiFi extender half way between the system and router and the WiFi detects both signals, one very weak and the other very strong from the extender.
It works when it connects to the weak signal but it's slow and after several on and off wlan0 it gets in to the strongest signal, I wonder if there's a way to control which one it should connect.
And this is where it does not work at all, it does not seem to reach the internet despite the signal is near max strength.
So I just did an extender setup wizard again to make sure the routing to main router was working fine and after that still connects but no internet, persist.
Seems to be something wrong with authentication.
By reading some more forums I decided to hand change the wpa_supplicant.conf file
from
proto=RSN
to
proto=WPA RSN
and voilá! It authenticates, but still no internet.

Ping test to the router 192.168.1.1 is super slow with several packet loss.

# /etc/rc.conf
(...)
wlans_iwn0="wlan0"
ifconfig_wlan0="country PT regdomain ETSI WPA SYNCDHCP"
(...)

# /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1


network={
 ssid="****-5G"
 key_mgmt=WPA-PSK
 proto=WPA RSN
 psk="****"
}

The panic error is this and it still happens some times, but recovers.
kernel: iwn0: iwn_panicked: controller panicked, iv_state = 5; restarting
kernel: wlan0: link state changed to DOWN
kernel: iwn0: iwn_read_firmware: ucode rev=0x09dd0401
dhclient[6791]: connection closed
dhclient[6791]: exiting.
kernel: wlan0: link state changed to UP


#### EDIT ####
There must be really a problem with using the extender.
The internet becomes extremely slow when using the signal from extender despite the signal strength.
It improves when I turn off the extender and connect to the weak signal, router directly.
Is there an extra flag I should enable for a TPLink WiFi Extender?
It seems that only FreeBSD is having a hard time to get through it because all other systems are OK.


----------



## rmomota (Oct 23, 2022)

Hi there!

I'm replying to myself. 
So here it goes.
The problem happens when the wifi gets connected to router directly and then switches to the extender signal because both have the same SSID.
When this happens the ifconfig command returns 2 IPv4 addresses for the same wlan0 interface.
When the interface reaches this state I'm unable to use the extender despite it gets connected to it.
I'm guessing it may be related to ARP table and/or routing issues.
Today when I turned on the system and got connected to the extender, no problems until now, the ifconfig shows only 1 IPv4 address.
I will get back here when the problem returns to confirm this behavior.

Cheers


----------



## Alain De Vos (Oct 23, 2022)

When 2 IP addresses the default route might be important.


----------



## rmomota (Oct 23, 2022)

Alain De Vos said:


> When 2 IP addresses the default route might be important.


in this case it's the same subnet, same gateway, it shouldn't make any difference, right?
something else is going on and I think it might me the ARP table, no matter how many times I rebooted the system and getting in to the same problem but today it just connected.
Probably because from yesterday ARP records have expired.
If it happens again I will try to force ARP expiration.

After all this it is nothing related to 5Ghz but with having a router and an extender.


----------



## rmomota (Nov 1, 2022)

Hi,
it happened again and here's the problem and solution
Problem:
When using a wifi extender, same SSID, the main router dhcp delivers one IP address but then I moved the laptop to another room to get the signal from the router, the still active signal was very poor so I turned off the interface and turned on again.
By doing this it connected to the main router and the dhcp gave the interface a new IP address so the same interface kept 2 IPv4 addresses.
This happens because the MAC address is different when using the extender, the dhcp interprets it as a new device so gives back a new IP.
And this is the reason why the network becomes super slow practically unresponsive.

Solution:
Turn off interface: 
# ifconfig wlan0 down
Clean both IPv4:
# ifconfig wlan0 192.168.1.100 delete
#ifconfig wlan0 192.168.1.104 delete
Bring it up again:
#ifconfig wlan0 up
The dhcp will give again one of the two IP's and the network is back.

How it should work:
The network daemon should detect the strongest signal and switch automatically. I had to turn off an of again.
And whenever it switches and gets a new IP from dhcp it should clean up the previous IP address from the interface.


----------



## rmomota (Nov 25, 2022)

I got updates on this issue.
The problem keeps coming back over and over so this is what I think what is happening.
As mentioned above I've got a wifi extender that uses the same SSID as the main wifi router.
Seems that when passing by the extender I have no network despite the signal strength is perfect.
When connected to the router wifi everything seems fine.

I wonder how to fix this behavior as the solution above seems to work only when it connects to the main router.


----------



## tanis (Nov 25, 2022)

You can try to add multiple bssids for your network.

What's a bit strange, is the point, that the Wifi extender is not only boosting the signal but is kind of spoofing the arp request so DHCP is handing out a new ip address. Are you sure you are the only one using that extender ?!


----------



## rmomota (Nov 26, 2022)

Yes I'm the only one using this extender because the SSID and access key is the same as main router.
It works well with Linux and M$ Windows, it's really a FreeBSD problem only.
I've other equipments as tablets, cellphones, vacuum robots and aircon connected to that extender with no problems at all.


----------



## tanis (Nov 26, 2022)

Don’t get me wrong  I don’t doubt that there is an issue with the iwn driver not being able to handle that particular scenario described here. 

From my point of view there are the following solutions to this issue:

A) Debugging and fixing the iwn issue. Wifi is, no doubt, in very high demand and FreeBSD is lacking man power in that department.

B) Go for a different wifi adapter (dongle, internal adapter replacement). But I would expect issues in that particular scenario as well.

C) Adjusting that wifi to a more common scenario. There are enough public tutorials how to set this up.

D) Choose a different OS.


----------



## rmomota (Nov 26, 2022)

Well,
this same laptop works perfectly fine with a pendrive linux live image so this is not a hardware problem at all.

I'm giving FreeBSD a try, don't take me as a masochist but I like to face some challenges and admit some pain until figure out how stuff work.
The problem here is that it works, sometimes it does, sometimes it does not.
No matter what tutorials and changes I've already made to the system the behavior persist.
Maybe because the SSID and password is the same and the wifi keeps flipping between both signals or something like that.
When I run a ping to 192.168.1.1 it pings and then several requests are dropped and then it pings again, the wifi signal is great, in xfce interface it's max signal.
Then restarting the wifi interface several times and somehow it gets stable and it works until next reboot.

The option D) will be the choice if I don't find a solution for this.
Spending on new hardware doesn't make sense when the hardware I got is working just fine with other system, spending it's out of question.


----------



## juha (Nov 27, 2022)

I wonder what happens if you set a static IP instead of DHCP for your ifconfig_wlan0

If no good it may help to use BSSID to narrow down what is happening - BSSID is the mac address of the extender or access point

ifconfig_wlan0="ssid your_ssid_here bssid xx:xx:xx:xx:xx:xx DHCP"









						Chapter 33. Advanced Networking
					

Advanced networking in FreeBSD:  basics of gateways and routes, CARP, how to configure multiple VLANs on FreeBSD, etc




					docs.freebsd.org


----------



## rmomota (Nov 27, 2022)

juha said:


> I wonder what happens if you set a static IP instead of DHCP for your ifconfig_wlan0
> 
> If no good it may help to use BSSID to narrow down what is happening - BSSID is the mac address of the extender or access point
> 
> ...


that's and interesting tip. I will definitely try that.


----------



## rmomota (Dec 3, 2022)

Well, it didn't work.
In fact it does what is expected to do, it connects to only one device but the network issue persists.
Seems like switching on and off ...
ifconfig wlan0 down
ifconfig wlan0 up
... several times, connecting to same device, without any change brings it to work so it must be really something wrong with the driver/system.
Can't figure out what it is.
I'm quitting using this system and that's it.


----------

