# random wifi disconnects with intel wireless



## csgordon (Nov 10, 2022)

I'm running FreeBSD 13.1-RELEASE-p3, and keep encountering random wifi disconnects.  Sometimes I can fix this by doing

```
service netif restart && service routing restart
```
Occasionally it gets sufficiently jammed that the only fix I've found is a reboot (the above, and `devctl reset iwm0`, don't fix things).

The hardware isn't very exciting, here's `pciconf -lv`:

```
iwm0@pci0:2:0:0:    class=0x028000 rev=0x78 hdr=0x00 vendor=0x8086 device=0x24fd subvendor=0x8086 subdevice=0x0010
    vendor     = 'Intel Corporation'
    device     = 'Wireless 8265 / 8275'
    class      = network
```
My rc.conf is also not unusual:

```
hostname="x1"
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
local_unbound_enable="YES"
sshd_enable="YES"
moused_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
kld_list="i915kms acpi_video"
hald_enable="YES"
slim_enable="YES"
dbus_enable="YES"
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
webcamd_enable="YES"
ubuntu_enable="YES"
cupsd_enable="YES"
devfs_system_ruleset="system"
devfs_enable="YES"
virtual_oss_enable="YES"
```

I know it's not a hardware issue because I used this machine for a couple years with Windows prior to switching to GhostBSD, now FreeBSD, and have only observed this problem with BSDs.  It seems to happen more often (but not exclusively) when I'm making heavy use of wifi (e.g., a Zoom meeting from Firefox).

Has anyone encountered and fix this before? Any suggestions for things I could try / log / look at to try to diagnose and fix the problem? I'm relatively new to FreeBSD, so any suggestions would be appreciated, even if they might seem "too obvious."[/icode]


----------



## cy@ (Nov 10, 2022)

What do you see in /var/log/messages? What does dmesg say?


----------



## smithi (Nov 10, 2022)

cy@ said:


> What do you see in /var/log/messages? What does dmesg say?



And ifconfig?


----------



## RichardM (Nov 10, 2022)

Hi, I get a similar problem with the iwlwifi driver for an Intel Wifi AX210 chip. Dmesg then has a line about "queue stuck". Apparently this issue happens for Linux too, and is a problem with the Intel firmware that is loaded. Maybe something similar for your chip? "service netif restart" always fixes it for me.


----------



## csgordon (Nov 11, 2022)

I'll check /var/log/messages and dmesg next time it happens, thanks for the suggestion.
I forgot I had saved the results of restarting those two services, which contains ifconfig output:

```
➜  ~ sudo service netif restart && sudo service routing restart
Password:
dhclient not running? (check /var/run/dhclient/dhclient.em0.pid).
Stopping wpa_supplicant.
Waiting for PIDS: 72669.
Stopping Network: lo0 em0 wlan0.
lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
em0: flags=8c22<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=481249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP>
    ether 8c:16:45:c1:f5:b5
    media: Ethernet autoselect
    status: no carrier
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 34:e1:2d:20:94:a5
    groups: wlan
    ssid "" channel 6 (2437 MHz 11g)
    regdomain FCC country US authmode OPEN privacy OFF txpower 30
    bmiss 10 scanvalid 60 protmode CTS wme
    parent interface: iwm0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Destroyed wlan(4) interfaces: wlan0.
Created wlan(4) interfaces: wlan0.
Starting wpa_supplicant.
Starting dhclient.
wlan0: no link .............. giving up
/etc/rc.d/dhclient: WARNING: failed to start dhclient
Starting Network: lo0 em0 wlan0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=481249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER,NOMAP>
    ether 8c:16:45:c1:f5:b5
    inet6 fe80::8e16:45ff:fec1:f5b5%em0 prefixlen 64 scopeid 0x1
    media: Ethernet autoselect
    status: no carrier
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 34:e1:2d:20:94:a5
    groups: wlan
    ssid "" channel 6 (2437 MHz 11g)
    regdomain FCC country US authmode WPA1+WPA2/802.11i privacy MIXED
    deftxkey UNDEF txpower 30 bmiss 10 scanvalid 60 protmode CTS wme
    roaming MANUAL bintval 0
    parent interface: iwm0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
delete host 127.0.0.1: gateway lo0
delete host ::1: gateway lo0
delete net fe80::: gateway ::1
delete net ff02::: gateway ::1
delete net ::ffff:0.0.0.0: gateway ::1
delete net ::0.0.0.0: gateway ::1
add host 127.0.0.1: gateway lo0
add host ::1: gateway lo0
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
➜  ~ netstat -r
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
localhost          link#2             UHS         lo0

Internet6:
Destination        Gateway            Flags     Netif Expire
::/96              localhost          UGRS        lo0
localhost          link#2             UHS         lo0
::ffff:0.0.0.0/96  localhost          UGRS        lo0
fe80::/10          localhost          UGRS        lo0
fe80::%em0/64      link#1             U           em0
fe80::8e16:45ff:fe link#1             UHS         lo0
fe80::%lo0/64      link#2             U           lo0
fe80::1%lo0        link#2             UHS         lo0
ff02::/16          localhost          UGRS        lo0
➜  ~ ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 34:e1:2d:20:94:a5
    groups: wlan
    ssid "" channel 6 (2437 MHz 11g)
    regdomain FCC country US authmode WPA1+WPA2/802.11i privacy MIXED
    deftxkey UNDEF txpower 30 bmiss 10 scanvalid 60 protmode CTS wme
    roaming MANUAL bintval 0
    parent interface: iwm0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```
In the recorded instance the ifconfig output looked like it had never been associated, but I've also seen it keep an IP address associated with the interface even after disassociating from the AP.


----------



## csgordon (Nov 11, 2022)

okay, digging through /var/log/messages, I do see several variations of this line:

```
Nov 10 20:46:18 x1 wpa_supplicant[362]: wlan0: CTRL-EVENT-DISCONNECTED bssid=<removed> reason=3 locally_generated=1
```


----------



## csgordon (Nov 11, 2022)

yesterday I also grabbed a realtek dongle to see what was going on, and actually both disconnected simultaneously, though I see slightly different output for the realtek card:

```
Nov 10 20:46:18 x1 wpa_supplicant[7685]: wlan1: CTRL-EVENT-DISCONNECTED bssid=<removed> reason=3 locally_generated=1
Nov 10 20:46:18 x1 wpa_supplicant[7685]: wlan1: CTRL-EVENT-DSCP-POLICY clear_all
Nov 10 20:46:18 x1 syslogd: last message repeated 1 times
Nov 10 20:46:18 x1 wpa_supplicant[7685]: wlan1: CTRL-EVENT-TERMINATING
```


----------



## csgordon (Nov 14, 2022)

Okay I just looked again right after a random disconnect. It coincides with the messages mentioned in the above posts. dmesg is not informative, just a couple messages about wlan0 link state changing to DOWN, then UP, then DOWN and UP again.


----------



## shepper (Nov 14, 2022)

If it's both devices, could it be dhcp renewal?  I think there is an option in dhclient to lengthen the interval.
https://stackoverflow.com/questions/29966496/dhclient-override-renewal-time

Another way to test would be to set a static ip at home to see if it still drops the connection.


----------



## csgordon (Nov 17, 2022)

I'll give static IP a shot, but I'm doubtful it's dhcp alone; if it were dhcp I would expect a `service dhclient restart <iface>` to fix things, but in some cases restarting netif, routing, and dhclient (either/both) still leaves things requiring a reboot to get wifi working again.


----------



## blackhaz (Dec 12, 2022)

Experiencing the same issues with Intel(R) Dual Band Wireless AC 8260. Has always been like that. A USB Wi-Fi dongle is more stable, but slower for some reason although it operates in the 802.11n mode.


----------

