Very simple bind9 DNS server - dns

I am using Debian server 10 and bind9 for my DNS server network, I want very simple working with DNS server, my topology is like below:
client <-> DNS <-> voip.example.com
client IP: 172.17.106.9
client DNS primary: 172.17.106.15
client DNS secondary: 8.8.8.8
DNS IP: 172.17.106.15
voip.example.com IP: 172.17.106.12
I want to check the DNS records when each request is received from the client, and if it does not match, go to the secondary DNS stored in the client's secondary DNS(8.8.8.8)
I get this error on client cmd:
C:\Users\Farhad>nslookup voip.example.com
Server: ns1.example.com
Address: 172.17.106.15
*** ns1.example.com can't find voip.example.com: Server failed
my bind9 configuration is here:
/etc/bind/named.conf.local
zone "example.com" {
type master;
file "/etc/bind/db.example.com"; # zone file path
};
zone "17.172.in-addr.arpa" {
type master;
file "/etc/bind/db.172.17"; # 172.17.0.0/16 subnet
};
/etc/bind/named.conf.options
acl "trusted" {
172.17.106.15; # ns1
172.17.106.9; # client
172.17.106.12; # VoIP
};
options {
directory "/var/cache/bind";
recursion yes; # enables resursive queries
allow-recursion { trusted; }; # allows recursive queries from "trusted" clients
listen-on { 172.17.106.15; }; # ns1 private IP address - listen on private network only
allow-transfer { none; }; # disable zone transfers by default
forwarders {
8.8.8.8;
8.8.4.4;
};
};
/etc/bind/db.example.com
$TTL 604800
# IN SOA ns1.example.com. f.example.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
; name servers - NS records
IN NS ns1.example.com.
; name servers - A records
ns1.example.com. IN A 172.17.106.15
; 172.16.0.0/16 - A records
voip.example.com. IN A 172.17.106.12
/etc/bind/db.172.17
$TTL 604800
# IN SOA ns1.example.com. f.example.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
; name servers
IN NS ns1.example.com.
; PTR Records
15.106 IN PTR ns1.example.com. ; 172.17.106.15
12.106 IN PTR voip.example.com. ; 172.17.106.12

now it works fine with changed db.example.com and delete ns2 record and resolve exactly IP address of voip.example.com
but my primary issue still exist:
I want to check the DNS records when each request is received from the client, and if it does not match, go to the secondary DNS stored in the client's secondary DNS(8.8.8.8)
for example some client request to reach test.com , and client have primary dns 172.17.106.15 and secondary dns 8.8.8.8
query reviced from client to my dns server 172.17.106.15, but did not go to 8.8.8.8

Related

Using parked GoDaddy domain on Amazon Route 53 - import zone file failed

I am trying to use my parked GoDaddy domain name with AWS Elastic Beanstalk and followed as the answer from this question . I had a problem at step 4. I imported a zone file for windows from GoDaddy and when I imported it returned me a parsing error at PARKED. My import file looks like this:
; SOA Record
***.com. 600 IN SOA ***.***.com. dns.***.net (
--------
-----
----
-----
---
)
; A Records
# 600 IN A >>++PARKED1++<<
; CNAME Records
_domainconnect 3600 IN CNAME ***.**.****.com
www 3600 IN CNAME #
ftp 3600 IN CNAME #
; NS Records
# 3600 IN NS ***.****.com
# 3600 IN NS ***.****.com
I read AWS documentation on migrating DNS but it only says to just import. So what should I change in the settings or the import file?
You should use the IP address of your AWS Elasatic Beanstalk app. The A record is where your domain is pointing.
A Records point to IP addresses
CNAME points to another domain.
Simple A Record vs CNAME explanation

How to properly setup a bind9 DNS server on a Debian 8.7 droplet

I have bind9 setup on my old DO droplet (Debian 7.11) and everything was working great. I decided to setup a new droplet (Debian 8.7) and configure bind9 today.
On the old Debian 7 droplet I had it configured to be authoritative name server with the following names, ns1.example.com and ns2.example.com.
I registered the example.com domainname through GoDaddy, and set it point to my external name servers ns1.example.com ns2.example.com using their web interface.
However, DNS does not appear to be working on the Debian 8.7 droplet when I tried to set it up.
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";
// 107.170.40.252 <= public IP v4
zone "example.com" {
type master;
file "/etc/bind/zones/master/db.example.com";
};
zone "252.40.170.107.in-addr.arpa" {
type master;
file "/etc/bind/zones/master/db.107.170.40";
};
db.example.com
;
; BIND data file for example.com
;
$TTL 86400
# IN SOA ns1.example.com. chris.example.com. (
1 ; Serial
3h ; Refresh after 3 hours
1h ; Retry after 1 hour
1w ; Expire after 1 week
1h ) ; Negative caching TTL of 1 day
;
# IN NS ns1.example.com.
# IN NS ns2.example.com.
example.com. IN MX 10 mail.example.com.
example.com. IN A 107.170.40.252
ns1 IN A 107.170.40.252
ns2 IN A 107.170.40.252
www IN CNAME example.com.
db.107.170.40
;
; Addresses and other host information
;
$TTL 86400
# IN SOA example.local. hostmaster.example.local. (
2013090501 ; Serial
43200 ; Refresh
3600 ; Retry
3600000 ; Expire
2592000) ; Minimum
40.170.107.in-addr.arpa. IN NS dns.example.local.
252 IN PTR mail.example.local.
252 IN PTR ns1.example.local.
252 IN PTR ns2.example.local.
Any help on this matter would greatly be appreciated.
It ended up being a setting in the GoDaddy web interface.

BIND9 constant servfail

I want to create dns server on my VPS and add a domain to it from another provider. Domain is set in provider's panel to VPS as dns1 and sdns2.ovh.net as dns2. I'm getting SERVFAIL from dig over and over again and since I'm new to this I'm out of moves. What is wrong?
my zone file for domain.com:
$TTL 604800
# IN SOA ns1.domain.com. root.ns1.domain.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
# IN NS ns1.domain.com.
# IN NS ns2.domain.com.
# IN A 176.31.189.10
ns1 IN A 176.31.189.10
ns2 IN A 213.251.188.141
named-checkzone shows OK
named.conf entry:
zone "domain.com" {
type master;
file "db.domain.com";
};
named.conf.options:
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no;
listen-on-v6 port 53 {
any;
};
listen-on port 53 {
any;
};
};
Port 53 is allowed by firewall in/out. Bind service is active.
I'm getting dig SERVFAIL all the time.
My dns2 provider requires "ownercheck" but i cant do it since it looks like the zone file is not being read anyhow.
Please help.
problem solved
server was failing to load zone file - lack of full address
What helped in my case was to ensure that /etc/bind was actually writable by the bind user, since bind tries to place a compiled *.jnl file of the zone file there.
Also, enabling full logging helps to spot newbie errors like this easily... :)

Unable to add new domain to server via bind

I've tried several times to add a new domain to my server. I have the main domain working properly which I added via BIND
/etc/bind/named.conf.local for the main domain:
zone "maindomain.com" {
type master;
file "/etc/bind/zones/maindomain.com.db";
};
The domain has the following nameservers: ns1.maindomain.com and ns2.maindomain.com (self-appointed, work fine so far)
The zone configuration for this domain:
$TTL 1500
# IN SOA maindomain.com. root (
2007062703 ;serial
28800 ;refresh
3600 ;retry
604800 ;expire
38400 ) ;minimum 25 minutes
# IN A 92.114.82.208
maindomain.com. IN NS ns1.maindomain.com.
ns1 IN A 92.114.82.208
ns2 IN A 92.114.82.208
ns3 IN A 92.114.82.208
Anyhow, I have not managed to add a new domain on the same server with the following configuration:
/etc/bind/named.conf.local now has:
zone "maindomain.com" {
type master;
file "/etc/bind/zones/maindomain.com.db";
};
zone "maindomain2.com" {
type master;
file "/etc/bind/zones/maindomain2.com.db";
};
maindomain2.conf zone:
$TTL 1500
# IN SOA maindomain2.com. root (
2007062703 ;serial
28800 ;refresh
3600 ;retry
604800 ;expire
38400 ) ;minimum 25 minutes
# IN A 92.114.82.208
ns IN A 92.114.82.208
ns2 IN A 92.114.82.208
Through this configuration I have appointed the NS to maindomain2.com via the NameServer edit function:
ns.maindomain2.com
ns2.maindomain2.com
Appointed them to 92.114.82.208
Having done this the domain has not linked with the server, tried several restarts, several other configurations which were not successful - the NS do not solve, the domain does not solve to DNS.
Any ideas, please?

How to link a domain name to a server

I'm quite new to setting up webservers without a control panel. I've looked around answered questions on the site, but with no luck. With that said I've experimented a little to resolve my problem.
Basically I'm running bind9 on ubuntu 12.04 and I'm trying to bind a domain name I got from namecheap to the server. rDNS has been set up as are the nameservers with namecheap. I can obviously connect to my server with the IP which is 199.168.141.44. The domain I'm trying to get to work is www.aria-roleplay.com with nameservers ns1.aria-roleplay.com and ns2.aria-roleplay.com.
My httpd.conf file looks like this:
<VirtualHost *:80>
ServerAdmin admin#localhost
DocumentRoot "/var/www/"
ServerName www.aria-roleplay.com
</VirtualHost>
/etc/bind/db.linux_rocks
;
;BIND data file for local loopback interface
;
$TTL 604800
# IN SOA V-7848.linux.rocks. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 : Expire
604800 ) ; Negative Cache TTL
;
# IN NS V-7848.linux.rocks.
# IN A 127.0.0.1
# IN AAAA ::1
; Below are A Record Addresses
www.aria-roleplay.com IN A 199.168.141.44
dig aria-roleplay.com
; <<>> DiG 9.8.1-P1 <<>> aria-roleplay.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 34790
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;aria-roleplay.com. IN A
;; Query time: 4348 msec
;; SERVER: 199.168.141.44#53(199.168.141.44)
;; WHEN: Tue Aug 6 14:26:50 2013
;; MSG SIZE rcvd: 35
How am I going to get this to work?
If all you're trying to do is point a domain name to your server the easier way to do it is to just use your registrar's DNS servers (I know namecheap has some) and set up the A records to point to your server's IP address. This is pretty much the same as doing it your way however you're taking out the pain of running your own DNS server.
You can still host multiple sites on your machine, just create separate vhosts for each site and create the relevant A records for each domain in your namecheap account.

Resources