Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

dig resolves a name but ping not. Why?

Posted on 2014-12-21
3
Medium Priority
?
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
savone earned 1500 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

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
This program is used to assist in finding and resolving common problems with wireless connections.
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

704 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