5

I tried to set up bind DNS in Ubuntu.

I have 2 machine:

machine A is client:

IP: 192.168.190.176  
hostname: example.com 

machine B is DNS Server:

IP: 192.168.190.171 

In DNS server:

/etc/bind/named.conf.local:

zone "example.com" {
        type master;
        file "/etc/bind/db.example.com";
};
//reverse zone
zone "190.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192";
};

/etc/bind/db.example.com:

$TTL    604800
@       IN      SOA     example.com.        root.example.com. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      example.com.
@       IN      A       192.168.190.176
@       IN      AAAA    ::1

/etc/bind/db.192:

$TTL    604800
@       IN      SOA     example.com. root.example.com. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      example.com.
176.190.168     IN      PTR     example.com.

And in Client:

nslookup 192.168.190.176
Server:     192.168.190.171
Address:    192.168.190.171#53

** server can't find 176.190.168.192.in-addr.arpa: NXDOMAIN

Can you fix it?

UPDATE: I try with nslookup example.com

server can't find example.com: SERVFAIL

  • 1
    Just use 176 IN PTR example.com. – heemayl Apr 23 '17 at 15:39
5

You are overdoing it.

In your /etc/bind/named.conf.local file, you have already declared the snippet for reverse zone 190.168.192.in-addr.arpa i.e. 192.168.190:

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

Now in /etc/bind/db.192 file, you just need to refer to the last octet of the IP address, not the whole address; in fact, even more than one octet would be incorrect.

Presumably you are planning to assign 176 as the last octet i.e. the PTR RR, so just add:

176     IN      PTR     example.com.
  • But i try test with nslookup example.com, it don't work – QChí Nguyễn Apr 23 '17 at 16:10
  • I found resolve way, just ping -a ip – QChí Nguyễn Apr 23 '17 at 16:46
  • 1
    dig is your friend for testing DNS – eckes Apr 23 '17 at 18:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.