The Problem with Connecting to Public WiFi on Linux
A few days ago I went to a Starbucks in Toronto to have some coffee and get some coding done on my laptop which had a linux distribution installed — Ubuntu 16.04. In order to have internet accesses I had to agree to the terms of service that usually pop-up on a browser after connecting to the wifi. The page that opens up for users to accept an agreement and have access is called a captive portal. Many businesses that offer free public wifi use this method. Personally, I’ve had no issues with accessing internet via a captive portal at Williams cafe. At Starbucks, I just could not get neither Chrome nor Firefox to redirect me to a login page.
After spending over an hour troubleshooting the connection, I gave up and left. I was a little disappointed to find out that the source of the problem was most likely not my wireless network card, operating system or the web browsers I was using but the configuration of the technology used in the captive portal.
I made sure that all the settings for the wifi connection were on auto and that the IP, gateway, and DNS were set to dynamic. Then I proceeded to test a few suggestions found on the askubuntu.com forums. None of them worked for me. I could connect to Starbucks wifi on my android phone without any issues. I was able to use my phone’s hotspot and network connections with WPA-2 encryption but not the connection at Starbucks.
I was not the only one experiencing this kind of issue:
There does not seem to be a 100% clear-cut answer as to where the fault lies. However, it seems that the crux of the issue is with the security of the captive portals themselves and how linux responds to them essentially hijacking the browser. Though there are ways to set up a captive portal without having this issue (https://blog.michaelfmcnamara.com/2007/11/wifi-hotspot-portal).
In the end, I decided to install Windows on a separate partition and use that as a fail-safe in case I am unable to connect to a wifi that has a captive portal which is not linux friendly.