LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 03-18-2013, 02:57 PM   #1
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 485

Rep: Reputation: 133Reputation: 133
Smile bind server is not resolving...


OS: CentOS 6.4 Basic Server
Platform: VirtualBox

I'm learning bind and in the very first step i got stuck... pls help.

I have 2 centos boxes in virtualbox, first one acting as bind server and the other as a normal/client machine. Both have static ip address and can ping each other by ip address. both machines can ping google.com (internet). firewall is disabled in both machines.

but when i use hostname, client box can ping to server, but strangely the server with the bind installed cannot ping client.

I'm following this tutorial with only exception that there is no slave bind server.

Setup DNS Server step by step in CentOS 6.3

Bind Server
Hostname:srv.mddesai.local
IP:192.168.1.74

Client Machine:
Hostname: cent64
IP: 192.168.1.5

Bind Server:
Code:
[root@srv ~]# ping srv.mddesai.local
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.042 ms
^C

[root@srv ~]# ping google.com
PING google.com (74.125.236.110) 56(84) bytes of data.
64 bytes from bom03s01-in-f14.1e100.net (74.125.236.110): icmp_seq=1 ttl=55 time=84.2 ms
64 bytes from bom03s01-in-f14.1e100.net (74.125.236.110): icmp_seq=2 ttl=55 time=83.8 ms
^C

[root@srv ~]# ping 192.168.1.5
PING 192.168.1.5 (192.168.1.5) 56(84) bytes of data.
64 bytes from 192.168.1.5: icmp_seq=1 ttl=64 time=0.303 ms
64 bytes from 192.168.1.5: icmp_seq=2 ttl=64 time=0.220 ms
^C

[root@srv ~]# ping cent64
ping: unknown host cent64

[root@srv ~]# dig cent64
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> cent64
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 9647
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;cent64.				IN	A

;; AUTHORITY SECTION:
.			7357	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2013031801 1800 900 604800 86400

;; Query time: 0 msec
;; SERVER: 192.168.1.74#53(192.168.1.74)
;; WHEN: Tue Mar 19 00:49:09 2013
;; MSG SIZE  rcvd: 99

[root@srv ~]# dig -x 192.168.1.5
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> -x 192.168.1.5
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 21154
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;5.1.168.192.in-addr.arpa.	IN	PTR

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa.	86400	IN	SOA	srv.mddesai.local. root.mddesai.local. 2011071001 3600 1800 604800 86400

;; Query time: 0 msec
;; SERVER: 192.168.1.74#53(192.168.1.74)
;; WHEN: Tue Mar 19 00:49:25 2013
;; MSG SIZE  rcvd: 100


Client Machine:
Code:
[root@cent64 ~]# ping srv.mddesai.local
PING srv.mddesai.local (192.168.1.74) 56(84) bytes of data.
64 bytes from srv.mddesai.local (192.168.1.74): icmp_seq=1 ttl=64 time=0.194 ms
64 bytes from srv.mddesai.local (192.168.1.74): icmp_seq=2 ttl=64 time=0.200 ms
^C

[root@cent64 ~]# ping google.com
PING google.com (74.125.236.101) 56(84) bytes of data.
64 bytes from bom03s01-in-f5.1e100.net (74.125.236.101): icmp_seq=1 ttl=56 time=93.1 ms
64 bytes from bom03s01-in-f5.1e100.net (74.125.236.101): icmp_seq=2 ttl=56 time=84.0 ms
^C

[root@cent64 ~]# dig srv.mddesai.local
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> srv.mddesai.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56752
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;srv.mddesai.local.		IN	A

;; ANSWER SECTION:
srv.mddesai.local.	86400	IN	A	192.168.1.74

;; AUTHORITY SECTION:
mddesai.local.		86400	IN	NS	srv.mddesai.local.

;; Query time: 3 msec
;; SERVER: 192.168.1.74#53(192.168.1.74)
;; WHEN: Tue Mar 19 00:51:17 2013
;; MSG SIZE  rcvd: 65

[root@cent64 ~]# dig -x 192.168.1.74
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> -x 192.168.1.74
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25130
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;74.1.168.192.in-addr.arpa.	IN	PTR

;; ANSWER SECTION:
74.1.168.192.in-addr.arpa. 86400 IN	PTR	srv.mddesai.local.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa.	86400	IN	NS	srv.mddesai.local.

;; ADDITIONAL SECTION:
srv.mddesai.local.	86400	IN	A	192.168.1.74

;; Query time: 3 msec
;; SERVER: 192.168.1.74#53(192.168.1.74)
;; WHEN: Tue Mar 19 00:51:29 2013
;; MSG SIZE  rcvd: 104
/etc/named.conf
PHP Code:
options {
        
listen-on port 53 192.168.1.74127.0.0.1; };
        
listen-on-v6 port 53 { ::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     localhost192.168.1.0/24; };
        
recursion yes;

        
dnssec-enable yes;
        
dnssec-validation yes;
        
dnssec-lookaside auto;

        
/* Path to ISC DLV key */
        
bindkeys-file "/etc/named.iscdlv.key";

        
managed-keys-directory "/var/named/dynamic";
};

logging {
        
channel default_debug {
                
file "data/named.run";
                
severity dynamic;
        };
};

zone "." IN {
        
type hint;
        
file "named.ca";
};

zone    "mddesai.local" IN {
        
type master;
        
file "fwd.mddesai.local";
        
allow-update none; };
};

zone    "1.168.192.in-addr.arpa" IN {
        
type master;
        
file "rev.mddesai.local";
        
allow-update none; };
};


include 
"/etc/named.rfc1912.zones";
include 
"/etc/named.root.key"

/var/named/fwd.mddesai.local
PHP Code:
$TTL 86400
@   IN  SOA     srv.mddesai.localroot.mddesai.local. (
        
2011071001  ;Serial
        3600        
;Refresh
        1800        
;Retry
        604800      
;Expire
        86400       
;Minimum TTL
)
@       
IN  NS  srv.mddesai.local.
srv     IN  A   192.168.1.74 
/var/named/rev.mddesai.local
PHP Code:
$TTL 86400
@   IN  SOA     srv.mddesai.localroot.mddesai.local. (
        
2011071001  ;Serial
        3600        
;Refresh
        1800        
;Retry
        604800      
;Expire
        86400       
;Minimum TTL
)
@       
IN      NS      srv.mddesai.local.
srv     IN      A       192.168.1.74
74      IN      PTR     srv
.mddesai.local

Hope this not a drag...

Thanks

Last edited by mddesai; 03-20-2013 at 05:36 AM. Reason: changed tags for better readability
 
Old 03-19-2013, 04:10 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,

Quote:
[root@srv ~]# ping cent64
ping: unknown host cent64
This is correct. There is no cent64 entry in the forward zone and I guess there is no entry in /etc/hosts of the server either


Quote:
dig cent64
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> cent64
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 9647
<snip>
Same as above. Note also that if you want to use not FQDNs you need to add a "+search" in the dig command


Quote:
dig -x 192.168.1.5
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> -x 192.168.1.5
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 21154
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
<snip>
There is no 192.168.1.5 entry in the reverse zone file (/var/named/rev.mddesai.local)


Please note the queries from client get answered because there are the respective RRs in the 2 zone files

Regards
 
Old 03-20-2013, 02:16 AM   #3
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 485

Original Poster
Rep: Reputation: 133Reputation: 133
Unhappy

Quote:
Originally Posted by bathory View Post

There is no cent64 entry in the forward zone and I guess there is no entry in /etc/hosts of the server either
I'm a newbie. help me correct, these are my understandings - one cant enter every machine's ip address in forward zone...only dns server ip address. if so, then what is the point of bind server? it can be simply achieved by entering "ip hostname" addresses in /etc/hosts file. isn't its the bind's job to figure out ip address?

Quote:
Originally Posted by bathory View Post

Note also that if you want to use not FQDNs you need to add a "+search" in the dig command
Code:
[root@cent64 ~]# hostname
cent64
[root@cent64 ~]# echo -e "NETWORKING=yes\nHOSTNAME=cent64.mddesai.local" > /etc/sysconfig/network
[root@cent64 ~]# reboot

[root@cent64 ~]# hostname
cent64.mddesai.local

[root@srv ~]# ping cent64.mddesai.local
ping: unknown host cent64.mddesai.local

[root@srv ~]# dig cent64.mddesai.local
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> cent64.mddesai.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52449
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;cent64.mddesai.local.		IN	A

;; AUTHORITY SECTION:
mddesai.local.		86400	IN	SOA	srv.mddesai.local. root.mddesai.local. 2011071001 3600 1800 604800 86400

;; Query time: 0 msec
;; SERVER: 192.168.1.74#53(192.168.1.74)
;; WHEN: Wed Mar 20 12:14:22 2013
;; MSG SIZE  rcvd: 83
Nope. Still not working.

these are my config files:

Server:
Code:
[root@srv ~]# cat /etc/hosts
127.0.0.1   localhost srv.mddesai.local srv
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.74	srv.mddesai.local

[root@srv ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search mddesai.local
nameserver 192.168.1.74
nameserver 8.8.8.8

[root@srv ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=srv.mddesai.local
GATEWAY=192.168.1.1

[root@srv ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
NAME="System eth0"
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.74
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.74
DNS2=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
HWADDR=00:05:5D:4A:62:52
LAST_CONNECT=1363457995
Client:
Code:
[root@cent64 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.5 cent64 cent64.mddesai.local

[root@cent64 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.1.74

[root@cent64 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cent64.mddesai.local

[root@cent64 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
NAME="System eth0"
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=08:00:27:ce:d3:14
IPADDR=192.168.1.5
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.74
DEFROUTE=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
USERCTL=no
this bind server is proving to be more headache than i thought...

Last edited by mddesai; 03-20-2013 at 02:18 AM.
 
Old 03-20-2013, 02:30 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,269

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Quote:
it can be simply achieved by entering "ip hostname" addresses in /etc/hosts file. isn't its the bind's job to figure out ip address?
/etc/hosts was how it WAS done in the very early days, but when the 'internet' (ARPANet) got into the 10s to 100s of machines, emailing hosts files back and forth and manually updating your local copy became prohibitive.

DNS is the replacement; its a hierarchical flat-file DB design; the trick is to give the local DNS server enough info to manage its LAN (local zones) then forward enquiries for non-local stuff to other DNS servers further 'up' the chain.
Have a quick scan of https://en.wikipedia.org/wiki/Domain_Name_System

For a very small static LAN or eg in my case one host with a few VMs, /etc/hosts is sufficient; I don't have a DNS / bind server setup, but it uses the same logic to go to eg LQ
I don't have LQ or any external addresses in my hosts file, instead it uses /etc/nsswitch.conf and /etc/resolv.conf.
 
Old 03-20-2013, 03:02 AM   #5
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Hi,
Quote:
I'm a newbie. help me correct, these are my understandings - one cant enter every machine's ip address in forward zone...only dns server ip address. if so, then what is the point of bind server? it can be simply achieved by entering "ip hostname" addresses in /etc/hosts file. isn't its the bind's job to figure out ip address?
Read above what chrism01 has written.

Quote:
[root@srv ~]# ping cent64.mddesai.local
ping: unknown host cent64.mddesai.local
Ping uses /etc/hosts and then a dns server in order to resolve a hostname. Sicne "cent64.mddesai.local" does not exist in both the hosts file and the dns zone file, the answer you get is correct


Quote:
[root@srv ~]# dig cent64.mddesai.local
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6.3 <<>> cent64.mddesai.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52449
<snip>
Dig asks a dns server in order to resolve a hostname, so again the answer is correct as there is no "cent64.mddesai.local" RR in the forward zone file.
 
Old 03-20-2013, 03:35 AM   #6
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 485

Original Poster
Rep: Reputation: 133Reputation: 133
Thumbs up

Quote:
Originally Posted by chrism01 View Post
For a very small static LAN or eg in my case one host with a few VMs, /etc/hosts is sufficient; I don't have a DNS / bind server setup, but it uses the same logic to go to eg LQ
Quote:
Originally Posted by bathory View Post
Hi,
Ping uses /etc/hosts and then a dns server in order to resolve a hostname. Sicne "cent64.mddesai.local" does not exist in both the hosts file and the dns zone file, the answer you get is correct

Dig asks a dns server in order to resolve a hostname, so again the answer is correct as there is no "cent64.mddesai.local" RR in the forward zone file.
But what if i have say around 200-300 machines in lan and every machine's ip address is given by dhcp? then how do i fill hosts file?

Let me tell what i am upto, i have windows 2003 server with domain controller on it for which around 200 XP PCs are attached. it also serve as dns server and dhcp server. i have also around 3 file servers attached to domain controller. these are all created by myself and i'm managing it from past 4 years. now management want to shift to centos for file server and others and if possible as domain controller also. learning bind is the first step in that direction. then follows dhcp, samba etc...

In Windows server while setting up Domain Controller, DNS server is automatically created and it takes care of all host by itself. i guess its not so automatic in linux and i think i should buy a decent book on bind and start flipping pages...from start.

So its officially clear then... no shortcuts...

Thanks bathory and chrism01

Note: i added "cent64 IN A 192.168.1.5" in fwd.mddesai.local file and also "cent64 IN A 192.168.1.5", "5 IN PTR cent64.mddesai.local." in rev.mddesai.local. now its working. so far so good. well i thought those line will be automatically added by bind when i try to connect client machine... thats the part of confusion.

Last edited by mddesai; 03-20-2013 at 04:19 AM.
 
Old 03-20-2013, 05:04 AM   #7
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,910

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Quote:
But what if i have say around 200-300 machines in lan and every machine's ip address is given by dhcp? then how do i fill hosts file?
You can configure the dhcp server to update dynamically the dns server (DDNS). There are tons of tutorials for DDNS setup (e.g. ths)


Quote:
In Windows server while setting up Domain Controller, DNS server is automatically created and it takes care of all host by itself. i guess its not so automatic in linux and i think i should buy a decent book on bind and start flipping pages...from start.
You should look on samba if you want a replacement for windows DC.

Regards
 
1 members found this post helpful.
Old 03-20-2013, 05:17 AM   #8
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 485

Original Poster
Rep: Reputation: 133Reputation: 133
Quote:
You can configure the dhcp server to update dynamically the dns server (DDNS). There are tons of tutorials for DDNS set up
Great !!!

Dynamic DNS with Bind and DHCP on CentOS 5.x

This solved everything...

Thank you very much.

Last edited by mddesai; 03-20-2013 at 05:18 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bind not resolving remote domains wasamzy Linux - Networking 3 12-11-2012 10:26 AM
Strange BIND behaviour when resolving chrisgti Linux - Networking 13 03-16-2010 10:02 AM
Bind isn't resolving new name brgsousa Linux - Software 9 01-23-2010 08:40 AM
DNS not resolving using bind draxan Linux - Networking 2 08-12-2009 09:59 AM
Please help with reverse resolving in BIND GSMD Linux - Networking 4 01-12-2007 04:22 AM


All times are GMT -5. The time now is 07:49 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration