DNSlock - DNSmasq based network wide content/advertisement blocker for debian based operating systems.
Single command Installer:
- Make sure the device or server on which you want to install DNSlock have a static IP address.
- Get root permissions (sudo su)
curl https://raw.githubusercontent.com/raghavdua1995/DNSlock/master/install | bash
- Configure your devices/router(for network wide content blocking) to use DNSlock as it's primary DNS server
Note : The above installer downloads this script.
DNSlock uses the following commands:
DNSlock --update
: Update the hosts file
DNSlock --start
: Start DNSlock
DNSlock --status
: Check if DNSlock is active or inactive
DNSlock --stop
: Stop DNSlock
DNSlock --restart
: Restart DNSlock
DNSlock --blacklist <domain1> <domain2> .....
: Blacklist domains
DNSlock --*blacklist <domain1> <domain2> .....
: Remove domains from blacklist
DNSlock --whitelist <domain1> <domain2> .....
: Whitelist domains
DNSlock --*whitelist <domain1> <domain2> .....
: Remove domains from whitelist
DNSlock --wildcard <domain1> <domain2> .....
: Wildcard block domains
DNSlock --*wildcard <domain1> <domain2> .....
: Remove domains from wildcard list
DNSlock --forcesafesearch
: Enforce safe search on Google and Youtube
DNSlock --disablesafesearch
: Stop enforcing safe search on Google and Youtube.
DNSlock --reset dnsmasq
: Resets dnsmasq server to default settings
DNSlock --reset sources
: Replaces hosts file sources list with the default one
DNSlock --reset webserver
: Restores lighttpd web server's default settings
DNSlock --reset blacklist
: Removes all user blacklisted domains
DNSlock --reset whitelist
: Removes all user whitelisted domains
DNSlock --reset ip
: Resets/Updates DNSlock's IP address/Interface
DNSlock --reset complete
: Performs a full reset
Note : DNSlock --reset can accept multiple arguments
DNSlock --tail
: Tail DNSlock logs
DNSlock --flush
: Flush DNSlock logs
DNSlock --query
: Query if a domain is being blocked
DNSlock's hosts file sources are mentioned in /etc/DNSlock/sources.list You can edit the file and add new sources using any text editor, we will be using nano editor in the following instructions:
sudo nano /etc/DNSlock/sources.list
, Enter password if prompted.- Add link for the hosts file you want to add.
DNSlock --update
, Update hosts file
You can add virtually any number of hosts file sources you want, Filterlist is a comprehensive directory of hosts files around the internet.
Single command Uninstaller:
- Get root permissions (sudo su)
curl https://raw.githubusercontent.com/raghavdua1995/DNSlock/master/uninstall | bash
- Configure your devices/router(for network wide content blocking) to use some other DNS server (like the one provided by your ISP or Google's DNS server).
Note : The above uninstaller downloads this script.
An open source project by Raghav Dua.