Site Tools


advanced-adblock

This is an old revision of the document!


Adblock

The Adblock menu contains settings to configure FreshTomato's built-in ad blocker. The page is divided into sections. These sections include: Adblock Settings, Blacklist URL, Blacklist Custom and Whitelist.

FreshTomato's ad blocker works through DNS cache poisoning. It downloads lists of URLs/domains to block. It then replaces whatever dnsmasq resolves as the advertiser's correct IP address with an address of 0.0.0.0. Since 0.0.0.0. is an invalid/unknown IP address, no connection is made to that URL and no page is drawn, if pixlserv is installed and integrated with Adblock. If pixlserv is not integrated, some pages/frames will draw with an error from the web browser, stating the page could not be found.1)

Alternatively, DNS queries are replaced with 127.0.01, the loopback address, (the same address as the client making the DNS request). Again, the URL will be blocked.

For Adblock to work properly, client devices must be configured to use FreshTomato's IP address (dnsmasq) as their DNS server. This can be done either by static IP configuration (on the device itself) or through FreshTomato's DHCP Service. For the latter method you would first enable DHCP under Basic/Network. To enable the actual DNS server, select “Use internal DNS” under Advanced/DHCP/DNS. These two steps are mandatory, as clients bypassing FreshTomato's DNS server will not have their ads blocked.

There are three optional settings that help ensure smooth Adblock operations:

  1. Enabling Advanced/DHCP/DNS/Intercept DNS Port
  2. Enabling Advanced/DHCP/DNS/Prevent Client auto DoH
  3. Enabling the “DoH Server” list in AdBlock itself. This was added to the defaults as of release 2021.6 . If this entry is missing, it can be added manually:
    https://raw.githubusercontent.com/oneoffdallas/dohservers/master/list.txt
    This prevents DoH requests from being resolved.

Warning: FreshTomato's built-in ad blocker is separate from the ad blocking scripts seen on the Web pasted into FreshTomato's custom script window. If you also use one of those, and enable FreshTomato's built-in ad blocker, conflicts and problems may happen. Choose and enable one but not both at the same time.

Adblock Settings

Enable: Checking this box enables FreshTomato's built-in ad blocker.

Debug Mode: Checking this box enables debug mode in the log. This tells FreshTomato that you want all DNS queries that are routed to dnsmasq to be logged to the system log (syslog). This is useful in testing/troubleshooting Adblock. For more on testing, see the Testing/Troubleshooting Adblock section later on this page.

Blacklist URL

This section contains a table containing a list of the various blacklists FreshTomato can download and use for ad blocking.

On: Clicking on one of the blacklist rows will make a checkbox appear at the far left of the row. Checking that box will enable the download (and update) and usage of that particular DNS blacklist. When you are finished selecting which blacklists you wish to use, click Save for the changes to take effect.

Blacklist URL: Shows the location on the Internet where that particular blacklist can be found.

Description: Display a name (if the creator used one) for the particular blacklist.



Delete: Clicking this button on a checked Blacklist URL will permanently delete that Blacklist. Note that there is no option to reset these to the original Blacklist URL entries. If you delete a Blacklist URL that is important to you, you will need to find it, and enter it back into the Blacklist URL table.

Add: Clicking Add inserts a blank row in which you can type a new URL from which to download and use a new Blacklist.

An Autoupdate function will launch randomly every day between 2:00AM and 2:59 to download the most up-to-date Blacklists from the URLs in the list.

Custom Blacklist

The Custom Blacklist section contains a field into which you enter custom blocking entries. All entries must be separated by spaces for the function to work properly for each entry.

Custom Whitelist

Here you enter custom URLs that you would like to allow, by default. Entry rule are similar to the Custom Blacklist field. You must separate all entries with spaces.

Adblock Notes

Testing/Troubleshooting Adblock

Blacklisted or Custom entries can be tested to see if Adblocker is properly redirecting them by using the nslookup tool on Windows, Linux or OS X. Simply run nslookup and enter the domain/URL in question. If it resolves to 0.0.0.0, then Adblock is working properly, and the domain will be blocked. You can also check FreshTomato's Syslog (System log) to see whether Adblock activity is reflected there. For example, this entry:

Jan 9 19:57:29 rt-n66 daemon.info dnsmasq[4872]: config hbx.media.net is 0.0.0.0

shows that the dnsmasq daemon replaced the true IP address of hbx.media.net with 0.0.0.0. Adblocker worked in this case.

If the router crashes, you may have used too many large Blacklists, and the router exhausted available RAM. Try using smaller blacklists, or fewer of the large ones.


Adblock doesn't work with DoH and other Encrypted DNS lookups

Increasingly, more and more devices are using DNSSEC, and encrypted DNS protocols, such as DoH [DNS over HTTP(S)]. Adblock will not work with these DNS lookup methods. This is both because they are encrypted, and because in many cases, they are directed to a third-party server, not to the FreshTomato router/device.

As mentioned earlier, enabling the “DoH Server” List may remedy this problem.

1)
If only elements are blocked, it's likely the page will load without error – uncluttered.
advanced-adblock.1642693382.txt.gz · Last modified: 2022/01/20 15:43 by hogwild