LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Local dns configuration (https://www.linuxquestions.org/questions/linux-newbie-8/local-dns-configuration-746003/)

fizeelinux 08-08-2009 05:23 AM

Local dns configuration
 
Hi all i am planning to setup a local dns server in centos 5.3 and further to setup a mail server(for sending mails within intranet).I have termed my local domain as 'centos.local'.After configuration i tried to dig the dns server IP as well as its name.With dns server IP it is working fine but not with dns server name.It gives me error SERVFAIL.Below is my configuration file.Please let me know where i have committed the mistake.Thanks in advance



Code:

#cat /etc/named.caching-nameserver.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 192.168.1.200; };
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";

// Those options should be used carefully because they disable port
// randomization
// query-source port 53;
// query-source-v6 port 53;

allow-query { 192.168.1.200/24; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { 192.168.1.200/24; };
match-destinations { 192.168.1.200/24; };
recursion yes;
include "/etc/named.rfc1912.zones";
};


Code:

#cat /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "." IN {
type hint;
file "named.ca";
};

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; };
};
#Modification started
zone "dns.centos.local" IN {
type master;
file "centos.for";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "centos.rev";
allow-update { none; };
};
#Modification ended
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.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; };
};

Code:

#dig -x 192.168.1.200
; <<>> DiG 9.3.4-P1 <<>> -x 192.168.1.200
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35544
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

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

;; ANSWER SECTION:
200.1.168.192.in-addr.arpa. 86400 IN PTR dns.centos.local.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS dns.centos.local.

;; Query time: 2 msec
;; SERVER: 192.168.1.200#53(192.168.1.200)
;; WHEN: Sat Aug 8 14:39:53 2009
;; MSG SIZE rcvd: 88


Code:

#dig -x dns.centos.local
; <<>> DiG 9.3.4-P1 <<>> -x dns.centos.local
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 52128
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;local.centos.dns.in-addr.arpa. IN PTR

;; Query time: 399 msec
;; SERVER: 192.168.1.200#53(192.168.1.200)
;; WHEN: Sat Aug 8 14:40:22 2009
;; MSG SIZE rcvd: 47


#cat /etc/resolv.conf
search centos.local
nameserver 192.168.1.200

markush 08-08-2009 06:59 AM

"man dig" tells me that "dig -x" maps adresses to names.
To query for a name use "dig -q dns.centos.local".

Markus

fizeelinux 08-09-2009 11:44 PM

Quote:

Originally Posted by markush (Post 3635685)
"man dig" tells me that "dig -x" maps adresses to names.
To query for a name use "dig -q dns.centos.local".

Markus


Thanks but the result is the same as dig -x dns.centos.local with status fail.Is my configuration file correct.Thanks

bathory 08-10-2009 12:05 AM

Quote:

#Modification started
zone "dns.centos.local" IN {
type master;
file "centos.for";
allow-update { none; };
};
You said you want to setup the domain centos.local, so you have to change the zone name above. Also post here the zone file centos.for, so we can help you further.

Regards

fizeelinux 08-10-2009 11:38 PM

Quote:

Originally Posted by bathory (Post 3637287)
You said you want to setup the domain centos.local, so you have to change the zone name above. Also post here the zone file centos.for, so we can help you further.

Regards

Thanks Bathory.I have changed the zone in /etc/named.rfc1912.zones file


zone "centos.local" IN {
type master;
file "centos.for";
allow-update { none; };
};

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


And my forward and reverse zone files are as below

Code:

cat /var/named/chroot/var/named/centos.for
$TTL 86400
@ IN SOA dns.centos.local root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS dns.centos.local
dns.centos.local IN A 192.168.1.200
IN AAAA ::1


Code:

cat /var/named/chroot/var/named/centos.rev
$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.centos.local.
200 IN PTR dns.centos.local.

Please assist me on this.Thanks

bathory 08-11-2009 12:02 AM

You miss the dot at the end of the hostnames. Change the zone file to:
Code:

$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
2009081101 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200

Restart named and see if it works.

fizeelinux 08-11-2009 02:10 AM

Quote:

Originally Posted by bathory (Post 3638728)
You miss the dot at the end of the hostnames. Change the zone file to:
Code:

$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
2009081101 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200

Restart named and see if it works.


Thanks for your reply Bathory.

cat /var/named/chroot/var/named/centos.for

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

IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200
IN AAAA ::1


I restarted the service but the result status is SERVFAIL.I really dont have any idea on this.Thanks

bathory 08-11-2009 02:17 AM

If you don't increase the serial (see the zone file I've posted), named will not be aware of any changes done.
Btw it's better to use the date format for the serial, so you know when you've last change the zone file.

fizeelinux 08-11-2009 05:00 AM

Quote:

Originally Posted by bathory (Post 3638830)
If you don't increase the serial (see the zone file I've posted), named will not be aware of any changes done.
Btw it's better to use the date format for the serial, so you know when you've last change the zone file.

I have now given the value in the serial field of the 'centos.for' zone file.I am sorry to say that still the same result.

cat /var/named/chroot/var/named/centos.for

$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
2009081601 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200

bathory 08-11-2009 05:33 AM

You must leave at least an empty space before the NS record. It's better use <Tab> for readability:
Code:

$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
2009081602 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

                          IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200

Note also that I've increased serial by 1.

fizeelinux 08-15-2009 02:32 AM

Quote:

Originally Posted by bathory (Post 3639009)
You must leave at least an empty space before the NS record. It's better use <Tab> for readability:
Code:

$TTL 86400
@ IN SOA dns.centos.local. root.dns.centos.local. (
2009081602 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

                          IN NS dns.centos.local.
dns.centos.local. IN A 192.168.1.200

Note also that I've increased serial by 1.


Thanks I followed up the suggestion what you have proposed but problem isnt solved.Any ideas .

bathory 08-15-2009 03:45 AM

Could you post the output of "dig dns.centos.local" again?

Since you have enabled logging look at the named.run log file to see if you find anything. You can change the severity to debug from dynamic as you don't have rndc implemented.
You can change the subnet mask from 192.168.1.200/24 to 192.168.1.0/24, so it includes all your subnet and see if it helps.

fizeelinux 08-18-2009 09:18 AM

Quote:

Originally Posted by bathory (Post 3644149)
Could you post the output of "dig dns.centos.local" again?

Since you have enabled logging look at the named.run log file to see if you find anything. You can change the severity to debug from dynamic as you don't have rndc implemented.
You can change the subnet mask from 192.168.1.200/24 to 192.168.1.0/24, so it includes all your subnet and see if it helps.


Hi Bathory .I configured local dns in Open SUSE 11.0 .Its working perfectly.Thanks for your help.Cheers.


All times are GMT -5. The time now is 03:07 AM.