Site Tools



The Adblock page contains settings for configuring 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 adblocker 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 Since is an invalid/unknown IP address, no connection is made to that URL and no page is drawn. 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.

In order for Adblock to work properly, client devices must be configured to use Tomato's IP address (dnsmasq) as their DNS server. This can be done in static form (on the device itself) or through Tomato. In Tomato, this is done in the Basic/Network menu, by setting DNS to manual, and typing in Tomato's own IP address in the DNS Server field(s). If clients are configured otherwise, dnsmasq will not intercept their DNS requests, and ads will not be blocked.

Any device configured not to use the Tomato router as its DNS Server will get DNS resolution directly, without intervention from dnsmasq, and the Adblocker. Consequently, it will display advertisements.

Beginner's note: FreshTomato's built-in ad blocker is separate from the ad blocking scripts you see on the Web pasted into Tomato's custom script window. If you also use one of those, and enable Tomato's built-in ad blocker, conflicts and problems may happen. Choose and enable one, or the other, but not both.

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 Tomato 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 Tomato 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 while a Blacklist URL is checked 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.

Autoupdate 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.

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, then Adblock is working properly, and the domain will be blocked. You can also check Tomato's Syslog (System log) to see whether Adblock activity is reflected there. For example, this entry:

Jan 9 19:57:29 rt-n66 dnsmasq[4872]: config is

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

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

adblock.txt · Last modified: 2021/03/28 15:22 by hogwild