Saturday, 6 September 2014

Block web-sites with BIND9

I'm skipping the installation and set up of the BIND9 because there are several other site that do it. I just explain how to configure named.conf to be able to block domains.

You'll need a 'null.zone.file' under etc folder:

; DNS NULL Zone File for host filtering

$TTL 36000
@ in  soa  localhost. postmaster.localhost. (
           0   ;serial
           0   ;refresh
           0   ;retry
           0   ;expiration
           0 ) ;minimum

; Zone NS records

@          NS localhost.
           A 127.0.0.1
*          IN A 0.0.0.0


Now see the named.conf:

options {
    directory "c:\bind9\etc";

    listen-on  { 127.0.0.1; };
    forwarders { 192.168.100.1;};
    #forwarders { 8.8.8.8; 8.8.4.4;};#if you would like to use Google DNS servers
    recursion yes;
    allow-transfer { none; };
};

logging{
    channel my_log{
        file "myconf.log" versions 3 size 2m;
        severity info;
        print-time yes;
        print-severity yes;
        print-category yes;
    };
    category default{
        my_log;
    };
};


key "rndc-key" {
    algorithm hmac-md5;
    secret "your secret key";
};

controls {
    #inet 127.0.0.1 port 953
    #allow { 127.0.0.1; } keys { "rndc-key"; };
    inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
 };


zone "gemius.pl" {type master; notify no; file "null.zone.file";};
zone "adserver.yahoo.com" {type master; notify no; file "null.zone.file";};

Now the above website will be blocked and you experience a little more responsibility on web-sites.
Of course you can block unwanted web-sites.

No comments:

Post a Comment