Linux is not Resolving DNS

Another quick tip takes us to a Linux (Ubuntu) based system that is not resolving hostnames even with DNS properly plugged in.  You may even be able to successfully perform a NSLOOKUP against your domain controller.  As usual, the right file update corrects the issue.

The screenshots of this example are from a Raspberry Pi device running RaspBMC. Being based on Debian systems, this process also works on Ubuntu as well.

First, we can verify that we are not able to resolve addresses in the system. The example Debian system is actually pulling its address from DHCP.  This first image is verifying the proper DNS settings.

Proper IP and DNS Provided by DHCP

Proper IP and DNS Provided by DHCP

However, we cannot ping by DNS.

DNS Ping Failure

DNS Ping Failure

To fix this, we will want to edit the /etc/nsswitch.conf file. If you take a look at the file, by default the result of “Not Found” is returned prior to DNS actually being queried.

Default nsswitch.conf File

Default nsswitch.conf File

Editing the file as listed below will instantly correct the resolution issue. No service or system restarts required.

Updated nsswitch.conf File

Updated nsswitch.conf File

And now we are able to properly ping via DNS.

Proper Ping and Verification of nsswitch.conf

Proper Ping and Verification of nsswitch.conf

Leave a Reply

Your email address will not be published. Required fields are marked *