LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2012, 11:41 PM   #1
kathy_lo
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Rep: Reputation: Disabled
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?
 
Old 10-30-2012, 04:46 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

What's in /etc/nsswitch.conf? Make sure you have a line like this:
Code:
hosts:  files dns
BTW the reverse zone is has a wrong ORIGIN. It should be
Code:
$ORIGIN  10.168.192.in-addr.arpa.
Regards
 
Old 11-06-2012, 03:52 AM   #3
DutchGeek
Member
 
Registered: Sep 2006
Distribution: SuSE, Slackware
Posts: 55

Rep: Reputation: 10
Have you tried this:

Code:
named-checkzone test.office.org /var/named/zone/test.office.org
or

Code:
named-checkconf -z /etc/named.conf
can you post the content of your /etc/resolv.conf file? ping uses this.
Im no expert in processes but you might try:
Code:
strace -etrace=file  ping pc01.test.office.org 
strace -etrace=file  host pc01.test.office.org
 
Old 11-15-2012, 03:14 AM   #4
kathy_lo
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Hi,

What's in /etc/nsswitch.conf? Make sure you have a line like this:
Code:
hosts:  files dns
BTW the reverse zone is has a wrong ORIGIN. It should be
Code:
$ORIGIN  10.168.192.in-addr.arpa.
Regards
Yes, in /etc/nsswitch.conf, it has a line "hosts: files dns"
And, I corrected the ORIGIN.

But, still cannot ping it
 
Old 11-15-2012, 03:21 AM   #5
kathy_lo
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by DutchGeek View Post
Have you tried this:

Code:
named-checkzone test.office.org /var/named/zone/test.office.org
or

Code:
named-checkconf -z /etc/named.conf
can you post the content of your /etc/resolv.conf file? ping uses this.
Im no expert in processes but you might try:
Code:
strace -etrace=file  ping pc01.test.office.org 
strace -etrace=file  host pc01.test.office.org
The content of /etc/resolv.conf is:

#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.
 
Old 11-15-2012, 03:55 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
The content of /etc/resolv.conf is:

#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.
 
1 members found this post helpful.
Old 11-18-2012, 07:12 PM   #7
kathy_lo
LQ Newbie
 
Registered: Oct 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
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.
Thanks. I solved the problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding ping packets from one 1st host to 2nd host via 2rd host sachee Linux - Networking 1 09-25-2011 01:51 PM
Bind9 ,host does reslove a dns name but ping says unknown host Byenary Linux - Networking 10 01-12-2011 01:33 AM
Debian 5 , after SysCp Installation and configure Ping Valure ( ping: unknown host ) brenner23 Linux - Networking 1 07-14-2010 09:01 PM
Inconsistent results using ping, dig, nslookup, whois, host steelaz Linux - Networking 3 04-05-2009 07:50 AM
Unknown Host <Linuxmachinename> / Unable to ping by host name nishi_k_79 Linux - Networking 4 11-01-2003 01:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration