I’m new to DNS setup and followed several instructions on setting up Bind DNS. Below is my zone file:
; $TTL 604800 @ IN SOA sandbox.svr. root.viper.sandbox.svr. ( 13 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; ; Name servers @ IN NS sandbox.svr. @ IN A 192.168.1.7 ; A records for name servers viper.sandbox.svr IN A 192.168.1.7 viper IN A 192.168.1.7 ; ; BIND reverse data file for local loopback interface ; $TTL 604800 @ IN SOA viper.sandbox.svr. root.sandbox.svr. ( 11 ;Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; ; name servers - NS Records @ IN NS viper.sandbox.svr. ; PTR Records 10 IN PTR viper.sandbox.svr.
When I run
dig sandbox.svr
It doesn’t return any A record.
but when I test with:
dig viper.sandbox.svr
it does return A records:
root@viper:/var/log# dig viper.sandbox.svr ; <<>> DiG 9.16.1-Ubuntu <<>> viper.sandbox.svr ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 489 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 65494 ;; QUESTION SECTION: ;viper.sandbox.svr. IN A ;; ANSWER SECTION: viper.sandbox.svr. 0 IN A 192.168.1.7 ;; Query time: 0 msec ;; SERVER: 127.0.0.53#53(127.0.0.53) ;; WHEN: Fri Oct 16 20:16:56 WAT 2020 ;; MSG SIZE rcvd: 62
What I could I be doing wrong? My config is for a local environment and running on Ubuntu 20.04 Desktop.
Please see the syslog output below.
Oct 18 08:52:59 viper named[312379]: using default UDP/IPv4 port range: [32768, 60999] Oct 18 08:52:59 viper named[312379]: using default UDP/IPv6 port range: [32768, 60999] Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface lo, 127.0.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface enp0s31f6, 192.168.1.7#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface virbr0, 192.168.122.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-048207a4c5eb, 172.19.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-22b8ad392785, 172.23.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-48aff5a17a13, 172.18.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-7ce2fd66ca47, 172.21.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-c5039c7c4806, 172.20.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface docker0, 172.17.0.1#53 Oct 18 08:52:59 viper named[312379]: listening on IPv4 interface br-c89505e1a15e, 172.22.0.1#53 Oct 18 08:52:59 viper named[312379]: unable to set effective uid to 0: Operation not permitted Oct 18 08:52:59 viper named[312379]: generating session key for dynamic DNS Oct 18 08:52:59 viper named[312379]: unable to set effective uid to 0: Operation not permitted Oct 18 08:52:59 viper named[312379]: sizing zone task pool based on 7 zones Oct 18 08:52:59 viper named[312379]: none:100: 'max-cache-size 90%' - setting to 14184MB (out of 15760MB) Oct 18 08:52:59 viper named[312379]: obtaining root key for view _default from '/etc/bind/bind.keys' Oct 18 08:52:59 viper named[312379]: set up managed keys zone for view _default, file 'managed-keys.bind' Oct 18 08:52:59 viper named[312379]: none:100: 'max-cache-size 90%' - setting to 14184MB (out of 15760MB) Oct 18 08:52:59 viper named[312379]: configuring command channel from '/etc/bind/rndc.key' Oct 18 08:52:59 viper named[312379]: command channel listening on 127.0.0.1#953 Oct 18 08:52:59 viper named[312379]: configuring command channel from '/etc/bind/rndc.key' Oct 18 08:52:59 viper named[312379]: couldn't add command channel ::1#953: address not available Oct 18 08:52:59 viper named[312379]: managed-keys-zone: loaded serial 40 Oct 18 08:52:59 viper named[312379]: zone 1.168.192.in-addr.arpa/IN: loaded serial 11 Oct 18 08:52:59 viper named[312379]: zone 127.in-addr.arpa/IN: loaded serial 1 Oct 18 08:52:59 viper named[312379]: zone 0.in-addr.arpa/IN: loaded serial 1 Oct 18 08:52:59 viper named[312379]: zone 255.in-addr.arpa/IN: loaded serial 1 Oct 18 08:52:59 viper named[312379]: zone localhost/IN: loaded serial 2 Oct 18 08:52:59 viper named[312379]: zone sandbox.svr/IN: loaded serial 197 Oct 18 08:52:59 viper named[312379]: all zones loaded Oct 18 08:52:59 viper named[312379]: running Oct 18 08:52:59 viper named[312379]: zone sandbox.svr/IN: sending notifies (serial 197) Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:200::b#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:1::53#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2::c#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:503:c27::2:30#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2d::d#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:12::d0d#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:503:ba3e::2:30#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:2f::f#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:9f::42#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:7fe::53#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:500:a8::e#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:7fd::1#53 Oct 18 08:52:59 viper named[312379]: address not available resolving './NS/IN': 2001:dc3::35#53 Oct 18 08:53:00 viper named[312379]: managed-keys-zone: Key 20326 for zone . is now trusted (acceptance timer complete) Oct 18 08:53:00 viper named[312379]: resolver priming q
I tried to troubleshoot by removing my internet connection and noticed that dig responded with the A records but once connected to the intenet, it doesn’t. Is there a way to make the local DNS resolve for local query and forward public name to say google dns server?
Answer
Please add:
@ IN A 192.168.1.7
Then it will answer for pure domain query, without hostname.
Thanks,
Attribution
Source : Link , Question Author : ojoma , Answer Author : Drixter