I am doing this locally so I am using the loopback address. when I do nslookup ns.main.com, i get this message...
What command are you running specifically? If you simply run nslookup ns.main.com
, nslookup will look in /etc/resolv.conf
to find a nameserver, which probably isn't what you want.
You can provide nslookup
with an explicit server by passing it a second command line argument:
nslookup <name_to_lookup> <server_to_query>
There is one typo in your named.conf
; you have:
directory "var/bind";
When you probably mean:
directory "/var/bind";
You will also need to ensure that directory exists.
If I deploy your named.conf
with the above change and place your zone records in /etc/bind/zone/main.com
, then nslookup
seems to work correctly:
# nslookup ns.main.com localhost
Server: localhost
Address: ::1#53
Name: ns.main.com
Address: 127.0.0.1
I've made a complete Dockerfile and associated files available here as a demonstration; if you build an image:
$ docker build -t named .
And then run it:
$ docker run --name named --rm -d named
You can verify that it works:
$ docker exec named nslookup ns.main.com localhost
Server: localhost
Address: ::1#53
Name: ns.main.com
Address: 127.0.0.1