LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   bind not resolves forward lookup (https://www.linuxquestions.org/questions/linux-server-73/bind-not-resolves-forward-lookup-750117/)

sunils1973 08-25-2009 09:23 AM

bind not resolves forward lookup
 
I have configured bind9 in a debian lenny multihomed pc which acts as the squid proxy

Recently i configured bind9 and it is working partially

Sorry that I could'nt post the configuration files now, as I am now in home

I can ping the systems
such as ping linux.tempnet.net, server.tempnet.net, cp.tempnet.net

cp - the multihomed pc (192.168.10.1)
Also #host 192.168.10.1 returns cp.tempnet.net
#host 192.168.10.2 returns linux.tempnet.net
#host 192.168.10.4 returns server.tempnet.net

But
#dig 192.168.10.1 is not returning the correct that I think
it displays some root DNS- I think it should return cp.tempnet.net

dig cp.tempnet.net returns 127.0.0.1

Thanks in advance

Suncoast 08-25-2009 04:39 PM

Quote:

Originally Posted by sunils1973 (Post 3656829)
But
#dig 192.168.10.1 is not returning the correct that I think
it displays some root DNS- I think it should return cp.tempnet.net


You need the -x for reverse lookups. Try

dig -x 192.168.10.1

sunils1973 08-26-2009 05:22 AM

Quote:

Originally Posted by Suncoast (Post 3657346)
You need the -x for reverse lookups. Try

dig -x 192.168.10.1

Yes it works

Thank u

sunils1973 09-04-2009 03:05 AM

I am trying to configure Bind9 in a multihomed pc in my home
eth1 dhcp - cable modem
eth0 192.168.0.2

Another windows machine 192.168.0.3

What is the problem with DNS configuration?

***************************************************
named.conf
*************************************************************************
debian:/etc/bind/zones# cat /etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";

**********************************************************************
/etc/bind/named.conf.local
********************************************************************
debian:/etc/bind/zones# cat /etc/bind/named.conf.local
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "homenet.net" {
type master;
file "/etc/bind/zones/db.homenet.net";
};
zone "0.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.0.168.192";
};
***************************************************************

Forward lookup -
debian:/etc/bind/zones# cat db.homenet.net
; BIND reverse data file for empty rfc1918 zone
;
; DO NOT EDIT THIS FILE - it is used for multiple zones.
; Instead, copy it, edit named.conf, and use that copy.
;
;
; DO NOT EDIT THIS FILE - it is used for multiple zones.
; Instead, copy it, edit named.conf, and use that copy.
;
$TTL 86400
@ IN SOA sun1.homenet.net.root.homenet.net. (
2009080408 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS sun1.homenet.net.
IN MX 10 sun1.homenet.net.
sun1 IN A 192.168.0.2
sun2 IN A 192.168.0.3

*****************************************************
Reverse lookup
***************************************************
debian:/etc/bind/zones# cat db.0.168.192
; BIND reverse data file for empty rfc1918 zone
;
; DO NOT EDIT THIS FILE - it is used for multiple zones.
; Instead, copy it, edit named.conf, and use that copy.
;
;
; DO NOT EDIT THIS FILE - it is used for multiple zones.
; Instead, copy it, edit named.conf, and use that copy.
;
$TTL 86400
@ IN SOA sun1.homenet.net.root.homenet.net. (
2009080408 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS sun1.homenet.net.
IN MX 10 sun1.homenet.net.
2 IN PTR sun1.homenet.net.
3 IN PTR sun2.homenet.net.

***************************************************************
/etc/hosts file
**************************************************************

debian:/etc/bind/zones# cat /etc/hosts
127.0.0.1 localhost
192.168.0.2 sun1.homenet.net sun1
debian:/etc/bind/zones#
**************************************************

Suncoast 09-04-2009 06:09 PM

Code:

@ IN SOA sun1.homenet.net.root.homenet.net. (

Should be

@ IN SOA sun1.homenet.net.    root.homenet.net. (


sunils1973 09-05-2009 09:19 AM

Still problem (Actually it was there spaces after the dot. I forget to include space after experiment)

Changed entry
*********************************************************
@ IN SOA sun1.homenet.net. root.homenet.net. (

@ IN SOA sun1.homenet.net. root.homenet.net. (
2009080501 ; Serial

******************************************************
debian:/etc/bind/zones# dig -x 192.168.0.2

; <<>> DiG 9.5.1-P3 <<>> -x 192.168.0.2
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 36045
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

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

;; AUTHORITY SECTION:
168.192.in-addr.arpa. 1672 IN SOA localhost. root. 1 604800 86400 2419200 604800

;; Query time: 32 msec
;; SERVER: 202.88.238.3#53(202.88.238.3)
;; WHEN: Sun Sep 6 06:46:11 2009
;; MSG SIZE rcvd: 91

**************************************************************************
debian:/etc/bind/zones# host 192.168.0.2
Host 2.0.168.192.in-addr.arpa. not found: 3(NXDOMAIN)

bathory 09-05-2009 09:28 AM

Hi,

Add the ORIGIN record after the $TTL line in db.0.168.192 :
Code:

$ORIGIN 0.168.192.in-addr.arpa.
Increase serial and restart bind

sunils1973 09-07-2009 07:55 AM

host 192.168.0.2
Host 2.0.168.192.in-addr.arpa. not found: 3(NXDOMAIN)

*************************************************************
entry in db.0.168.192

$TTL 86400
$ORIGIN 0.168.192.in-addr.arpa.

bathory 09-07-2009 08:06 AM

Have you increased the serial and restart bind?
What is the output of:
Code:

dig SOA 0.168.192.in-addr.arpa.

Suncoast 09-08-2009 08:04 AM

Code:

debian:/etc/bind/zones# cat db.0.168.192
$TTL    86400
@      IN      SOA    sun1.homenet.net.  root.homenet.net. (
                    2009080408        ; Serial
                        604800        ; Refresh
                          86400        ; Retry
                        2419200        ; Expire
                          86400        ; Negative Cache TTL
)
                IN      NS      sun1.homenet.net.
2              IN      PTR    sun1.homenet.net.
3              IN      PTR    sun2.homenet.net.

Much of Bind is careful attention to detail. You have some extra data in your reverse file. Try this.

sunils1973 09-08-2009 10:09 AM

Yes I have changed the serial no also

(For all files like db.0, db.127 db.local etc.. is it necessary to change all serial nos?)
Another problem
When I tried to edit the entries via sed, it corrupted
So I removed the package and also removed the /etc/bind directory.

After the new installation, there was no configuration files. How to obtain the configuration files

Though I have taken backup of the above files, I want the fresh configuration files

How to obtain it?

Suncoast 09-08-2009 12:56 PM

Every time you change a Bind file, change the serial number. Just the file you are changing, not all of them.

The widely used format is Year-Month-Day-0_to_99. YYYYMMDD##

This number can be anything you want it to be, as long as the new number is greater than the previous number. This is one of those things that you just need to know to change on your own when requesting help with Bind.

If there is a program to create new Bind files, I don't know what it is. I believe the default sample files are installed with the package.


All times are GMT -5. The time now is 03:37 PM.