How to define a subdomain in nsd3
nsd3 is very little-known but super-lightweight and stable DNS server which makes it a great alternative to bind9 for low-end boxes. There is a very good tutorial here on how to set up nsd3 on debian server.
My problem is that I need to set up a subdomain subd1.mydomain.com that is going to be severed on another VPS. I tried to add
subdmn1.mydomain.com. IN 1.2.3.5 (assuming that my destination IP is 1.2.3.5 different from current machine's IP 1.2.3.4) Then after running
nsdc rebuild
service nsd3 restart
the subdmn1.mydomain.com开发者_运维知识库 fails to resolve to the IP. Any clues will be much appreciated.
nsd3 accepts BIND-style zone files, so in your zone file for mydomain.com, you can add a line that looks like this:
subdomain1 IN A 1.2.3.5
That makes subdomain1.mydomain.com
resolve to 1.2.3.5, while your normal A record can point to the 1.2.3.4 IP.
You have to take care however that you defined the $ORIGIN domain correctly, otherwise it won't work. That means that your domain name must include a period at the end, like this: mydomain.com.
I personally always use sudo zonec -v
for compiling the zone file database, because that gives a verbose output with all errors (if any) clearly displayed.
For a very thorough example of zone files and DNS configuration, you can also check out: http://www.zytrax.com/books/dns/ch6/mydomain.html
Did you forget to increment serial number? I on the other hand keep forgetting to run 'nsdc rebuild'.
精彩评论