I have a VPS (running Debian) and a domain ("mydomain.net"). What I want to achieve is this: I want to create a subdomain "home.mydomain.net" for dynamic hosts in my home, e.g. my NAS etc., so that I can resolve my NAS from everywhere with "nas.home.mydomain.net". (In the end I want to build my own DynDNS service, but the update part etc. is not the point here, I can handle that.)

Let's assume that I want to have a DNS entry for test.home.mydomain.net that points to for now (as I can be sure that there will be an ICMP echo, I can change that later).

From what I read while researching how to configure things, I think I need to have these things:

  • a BIND9 DNS server running on my VPS
  • an A record in mydomain.net's DNS zone pointing to my own DNS server
  • an NS record in mydomain.net's DNS zone that delegates requests for home.mydomain.net to the aforementioned nameserver on my VPS

In my VPS administration backend I can edit the DNS zone for my mydomain.net and I added the entries mentioned above, these are the entries now ( stands for the fixed IPv4 address of my VPS):

mydomain.net        86400   SOA 0   ns1.myprovider.net. hostmaster.myprovider.net. 2018041707 3600 1200 2419200 86400   
mydomain.net        86400   NS  0   ns1.myprovider.net  
mydomain.net        86400   NS  0   ns2.myprovider.net  
mydomain.net        86400   NS  0   ns3.myprovider.net  
home.mydomain.net   86400   NS  0   ns.mydomain.net 
ns.mydomain.net     86400   A   0
mydomain.net        86400   A   0
www.mydomain.net    86400   A   0

Is this correct so far? At this point I can successfully ping ns.mydomain.net.

When I do an nslookup www.mydomain.net from a separate Windows box, it gets resolved correctly to

When I try to lookup something not existing like nslookup xyz.mydomain.net, I get an instant answer that the domain is not existing.

When I try to resolve e.g. test.home.mydomain.net, it takes some seconds until I get DNS request timed out.. From what I understand, this is correct so far, is it? The DNS request gets delegated to ns.mydomain.net, but there's nothing answering yet, so I get a timeout.

Next step: installing and configuring BIND9 on my Debian VPS. I freshly installed it (apt install bind9). Now I want to set it up in such a way that it only takes care of resolving hosts in home.mydomain.net. I don't need a full-grown DNS server that forwards for arbitrary requests etc., all I need is that it "feels responsible" for hosts in home.mydomain.net and (for now) resolves test.home.mydomain.net to There's an overwhelming amount of information on bind9 configuration, but I did not manage to find out what exactly I need to do. Here's what I tried:

(Updated) This is my /etc/bind/named.conf.local:

zone "home.mydomain.net" {
    type master;
    file "/etc/bind/db.home.mydomain.net";

And this is the corresponding /etc/bind/db.home.mydomain.net:

$TTL 5
@ IN SOA ns.mydomain.net. root.mydomain.net. (
ns.mydomain.net  IN      A    [My NS IPv4 address]
ns.mydomain.net  IN      AAAA [My NS IPv6 address]
test             IN      A

This does not work after restarting bind9, I can't resolve test.home.mydomain.netto, I'm still running into a request timeout. I think I might not have completely understood the role of the SOA record, otherwise I missed something else. Can anybody tell me what's missing and/or wrong?


The above configuration works now - after adding A and/or AAAA records for my nameserver. It feels a bit strange that you have to give these records as they point to itself? Why is that?

  • 2
    While I am not 100% sure, the trailing dot in zone name in zone statement may be an issue here. Are there any messages in the logs? Is there /etc/bind/named.conf file which includes /etc/bind/named.conf.local file? Do you have a firewall on your VPS? If yes - are TCP and UDP ports 53 open? – Tomek Apr 18 '18 at 19:37
  • You're right, the dot in the zone name was wrong. Besides that, I got it working and I updated the question with my current config. I still wonder why I have to add A/AAAA records for the nameserver itself? – Alex Apr 19 '18 at 4:34

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.