I recently moved into some co-working space and I immediately had issues with the internet connection. My connection would be intermittent and would frequently drop; sometimes I had hours of uninterrupted connectivity, at other times it wouldn't last more than a few seconds without dropping completely. I had no issues with any other wifi network at home, in offices or in public.
(If you want to just see the solution that worked for me, skip down to TL;DR)
Additionally, nobody else on the network had issue but most were using macOS or Windows, whereas I was using Ubuntu Linux. After a short period looking into the router settings, we concluded that where ever the fault lay, I wouldn't be able to make any changes to the router settings, with myself being the only user having trouble. The problem clearly either was with my wireless hardware (Intel Dual Band Wireless AC 3160) or the drivers/firmware interfacing with it, iwlwifi.
ping would always give me one of two results, no connection whatsoever:
$ ping google.co.uk ping: google.co.uk: Temporary failure in name resolution
Or unusually high packet loss:
$ ping google.co.uk
PING google.co.uk (188.8.131.52) 56(84) bytes of data. 64 bytes from lhr35s11-in-f3.1e100.net (184.108.40.206): icmp_seq=1 ttl=50 time=8.41 ms 64 bytes from lhr35s11-in-f3.1e100.net (220.127.116.11): icmp_seq=2 ttl=50 time=9.19 ms 64 bytes from lhr35s11-in-f3.1e100.net (18.104.22.168): icmp_seq=3 ttl=50 time=8.96 ms 64 bytes from lhr35s11-in-f3.1e100.net (22.214.171.124): icmp_seq=4 ttl=50 time=13.8 ms 64 bytes from lhr35s11-in-f3.1e100.net (126.96.36.199): icmp_seq=5 ttl=50 time=51.6 ms 64 bytes from lhr35s11-in-f3.1e100.net (188.8.131.52): icmp_seq=6 ttl=50 time=9.28 ms 64 bytes from lhr35s11-in-f3.1e100.net (184.108.40.206): icmp_seq=7 ttl=50 time=9.15 ms 64 bytes from lhr35s11-in-f3.1e100.net (220.127.116.11): icmp_seq=8 ttl=50 time=9.23 ms 64 bytes from lhr35s11-in-f3.1e100.net (18.104.22.168): icmp_seq=9 ttl=50 time=9.20 ms 64 bytes from lhr35s11-in-f3.1e100.net (22.214.171.124): icmp_seq=10 ttl=50 time=8.76 ms ^C --- google.co.uk ping statistics --- 14 packets transmitted, 10 received, 28% packet loss, time 13088ms rtt min/avg/max/mdev = 8.418/13.772/51.616/12.700 ms
A search for the problem online threw up many suggestions of how to fix it, none of which worked for myself but had helped others:
- Updating the linux firmware to the latest version. Deb packages are available here.
- Turning off wireless power management as that can cause high pings when using the laptop battery. instructions on how to do so here.
- Disabling 802.11n mode (
11n_disable) in the iwlwifi driver options. Instructions to do that can be found here.
- Tweaking various other iwlwifi options such as power saving and bluetooth co-existence (
bt_coex_active). Additional instructions on those options can be found here.
- And setting the wireless regulatory domain to my country. Instructions here.
The solution was to be found at the Ubuntu Forums where one user spotted the following in the output from
dmesg (command to view the Linux kernel output):
[ 1259.244282] wlp1s0: authenticated [ 1259.249535] wlp1s0: associate with <MAC 'Network SSID' [AC11]> (try 1/3) [ 1259.254572] wlp1s0: RX AssocResp from <MAC 'Network SSID' [AC11]> (capab=0x11 status=0 aid=26) [ 1259.256130] wlp1s0: associated [ 1259.352184] wlp1s0: Limiting TX power to 30 (30 - 0) dBm as advertised by <MAC 'Network SSID' [AC11]> [ 1263.177589] wlp1s0: disconnect from AP <MAC 'Network SSID' [AC11]> for new auth to <MAC 'Network SSID' [AC5]> [ 1263.183550] wlp1s0: authenticate with <MAC 'Network SSID' [AC5]> [ 1263.209598] wlp1s0: send auth to <MAC 'Network SSID' [AC5]> (try 1/3) [ 1263.211391] wlp1s0: authenticated [ 1263.217552] wlp1s0: associate with <MAC 'Network SSID' [AC5]> (try 1/3) [ 1263.220416] wlp1s0: RX AssocResp from <MAC 'Network SSID' [AC5]> (capab=0x431 status=0 aid=7) [ 1263.221106] wlp1s0: associated [ 1585.929624] wlp1s0: deauthenticating from <MAC 'Network SSID' [AC5]> by local choice (Reason: 3=DEAUTH_LEAVING)
The above output shows that the driver was switching between two access points (AC5 and AC11) for the network frequently, which caused the drops in connectivity.
The Fix (Manual) - TL;DR
So with the problem identified as the laptop switching frequently between two access points and so not being able to retain a stable connection for more than a few seconds, we could address the problem.
The solution was found here, which amounts to binding the network to the strongest access point.
Right-click the Network Manager icon (in Ubuntu), select Edit Connections and edit the affected Wi-Fi network. Fill in the MAC address for your access point; which can be found with:
sudo iwlist <interface> scan
<interface> is your wireless network interface name, likely wlan0, but which can be found by running
iwconfig. The above command will output all the nearest wireless network access points, with each looking similar to the below:
wlp1s0 Scan completed :
Cell 01 - Address: 0C:F4:D5:51:23:4C
Frequency:5.52 GHz (Channel 104)
Quality=57/70 Signal level=-53 dBm
You then need to find the cell with the highest quality signal for your network and make a note of the MAC address, entering it in the BSSID option of the Wi-Fi connection settings in NetworkManager.
The Fix (Automated)
On discovering the fix above had worked, I set to work on writing a bash script that would automate the above process so that I could run it in the event that I moved closer to another access point and my connection suffered as a result.
Simply grab the script from here, save it and run the following, making it executable first:
chmod a+x set-access-point.sh
./set-access-points.sh <network-SSID> <network-interface-id>
<network-SSID> is the SSID/name of the network with mutiple access points and
<network-interface-id> is the name of the network interface (found by running
iwconfig), this defaults to wlan0 if not supplied.
The script will basically scan the list of nearby networks, find all access points for the supplied SSID and get the MAC address of the access point with the strongest quality signal. You will then be prompted whether you want to update the settings and set the BSSID for the connection in the NetworkManager settings.
My experience with bash is a little limited so drop me a line if you find a bug with the script.