Service "nameserver" appears to be down

Every now and then I get these notifications from cPanel that my nameserver has failed.  this is stressing me out.  How can i fix these issues?

Using GoDaddy VPS with WHM

** This is my first VPS... I'm comfy with apache, command line but am a freshman.  Eager to learn!

screen shot of the email i get
Delton ChildsOwnerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel McAllisterPresident, IT4SOHO, LLCCommented:
So the term "nameserver" in this case is referring to a DNS service.... and from the info you provided, it appears your Linux server is having issues with BIND (one of the original DNS server packages).

So before I go further, since you're a "freshman" let me relate that there are TWO distinct parts of being a DNS server (yes, there are technically others -- but for this discussion, we're just looking at the 2 main kinds of DNS services):

 FIRST: There is the kind of server (called an authoritative server) that will resolve a set of specific names to their IP addresses. When you register a new domain name, you have to specify where your authoritative name servers will be, and by default, that is usually with your registrar. Their authoritative nameservers are usually sufficient, unless you have some need or desire to host your own. (For example, many companies have their own to handle their own private "internal" domains -- like Active Directory domains). When an Authoritative Server receives a request for a domain that it is not authoritative for itself, it usually returns an error message (usually because there are advanced settings that can alter this). The settings for which Authoritative DNS servers are used for your domain are in DNS itself -- part of your registration.

  SECOND: There is the kind of server (called a "resolving" or "recursing" server) that accepts a request from a user, and then uses the Global DNS to resolve that name into its IP address (that is, it LOCATES the authoritative server for the client's given domain name, and gives the client the result from that authoritative server). These nameservers are usually provided by your ISP (that is, the company that is giving the client system an IP address on the Internet). Again, you can host your own, but there is not always a good reason to do so. The settings for your recursing name server are in your own system (in many cases, they are set via DHCP).

I'm going to write the rest of this based on the assumption that your BIND is a resolving (or in BIND's vernacular: caching-only) nameserver.

So FIRST, before exploring how to "fix" this, let me re-state that you don't HAVE to run a DNS service (of either kind) yourself (on your web server) at all -- you can use your registrar's authoritative service, and your hosting provider's recursor.

The issue for you then seems to be that your BIND (named) service seems to be stopping... but depending upon your configuration, that may not actually be true. (The named service often runs in a chroot environment, in which case it can appear "dead" even though it is not).

So that seems to leave you with 3 options:
 1) You are running BIND (named) and you don't need to (or want to at this point) so you just want to get it out and use a GoDaddy (VPS provider) recursor, or
 2) You are running BIND (named) and you THINK it's failing but you don't know for sure, and you want to see if it is actually failing, and either way, make the messages stop, or
 3) You are running BIND (named) and you already know you want to replace it with something else (there are lots of other alternatives -- my preference is for PowerDNS).

Write back and let me know which option you want to explore... it's too much to put into a single response

Dan
IT4SOHO
Delton ChildsOwnerAuthor Commented:
I would like my configuration to be as simple as possible.  This server is only used for web hosting & just standard CMS as well, like wordpress & opencart.  

I did find this GoDaddy VPS help doc:  Update BIND on your linux server

I need to explore option two!  I think it's failing but I don't know for sure.  All my sites seem to up but I know the system restarts.  It's intermittent as well.  I haven't received a notification in a week now.  Please let me know what you think is best!

note: it was not my intention to "neglect this thread"!  :S
Daniel McAllisterPresident, IT4SOHO, LLCCommented:
OK, so long as you have shell access to your VPS, here are some simple steps to verify what's going on. NOTE: My assumption here is that you're running a RHEL type of Linux.

First, lets look at your overall network configuration:
ifconfig -a  tells you everything you might want to know about the configuration of your specific physical and logical network cards. You can pipe it thru more (that is: ifconfig -a | more), or you can specify a device name to pare down the results (ifconfig -a eth0).

What you'll get (that you care about) is your IP address, netmask, and whether the card is up, transmitting, and receiving data.

Changing these values also uses the ifconfig command, but I'll leave you to research that on your own.

Next, lets look at your connection to other networks (aka: routing):
route is the linux command to print the routing tables, and since you think you're having DNS issues, you'll want to tell route NOT to try to resolve things with DNS! (route -n).

What we care about here is that your interface cards are shown (all of them that are "up") and that the "default route" points to the appropriate place.

Lets say your output looks like:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0            0.0.0.0         255.255.255.0   U     0      0        0     eth0
1.0.0.0              0.0.0.0         255.255.255.0   U     0      0        0     eth1
0.0.0.0              1.0.0.1         0.0.0.0               UG    0      0        0     eth1
This would imply that interface eth0 is your LAN interface, and has an IP address in the 10.0.0.x range; that eth1 is your WAN interface, and has an IP address in the 1.0.0.x range (yes, these are made up); and that your default GW is located at 1.0.0.1 -- which is on your WAN interface, eth1.

Now before we go any further, let's test your Internet connection with ping
In more than 90% of cases, you will start with the assumption that your Internet is up, so you'll just ping something out there. Google will hate me, but one of their DNS servers that always answers a PING has about the easiest real-world IP address to remember: 8.8.8.8. So, run: ping -c 4 8.8.8.8

NOTE: If you don't use the -c option, the Linux ping will continue forever (or until you kill it).

If you get 4 replies, you're good to go. If not, you will want to ping your gateway (the default gateway we saw on the 0.0.0.0 line of the route command above). In my example world here: ping -c 4 1.0.0.1

If that works (that is, you get replies), your GW isn't acting as a GW (check your IP address from your ISP), or there is an ISP issue. However, if that doesn't work, you at least know you're having trouble getting to the GW, so that is why you cannot get to the Internet. Since we're directly connected to the WAN (in my example), we're stuck looking at the networking into your ISP's equipment (cable modem, etc).

Changing your routing tables also uses the route command, but I'll leave you to research that on your own.

To continue, lets assume you ARE connected to the Internet....

The 3rd thing we'll test (and potentially configure) is DNS. (I know this was the primary question, but since you're a newbie, I thought it best to be thorough).

First, whether or not you're using BIND to be your own DNS server, you will what to make sure you have the bind-utils package installed:
 # yum install -y bind-utils

The command we're going to use here is host, and we'll start by querying a site we all know, google.com:
 # host google.com

If the command is successful, you'll get several lines of output telling you where the Google servers are on the Net. If not, there will be a pause while your system attempts to resolve the google.com name, and then an error message.

OK, so assuming you are NOT using NetworkManager, your DNS resolution settings are located in the file /etc/resolv.conf.

There could be several types of entries, but the ones we care most about (especially when trying to resolve google.com) are the ones that say nameserver.

My caveat about NetworkManager is because that service will re-write the /etc/resolv.conf (annoyingly), so you have to make changes elsewhere, or disable NetworkManager. (IMHO: NetworkManager is not for servers. period.)

So, if you need to make an entry in /etc/resolv.conf, it might look like this:
 nameserver 127.0.0.1

That would be saying that you are your own DNS service.

But it might also look like this:
 nameserver 8.8.8.8

Which, as you may recall, is a Google DNS server (public).

In MOST cases, you will see MULTIPLE nameserver lines.

So this takes us back to the host command. Previously, with just the google.com argument, you relied on the entries in resolv.conf to get the DNS data for google.com. But if there are multiple nameservers there, your results may vary.

So add another argument to host, specifying the nameserver to use:
  host google.com 127.0.0.7

This tests the DNS resolution of google.com at your own host (you must be running a DNS server for this to work, and since you believe that you are, this should return a result - quickly).

Now if you wanted to STOP hosting your own DNS server, you could simply remove your own host (either 127.0.0.1 or your server's other IP address) out of the resolv.conf file. So long as there are other nameserver entries, your system would start to use only those external services as soon as you save the file.

NOTE: Your ISP may have their own DNS servers they may want you to use, otherwise, you can use Google's or there are many other public DNS servers out there.

To test the google DNS server I showed, you would use:
  host google.com 8.8.8.8

If that fails, you may need to go back to Step 1 above and check your networking configs, or check your firewall settings.

On a final note:
The server monitoring is checking the status of your named daemon, probably with something similar to the command: service named status

As I have mentioned previously, most BIND (named daemon) installations put the service into a chroot "jail" for security reasons. That often makes the "service" script unable to see or communicate with the named daemon that is running (because it's in "jail"), and so it will sometimes incorrectly report that the service is NOT running, even when it is. If the host command works using your own IP address, then your DNS service is running.


I hope this gives you a heads-up on your VPS server's networking configs, and especially where and how your DNS is being setup and used.

To quickly recap:
 - to quickly see and change your IP address, use ifconfig
 - to quickly see and change your GW address, use route
 - to quickly see and change your DNS setings, see the file at /etc/resolv.conf
 - to TEST these settings, use the commands ping and host

Good Luck!

Dan
IT4SOHO

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.