Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Diagnosing an intermittent WiFi connection with particular characteristics

I have a new 2020 iMac. It connects to the office WiFi and Ethernet just fine. Despite many hours of effort, I cannot get it to connect to a particular WiFi access point for more than 6 seconds.


The Access Point:

  • Created by a WL1835MOD (supports 802.11b/g/n), put in access point mode by wpa_supplicant on Debian.
  • Runs a DHCP server using dnsmasq, with IP address 192.168.4.1, and successfully serves 192.168.4.239 to the iMac (and other IP addresses to other clients).
  • Also has a cellular internet connection, and may or may not share it with clients on WiFi, with no change in symptoms.
  • Variations to SSID, country and frequency (channel) cause no change in symptoms.
  • Various arrangements of antenna and relative location cause no change in symptoms.
  • Is 100% reliable when connected to from any other device I can find (MacBook Pro, iPhone, iPad).


The iMac:

  • Is a plain fresh factory build, with interface en1 being an Airport Extreme running wl0 version 9.30.357.41.32.5.49.
  • Otherwise has no noticeable network issues, including via Ethernet and when connecting to other WiFi networks.


The symptoms:

  • The SSID sometimes takes a while to appear in the list in System Preferences or the Wi-Fi drop-down. Sometimes WiFi has to be turned off and back on for it to appear.
  • When it does, it can be selected, the password entered, and the connection is "connected" and seems fully operational.
  • Between 2 and 6 seconds later, the status changes to "On" (not connected to a network)) and the sheet appears stating that either the Wi-Fi network could not be joined or requires a WPA2 password.
  • The SSID disappears from the list, but once it reappears the cycle can be repeated.
  • Sometimes the "could not be joined" sheet doesn't appear until the cycle has repeated a few times automatically.


What I've tried:

  • Deleting the contents of /Library/Preferences/SystemConfiguration (except com.apple.Boot.plist), emptying the trash and rebooting.
  • Resetting the PRAM.
  • Rebooting with shift held down.
  • Removing all the known WiFi networks in System Preferences.
  • Deleting all the relevant entries in Keychain Access.
  • Making changes to the access point as mentioned above.
  • Creating a Location, waiting 30 seconds, using the Location, deleting the Location, going back to Automatic.
  • Turning Wi-Fi off and then on again.
  • Poured through tons of logs looking for anything useful.


What I've seen:

  • When the iMac does connect it reports the network as WPA/WPA2 Personal, Channel 11 (2.4GHz, 20MHz), County Code AU, RSSI -72dBm, Noise -91 dBm, Tx Rate 13Mbps, 802.11n, MCS Index 6, NSS 1.
  • The access point logs an "AP-STA-CONNECTED" with the matching MAC address as well as "HT: Forty MHz Intolerant is set by STA in Association Request".
  • While the network is connected I can happily SSH to the device and use it. The SSH session even sometimes survives through the periodic disconnects.
  • If I turn on wifi debugging, I get a lot of entries, including:
  • "Info: <airportd[291]> <en1> Failed to associate to Wi-Fi network The_SSID, returned error code -3902, no more attempts", and
  • "Info: <airportd[291]> <en1> Failed to associate to Wi-Fi network The_SSID, returned error code 5, no more attempts", even though earlier it says

"Assoc: <airportd[291]> Will associate to [ssid=The_SSID, bssid=d8:a9:8b:c3:03:37, channel=(channel=11, width=20), ibss=no, cc=(null), rssi=-64, rsn=(mcast=tkip, ucast={ aes_ccm tkip }, auths={ psk }, caps=0xc), wpa=(mcast=tkip, ucast={ ccmp tkip }, auths={ psk }), wep=no]


As far as I can tell, the iMac simply "gives up" on the connection, even though it is established.


What can I do to get to the bottom of it?



iMac Line (2012 and Later)

Posted on Aug 27, 2020 7:02 PM

Reply

Similar questions

14 replies

Aug 31, 2020 8:01 PM in response to Liteyear

I done a bunch more experimentation but am none the wiser. Tried:

  • Access point: Fresh Debian install.
  • Access point: Network Manager instead of wpa_supplicant.
  • iMac: disabling IPv6, setting manual IP address, DNS, MTU.


No change in symptoms.


I managed to capture a log from point of establishment to disconnection. I did the same for a similar access point and poured through the (1000 line) log line by line but couldn't see anything that appeared in the unsuccessful log which didn't also appear in the successful log, up until the fatal line:


Tue Sep  1 11:42:30.122 Info: <airportd[19249]> <en1> Failed to associate to Wi-Fi network TheSSID, returned error code -3902, retrying


The log on the access point is always the same (connected, DHCP served, disconnected 6 seconds later):


Sep 01 02:43:57 ap-name wpa_supplicant[7198]: HT: Forty MHz Intolerant is set by STA 14:7d:da:24:98:ea in Association Request
Sep 01 02:43:57 ap-name wpa_supplicant[7198]: wlan0: AP-STA-CONNECTED 14:7d:da:24:98:ea
Sep 01 02:43:59 ap-name dnsmasq-dhcp[15213]: DHCPDISCOVER(wlan0) 14:7d:da:24:98:ea
Sep 01 02:43:59 ap-name dnsmasq-dhcp[15213]: DHCPOFFER(wlan0) 10.42.0.185 14:7d:da:24:98:ea
Sep 01 02:44:00 ap-name dnsmasq-dhcp[15213]: DHCPREQUEST(wlan0) 10.42.0.185 14:7d:da:24:98:ea
Sep 01 02:44:00 ap-name dnsmasq-dhcp[15213]: DHCPACK(wlan0) 10.42.0.185 14:7d:da:24:98:ea iMacName
Sep 01 02:44:03 ap-name wpa_supplicant[7198]: wlan0: AP-STA-DISCONNECTED 14:7d:da:24:98:ea


I've attached the unsuccessful wifi log in case any one can spot anything I've missed.



Aug 29, 2020 8:20 AM in response to Liteyear

Good day Liteyear,


Welcome to Apple Support Communities!


Based on what you mentioned, there's some trouble maintaining an established Wi-Fi network. Do you have the Ethernet cable connected to the same network while you are trying to connect to Wi-Fi? If so, removed the ethernet cable and test. If you can connect your iMac to other WI-Fi networks without an error or issue, you may want to check your closed firewall ports.


It sounds like the connection is being dropped, and this is likely an action from the network or router. Temporarily disable your security packages on this network and test. This includes any router driven firewalls. You can find necessary ports here: TCP and UDP ports used by Apple software products.


Lastly, make sure any and all suggestions are checked using this document: If your Mac doesn't connect to the Internet over Wi-Fi.


Best regards.

Aug 31, 2020 8:32 PM in response to Liteyear

Long shot...


RichardFoo User level: Level 1 (4 points)

Feb 15, 2019 4:24 PM in response to TimsTech

I've been debugging a problem with my VPN client constantly reconnecting, along with poor WiFi performance. After much digging, I came across an excellent article - although written for Yosemite and iOS8, it still seems to be relevant to Mojave, especially with a newer WiFi chip in the 2018 MacBook Pro. https://medium.com/@mariociabarra/wifriedx-in-depth-look-at-yosemite-wifi-and-awdl-airdrop-41a93eb22e48


The author wrote a program that essentially just issues a command and keeps it enforced. You can try it manually in a terminal window: sudo ifconfig awdl0 down

To reverse the command, type: sudo ifconfig awdl0 up


He gives a great technical explanation, so I won't repeat it here. The command disables a virtual network interface that's used for ad-hoc WiFi by features like Airdrop; I personally won't miss them. So far, I've gone from losing my connection 20 times an hour to being stable for 3+ hours.

Sep 8, 2020 11:50 PM in response to BDAqua

Tried and eliminated a few more things:


  • Turned off Bluetooth.
  • Tried two different Windows 10 PCs as clients - they also failed mysteriously!! Something in new OS's in general??
  • Changed from WEP to WPA2.
  • Changed password length, SSID name, etc.


And then tried one more thing...

  • Change security to "Open" by turning off password security (in wpa_supplicant, that's "key_mgmt=NONE").


And it works!! WiFi connection established and maintained for at least a few minutes. So still mysterious, but that helps narrow it down a lot.


In summary:


  • Works:
    • Early 2013 MacBook Pro running macos 10.14.6 (Mojave)
    • iPhone SE running iOS 13.6
    • Old Toshiba running Windows 7.
  • Doesn't work:
    • Late model desktop PC running Windows 10.
    • Ancient ASUS laptop running Windows 10.
  • Only works if security is changed to "Open" (no password):
    • 2020 iMac running macos 10.15.6 (Catalina)
    • Win 10 devices not yet checked.


Aug 30, 2020 4:19 PM in response to jdo_apple

Thanks for the response.


I've tried with and without the Ethernet connection active, with no change in symptoms.


There is no firewall on the network or the router.


There are no security packages to disable and all those ports are open.


I have followed the instructions in that WiFi diagnostics link many times and have tried to interpret the information that appears in the log, but it is very complicated and verbose. I put some of the relevant entries I could find in the original post.


Anything else I can do to fault find?

Aug 30, 2020 6:52 PM in response to BDAqua

Why? Did you try the new Location at all?


Creating and deleting a Location is one of many, many suggestions people have made that at least one person has reported success with. In particular, here: https://apple.stackexchange.com/a/353603


Yes, I tried using the new Location before deleting it.


By the way, I've also now tried creating a new user account, logging out and logging into the new account. The WiFi symptoms are the same in the new account.


I've also tried WiFi Explorer Lite, which lists the network (and others) much quicker and more consistently that macos's own lists. There's nothing alarming about the network in WiFi Explorer Lite.

Sep 10, 2020 3:52 PM in response to BDAqua

Okay, I have an answer... it's a bit unsettling.


After the "no password" workaround I described above opened a door to explore, I went deep into why the authentication was failing. Most diagnostics were very misleading, but wpa_supplicant itself gave some very vague insight.


Eventually I was able to show that WPA authentication works, but WPA2 does not. The logs showed that in WPA the pairwise key handshake completes and then the group key handshake completes. In WPA2 the pairwise key handshake completes but then the process stops until the connection is dropped, regardless of whether AES, CCMP or TKIP was enabled.


After an exhaustive process of elimination, including endless permutations of dozens of different configuration settings, I found the only working solutions were to disable WPA2, or use hostapd instead. The fact that I tried Network Manager earlier with no success seems to have been a red herring, because under the hood it probably just used wpa_supplicant anyway.


So the theory I have is:

wpa_supplicant, by default, advertises WPA and WPA2 but does not provide a WPA2 Authenticator. Old clients just use WPA and never notice. Newer clients (including Mojave on a 2020 iMac) try WPA2, which does not complete so they drop the connection and mystery abounds.


There does not appear to be a fix on the client side. Catalina does allow you to set up a WiFi connection and specify the authentication used, but the only option that includes WPA also includes WPA2, which seems to be used preferentially with no fallback.


The fix has to be on the access point side: the immensely prevalent wpa_supplicant must be configured with "proto=wpa" to disable WPA2, or wpa_supplicant must be replaced with something that provides an WPA2 Authenticator like hostapd.


I still do not understand why during the 6 seconds before disassociation, the WiFi connection appears to be completely useable.


Phew.

Diagnosing an intermittent WiFi connection with particular characteristics

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.