`addn-host` to block some websites does not work

  1. On FreshTomato, I was able to specify an entry in addn-host of dnsmasq to a file that poisons some DNS records, e.g. 0.0.0.0 facebook.com
  2. After updating this file, I always run service dnsmasq restart and it works
  3. I did the same on OpenWrt, but ping facebook.com on the router still gave me the real IP address
  4. Any idea why?
  1. router uses upstream DNS, not the one on the router ?

Is there a way I can run a few simple commands to poison and unpoison the records?

In the GUI: Network > DHCP and DNS > General:
under addresses add /facebook/#

1 Like

image

thanks that worked, but I have quite a few FQDNs to block... and I forgot to mention earlier

  1. After blocking, I tested resolving on my Windows and it returned the real IP
  2. Thinking it might be the cache or something, I went to the router and try, it still returned the real IP
  3. That was how I concluded additional hosts did not work
  4. Actually I don't care if router can reach the FQDNs
  5. What matters is that my clients, e.g. Windows/Linux cannot reach the blocked FQDNs

Will additional hosts files work if i ignore the resolv file?

Yes, Ignore resolv file made my Addtional hosts files work

you can use the adblock package with a custom block list.

I tried that, but wasn't able to script it.

And on a separate note, resuming and suspending adblock is super slow, /etc/init.d/adblock status does not update until almost after 1 min

there are at least two or three adblock packages, but I can imagine the status doesn't update until all the default block lists have been DLed and crunched by the addon.

No, that's not what I meant.

Okay, so I have a switch on my HomeAssistant (HA) that when toggled will turn on/off ads by performing a SSH into the router. HA also connect separately to the router to retrieve the actual status of adblock.

The HA switch can't work coherently when there is a 1 min delay from telling it to suspend until it reports that it has suspended itself.

  1. After some further debugging, Additional Hosts Files expects a folder, not file
  2. When given a path that has some host files, addn-host works reliably

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.