LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2010, 05:51 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
Reverse lookup not resolving IP to Name.


I have configured Bind 9 in my test lab using class c .I can successfully dig pc1 as following.

[root@mainserver ~]# dig A pc1.mydomain.com

; <<>> DiG 9.2.4 <<>> A pc1.mydomain.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61797
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;pc1.mydomain.com. IN A

;; ANSWER SECTION:
pc1.mydomain.com. 86400 IN A 192.168.1.1

;; AUTHORITY SECTION:
mydomain.com. 86400 IN NS mainserver.mydomain.com.

;; ADDITIONAL SECTION:
mainserver.mydomain.com. 86400 IN A 192.168.1.254

;; Query time: 363 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 23 01:51:28 2010
;; MSG SIZE rcvd: 91


but when i try to use reverse lookup it does't give me ans.

[root@mainserver ~]# dig -x 192.168.1.1

; <<>> DiG 9.2.4 <<>> -x 192.168.1.1
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 56468
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

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

;; Query time: 77 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jul 26 19:49:55 2010
;; MSG SIZE rcvd: 42


My /etc/resolve file is as

search mydomain.com
nameserver 192.168.1.254

Please guide that how can I fix this issue.
thanks
garden
 
Old 07-27-2010, 05:56 AM   #2
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
reverse lookup is a separate zone and needs to be configured as such in bind. for IPv4, use a zone named z.y.x.in-addr.arpa. pointing to a zone-file with PTR records for each value of n, where x.y.z.n is the full dotted IPv4-address.

example:

zone: 0.168.192.in-addr.arpa -> file rev-lan.db

zonefile: 1 IN PTR foo.example.org.

makes 192.168.0.1 resolve to foo.example.org

Don't forget the trailing dot in a PTR record to make it "absolute".
 
Old 07-27-2010, 06:18 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
in \etc\named.conf file

zone “1.168.192.in-addr.arpa” IN {
type master;
file “mydomain.com.rev” ;
allow-update {none; };
};


and my reverse life is as

[root@mainserver named]#vi@mydomain.com.rev

PHP Code:
$ORIGIN 1.168.192.in-addr-arpa.
     
$TTL    86400
      
@            IN SOA mainserver.mydomain.com.    admin@mydomain.com (
                        
20100722        serial   (d.    admin)
                        
3H        ;refresh
                        15M        
;retry
                        1W        
;expire
                        1D        
;minimum
       
@            IN NS        mainserver.mydomain.com.
       @            
IN MX        10    mainserver.mydomain.com.
        
254.1.168.192.in-addr.arpa.           IN    PTR       mainserver.mydomain.com.
         
1.1.168.192.in.addr.arpa.           IN    PTR 

Last edited by gardenair; 07-27-2010 at 06:28 AM.
 
Old 07-27-2010, 06:24 AM   #4
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Uhm .. I spot a lot of little errors like "ORIGIN" instead of "$ORIGIN", "in.addr" instead of "in-addr" ... and the file ends after a "PTR"? ... this record lacks a hostname!

Btw, you do NOT need to write the full thing like "1.1.168.192.in.addr.arpa." if $ORIGIN is set appropriately -- it will be appended automatically, so just "1" would be enough.
 
Old 07-27-2010, 06:30 AM   #5
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
sorry,in my linux box there was already $ORIGIN i forget to write here in my post.
Please specify with code where is an error.

$ORIGIN 1.168.192.in.addr.arpa.
is it correct ?

should be too much thankful.

Last edited by gardenair; 07-27-2010 at 06:35 AM.
 
Old 07-27-2010, 06:35 AM   #6
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Quote:
Originally Posted by gardenair View Post
1.1.168.192.in.addr.arpa. IN PTR
This line definitely has two errors:
- "in.addr" instead of "in-addr"
- nothing after the "PTR", so this address points to nothing -- you need to put a FQDN after PTR, with trailing dot.

And, the whole IP-address is unnecessary here, "1" instead of "1.1.168.192.in-addr.arpa." would be enough
 
Old 07-27-2010, 06:36 AM   #7
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Quote:
Originally Posted by gardenair View Post
$ORIGIN 1.168.192.in.addr.arpa.
is it correct ?
No, the top-level zone for IPv4 addresses is "in-addr.arpa." and NOT "in.addr.arpa.".
 
Old 07-27-2010, 06:45 AM   #8
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
thanks a lot "zirias" for the help.I appriciate you. It is now working perfact.

One thing more i want to discuss that what is the role of /etc/resolve
my default it was as

Code:
search localdomain
nameserver 127.0.0.1
but I change it as

Code:
search mydomain.com
nameserver 192.168.1.254
what does this file do ?
 
Old 07-27-2010, 06:49 AM   #9
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
It tells your libc where to look for a nameserver inside "gethostbyname()" calls and the like. The parameter "search" is appended automatically to unqualified hostnames, so a gethostbyname('foo'); will really look up "foo.mydomain.com.".
 
Old 07-27-2010, 07:29 AM   #10
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
from client side how can i test my server ? when i write
Code:
[root@pc1 root] ping www.mydomain.com
ping:unknown host  www.mydomain.com
the client can ping with ip address of the bind serveri.e 192.168.1.254
 
Old 07-27-2010, 07:34 AM   #11
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
So this client is located inside the same private LAN, otherwise it wouldn't be able to ping a 192.168.0.0/16 address. Just adjust /etc/resolv.conf on this client
 
Old 07-27-2010, 07:48 AM   #12
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
yes it is inside the same network.I should be thankful if you guide me that how can i add the client in /etc/resolv.conf file ?My client address is 192.168.1.1 and the subnet mask is same which is
255.255.255.0

Code:
search mydomain.com
nameserver 192.168.1.254
pc1 192.168.1.1
the editor is showing it under red colour which is i am sure wronge.Please guide about it.

in the pc1 i edit the file and it was showing as as
Quote:
nameserver 192.168.1.254
search mydomain.com

Last edited by gardenair; 07-27-2010 at 07:55 AM.
 
Old 07-27-2010, 07:53 AM   #13
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Uhm ... what do you THINK this "pc1" entry should do? the only thing you HAVE to configure in resolv.conf is the IP address of your primary name server. I don't know what it is in your case, just put there the IP where you installed "bind".
 
Old 07-28-2010, 12:34 AM   #14
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
Code:
Uhm ... what do you THINK this "pc1" entry should do? the only thing you HAVE to configure in resolv.conf is the IP address of your primary name server. I don't know what it is in your case, just put there the IP where you installed "bind".
Well pc1 i.e "pc1.mydomain.com" is my client machine and main server is the computer in which bind is install.The client computer pc1 and the main server (Bind server) i.e FQDN "mainserver.mydomain.com "are on the same network.from client machine i can't resolve the name to IP address as my server do successfully with client.
The /etc/resolv.conf file in my bind server is as

Code:
search mydomain.com
nameserver 192.168.1.254
At my client computer when I use dig command
Code:
[root@pc1 root]# dig A mainserver.mydomain.com
it does't resolve

Kindly help me .....please

thanks
 
  


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
Reverse-IP Lookup LInxia Linux - Networking 4 05-08-2011 05:31 AM
[SOLVED] bind reverse zone; no name with reverse lookup deadeyes Linux - Server 3 10-12-2009 10:54 AM
Reverse lookup on Postfix Phaethar Linux - Software 1 05-03-2004 05:00 PM
Bind reverse lookup Kostko Linux - Networking 2 12-07-2002 10:06 AM
reverse DNS lookup phil1076 Linux - General 1 01-22-2002 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration