Score:0

BIND9: Host xxxxx not found: 2(SERVFAIL)

lu flag

I've installed and set up the bind9 DNS server on UbuntuServer 22.04.3.

Then I've checked my hosts. And I have got an error:

host host1
Host host1 not found: 2(SERVFAIL)

But the reverse operation works without any problem.

host 192.168.0.16
16.0.168.192.in-addr.arpa domain name pointer host1.

My forward zone is:

;
$TTL    604800
@       IN      SOA     ns.obfuscated.com. root.ns.obfuscated.com. (
                              3         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
; name servers - NS records
@       IN      NS      ns.obfuscated.com.

; name servers - A records
ns  IN A       192.168.0.101

; 192.168.0.0/24 - A records
host3   IN A     192.168.0.201 ; 
host2   IN A     192.168.0.250 ; 
host1   IN A     192.168.0.16  ; 

The zones file is:

zone "obfuscated.com" {
        type master;
        file "/var/lib/bind/forward.bind";
        check-names ignore;
        };
zone "0.168.192.in-addr.arpa" {
        type master;
        file "/var/lib/bind/reverse.bind";
        check-names ignore;
         };

The Netplan config:

network:
  ethernets:
    ens33:
      addresses:
      - 192.168.0.101/24
      nameservers:
        addresses: [192.168.0.101, 192.168.0.1]
        search: [ obfuscated.com ]
      routes:
      - to: default
        via: 192.168.0.1

I'm positive in mistakes of the forward.bind file, but can't find them. The named-checkzone command has no errors.

HBruijn avatar
in flag
Simplified: DNS only works for FQDN's and requires that a resolver appends a search domain to unqualified / short hostnames before using DNS to resolve them. What happens when you directly query your name server with the FQDN? `dig host1.obfuscated.com. @192.168.0.101`
Ilya Shmadchenko avatar
lu flag
HBruijn, I have that answer: ```;; QUESTION SECTION: ;host1.obfuscated.com. IN A ;; ANSWER SECTION: host1.obfuscated.com. 604800 IN A 192.168.0.16 ;; Query time: 0 msec ;; SERVER: 192.168.0.101#53(192.168.0.101) (UDP) ;; WHEN: Mon Aug 21 14:06:46 MSK 2023 ;; MSG SIZE rcvd: 97 ```
HBruijn avatar
in flag
So there is nothing wrong with how bind is configured. I never use `host` but if that is a utility to query DNS it probably expects, like `dig` a FQDN and doesn't append the search domain to short hostnames. If that is the case, then there was no fault, except in how you went about testing. `getent hosts shortname` is the tool to test how the system resolver library works (as that honors `/etc/nsswitch.conf`, /`etc/hosts`, search domains and more)
Nikita Kipriyanov avatar
za flag
@HBruijn no, `host` uses system resolver settings, e.g. `resolv.conf` or whatever. It respects the search suffixes specified there. Very useful tool to check the local resolver, and as we see here, it seems it isn't configured correctly. But `SERVFAIL` is strange. I'd run `host -v host1` to see more details about the query it sent; however, if the problem is resolver, I am not familiar with Netplan, I don't know how to fix that.
Ilya Shmadchenko avatar
lu flag
@HBruijn, and what if I need to use only shortnames?
Ilya Shmadchenko avatar
lu flag
@NikitaKipriyanov, there's a result: ```host -v host1 Trying "host1.obfuscated.com" Trying "host1" Host host1 not found: 2(SERVFAIL) Received 29 bytes from 127.0.0.53#53 in 0 ms ```
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.