LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-10-2017, 03:36 PM   #1
Thomas Korimort
Member
 
Registered: Jul 2016
Location: 2640 Enzenreith, Austria
Distribution: Debian/Raspbian
Posts: 63

Rep: Reputation: Disabled
DNS server configuration troubleshooting


I have configured a DynDNS on my router/modem called korimort.freedynamicdns.org which points to my modem as a gateway. It works nicely with a port forward of port 80 to my local server 192.168.1.2:80 for the web server, such that my web server can be reached externally at http://korimort.freedynamicdns.net

I want to run my own DNS server in local network having such domains as www.korimort.freedynamicdns.net . For that i installed bind9 under my Debian 9 stretch RaspBian Raspberry Pi 3 server. I forwarded TCP port 53 to my local server 192.168.1.2 . I configured the bind server as follows:

named.conf.local:
Quote:
zone "1.168.192.in-addr.arpa" {
notify no;
type master;
file "db.1.168.192.in-addr.arpa";
};

zone "korimort.freedynamicdns.net" {
notify no;
type master;
file "db.korimort.freedynamicdns.net";
};
Furthermore db.1.168.192.in-addr.arpa:

Quote:
$TTL 86400
@ IN SOA ns.korimort.freedynamicdns.net. tomkori.gmx.net. (
1; serial
3h; refresh
15; retry
1w; expire
3h; nxdomain ttl
)
@ IN NS ns.korimort.freedynamicdns.net.
@ IN PTR korimort.freedynamicdns.net.
2 IN PTR ns.korimort.freedynamicdns.net.
2 IN PTR rpiserver.korimort.freedynamicdns.net.
3 IN PTR thomaspc.korimort.freedynamicdns.net.
5 IN PTR raspberrypi.korimort.freedynamicdns.net.
6 IN PTR raspi-server2-eth.korimort.freedynamicdns.net.
7 IN PTR raspi-server2-wlan.korimort.freedynamicdns.net.
and furthermore db.korimort.freedynamicdns.net:

Quote:
$TTL 86400
@ IN SOA ns.korimort.freedynamicdns.net. tomkori.gmx.net. (
1; serial
3h; refresh
15; retry
1w; expire
3h; nxdomain ttl
)
@ IN NS ns.korimort.freedynamicdns.net.
ns IN A 192.168.1.2
www IN A 192.168.1.2
ftp IN A 192.168.1.2
rpiserver IN A 192.168.1.2
raspi-server2-eth IN A 192.168.1.6
raspi-server2-wlan IN A 192.168.1.7
raspberrypi IN A 192.168.1.5
thomaspc IN A 192.168.1.3
After starting the server i try the dig command:

dig @192.168.1.2 korimort.freedynamicdns.net

and it yields no matter what i dig for at the server 192.168.1.2
(i added forwards of 4.4.4.4 and 8.8.8.8 also). The server seems to get the request, but it does not answer it for whatever reason.

Quote:
dig @192.168.1.2 korimort.freedynamicdns.net
; <<>> DiG 9.10.3-P4-Raspbian <<>> @192.168.1.2 korimort.freedynamicdns.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 421
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;korimort.freedynamicdns.net. IN A

;; Query time: 0 msec
;; SERVER: 192.168.1.2#53(192.168.1.2)
;; WHEN: Fri Nov 10 21:31:52 UTC 2017
;; MSG SIZE rcvd: 56
 
Old 11-11-2017, 02:19 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
dig @192.168.1.2 korimort.freedynamicdns.net
; <<>> DiG 9.10.3-P4-Raspbian <<>> @192.168.1.2 korimort.freedynamicdns.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 421
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
<snip>
You get 1st a SERVFAIL and 2nd not an authoritative answer (no aa among the others flags: qr rd ra) from your dns server.
Add an A RR for korimort.freedynamicdns.net:
Code:
$TTL 86400
@ IN SOA ns.korimort.freedynamicdns.net. tomkori.gmx.net. (
2; serial
3h; refresh
15; retry
1w; expire
3h; nxdomain ttl
)
@ IN NS ns.korimort.freedynamicdns.net.
@ IN A 192.168.1.2
ns IN A 192.168.1.2
www IN A 192.168.1.2
ftp IN A 192.168.1.2
rpiserver IN A 192.168.1.2
raspi-server2-eth IN A 192.168.1.6
raspi-server2-wlan IN A 192.168.1.7
raspberrypi IN A 192.168.1.5
thomaspc IN A 192.168.1.3
Don't forget to increase the serial and reload the zone before trying again.

Regards
 
Old 11-11-2017, 02:35 AM   #3
Thomas Korimort
Member
 
Registered: Jul 2016
Location: 2640 Enzenreith, Austria
Distribution: Debian/Raspbian
Posts: 63

Original Poster
Rep: Reputation: Disabled
Thanks for your idea. Still i get SERVFAILS from dig and nslookup. In order to check for typos and other errors i tested all my files with named-checkconf, named-chckzone, compile-zone,... to me it seems that for some reason the zone files are simply not loaded by the bind server or that the bind server cannot follow any requests. I have changed my conf to

Quote:
zone "1.168.192.in-addr.arpa" {
notify no;
type master;
file "db.1.168.192.in-addr.arpa";
allow-query { any; };
forwarders { 4.4.4.4; 8.8.8.8; };
};

zone "korimort.freedynamicdns.net" {
notify no;
type master;
file "db.korimort.freedynamicdns.net";
allow-query { any; };
forwarders { 4.4.4.4; 8.8.8.8; };
};
but it did not help. Maybe something is wrong with the directory path?? I have put the db files also where all the other db files are contained in /etc/bind directory and permissions are root/bind. server also starts without any problems, but any query whatsoever results in servfail.
 
Old 11-11-2017, 03:06 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
A couple of things:

You don't need forwarders if you want to run an authoritative nameserver

I've just noticed in your OP, that you have "forwarded TCP port 53 to my local server 192.168.1.2".
You have to open also port 53/UDP, as dns is using UDP mainly. I guess that's why you're getting the SERVFAIL.

Quote:
have put the db files also where all the other db files are contained in /etc/bind directory and permissions are root/bind. server also starts without any problems, but any query whatsoever results in servfail.
I don't know about debian/bind configuration, but most likely the zone files are under /var/cache/bind. Unless you're running bind chrooted (default /var/bind9/chroot).
 
Old 11-11-2017, 09:42 AM   #5
Thomas Korimort
Member
 
Registered: Jul 2016
Location: 2640 Enzenreith, Austria
Distribution: Debian/Raspbian
Posts: 63

Original Poster
Rep: Reputation: Disabled
Thank you for your answer. I have already also activated UDP forward. And still the same. I have put my two zone files in /etc/bind, where also all the other zone files are residing. Maybe i should give the full path in the zone declaration. As for your suggestion to add @ IN A 192.168.1.2 i think this is inconsistent since @ is clearly the dynamic WAN IP of my modem/router which could be extended to further subdomains. Anyhow, the suggested change did not change anything. There are three files in /etc/bin/ directory: named.conf.options, named.conf.local and named.conf . In named.conf named.conf.local is included and it is commented that all zone declarations shall go into named.conf.local . That i did. I checked the syntax and contents of the zone files with the tools and it seems reasonable to me. However, it seems as if the zones are not known by the server.

I want to make an authoritative server for korimort.freedynamicdns.net zone as seen most probably correctly in the zone files. Inside my network i would like to use such names like rpiserver being resolved to 192.168.1.2 aso. maybe without querying outside servers for the full IP address of rpiserver.korimort.freedynamicdns.net . As already said i forward both UDP and TCP port 53 to my server 192.168.1.2 with bind9 installed on it. As from the configuration files i don't suspect that zone declarations need to be activated, but maybe the declarations are not properly parsed or parsed as comment ?!?!? Also no other zone files are activated of the many for localhost contained in the directory. One could uncomment the appropriate directive for the include of RFC zones. I did not do that. The only zones that should be known to the server are the two zones i defined: korimort.,freedynamicdns.net and the reverse lookup 1.168.192.in-addr.arpa .As already mentioned i checked the zoone files for syntax and semantics by the tools check-namedconf, check-compilezones, check-namedzones,...
 
Old 11-11-2017, 10:37 AM   #6
Thomas Korimort
Member
 
Registered: Jul 2016
Location: 2640 Enzenreith, Austria
Distribution: Debian/Raspbian
Posts: 63

Original Poster
Rep: Reputation: Disabled
Ok. It seems as if one of two things was the problem. I restarted bind9 by the command /etc/init.d/bind9 restart instead of systemctl restart bind9 or it was because of relative file names. Now, it works. However, one problem remains:

When i add the line you said @ IN A 192.168.1.2 then korimort.freedynamicdns.net is resolved as 192.168.1.2 but in fact it is already resolved to be the dynamic open IP registered in my modem/router. Isn't that inconsistent? Instead, if i declare forwarders then any request for resolving korimort.freedynamicdns.net should be forwarded to outside DNS servers which would resolve it correctly. Thus i can expect, that no time whatsoever my server will be queried for korimort.freedynamicdns.net . I think it would be wrong to return the local IP of my local DNS server as technically korimort.freedynamicdns.net is referencing the domain/subnet that is controlled by my modem/router and not a single network interface in it. If accidentially my server would be requested to resolve korimort.freedynamicdns.net it would be better to return no answer at all, than returning a wrong answer.

What do you say?

As for resolving local names like rpiserver i think i could try to define a zone file for the . domain ?!?!??!
 
Old 11-11-2017, 12:11 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,
Quote:
Ok. It seems as if one of two things was the problem. I restarted bind9 by the command /etc/init.d/bind9 restart instead of systemctl restart bind9 or it was because of relative file names. Now, it works.
Cool!


Quote:
When i add the line you said @ IN A 192.168.1.2 then korimort.freedynamicdns.net is resolved as 192.168.1.2 but in fact it is already resolved to be the dynamic open IP registered in my modem/router. Isn't that inconsistent? Instead, if i declare forwarders then any request for resolving korimort.freedynamicdns.net should be forwarded to outside DNS servers which would resolve it correctly. Thus i can expect, that no time whatsoever my server will be queried for korimort.freedynamicdns.net . I think it would be wrong to return the local IP of my local DNS server as technically korimort.freedynamicdns.net is referencing the domain/subnet that is controlled by my modem/router and not a single network interface in it. If accidentially my server would be requested to resolve korimort.freedynamicdns.net it would be better to return no answer at all, than returning a wrong answer.
If you want to have different name resolutions based on the client (i.e. external or internal), you should use views.
 
Old 11-12-2017, 02:01 AM   #8
Thomas Korimort
Member
 
Registered: Jul 2016
Location: 2640 Enzenreith, Austria
Distribution: Debian/Raspbian
Posts: 63

Original Poster
Rep: Reputation: Disabled
Thanks for the info. I think i stumbled accross the article some time ago. Then i found this XName site to be commercialised. But the view perspective in BIND9 seems a good thing.

I think that it would be more proper to name a name server of No-Ip my DynDNS Provider in the SOA line like

Quote:
korimort.freedynamicdns.net in SOA ns1.freedynamicdns.net tomkori.gmx.net (...)
or maybe i could simply name any name server that has full resolution capabilities for korimort.freedynamicdns.net?

And if i would make an internal name for korimort.freedynamicdns.net shouldn't it be more the IP of my gateway than the IP of my server like 8.8.8.8?

Then also No-IP offers a package that allows for an own DNS server. I am already configuring my DNS server. So why would i need to pay money to No-IP to get a permission to have my own DNS server? Is it because they delegate/forward my korimort domain to my DNS server? Otherwise, if my DNS servers DNS is not mentioned anywhere is there a problem with (reverse) DNS resolution? As long as my router forwards the port to my DNS server, shouldn't my DNS server then be already fully integrated in the whole DNS network? What am i missing here?

Last edited by Thomas Korimort; 11-12-2017 at 02:05 AM.
 
Old 11-12-2017, 09:01 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I think that it would be more proper to name a name server of No-Ip my DynDNS Provider in the SOA line like

korimort.freedynamicdns.net in SOA ns1.freedynamicdns.net tomkori.gmx.net (...)
or maybe i could simply name any name server that has full resolution capabilities for korimort.freedynamicdns.net?
This is already done by no-ip.com.
Code:
dig ns freedynamicdns.net +short
nf3.no-ip.com.
nf2.no-ip.com.
nf1.no-ip.com.
nf4.no-ip.com.
nf5.no-ip.com.

Quote:
Then also No-IP offers a package that allows for an own DNS server. I am already configuring my DNS server. So why would i need to pay money to No-IP to get a permission to have my own DNS server?
You have to pay them, because they are the registrar of freedynamicdns.net. So if you want to run your own dns for the subdomain korimort.freedynamicdns.net, you need them to delegate it to you.
Without the delegation no-one from outside your network could ever resolve your (sub)domain
 
1 members found this post helpful.
  


Reply



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
troubleshooting a simple dns server connection vincix Linux - Newbie 7 02-05-2014 01:43 AM
[SOLVED] Minimum Partition Size Required in Redhat Linux Server for DNS Server Configuration vamshi_krishv Linux - Server 3 05-06-2011 01:08 AM
DNS SERVER Configuration Help akhtar.bhat Linux - Server 4 01-22-2009 11:56 PM
DNS Server Configuration vinhhv Linux - Networking 1 09-16-2003 07:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:46 PM.

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
Open Source Consulting | Domain Registration