Ubuntu – Wifi keeps dropping out – Ubuntu 20.04 and Broadcom wireless adaptor

broadcomdriversnetworkingwireless

I just recently installed Ubuntu 20.04 (clean install, dual boot from windows) and the wifi keeps dropping out. It was previously stable under windows and from other computers in the house so I don't believe it's an issue with the router or the actual internet connection.

I tried reinstalling the broadcom drivers according to Installing Broadcom Wireless Drivers which recommended the bcmwl-kernel-source drivers but that hasn't helped resolve the issue.

I'm still quite new to the linux game so if someone would be able to have a look at the wireless diagnostic scripted linked: https://paste.ubuntu.com/p/R4PMFVTvDT/

Thank you so much for you help!

Best Answer

I was in a similar situation since two weeks and I found a solution yesterday (11th May) which is working so far (dual boot Ubuntu 20.04 / Windows, wireless card Broadcom 4325).

Surprisingly, my issue was not due to wireless driver or power management (tried many things in previous days, no improvement) but related to the ARP entry of my computer expiring on my local router (ARP stands for Address Resolution Protocol, it makes translation beetween IP addresses and MAC addresses).

To make it short (investigation details at the end of this answer) :

  • The ARP entries of my router have a timeout of 20 minutes,
  • For my computer it was decreasing up to expiration (which made me lose connection every 20 minutes),
  • And the same for other devices but for them it was automatically refreshed before expiring. I made network captures to find out what these devices were doing differently and found that their timeout is refreshed when they send an ARP request.

=> A solution appeared, I had to tell my computer to do the same ! (send ARP request)

Implementation of the solution

To send an ARP request, I used arping that you can install from its package :

sudo apt install arping

When you launch it, it says that it must run as root or with the cap_net_raw capability. Since I didn't wanted to launch it as root, I added the capability :

sudo setcap "cap_net_raw+ep" /usr/sbin/arping

I used the following command to send one ARP Request to my router (replace the IP address with the one relevant for you) :

arping -c 1 192.168.1.1

Then I wanted this command to run every 15 minutes to refresh the ARP entry regularly. This is done by editing the file /etc/crontab :

sudo vi /etc/crontab

And adding this line at then end of the file :

*/15 * * * * <username> arping -c 1 192.168.1.1

That will make the ARP request sent every 15 minutes.

Detailed investigation process

Here are more details on how I discovered the issue :

  • Developped a widget telling me with timestamps when the connection is lost, and when it comes back.
  • Running a tcpdump capture until a disconnection/reconnection happens (purpose of the widget).
  • In the capture, found ARP messages around the issue time.
  • Looked into the ARP table of my pfSense router and saw that the timeout entry for my PC was always decreasing until expiration ; for other devices connected it decreased also but at some point it was resetting to default value (1200s in my case) before expiration.
  • Waited until expiration to confirm I observe the disconnection symptom on my computer (yes).
  • Made tcpdump captures on the router to see how others devices were successfully resetting their timeout : by sending ARP requests before it expires.
  • Installed arping as explained above and sent a test ARP request to the router : it resetted my expiration timeout to 1200s, victory ! \o/

Finally, I don't know why I never faced this issue when using Windows. When checking the ARP table I see the entry becoms expired as well but then immediately get resetted to 20 minutes and I cannot see a network disconnection.

You may also wonder how to check the ARP table. If you are using a pfSense router, it can be found in the submenu "Diagnostics > Table ARP" (to be translated in English, my menus are in French). With another device, you will have to check its documentation.

But at the end, event if you can't check the ARP table you can still try to insert the line in /etc/crontab and run it for a couple of hours/days. If your problem doesn't reappear then it was the issue :-)

Hope this helps !

Related Question