LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DNS server name to ip resolve problem (https://www.linuxquestions.org/questions/linux-server-73/dns-server-name-to-ip-resolve-problem-773358/)

Ravinder Singh Thakur 12-03-2009 11:02 PM

DNS server name to ip resolve problem
 
Dear All,

I have configured the dns server for local environment with domain name of my choice like ns.redhat.com, and ip address of 192.168.20.19 and subnet mask (255.255.255.0).When i run command like nslookup, host, dig to see the reponse of my dns. I get the right answer like show below

1

nslookup 192.168.20.19
Server: 192.168.20.19
Address: 192.168.20.19#53

19.20.168.192.in-addr.arpa name = ns.redhat.com.


2

host 192.168.20.19
19.20.168.192.in-addr.arpa domain name pointer ns.redhat.com.





3
dig -x 192.168.20.19

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> -x 192.168.20.19
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18529
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

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

;; ANSWER SECTION:
19.20.168.192.in-addr.arpa. 86400 IN PTR ns.redhat.com.

;; AUTHORITY SECTION:
20.168.192.in-addr.arpa. 86400 IN NS ns.redhat.com.

;; Query time: 1 msec
;; SERVER: 192.168.20.19#53(192.168.20.19)
;; WHEN: Thu Dec 3 18:50:10 2009
;; MSG SIZE rcvd: 85

But when i ask reverse question to my dns it give follwoing error or response which is not desirable. I mean it should give corresponding ip address of the ns.redhat.com that is 192.168.20.19

1
nslookup ns.redhat.com
Server: 192.168.20.19
Address: 192.168.20.19#53

** server can't find ns.redhat.com: SERVFAIL

2

host ns.redhat.com
Host ns.redhat.com not found: 2(SERVFAIL)


3

dig ns.redhat.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> ns.redhat.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 51614
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ns.redhat.com. IN A


;; Query time: 1 msec
;; SERVER: 192.168.20.19#53(192.168.20.19)
;; WHEN: Thu Dec 3 18:53:12 2009
;; MSG SIZE rcvd: 31


These are my named.conf, forward zone and reverse zone files.




cat /etc/named.conf

options {
directory "/var/named";

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

allow-query { localhost; 192.168.20.0/24; };

// query range

allow-transfer { localhost; 192.168.20.0/24; };

// transfer range

allow-recursion { localhost; 192.168.20.0/24; };

// recursion range

};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};
// here is the section for internal informations

view "internal" {
match-clients {

localhost;

192.168.20.0/24;

};

zone "." IN {

type hint;

file "named.ca";

};

zone "redhat.com" IN {

type master;

file "redhat.com.lan";

allow-update { none; };

};

zone "20.168.192.in-addr.arpa" IN {

type master;

file "20.168.192.db";

allow-update { none; };

};

zone "localdomain" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "255.in-addr.arpa" IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" IN {

type master;

file "named.zero";

allow-update { none; };

};

};
include "/etc/rndc.key";


Forward Zone File /var/named/redhat.com.lan.



$TTL 86400
@ IN SOA ns.redhat.com. root.ns.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS ns.redhat.com.
IN A 192.168.20.19
IN MX 10 ns.redhat.com.

ns.redhat.com. IN A 192.168.20.19




Reverse Zone File /var/named/20.168.192.db


$TTL 86400
@ IN SOA ns.redhat.com. root.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS ns.redhat.com.
IN PTR ns.redhat.com.
IN A 255.255.255.0

19 IN PTR ns.redhat.com.



This is my resolv.conf


This is /etc/resolv.conf

nameserver 192.168.20.19



Thankyou in Advance

abhandari 12-04-2009 12:00 AM

Quote:

Originally Posted by Ravinder Singh Thakur (Post 3779202)
Dear All,

I have configured the dns server for local environment with domain name of my choice like ns.redhat.com, and ip address of 192.168.20.19 and subnet mask (255.255.255.0).When i run command like nslookup, host, dig to see the reponse of my dns. I get the right answer like show below

1

nslookup 192.168.20.19
Server: 192.168.20.19
Address: 192.168.20.19#53

19.20.168.192.in-addr.arpa name = ns.redhat.com.


2

host 192.168.20.19
19.20.168.192.in-addr.arpa domain name pointer ns.redhat.com.





3
dig -x 192.168.20.19

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> -x 192.168.20.19
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18529
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

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

;; ANSWER SECTION:
19.20.168.192.in-addr.arpa. 86400 IN PTR ns.redhat.com.

;; AUTHORITY SECTION:
20.168.192.in-addr.arpa. 86400 IN NS ns.redhat.com.

;; Query time: 1 msec
;; SERVER: 192.168.20.19#53(192.168.20.19)
;; WHEN: Thu Dec 3 18:50:10 2009
;; MSG SIZE rcvd: 85

But when i ask reverse question to my dns it give follwoing error or response which is not desirable. I mean it should give corresponding ip address of the ns.redhat.com that is 192.168.20.19

1
nslookup ns.redhat.com
Server: 192.168.20.19
Address: 192.168.20.19#53

** server can't find ns.redhat.com: SERVFAIL

2

host ns.redhat.com
Host ns.redhat.com not found: 2(SERVFAIL)


3

dig ns.redhat.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> ns.redhat.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 51614
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ns.redhat.com. IN A


;; Query time: 1 msec
;; SERVER: 192.168.20.19#53(192.168.20.19)
;; WHEN: Thu Dec 3 18:53:12 2009
;; MSG SIZE rcvd: 31


These are my named.conf, forward zone and reverse zone files.




cat /etc/named.conf

options {
directory "/var/named";

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

allow-query { localhost; 192.168.20.0/24; };

// query range

allow-transfer { localhost; 192.168.20.0/24; };

// transfer range

allow-recursion { localhost; 192.168.20.0/24; };

// recursion range

};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};
// here is the section for internal informations

view "internal" {
match-clients {

localhost;

192.168.20.0/24;

};

zone "." IN {

type hint;

file "named.ca";

};

zone "redhat.com" IN {

type master;

file "redhat.com.lan";

allow-update { none; };

};

zone "20.168.192.in-addr.arpa" IN {

type master;

file "20.168.192.db";

allow-update { none; };

};

zone "localdomain" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa" IN {

type master;

file "named.local";

allow-update { none; };

};

zone "255.in-addr.arpa" IN {

type master;

file "named.broadcast";

allow-update { none; };

};

zone "0.in-addr.arpa" IN {

type master;

file "named.zero";

allow-update { none; };

};

};
include "/etc/rndc.key";


Forward Zone File /var/named/redhat.com.lan.



$TTL 86400
@ IN SOA ns.redhat.com. root.ns.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS ns.redhat.com.
IN A 192.168.20.19
IN MX 10 ns.redhat.com.

ns.redhat.com. IN A 192.168.20.19




Reverse Zone File /var/named/20.168.192.db


$TTL 86400
@ IN SOA ns.redhat.com. root.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS ns.redhat.com.
IN PTR ns.redhat.com.
IN A 255.255.255.0

19 IN PTR ns.redhat.com.



This is my resolv.conf


This is /etc/resolv.conf

nameserver 192.168.20.19



Thankyou in Advance

=====================
Try this...
=====================
$TTL 86400
@ IN SOA ns.redhat.com. root.ns.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

@ IN A 192.168.20.19
ns IN A 192.168.20.19
IN A 192.168.20.19
IN MX 10 ns.redhat.com.
===============================

Ravinder Singh Thakur 12-04-2009 11:55 PM

Actually dear this does not work which you tell me above for my dns server it shows follwoing error when i restart named service


/etc/init.d/named restart
Stopping named: [ OK ]
Starting named:
Error in named configuration:
zone redhat.com/IN: has no NS records
internal/redhat.com/IN: bad zone
zone 20.168.192.in-addr.arpa/IN: loaded serial 42
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
[FAILED]

deadeyes 12-05-2009 07:56 AM

Quote:

Originally Posted by Ravinder Singh Thakur (Post 3780540)
Actually dear this does not work which you tell me above for my dns server it shows follwoing error when i restart named service


/etc/init.d/named restart
Stopping named: [ OK ]
Starting named:
Error in named configuration:
zone redhat.com/IN: has no NS records
internal/redhat.com/IN: bad zone
zone 20.168.192.in-addr.arpa/IN: loaded serial 42
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
[FAILED]

Your reverse file, I think you should change it like something like this:

$TTL 86400
@ IN SOA ns.redhat.com. root.redhat.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS ns.redhat.com.

19 IN PTR ns.redhat.com.

I have something like this configured on my server.


All times are GMT -5. The time now is 10:26 PM.