[SOLVED] ping reply unknown host but dig and host return correct IP
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ping reply unknown host but dig and host return correct IP
I am using CentOS 6.3 Kernet 2.6.32-279.el6.i686.
- selinux is disabled
- My computer has 1 LAN interface and is configured to use statis IP "192.168.10.1".
- The hostname of the computer is configured to "pc01.test.office.org".
- The firewall is disabled (i.e. not start iptables)
- IPv6 is disabled by
1. adding "ipv6.disable=1" as kernel parameter in grub.conf
2. adding file containing a line "install ipv6 /bin/true" in /etc/modprobe.d
3. adding "IPV6INIT=no" and "IPV6_AUTOCONF=no" in /etc/sysconfig/network-scripts/ifcfg-eth0
4. adding "net.ipv6.conf.all.disable_ipv6=1" in /etc/sysctl.conf
I install bind-9.8.2 and configure it as follow:
/etc/named.conf:
options {
listen-on port 53 { 127.0.0.1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db"
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { 192.168.10.0/24; localhost; };
recursion yes;
};
logging {
channel default_debug {
file "data/named.run";
severity info;
print-severity yes;
print-time yes;
print-category yes;
};
};
zone "test.office.org" IN {
type master;
file "zone/test.office.org";
};
zone "10.168.192.IN-ADDR.ARPA" IN {
type master;
file "zone/192.168.10";
};
zone "." IN {
type hint;
file "named.ca";
};
incluce "/etc/named.rfc1912.zones";
incluce "/etc/named.root.key";
Then, inside /var/named/zone, I created 2 files:
File 1: 192.168.10
$TTL 1H
$ORIGIN 192.168.10.IN-ADDR.ARPA.
@ IN SOA pc01.test.office.org. root.test.office.org. (2012102902 3H 1H 1W 1H) IN NS pc01.test.office.org.
1 PTR pc01.test.office.org.
File 2: test.office.org
$TTL 1H
$ORIGIN test.office.org.
@ IN SOA pc01.test.office.org. root.test.office.org. (2012102902 3H 1H 1W 1H) IN NS pc01.test.office.org.
pc01 IN A 192.168.10.1
samba IN CNAME pc01
dhcp IN CNAME pc01
mail IN CNAME pc01
www IN CNAME pc01
ldap IN CNAME pc01
dns IN CNAME pc01
After configuration and setup, I run "ping pc01.test.office.org". It reply "ping: unknown host pc01.test.office.org".
If I run "host pc01.test.office.org", it reply "pc01.test.office.org has address 192.168.10.1"
Anyone tell me why "ping" cannot resolve it? Is the configuration incorrect?
#Generated by NetworkManager
search test.office.org
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts liek so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lib.foo.com bar.foo.com
And, the output of running named-checkzone is OK, no error. The output of "strace -etrace=file ping pc01.test.office.org" and "strace -etrace=file host pc01.test.office.org" did not show any errors.
#Generated by NetworkManager
search test.office.org
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts liek so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lib.foo.com bar.foo.com
There are no nameservers defined in /etc/resolv.conf. So as NM suggests, i.e. edit /etc/sysconfig/network-scripts/ifcfg-eth0 (replace eth0 with your actual nic) and add
Code:
DNS1=x.x.x.x
where x.x.x.x is the IP of your nameserver.
Now that I look again your configuration, the SOA is wrong in both zones. It should be
Code:
@ IN SOA pc01.test.office.org. root.test.office.org. (2012102902 3H 1H 1W 1H)
@ IN NS pc01.test.office.org.
There are no nameservers defined in /etc/resolv.conf. So as NM suggests, i.e. edit /etc/sysconfig/network-scripts/ifcfg-eth0 (replace eth0 with your actual nic) and add
Code:
DNS1=x.x.x.x
where x.x.x.x is the IP of your nameserver.
Now that I look again your configuration, the SOA is wrong in both zones. It should be
Code:
@ IN SOA pc01.test.office.org. root.test.office.org. (2012102902 3H 1H 1W 1H)
@ IN NS pc01.test.office.org.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.