Solved

dig resolves a name but ping not. Why?

Posted on 2014-12-21
3
219 Views
Last Modified: 2014-12-21
Hi.

I installed and configured bind9 on a linux debian. From this machine I'm making a dig using one of the defined names in the zone and it works (even if I don't use the @ parameter on dig), so this command is working well:
dig myname.mydomain @127.0.0.1

Open in new window

and also this other:
dig myname.mydomain

Open in new window


However, this command doesn't seems to work:
ping myname.mydomain

Open in new window

Which responds with this error: ping: unknown host ns.grup7.gsx

Why? How can I make it work?
0
Comment
Question by:gplana
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
savone earned 500 total points
Comment Utility
Chances are you have something in your /etc/hosts file that ping is using.

dig uses DNS only to resolve names.  It is a tool designed to troubleshoot or query DNS servers.

Ping uses mechanisms listed in the /etc/nsswitch.conf file for resolution.  This by default is usually:

hosts:      files mdns4_minimal [NOTFOUND=return] dns myhostname

Open in new window


Run the following commands:

grep hosts /etc/nsswitch.conf

and

cat /etc/hosts

They should give you an idea of why the answer from ping is different from the answer from dig.

Post the output of the two commands above if you need further help.
0
 
LVL 15

Author Comment

by:gplana
Comment Utility
Yes, problem was on /etc/resolv.conf file.  Thank you for your help.
0
 
LVL 15

Author Closing Comment

by:gplana
Comment Utility
It was not exactly what you said, but you give me a good clue. Thank you!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

There have been a lot of times when we have seen the need to enter a large number of DNS entries in a forward lookup zone. The standard procedure would be to launch the DNS Manager console, create the Zone and start adding new hosts using the New…
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now