62

As a long time user of Ubuntu (10y+) I have noticed the relationship between Ubuntu and public Wifi hotspots (without wifi security) that require login through a web page have not always been easy...

At times, I was able to be automatically redirected to a web page for logging in, but I have been experiencing the same problem for a while: after connecting to the open wifi network, the browser does not redirect to the login page! I have just updated to 16.04 and I was disappointed to see it did not fix the problem.

I tried deleting the connection from Network Manager but this doesn't change anything. The behaviour is the same with any browser (Chromium, Firefox, Opera, etc). I have dual-boot on this machine and no problem connecting to those network in Windows...I don't really know what else to try...

Is anyone else experiencing this issue? Any help to troubleshoot (or solve) the problem is highly appreciated. Please let me know if you need command outputs for diagnostics.

Update: Today, I did manage to connect to one of these wifi networks, but received a warning first :

enter image description here

However, I tried to connect to a Starbucks network afterwards and still have the same problem. Thaller below pointed to a possible problem in the NetworkManager.conf file: could anyone maybe post a normal file so I can see what's wrong with mine?

6
  • Sounds like a browser problem and not an Ubuntu problem. Have you tried other browsers, say Chrome(ium) for example? Sep 19, 2016 at 15:38
  • Just edited my post:the issue is present with any browser
    – R Pennese
    Sep 19, 2016 at 15:55
  • Does it work with those browsers in Windows? Or it just opens in IE?
    – user589808
    Sep 19, 2016 at 17:15
  • @CelticWarrior, yes the Windows versions of those browsers allow to be redirected and log in.
    – R Pennese
    Sep 20, 2016 at 7:36
  • Check the answer below. Also some captive portals use things like ActiveX which is Microsoft proprietary for Windows. If that's the case the login page may not load properly or not at all.
    – user589808
    Sep 20, 2016 at 16:03

12 Answers 12

46

Here is what I have found works for forcing the captive portal (i.e., login page for WIFI connections on public hotspots):

  1. Make the connection to the WIFI.

  2. Open a terminal and type route -n. You should receive a display such as:

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    
    default         10.1.0.1        0.0.0.0         UG    600    0        0 wlo1    
    10.1.0.0        *               255.255.248.0   U     600    0        0 wlo1    
    link-local      *               255.255.0.0     U     1000   0        0 wlo1```
    
    
  3. Type the default Gateway (i.e., 10.1.0.1) into your browser's address bar, you will receive the WIFI login page.

6
  • This is useful info. Ubuntu tried to connect to nmcheck.gnome.org for me for some reason.
    – qwr
    Jun 1, 2018 at 21:01
  • 5
    What about a solution using only core utilities? I don't have route, and of course can't install it because I don't have internet on that device. Aug 15, 2018 at 18:17
  • 5
    One small suggestion... I had to pass the -n option with my route command (i.e. route -n) to get the necessary ip. Without it, the Default Gateway was shown as a domain name that couldn't be resolved. The -n option forces route to display the results as numeric ip addresses. Oct 20, 2018 at 14:01
  • 6
    @grisaitis - core utilities has ip, which has option route. Usage: ip route May 29, 2019 at 15:57
  • 1
    None of the IP addresses that showed up were reachable. This did not work for me. (Ubuntu 20.04 LTS)
    – Kvothe
    Nov 14, 2021 at 22:25
15

Enter http://nmcheck.gnome.org in your browser. (I added the "hotspot login" of Ubuntu 18 to my favorites and it showed that address, every time I clicked on it.) It worked for me.

3
  • 2
    This is an underrated answer. Works perfectly for me and is extremely simple - I just added it to my bookmarks toolbar, so now resolving this is just a click away. Nov 15, 2019 at 3:22
  • I was able to get to this while experiencing issues, but it didn't help my connectivity for https pages or prompt the login portal.
    – eebbesen
    Feb 11, 2020 at 15:53
  • 2
    Similar to this answer, icanhazip.com worked great Aug 3, 2020 at 20:10
11

I have the same problem and I am going to add the following to my /etc/NetworkManager/NetworkManager.conf file:

[connectivity]
uri=http://nmcheck.gnome.org/check_network_status.txt

(source)

5
  • 3
    Is this an answer to the question? Mar 2, 2017 at 13:25
  • This did it for me! – Tested at Starbucks, with Ubuntu-Gnome 16.04
    – kostrykin
    Mar 27, 2018 at 17:25
  • Did not work for me (on Antergos-Gnome). Jun 19, 2018 at 17:29
  • 1
    Remember to restart the network manager with service network-manager restart after.
    – parsley72
    Jan 6, 2020 at 19:57
  • I am running Kubuntu 22.04. Adding this, and running sudo systemctl restart NetworkManager.service succeeded in getting me a log in popup when connecting to these public wifi services. However, my DNS is not working, so when I click "Log in", nothing happens. My resolv.conf contains entries 8.8.8.8 and 1.1.1.1. Jan 27, 2023 at 7:46
9

For me,

sudo dpkg-reconfigure resolvconf

completely solved the problem. I hope it will help you.

3
  • 12
    Could you please edit and expand your answer a bit, e.g. by describing what the command does ans why this might solve the problem in the question? Thanks and welcome to Ask Ubuntu.
    – Byte Commander
    Jan 6, 2017 at 15:25
  • 2
    This worked for me too. Resolv.conf seems to be a configuration which tells your browser/network connect where to look first for domain name resolvers (DNS). These captive portals redirect your requests for "somesite.com" to -> [captive login page].
    – emf
    Mar 10, 2017 at 19:06
  • Worked like a charm!!! Feb 21, 2022 at 6:29
4

Guruprasad L's blog post's answer for me.

  1. Create file /etc/NetworkManager/conf.d/20-connectivity-debian.conf (you'll need root or sudo).
  2. Add the following lines as recommended by Guruprasad:

    [connectivity]
    uri=http://network-test.debian.org/nm
    response=NetworkManager is online
    interval=300
    
  3. Restart the network manager with service network-manager restart (will need sudo or root again).

3

NetworkManager is a bit involved in this. When you configure connectivity-checking (see man NetworkManager.conf), then it will try periodically to download a website to see whether it has internet access. This is also used to detect a captive portal. Based on this, NetworkManager has a Connectivity state, which might be one of Local, Portal, Full.

Appart from that, NetworkManager does nothing. When using gnome3, gnome-shell looks at that connectivity state and might open a portal-login page, that is a browser with some website. Maybe there are other components that perform a similar task like NetworManager's connectivity check or gnome-shell's portal-login.

In the end, you can also do without these two. When you are behind a captive portal you can open a browse to a HTTP site (not HTTPS), the portal will redirect you to a login page.

Maybe you are not redirected because you are trying to open a HTTPS site. The portal usually blocks that entirely, because attempting to redirect it would anyway result in a certificate warning.

2
  • Thanks, thaller. I realized my NetworkManager.conf is only 5 lines long and I suspect this is not normal...I've probably been dragging it through all these release upgrades and the file remained the same. Is there a way to re-generate this file to the default version?
    – R Pennese
    Sep 20, 2016 at 16:06
  • There is no certificate warning: the browser doesn't react on its own and if type something in the address bar, it keeps thinking forever...
    – R Pennese
    Sep 20, 2016 at 16:09
2

Running route -n should have a first entry that looks something like:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.31.0.1      0.0.0.0         UG    20600  0        0 wlan0

If you can ping the gateway (e.g. ping 172.31.0.1) and if you know the URL for the captive portal (from connecting on your phone or another computer), you should be able to link these two to get to a login screen. Edit your hosts file sudo vi /etc/hosts and add an entry like:

172.31.0.1 gialto.wifi/hotspot/novotelmedellinguest

(Replace gialto.wifi/hotspot/novotelmedellinguest with the full address of the wifi login)

Then uncheck "enable networking" in the wifi settings in the upper right of your desktop and recheck it. Finally enter the full address in your browser (make sure to start with http:// if your browser is attempting to do a search instead of a lookup).

0

For future answers searchers, I had the exact same problem suddenly in Chromium for Ubuntu 16.04, but trying to navigate to a site in Firefox showed me the login page for the network.

0

This will likely be of no help to anyone, but I got xfinitywifi working on my Windows partition, then fiddled around with the MAC address until it suddenly started working. I can't replicate it currently.

0

I had the same problem. The login page of the networks just never showed up and the login screen window was broken. The cause was a dangling wireguard connection. After disabling that connection, all was fine.

0

I was getting a domain name resolution error when my browser tried to open the login page. If you have another internet source available, like a phone, you can look up the ip address using a service like https://www.nslookup.io/

I then replaced the domain name in my web browser url with the ip address and everything worked.

0

This solution worked for me on an Ubuntu computer with a camera and required a phone (Android) that had been connected and logged into the Wi-Fi network.

On the Ubuntu computer establish a Bluetooth network connection to the phone —i.e., tether it. Install the wifi-qr package on the Ubuntu computer. Untether it. On the phone, bring the QR code to share the network password up on the screen. On the computer, in a terminal, run wifi-qr s and scan the QR code using the computer's camera. Repeat if necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .