Solved

dig resolves a name but ping not. Why?

Posted on 2014-12-21
3
227 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
ID: 40511572
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
ID: 40511585
Yes, problem was on /etc/resolv.conf file.  Thank you for your help.
0
 
LVL 15

Author Closing Comment

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

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s list some of the technologies that enable smooth teleworking. 
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

820 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