LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Configuring bind dns (https://www.linuxquestions.org/questions/linux-server-73/configuring-bind-dns-4175623214/)

kingk110 02-06-2018 04:25 PM

Configuring bind dns
 
Hello everybody,

I am trying to install zimbra on ubuntu server 16 and making the mail server and dns server the same server which is the zimbra server.

I followed up the steps in these 2 links which are similar in steps https://linoxide.com/ubuntu-how-to/s...ite-ubuntu-16/ and http://linux-sys-adm.com/how-to-inst...-step-by-step/ (despite the wrong ip subnetting in the first one).
I faced problems first starting the bind service and the error unknown rr type and unkown class/type, I solved it by adding the
Code:

@ IN
at the beginning of the error line and removing the domain name.
Code:

@    NS      mail.
I tested the named-checkzone with the filezones I created and all are loaded correctly.

But when I test the dns with dig domain-name I don't got the same result in the links, and if continue to install zimbra it will give me that an mx record must be configured in this domain.

My files are same as the links but instead my domain name is sy.local. I searched a lot on the internet for a solution but didn't find anything.

Help please.
I will show the files to be more clear.
named.conf:
Code:

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

named.conf.local:
Code:

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

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

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

named.conf.options:
Code:

options {
directory "/var/cache/bind";

forwarders {
8.8.8.8; 8.8.4.4;
};

dnssec-validation auto;

auth-nxdomain no;    # conform to RFC1035
listen-on-v6 { any; };
};

db.sy.local:
Code:

$TTL    604800
@      IN      SOA    mail.sy.local. admin.sy.local.        (
030512  ; Serial
604800  ; Refresh
86400  ; Retry
2419200 ; Expire
604800 ); Negative Cache TTL
;
@                IN      NS              mail
IN                MX    10              mail
IN                A                          192.200.201.10
mail            IN      A                192.200.201.10

db.0.0.127:
Code:

$TTL 3D
@        IN      SOA    mail.sy.local. admin.sy.local. (
16        ; Serial
8H      ; Refresh
2H      ; Retry
4W      ; Expire
1D)      ; Minimum TTL
@    NS      mail.
1        PTR    localhost.

db.201.200.192:
Code:

$TTL 3D
@              IN      SOA    mail.sy.local.  admin.sy.local. (
15          ; Serial
8H      ; Refresh
2H      ; Retry
4W      ; Expire
1D)      ; Minimum TTL
@      NS        mail.
10        PTR    mail.

etc hosts:
Code:

127.0.0.1      localhost
192.200.201.10  mail.sy.local  mail

# The following lines are desirable for IPv6 capable hosts
#::1    localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters

resolv.conf:
Code:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#    DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.200.201.10
search sy.local

and here is the dig domain-name result:
Code:

root@mail:~# dig sy.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> sy.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44040
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;sy.local.                      IN      A

;; AUTHORITY SECTION:
sy.local.              604800  IN      SOA    mail.sy.local. admin.sy.local. 30512 604800 86400 2419200 604800

;; Query time: 0 msec
;; SERVER: 192.200.201.10#53(192.200.201.10)
;; WHEN: Wed Feb 07 00:21:48 EET 2018
;; MSG SIZE  rcvd: 84


bathory 02-06-2018 04:59 PM

Hi kingk110,

You have some errors in your forward zone file.
There must be at least one blank space in front of the RRs starting with IN or else you should use a hostname of a FQDN.
So the zonefile should be like this (I've used tabs for readability)
Code:

$TTL    604800
@      IN      SOA    mail.sy.local. admin.sy.local.        (
030513  ; Serial  INCREASE IT AFTER EDITING!
604800  ; Refresh
86400  ; Retry
2419200 ; Expire
604800 ); Negative Cache TTL
;
@                IN              NS              mail
                  IN              MX      10      mail            ;Leave at least a blank space
                  IN              A              192.200.201.10  ;Leave at least a blank space
mail              IN              A              192.200.201.10

Don't forget to increase the serial before reloading the zone.

Regards

kingk110 02-06-2018 10:39 PM

Quote:

Originally Posted by bathory (Post 5816628)
Hi kingk110,

You have some errors in your forward zone file.
There must be at least one blank space in front of the RRs starting with IN or else you should use a hostname of a FQDN.
So the zonefile should be like this (I've used tabs for readability)
Code:

$TTL    604800
@      IN      SOA    mail.sy.local. admin.sy.local.        (
030513  ; Serial  INCREASE IT AFTER EDITING!
604800  ; Refresh
86400  ; Retry
2419200 ; Expire
604800 ); Negative Cache TTL
;
@                IN              NS              mail
                  IN              MX      10      mail            ;Leave at least a blank space
                  IN              A              192.200.201.10  ;Leave at least a blank space
mail              IN              A              192.200.201.10

Don't forget to increase the serial before reloading the zone.

Regards

What about the changes that I've done should I return it and use as the links stated?? because I mad the spaces before the comments in the 2 lines you talked about and added the serial; nothing changed the dig result is the same and the bind started also with no errors.

kingk110 02-06-2018 10:53 PM

If I add @ at the begining of the error lines only and keeping the hostname and domain in db.0.0.127 and domain only in db.ip.ip.ip (@ NS mail.sy.local. and @ NS sy.local. )the bind will start with no errors but I will get this error while checking named-checkzone:
Code:

root@mail:~# named-checkzone sy.local /etc/bind/db.0.0.127
zone sy.local/IN: NS 'mail.sy.local' has no address records (A or AAAA)
zone sy.local/IN: not loaded due to errors.
root@mail:~# named-checkzone sy.local /etc/bind/db.201.200.192
zone sy.local/IN: NS 'sy.local' has no address records (A or AAAA)
zone sy.local/IN: not loaded due to errors.
root@mail:~#

named start results:
Code:

root@mail:~# /etc/init.d/bind9 status
● bind9.service - BIND Domain Name Server
  Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled)
  Drop-In: /run/systemd/generator/bind9.service.d
          └─50-insserv.conf-$named.conf
  Active: active (running) since Wed 2018-02-07 06:57:50 EET; 1s ago
    Docs: man:named(8)
  Process: 15855 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS)
 Main PID: 15861 (named)
    Tasks: 7
  Memory: 12.8M
      CPU: 73ms
  CGroup: /system.slice/bind9.service
          └─15861 /usr/sbin/named -f -u bind

Feb 07 06:57:50 mail named[15861]: zone 0.in-addr.arpa/IN: loaded serial 1
Feb 07 06:57:50 mail named[15861]: zone localhost/IN: loaded serial 2
Feb 07 06:57:50 mail named[15861]: zone 127.in-addr.arpa/IN: loaded serial 1
Feb 07 06:57:50 mail named[15861]: zone 201.200.192.in-addr.arpa/IN: loaded serial 20
Feb 07 06:57:50 mail named[15861]: zone 0.0.127.in-addr.arpa/IN: loaded serial 21
Feb 07 06:57:50 mail named[15861]: zone sy.local/IN: loaded serial 30513
Feb 07 06:57:50 mail named[15861]: zone 255.in-addr.arpa/IN: loaded serial 1
Feb 07 06:57:50 mail named[15861]: all zones loaded
Feb 07 06:57:50 mail named[15861]: running
Feb 07 06:57:50 mail named[15861]: zone 201.200.192.in-addr.arpa/IN: sending notifies (serial 20)

shouldn't the example in the link work correctly if I follow the steps as it is???

bathory 02-07-2018 12:35 AM

Quote:

root@mail:~# named-checkzone sy.local /etc/bind/db.0.0.127
zone sy.local/IN: NS 'mail.sy.local' has no address records (A or AAAA)
zone sy.local/IN: not loaded due to errors.
root@mail:~# named-checkzone sy.local /etc/bind/db.201.200.192
zone sy.local/IN: NS 'sy.local' has no address records (A or AAAA)
zone sy.local/IN: not loaded due to errors.
Wrong syntax! Use the correct zone name with the appropriate zone file:
Code:

named-checkzone sy.local /etc/bind/db.sy.local

Quote:

shouldn't the example in the link work correctly if I follow the steps as it is???
From a quick look I've taken, the 1st link tutorial misses the starting blank spaces, so it shouldn't work.

kingk110 02-07-2018 01:40 AM

[QUOTE=bathory;5816734]Wrong syntax! Use the correct zone name with the appropriate zone file:
Code:

named-checkzone sy.local /etc/bind/db.sy.local

I used it and it was loaded with no answer in dig but I tried to check db files also if there is a problem.
Code:

root@mail:~# named-checkzone sy.local /etc/bind/db.sy.local
zone sy.local/IN: loaded serial 30514
OK


bathory 02-07-2018 02:56 AM

Quote:

Originally Posted by kingk110 (Post 5816757)
I used it and it was loaded with no answer in dig but I tried to check db files also if there is a problem.
Code:

root@mail:~# named-checkzone sy.local /etc/bind/db.sy.local
zone sy.local/IN: loaded serial 30514
OK


I see no problem here...
So what happens if you try to resolve your hostname?
Code:

dig mail.sy.local

kingk110 02-07-2018 03:03 AM

Quote:

Originally Posted by bathory (Post 5816769)
I see no problem here...
So what happens if you try to resolve your hostname?
Code:

dig mail.sy.local

I get answer:
Code:

root@mail:~# dig mail.sy.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> mail.sy.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3783
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail.sy.local.                IN      A

;; ANSWER SECTION:
mail.sy.local.          604800  IN      A      192.200.201.10

;; AUTHORITY SECTION:
sy.local.              604800  IN      NS      mail.sy.local.

;; Query time: 0 msec
;; SERVER: 192.200.201.10#53(192.200.201.10)
;; WHEN: Wed Feb 07 10:58:29 EET 2018
;; MSG SIZE  rcvd: 72

I created another server and used link 2 to configure and edited all files through nano and vi tools from linux it was solved and I added spaces as you state.
I installed zimbra now with mx record but don't know what was the problem maybe editing files through winscp and saving directly.

Thanks a lot bathory.
I appreciate your help.


All times are GMT -5. The time now is 09:06 PM.