Get Ubuntu To Connect To Starbucks WiFi (Captive Portal)

Jean-Nicolas Boulay
3 min readAug 31, 2019

To start you need another device to get the Starbucks Captive Portal DNS IPs.

For example with my iPhone I go to Settings > “i” in the circle on the right of “Starbucks WiFi” > Configure DNS

Step by step… with little images :~)

Go to Settings

Make sure your WiFi is connected to “Starbucks WiFi”

Click on the blue circle with the “i” in it

Scroll down you should see the DNS option

Then you should be able to see the two DNS IPs

Now that you have the two DNS IPs, you will now go to the network settings on your Linux (Ubuntu) system. They are many ways to access the network settings. You can easily find those ways online.

Since I use i3wm I will show you how I access it.

  1. In the terminal, I use this command: nm-connection-editor (it might not exist on your Linux distro)
  2. It will show a GUI with your Network Connections
  3. You should see the “Starbucks WiFi”; double click on it
  4. Then go to the tab: IPv4 Settings
  5. You should see an input for “DNS servers”
  6. In that input, add the two DNS IPs (separate the IPs by using a comma “,”)
  7. Make sure to save
  8. Now you want to clear the DNS cache and restart your network service

Since the way to clear DNS cache might vary between Linux distros, you might need to search online on how to do it on your system.

Here are some of the commands I use:

  1. sudo /etc/init.d/networking restart
  2. sudo /etc/init.d/dns-clean restart
  3. sudo /etc/init.d/networking force-reload
  4. sudo /etc/init.d/nscd restart
  5. sudo /etc/init.d/dnsmasq restart

You can always restart your network service on your system:

  1. sudo service network-manager restart
  2. sudo /etc/init.d/neworking restart

If it still fails.

Try mapping the IP of Starbucks to the domain that Starbucks uses for their Captive Portal. Where I am located the domain is:

To get the IP to map to use this command (make sure you are connected to the “Starbucks WiFi”, first ;) ): ip route

The first line of the result of the command “ip route” should give you an IP that is used by the WiFi router.

Then in your /etc/hosts file add this line:

Again, those values might be different for you.

Hopefully this helps!

In the future I might write up a shell script to automate this… Maybe even an Docker container that will handler all of this :-0.

WARNING! By using StarBucks DNS they will be able to track your internet activity. You might want to look into getting a VPN. ;)