Using Free Wifi with Captive Portal despite DNS over HTTPS

I may or may not later post about configuring dnscrypt-proxy, but assuming you already are using DoH, you will probably encounter an issue with using free wireless networks at airports or similar public places.

Using DoH breaks how the captive portal at this airport works. The captive portal blocks all http traffic, including my DoH requests. So when I access a non-https site and it redirects me to a different domain, my laptop cannot resolve that domain. Using its IP directly also does not work because it captures all http traffic that is not targeted towards this domain.

Here's how to work around that limitation.

  1. Figure out the network's DNS server. Either by checking the settings on the already connected android phone, or if you don't have one, by doing

  2. dig the domain using that dns server to find its IP address.

    The result in the ANSWER SECTION should be its IP address as dictated by the airport wifi. It's possible that you are able to connect to that address directly, depending on how the WiFi is set up. Otherwise, proceed with the next step.

  3. Add it to /etc/hosts

    Reload any IP adress page (e.g. 192.0.0.1 or 1.1.1.1), login, then remove the hosts entry again once you're logged in.