2

I'm trying to learn BIND9. I've set up a home lab with my primary desktop running the bind server, a laptop, and a virtualbox ubuntu server 16.04 vm on a bridge connection running apache.

  • I can ping all machines from every machine using their IP addresses.
  • I can ssh into all machines from every machine.
  • I cannot resolve even the nameserver on the desktop with ping, nor will it resolve any machines from any of the machines.
  • No firewall is up on any machine in order to keep it simple for troubleshooting.
  • My connection to the wan is working normally from all machines.
  • Also, I'm not running a dns cache server
  • Neither named-checkzone or named-checkconf report errors in the configs

EDIT: when I use host while enforcing the desktop as the dns server (host nlab.local 192.168.1.2), everything works as expected from both the desktop and vm. This fails when I use host without specifying a dns server.

1/2 SOLUTION: I edited the head file (/etc/resolvconf/resolvconf.d/head) of my resolver and ran sudo resolvconf -u such that my localhost resolved before everything else. However, this is a potential problem, since it will cause all the other hosts to have to point their resolvers at the server for this to work, and it may slow them down or disrupt subsequent resolution. After all, the resolver never went down far enough to hit my localhost before. It just timed out on ping and the other tools (dig, host) didn't even bother trying. So, it's a bit of a half solution, which is why I'm not marking this solved yet. Also, it's weird that the dns settings in the interfaces file won't force the resolution. I'm left to wonder why such a line exists in static setups if the machine just goes to resolv.conf for nameservers.

Bind config files on the desktop:

named.conf

include "/etc/bind/named.conf.options"; 
include "/etc/bind/named.conf.local"; 
include "/etc/bind/named.conf.default-zones";

logging {   
    channel query.log {
        file "/var/log/query.log";  severity debug 3;   
    };  
    category queries { query.log; }; 
};

named.conf.local

zone "nlab.local" {
         type master;
         file "/etc/bind/db.nlab.local";
    };

zone "1.168.192.in-addr.arpa" {
        type master;
        notify no;
        file "/etc/bind/db.192";
};

named.conf.options

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable 
    // nameservers, you probably want to use them as forwarders.  
    // Uncomment the following block, and insert the addresses replacing 
    // the all-0's placeholder.

    // forwarders {
    //  0.0.0.0;
    // };

    //========================================================================
    // If BIND logs error messages about the root key being expired,
    // you will need to update your keys.  See https://www.isc.org/bind-keys
    //========================================================================
    dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
    allow-query { any; };

};

db.nlab.local

;
; BIND data file for nlab.local
;
$TTL    604800
@   IN  SOA ns.nlab.local. ike.nlab.local. (
                 11     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  ns.nlab.local.
@   IN  A   192.168.1.2
@   IN  AAAA    ::1
ns  IN  A   192.168.1.2
ns1 IN  A   192.168.1.12
nc1 IN  A   192.168.1.9
nightfall IN    CNAME   ns
freefall  IN    CNAME   nc1

db.192

;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     ns.nlab.local. root.nlab.local. (
                              5         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      ns.
2      IN      PTR     ns.nlab.local.

; also list other computers
12     IN      PTR     ns1.nlab.local.
9      IN      PTR     nc1.nlab.local.

My desktop IP is static, configured through network-manager, since modifying my /etc/network/interfaces manually keeps my networking.service from starting. Maybe that's a clue, but I don't know how to decipher it. However, I was able to set the static ip on the interfaces file in the vm, which originally ran the bind server (now disabled), and while I was able to resolve addresses on that machine, it still wasn't broadcasting to the other machines with these same configs.

IP: 192.168.1.2

Gateway: 192.168.1.1

DNS: 127.0.0.1, 8.8.8.8, 8.8.4.4

Diagnostics: On the desktop

netstat -naptu | grep 53

tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      9324/dnsmasq    
tcp        0      0 192.168.1.2:53          0.0.0.0:*               LISTEN      1540/named      
tcp        0      0 172.17.0.1:53           0.0.0.0:*               LISTEN      1540/named      
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1540/named      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1531/sshd       
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1540/named      
tcp        0      0 192.168.1.2:51444       34.211.99.53:443        TIME_WAIT   -               
tcp        0      0 192.168.1.2:44613       192.52.178.30:53        TIME_WAIT   -               
tcp       32      0 192.168.1.2:54530       162.125.5.3:443         CLOSE_WAIT  2976/dropbox    
tcp        0      0 192.168.1.2:41171       192.12.94.30:53         TIME_WAIT   -               
tcp        1      0 192.168.1.2:53664       54.236.121.227:443      CLOSE_WAIT  2976/dropbox    
tcp6       0      0 :::22                   :::*                    LISTEN      1531/sshd       
udp        0      0 127.0.0.1:60178         127.0.0.1:53            ESTABLISHED 2372/Plex DLNA Serv
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           1285/avahi-daemon: 
udp        0      0 127.0.0.1:46562         127.0.0.1:53            ESTABLISHED 2372/Plex DLNA Serv
udp        0      0 127.0.0.1:38551         127.0.0.1:53            ESTABLISHED 3715/plugin_host
udp        0      0 127.0.1.1:53            0.0.0.0:*                           9324/dnsmasq    
udp        0      0 192.168.1.2:53          0.0.0.0:*                           1540/named      
udp        0      0 172.17.0.1:53           0.0.0.0:*                           1540/named      
udp        0      0 127.0.0.1:53            0.0.0.0:*                           1540/named      
udp6       0      0 :::5353                 :::*                                1285/avahi-daemon: 

host works, I guess:

$ host nlab.local
nlab.local has address 192.168.1.2

$ host ns1.nlab.local
ns1.nlab.local has address 192.168.1.12

When forcing a server

$ host nlab.local 192.168.1.2
Using domain server:
Name: 192.168.1.2
Address: 192.168.1.2#53
Aliases: 

nlab.local has address 192.168.1.2
nlab.local has IPv6 address ::1

And ping fails:

$ ping nlab.local
ping: unknown host nlab.local

$ ping ns1.nlab.local
ping: unknown host ns1.nlab.local

The ping failures take several seconds to resolve.

dig gives this response:

$ dig nlab.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> nlab.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61277
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;nlab.local.            IN  A

;; ANSWER SECTION:
nlab.local.     604800  IN  A   192.168.1.2

;; AUTHORITY SECTION:
nlab.local.     604800  IN  NS  ns.nlab.local.

;; ADDITIONAL SECTION:
ns.nlab.local.      604800  IN  A   192.168.1.2

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Apr 03 12:50:55 EDT 2018
;; MSG SIZE  rcvd: 88

From the ubuntu server vm:

$ dig nlab.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> nlab.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 24440
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;nlab.local.            IN  A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Apr 03 12:59:11 EDT 2018
;; MSG SIZE  rcvd: 28

This is the vm's /etc/network/interfaces file:

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet static
address 192.168.1.12
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.2 8.8.8.8 75.75.75.75

Logging is working and the server is receiving queries from the apps on the desktop. I do not see any queries from the vm.

Thanks in advance for any assistance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.