How to resolve a DNS name for the same zone that is not found locally but exists on a different DNS server?

I need to start the local BIND DNS server for the Linux Containers series. Say zone example.com

My infrastructure already has an example.com domain, which I want to redefine some records using my local DNS server (it should be DNS, not local hosts).

Is there a way to tell BIND to check my local DNS server, and if the record is not found, find the record for the same zone on another DNS server.

I tried setting up forwarders, but I would say that this is only for different zones and not in the same zone.

Any ideas?

+4
source share
3 answers

There is no easy way to do what you want.

For a tedious decision, you can define a zone file for each DNS name that you want to override in the parent zone, for example:

named.conf:

zone "foo.domain" { type master; file "foo.domain"; } zone "bar.domain" { type master; file "bar.domain"; } 

foo.domain:

 foo.domain. SOA ... NS foo.domain. A 1.2.3.4 

bar.domain:

 bar.domain. SOA ... NS foo.domain. A 2.3.4.5 
+4
source

You can use the response policy zone (in the rpz name), which allows you to override any name requested through your bind server.

The paths relate to Debian.

In the options /etc/bind/named.conf.options section, add:

 options { # Create a response-policy zone to allow overrides response-policy { zone "rpz"; }; }; 

Add the rpz zone to /etc/bind/named.conf.local :

 zone rpz { type master; file "/etc/bind/db.rpz"; allow-query { none; }; }; 

Finally, the rpz zone rpz /etc/bind/db.rpz :

 ; BIND zone file for rpz zone ; $TTL 600 @ SOA localhost. root.localhost. ( 2017100300 ; Serial 86400 ; Refresh 10800 ; Retry 3600000 ; Expire 600 ; Negative Cache TTL ) NS localhost. google.com CNAME forcesafesearch.google.com. example.com A 192.0.2.123 
+1
source

You can also try using bind forwarders . Basically, your DNS server (if it does not know the answer) will ask for forwarding (s) to resolve the IP address.

Ie:

 # vi /etc/bind/named.conf.options options { directory "/var/cache/bind"; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; listen-on { 127.0.0.1; 192.168.1.0/24; }; forwarders { 10.138.27.194; }; }; 
0
source

Source: https://habr.com/ru/post/1501284/


All Articles