Hello Daniweb Members,

I have just finished setting up a simple DNS Server using BIND9 on Ubuntu, the main reason I did this was that it should theoretically make browsing faster as it doesn't need to send requests to my ISPs servers which are appeoximately 241 miles away... or at least that is what I said to my brother.

Admittedly it shall make it ever so slightly quicker, but it would be negligable... the main reason is so I can block specific websites. My main idea (I should point out I am new to setting up DNS servers) was to create a zone file which shall take the domain and change the IP to a local one which is running a Web Server, so that I can put up a 'block' page etc. This obviously isn't the most efficient way of doing it, but I am hoping this DNS spoofing shall be good enough.

I am not entirely sure how I should setup the required files, I've looked at many tutorials online however I haven't been able to complete this action with any success.

In my named.conf.local file I have:

zone "domainToBlock.com" in { type master ; file "zoneFiles/domainToBlock" ; } ;

And then in the domainToBlock file I have nothing... this is where I get stuck. As this is an internal server I do not have a domain for it, and the hostname is simply AH-Server. For the zone file I need to put in a domain name but I don't know what to use, would it be the LAN IP ( or would it be the localhost. For the new A record, can I just use localhost/LAN IP as the DNS server is running on the same hardware as the Web Server?

If anyone could please help me, mainly with working out what domain name I should be using, and how to configure the zone file to point to the local web server.

Thank you

I'm not familiar with BIND specifically, but am with DNS... So regarding..

For the zone file I need to put in a domain name but I don't know what to use, would it be the LAN IP ( or would it be the localhost.

For each domain you want to block in this manner, you need to create a zone for it. If you want to block google.com, you would have to create a zone called google.com, making that DNS server authoritative for that domain.

Thanks Jorge, however what do I do about the other domain, I am currently using the following example from Here.

The zone file in the example is as follows:

$TTL 24h

   @       IN SOA server.yourdomain.com. hostmaster.yourdomain.com. (
                  2003052800  86400  300  604800  3600 )

   @       IN      NS   server.yourdomain.com.
   @       IN      A
   *       IN      A

My question is, in the SOA what domain and hostname do I use, would it be for example AH-Server. or would it be something else?

Thank you

I managed to get it working using this, in case anyone else ever has this issue/is interested.

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

Edited 3 Years Ago by Octet

This question has already been answered. Start a new discussion instead.