Posted in Quick Tips

No DNS with Ubuntu and Android Hotspot Solution

No DNS with Ubuntu and Android Hotspot Solution Posted on December 29, 20232 Comments
Freedom Penguin’s founder & talking head – Matt has over a decade working with Linux desktops, his operating system experience consists of both Windows and Linux operating platforms. In addition to writing articles on Linux and open source technology for Datamation.com and OpenLogic.com/wazi, Matt also once served as a co-host for a popular Linux-centric podcast. Matt has written about various software titles, such as Moodle, Joomla, WordPress, openCRX, Alfresco, Liferay and more. He also has additional Linux experience working with Debian based distributions, openSUSE, CentOS, and Arch Linux.
(Last Updated On: December 30, 2023)

So on occasion, I rely on my wife’s Macbook Pro as I lack a laptop. Before you judge, understand that it’s dual-booting OS X and Ubuntu MATE 16.04. For obvious reasons, I use the latter.

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 /etc/resolv.conf.

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 8.8.8.8 (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.

More great Linux goodness!

Matt Hartley
Matt Hartley
Freedom Penguin’s founder & talking head – Matt has over a decade working with Linux desktops, his operating system experience consists of both Windows and Linux operating platforms. In addition to writing articles on Linux and open source technology for Datamation.com and OpenLogic.com/wazi, Matt also once served as a co-host for a popular Linux-centric podcast.

Matt has written about various software titles, such as Moodle, Joomla, WordPress, openCRX, Alfresco, Liferay and more. He also has additional Linux experience working with Debian based distributions, openSUSE, CentOS, and Arch Linux.

2
Leave a Reply

Please Login to comment
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Matt HartleyGabe Russell Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Gabe Russell
Member
Gabe Russell

I’m a super newb. Your article gave me an idea- can I use “Boot Camp” on my Macbook Pro to setup a dual boot for Mate? I never thought about setting up dual boot on that machine until this article. I suppose I can use Google and start researching this idea a bit more…

SuperMin
Admin
SuperMin