31.3.12

openSUSE: Using Yast to setup DNS

DNS servers without the fiddle factor

A dot in the wrong place and you're dead. With Yast, configuring a full DNS server takes 5 minutes. Yes, that's a full dns server with both forward and reverse lookups.

In this example our fqdn is hh3.hh3.site at IP 192.168.1.3

The Yast startup screen. We have added the Yast DNS server module using, erm, Yast. . .
The reverse zone: 1.168.192.in-addr.arpa


You tell the server and Yast that this is a reverse zone by reversing the IP losing the last digit (for 192 ranges at least) and adding in-addr.arpa to it so for us, our 192.168.1.3 becomes 1.168.192.in-addr.arpa
After clicking the DNS Sever. We added the reverse zone first
Reverse zone Basics tab. Leave it as it is
Reverse zone NS  Records tab. Your fqdn
Reverse zone SOA tab. Add salt to taste or leave it as it is
Reverse zone. Records tab. The 3 comes from the last digit in 192.168.1.3
The forward zone: hh3.site
The forward zone (our domain) is the same as the reverse zone except for this:
 Under NS Records tab enter hh3.hh3.site as the nameserver
 Under MX Records enter hh3.hh3.site with priority 5
 Leave SOA as it is:

Forward zone, Records tab shot 1. Adding the A record
The Records tab needs three entries adding:
hh3      A      192.168.1.3
ns1      CNAME      hh3
mail      CNAME      hh3
Choose the Type (centre column) from the drop down list.
Forward zone, Records tab shot 2. Adding the two CNAME records
Testing the forward zone
rcnamed restart
and check the logs.

dig hh3.hh3.site


; <<>> DiG 9.8.1-P1 <<>> hh3.hh3.site
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56186
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;hh3.hh3.site. IN A

;; ANSWER SECTION:
hh3.hh3.site. 900 IN A 192.168.1.3

;; AUTHORITY SECTION:
hh3.site. 900 IN NS hh3.hh3.site.

;; Query time: 10 msec
;; SERVER: 192.168.1.3#53(192.168.1.3)
;; WHEN: Sat Mar 31 10:03:57 2012
;; MSG SIZE  rcvd: 60

Testing the reverse zone

dig -x 192.168.1.3

; <<>> DiG 9.8.1-P1 <<>> -x 192.168.1.3
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61037
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

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

;; ANSWER SECTION:
3.1.168.192.in-addr.arpa. 172800 IN PTR hh3.hh3.site.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 172800 IN NS hh3.hh3.site.

;; ADDITIONAL SECTION:
hh3.hh3.site. 900 IN A 192.168.1.3

;; Query time: 26 msec
;; SERVER: 192.168.1.3#53(192.168.1.3)
;; WHEN: Sat Mar 31 10:03:09 2012
;; MSG SIZE  rcvd: 98



notes
The zone files are created under /var/lib/named/master
cat /var/lib/named/master/1.168.192.in-addr.arpa
$TTL 2d
@ IN SOA hh3.hh3.site. root.hh3.hh3.site. (
2012033101 ; serial
3h ; refresh
1h ; retry
1w ; expiry
1d ) ; minimum


1.168.192.in-addr.arpa. IN NS hh3.hh3.site.
3 IN PTR hh3.hh3.site.


cat /var/lib/named/master/hh3.site
$TTL 2d
@ IN SOA hh3.hh3.site. root.hh3.hh3.site. (
2012033101 ; serial
3h ; refresh
1h ; retry
1w ; expiry
1d ) ; minimum


hh3.site. IN MX 5 hh3.hh3.site.
hh3.site. IN NS hh3.hh3.site.
hh3 IN A 192.168.1.3
ns1 IN CNAME hh3
mail IN CNAME hh3

/etc/named.conf
options {
directory "/var/lib/named";
managed-keys-directory "/var/lib/named/dyn/";
dump-file "/var/log/named_dump.db";
statistics-file "/var/log/named.stats";
listen-on-v6 { any; };
notify no;
disable-empty-zone "1.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";
include "/etc/named.d/forwarders.conf";
};
zone "." in {
type hint;
file "root.hint";
};
zone "localhost" in {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.zone";
};
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 "127.0.0.zone";
allow-transfer { any; };
};
include "/etc/named.conf.include";
logging {
category default { log_syslog; };
channel log_syslog { syslog; };
};
zone "1.168.192.in-addr.arpa" in {
allow-transfer { any; };
file "master/1.168.192.in-addr.arpa";
type master;
};
zone "hh3.site" in {
allow-transfer { any; };
file "master/hh3.siteX";
type master;
};

Ubuntu reverse DNS


service bind9 stop
Then, working in /etc/bind create the file 1.168.192.in.addr.arpa

$TTL 2d
@  IN SOA  hh3.hh3.site. root.hh3.hh3.site. (
    2012033101 ; serial
    3h  ; refresh
    1h  ; retry
    1w  ; expiry
    1d )  ; minimum

1.168.192.in-addr.arpa. IN NS  hh3.hh3.site.

3  IN PTR  hh3.hh3.site.

Add these lines to named.conf.local

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

service bind9 start
And dig away!