No DNS with Ubuntu and Android Hotspot Solution
At home, I’m able to connect to my home wifi network without any issues at all. Pure 802.11n goodness, zero issues whatsoever. Recently, I needed to borrow the laptop for a trip away from the house. I would be relying heavily on the hotspot functionality of my Android phone. Now, my wife does this frequently on OS X, so surely this won’t be a problem for my distro of choice, right? Well, not exactly.
As it turns out, I was able to connect without any issues whatsoever. DNS, however, was not cooperating. After messing with it for a bit, I did some ping tests and determined that the problem was with the DNS settings. No biggie, I’ll just add Google or OpenDNS to the network-manager configuration. After adding it to the network-manager GUI, I rebooted and tried again. Instead of the satisfaction of a seeing webpages load, I was instead doled out an extra helping of “nope.”
Then it hit me – I needed to check my
Since using a wifi dongle loaded pages fine using my Android hotspot from my desktop PC, I suspected that the
/etc/resolv.confmight be the culprit on the Macbook Pro. After running a
cat /etc/resolv.confon both my PC and my wife’s Mac running Ubuntu MATE, I spotted the problem.
My main PC’s
/etc/resolv.confwas set to:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 search home
My wife’s Macbook however, was trying to connect to to the IP for the router instead of 127.0.1.1. Clearly, this isn’t helpful if you’re connecting to an Android hotspot instead. So I did what needed to be done.
sudo echo "nameserver 127.0.1.1" > /etc/resolv.conf
For those not familiar with networking terms, 127.0.1.1 refers to the localhost. If you want a better explanation, you’ll find one here.
Pro Tip: If 127.0.1.1 still doesn’t work for you, use 18.104.22.168 (Google DNS) instead. It’s a dirty hack, but it works.
Now some might suggest that you simply restart networking services. I would suggest going a step further and rebooting the computer exhibiting the symptoms I described above. Odds are good this will fix any DNS issues you’re experiencing.
Note: I do not have dnsmaq installed on any of the computers described in this article. If the above fix doesn’t work for you, odds are you may be using dnsmaq. Goto your package manager and do a search for it to see if you’re running with it. What you do with it, however, is up to you.