I have a requirement to setup a DNS server for internal name resolution and also forward query for certain public domains.
OS: Ubuntu 18.04 Bind: BIND 9.11.3-1ubuntu1.15-Ubuntu
Following is the current configuration. There is no issue for internal name resolution, however external resolution is not working. It seems named still trying to connect root domain instead of forward the query to 8.8.8.8. Any suggestions?
dig @127.0.0.1 google.com
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> @127.0.0.1 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 13713
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 40829a5298a0f45bbf5dab9d60d3c18125ca9f1e90d2092f (good)
;; QUESTION SECTION:
;google.com. IN A
;; AUTHORITY SECTION:
. 300 IN SOA ns. hostmaster.xy.com. 20120101 1800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jun 23 23:19:29 UTC 2021
;; MSG SIZE rcvd: 118
named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
named.conf.options
acl "trusted" {
localhost;
localnets;
};
options {
directory "/var/cache/bind";
version "not currently available";
listen-on { any; };
allow-query { trusted; };
recursion yes;
allow-transfer { none; };
dnssec-enable no;
dnssec-validation no;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { none; };
};
named.conf.local
zone "service.subdomain.local" IN {
type master;
file "/etc/bind/zones/forward.subdomain.local.local";
allow-update { none; };
};
zone "google.com" IN {
type forward;
forward only;
forwarders { 8.8.8.8; };
};
zone "." IN {
type master;
file "/etc/bind/fake.root";
};