I am trying to sinkhole/blackhole a list of domains using bind. I think my issue is using "Include" in the WRONG place on the conf. Can someone confirm the blacklist line of code is in the right place?
include "/etc/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
options {
directory "/var/named"; // the default
pid-file "/var/run/named/named.pid";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
allow-transfer {"none";};
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view "localhost_resolver" {
include "/var/named/blacklist.zones"; //RIGHT HERE!!!!!!!!!!!!!!
match-clients { 127.0.0.1/32; };
match-destinations { localhost; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
include "/var/named/named.rfc1912.zones";
};
view "internal" {
match-clients { localnets; };
match-destinations { localnets; };
recursion yes;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "my.real.domain" {
type master;
file "/var/named/my.real.domain.zone";
};
};
view "external" {
recursion no;
zone "." IN {
type hint;
file "/var/named/named.ca";
};
zone "my.real.domain" {
type master;
file "/var/named/my.real.domain.zone";
};
};
I could only get named service to start by putting it there. Log shows that the domains are loaded. Blacklist simply fw to 127.0.0.1, so this seems to work. When I
dig @127.0.0.1 blacklisted.domain
I get successful answer, pointing to 127 .. and the configured nameserver. But when I
ping blacklisted.domain
it pings the real ip, it resolves through the DNS. Can someone shed some light? I simply want to block a list of domains from local access. I know, I love dnsmasq too.