Skip to content

Instantly share code, notes, and snippets.

@spurgelaurels
Last active March 31, 2019 01:53
Show Gist options
  • Save spurgelaurels/450c6bc9d86fb68ff182b868951d7221 to your computer and use it in GitHub Desktop.
Save spurgelaurels/450c6bc9d86fb68ff182b868951d7221 to your computer and use it in GitHub Desktop.
FreeNAS - Ad Blocking with dnsmasq
- Create new Jail
- Configure "allow_raw_sockets" for jail
- Shell into jail
- Run as root
pkg install dnsmasq
- Add to dnsmasq.conf
dnsmasq_enable="YES"
- Add to your dnsmasq.conf (in addition to your otherwise configured options)
addn-hosts=/opt/dnsmasq/final_blocklist.txt
- Populate the blocklist with this script:
https://gist.github.com/chrisvella/5f3a18f1e442153cd685#file-make-mega-adblock-hostsfile-sh
My dnsmasq.conf:
root@dns:/usr/local/etc # grep -v "^#" dnsmasq.conf | grep -v ^$
domain-needed
bogus-priv
local=/reednet/
addn-hosts=/usr/local/etc/dnsmasq.blocklist
bind-interfaces
expand-hosts
dhcp-range=172.20.0.100,172.20.2.250,24h
dhcp-host=cbox,172.20.0.40,infinite
dhcp-host=mediabox,172.20.0.60,infinite
dhcp-host=freenas,172.20.0.77,infinite
dhcp-lease-max=400
dhcp-leasefile=/usr/local/etc/dnsmasq.leases
cache-size=2000
log-queries
log-dhcp
listen-address=127.0.0.1,172.20.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment