Linux (CentOS) – Fixing DNS (Name) Resolution Issues

Introduction

Trying to install Hadoop\Hive and running into a bit of error.

Error Message

The command issued is:



yum info hive

But, got a bunch of error messages; that includes:


http://mirror.umd.edu/centos/6.4/extras/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.umd.edu'"
Trying other mirror.
http://mirrors.usc.edu/pub/linux/distributions/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.usc.edu'"
Trying other mirror.
http://centos-distro.cavecreek.net/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'centos-distro.cavecreek.net'"
Trying other mirror.
http://mirror.spro.net/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.spro.net'"
Trying other mirror.
http://holmes.umflint.edu/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'holmes.umflint.edu'"
Trying other mirror.
http://centos.mirrors.tds.net/pub/linux/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'centos.mirrors.tds.net'"
Trying other mirror.
http://dist1.800hosting.com/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'dist1.800hosting.com'"
Trying other mirror.
http://mirror.clarkson.edu/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.clarkson.edu'"
Trying other mirror.
http://mirror.nexcess.net/CentOS/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirror.nexcess.net'"
Trying other mirror.
http://mirrors.greenmountainaccess.net/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.greenmountainaccess.net'"
Trying other mirror.
http://ftp.osuosl.org/pub/centos/6.4/updates/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'ftp.osuosl.org'"
Trying other mirror.

Error Identification

Based on having being playing around with my DNS Server lately, I know that the problem is me “jerryrigging” my network configuration; specifically DNS Server specification.

 

Error Diagnostic

 In Linux, DNS Client configuration details are viewable by browsing the the contents of /etc/resolv.conf

Read /etc/resolv.conf:


cat /etc/resolv.conf

Output:

Networking -- etc--resolve#conf
So the system is really helping us out here, it says that “No nameservers found” and to look for the ifcfg* files in the /etc/sysconfig/network-scripts folder.

Understand Problem

Let us see if we can understand the problem a bit more

What files are in the /etc/sysconfig/network-scripts Folder

List files:


ls -la /etc/sysconfig/network-scripts

 

Output:

Networking -- etc -- sysconfig -- network-scripts

Explanation:

  • The file listing is revealing –> ifcfg-eth0 is the configuration file for the NIC Card 1

Read out the contents of ifcfg-eth0

Show File Contents:


cat /etc/sysconfig/network-scripts/ifcfg-eth0

Output:

Networking --ifcfg-eth0

Explanation:

  • DEVICE=eth0 => eth0 is the first NIC Card
  • BOOTPROTO=dhcp => we are using DHCP
  • NM_CONTROLLED=yes => Network Manager can configure the NIC Card
  • IPV4_FAILURE_FATAL=yes => If IPV4 is not working, we consider it a fatal error and we like to be notified; this makes sense as our Network still relies on IPV4 and in fact IPV6 is disabled
  • IPV6INIT=no =>IPV6 should not be used
  • ;DNS1=xxxxx => The primary DNS Server is remarked out
  • PEERDNS=no => Don’t care

Understand Problem (even more)

So googled like crazy, because I do not know why my system is not receiving DNS Server information.

As I understand it:

  • In /etc/resolv.conf, we have no entries for DNS Server
  • In /etc/sysconfig/network-scripts/ifcfg-eth0, we have commented out the DNS1 value

Finally, was able to trace back to an entry I had in /etc/sysconfig/network-scripts/ifcfg-eth0, specifically PEERDNS=no

While trying to force the usage of DNS Servers information that I placed in /etc/resolv.conf, I had set PEERDNS=no.

From Googling, found out that when PEERDNS is set to no, DNS information are not passed down /etc/resolv.conf

Enable PEERDNS

Set PEERDNS to yes


sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Contents:

Networking -- PEERDNS

Get New IP Address and Domain Information

Get new IP Address and Domain Information


Syntax:

    -- renew IP Address for all Interfaces configured 
    -- for Dynamic IP 
    sudo dhclient

    -- renew IP Address for specific Interface
    -- to get interface use ifconfig
    sudo dhclient <interface>

Sample:

    -- renew IP Addresses for all Network Interfaces configured
    -- for dynamic IP
    sudo dhclient 

    -- renew IP Address for specific Interface
    -- to get Interface use ifconfig
    sudo dhclient eth0

 

Confirm Domain Information

Confirm Domain Information – resolv.conf


Syntax:

    -- review /etc/resolv.conf
    cat /etc/resolv.conf

Sample:
    -- review /etc/resolv.conf
    cat /etc/resolv.conf

Output:

Network -- etc -- resolv#conf

References

Network

5 thoughts on “Linux (CentOS) – Fixing DNS (Name) Resolution Issues

  1. Admiring the time and effort you put into your site and
    in depth information you offer. It’s nice to come across a blog every once in a while that isn’t the same unwanted rehashed information.
    Wonderful read! I’ve saved your site and I’m including your RSS feeds to my Google account.

    • Thanks for your kind words.

      As we are all here to live together, we can an all learn and encourage each other.

      I am finding that if I can enjoy it, I can learn it.

      Once again, thanks.

  2. I’ve been trying to solve this issue for a while now… so simple but worked great.
    Thanks for taking the time to create a nice blog.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s