How To Setup Vanity DNS Name Server Using BIND 9

by on July 18, 2008 · 7 comments· LAST UPDATED July 18, 2008

in , ,

Q. I've nameserver like and I'd like to provide Vanity DNS for each domain such as and Basically, my users should able to call my dns server as their own servers. This will create the illusion that my user run their own name servers. How do I setup vanity DNS using BIND 9 under UNIX / Linux?

A. It is pretty easy to setup nameserver for each domain using BIND. For example, and can be used as vanity DNS for domain.

Our sample setup

Your real DNS serverVanity DNSIP address for both Real and Vanity servers

So instead of using, you use for Please replace domain name and IPs according to your requirements.

How do I setup Vanity DNS for domain?

You need to register and with your domain service provider or ISP with the following settings:

  1. :
  2. :

Next, you need to setup named.conf as follows on master bind 9 server, enter:
# vi named.conf
Append zone as follows, enter:

zone "" {
        type master;
        file "/etc/bind/zones/";
        allow-transfer { };

Save and close the file. Run following command to check named.conf for error:
# named-checkconf
Now, create /etc/bind/zones/ zone file:
# vi /etc/bind/zones/
Append zone as follows, enter:

$TTL 3h
@        IN SOA (
                       2008071801        ; Serial yyyymmddnn
                       3h                ; Refresh After 3 hours
                       1h                ; Retry Retry after 1 hour
                       1w                ; Expire after 1 week
                       1h)             ; Minimum negative caching of 1 hour
; Vanity DNS
@                      86400    IN NS
@                      86400    IN NS
@                     86400     IN MX 10
; Vanity DNS must point to IP of and
ns1                    86400    IN A
ns2                    86400    IN A
; host stuff
@                      86400    IN A
www                    86400    IN A
ftp                    86400    IN A

Save and close the file. Run zone file validity checking for, enter:
# named-checkzone /etc/bind/zones/
Sample output:

zone loaded serial 2008071801

Now just reload bind 9, enter:
# rndc reload

Slave server configuration

Open named.conf on slave server and append following code:

     zone "" {
                type slave;
                file "/etc/bind/zones/";
                masters {; };
                allow-transfer { none; };

Save and close the file. Run following command to check named.conf for error:
# named-checkconf
Reload named, enter:
# rndc reload
It may take anywhere from 24-48 hrs to propagate a domain across the internet. You can test your setup with the following command:
$ host -t ns
Sample output: name server name server
Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 7 comments… read them below or add one }

1 M B Richards December 20, 2008 at 5:12 pm

When you try to click on the Printable version link above, it comes up with an error 404 pages


2 nixCraft December 20, 2008 at 5:35 pm

@M B Richards,

Thanks for the heads up. I’ve fixed the problem. Let me know if you’ve any other problem.


3 Danny December 21, 2008 at 5:15 pm

Great tutorial! Thank you for your kindness.

Best regards,


4 M.S. Babaei February 4, 2010 at 10:36 am

I’ve got a new FreeBSD VPS and I’m in trouble with this dns stuff:

Is there anybody to help me. I’ll be apperciated.


5 Robert September 19, 2011 at 1:29 am

“You need to register and with your domain service provider or ISP” Can you explain this more? Even if you run your own nameservers you still cant do it yourself? But you need to engage I presume whoever owns the ip ranges your using for you DNS servers?


6 Robert September 19, 2011 at 1:40 am

I understand now you mean the domain registrar.

They obviously provide some information back to the central dns servers? I guess some registrar’s might have automated this process, others would only do it manually and others may refuse to support this at all?


7 govind (TIS) August 14, 2012 at 7:30 pm

I used the DNS ip ‘s provided by my network provider . is it ok or should i own from ISP .please let me know . I am using ubuntu 12.04 (bind9 to configure)


Leave a Comment

Tagged as: , , , , , , , , , , , , ,

Previous Faq:

Next Faq: