Use Synology as an ad-blocker

Today I wondered if it was possible to use my Synology as an ad blocker.

I got the following steps from a thread at the synology forum: http://forum.synology.com/enu/viewtopic.php?f=39&t=78126

I combined these steps and tested them succesfully using my DS211+ with DSM 5.2 (update 3)

GUI Settings

  1. Install the DNS Server package on your Synology.
  2. Under “Zones”, “Create” a new “Master zone”
  3. Domain type: “Forward Zone”
  4. Domain name: “null.zone.file”
  5. Master DNS Server: Your-Synology-IP-Address (Ex: “192.168.1.2”)
  6. Serial format: “Date (YYYYMMDDNN)”
  7. Activate resolutions just in case the requested ip address can’t be resolved by the DNS Server. I am using alternate DNS addresses from Opennic

Telnet /SSH settings

  1. Download the ad-blocker.sh script from: https://www.dropbox.com/s/xz1i7hxb9sfug36/ad-blocker.sh?dl=0
  2. Copy the script to your NAS in the following directory: /var/packages/DNSServer/target/script/ad-blocker.sh
  3. Give the script execute permissions: chmod +x /var/packages/DNSServer/target/script/ad-blocker.sh
  4. Run the following command to execute the script: sh /var/packages/DNSServer/target/script/ad-blocker.sh

Now the DNS server is installed and configured on the NAS.

How to use the DNS Server?

There are several options. You can set the new DNS address on every single device you’re using.

But it is easier to reconfigure the DNS address centrally. In my case I decided to set the new DNS address on my router.

So, there you go, no more annoying ads!

Credits go to nebulus and dMajo

Advertisements
Use Synology as an ad-blocker

7 thoughts on “Use Synology as an ad-blocker

    1. If you want to add an ip address manually, you have to add it to the file ad-blocker.db.
      It is located in /var/packages/DNSServer/target/named/etc/zone/data

      Like

      1. Henk says:

        This only works until the next reload. The unix shell script (ad-blocker.sh) deletes the current ad-blocker.db and replaces it with the newly fetched (with wget) blacklist.
        If you want to permenantly add domain names to the blacklist, change the ad-blocker.sh script contain the following:

        # Add custom blacklist to ad-blocker.db
        wget “<>/ad-blocker-custom.txt”
        cat ad-blocker-custom.txt >> ad-blocker.db
        rm “ad-blocker-custom.txt”

        Add this right before the # Include the new zone data section.

        The “cat” command merges your own blacklist with the existing one.

        Like

  1. Hi.

    Could someone point me in the direction on how to modify the script so I can download the ad-blocker.db from my own webspace? I want to run the script daily and it would be easier to edit the ad-blocker.db to add new hosts.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s