1

Brief Introduction

I bought a domain name example.ir from my country domain name provider nic.ir and a VPS from examplevps.ir.
My VPS gave me an static IP and let's imagine it's: 170.120.100.140
Installed a web server running on localhost 127.0.0.1 and eth0 170.120.100.140.
I can connect to my VPS through ssh and do whatever I want and I'm a newbie... my first VPS.

What have I done?

Actually setup my bind9 like this:

named.conf.local

zone "example.ir" {
     type master;
     file "/etc/bind/db.example.ir";
};

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

db.example.ir

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

db.170

$TTL    604800
@   IN  SOA example.ir. root.example.ir. (
                  2     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  example.ir.
170 IN  PTR example.ir.

and also never forget to: service bind9 restart

What Do I Expect?

root@examplevps$ nslookup example.ir
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   example.ir
Address: 170.120.100.140

This is what I get

root@examplevps$ nslookup example.ir
;; Got SERVFAIL reply from 8.8.8.8, trying next server
Server:     4.2.2.4
Address:    4.2.2.4#53

** server can't find example.ir: SERVFAIL

Conclusion

Based on information I provided above it's completely clear what I want... and I think I must do something like:

  +------------------+
  |      My VPS      |
  |  170.120.100.140 |
  +------------------+
           |
  +------------------+
  | ns.examplevps.ir |  bind 170.120.100.140 > example.ir
  +------------------+
           |
  +------------------+
  |      nic.ir      |  bind ns.examplevps.ir > nic.ir
  +------------------+

I read many pages online but still can't figure out how it works.

1 Answer 1

0

You need to allow queries from evereywhere. Either add the following to each of the zone statements in named.conf.local to individually allow zones to be queried or add it in the named.conf.options to allow all zones to be queried:

allow-query { any; };

I recommend using dig to debug:

apt-get install dnsutils # for debian/ununtu
dig +trace example.ir

Further you need to point your nic to your nameserver. This is usually done in the nic's web interface, where you specify glue records for each zone with the nameserver serving the zone in the form of:

ns.example.ir -> 170.120.100.140

Most likely you will also have to provide 2 nameservers. You can point them to the same IP, although you will probably get a warning message, that not 2 distinct IP addresses are used.

ns1.example.ir -> 170.120.100.140
ns2.example.ir -> 170.120.100.140

You also need to define the glue records in your dns server's zone:

@    IN    SOA  ns1.example.ir. hostmaster.example.ir. (
                                   ...
                                   (
@    IN    NS    ns1
@    IN    NS    ns2
...
ns1  IN    A     170.120.100.140
ns2  IN    A     170.120.100.140
...
2
  • thanks for mentioning Glue Records and yes it worked but allow-query { any;} raised an error. Jun 2, 2016 at 12:43
  • You're welcome. It should be allow-query { any; }; with a semicolon after the brackets.
    – rda
    Jun 2, 2016 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .