What's new

Block websites with hosts.add file in /jffs/configs (Asus RT-AC86U, AsusWRT-Merlin 384.16)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ubik

Occasional Visitor
Hi guys,

First of all, sorry for the probably many times answered question but I'm having a hard time making my router load the hosts.add file with a bunch of custom hosts to block.

This is what I've done so far:
  • I've enabled "Enable JFFS custom scripts and configs" in Administration - System
  • I created a file on my desktop called "hosts.add" and added this as a test host 127.0.0.1(tab)obdev.at
  • I used scp to upload the file to /jffs/configs
  • I changed the permissions to 755
  • I've restarted the router
  • I tried service reload_dnsmasq, service restart_dnsmasq and killall -SIGHUP dnsmasq

However the website is still available. Am I missing something? Any tips?

Thanks in advance!
 
Try running dos2unix /jffs/configs/hosts.add

You also need to flush the dns cache on the device you’re testing from since that test domain has a TTL of 60 minutes.
 
Thanks for the tip, unfortunately that does not help. Also I should point out I'm doing this via Terminal on a Mac.

My hosts file is the follows when opened with nano:

Bildschirmfoto 2020-08-11 um 13.38.38.png


I tried flushing dns cache, but that also didn't do anything. I also tested it on multiple machines. (MacBook Pro and iPhone). Also restarting both the device and the router.

I also tried 0.0.0.0 but that shouldn't make a difference.

The DNS Server on my MacBook is the routers IP. Maybe something is wrong with my DNS server on the router itself? But that shouldn't matter, right?

** Also also; the custom router url from Asus (http://router.asus.com/) works without any issues.
 
Last edited:
Thanks for the tip, unfortunately that does not help. Also I should point out I'm doing this via Terminal on a Mac.

My hosts file is the follows when opened with nano:

View attachment 25331

I tried flushing dns cache, but that also didn't do anything. I also tested it on multiple machines. (MacBook Pro and iPhone). Also restarting both the device and the router.

I also tried 0.0.0.0 but that shouldn't make a difference.

The DNS Server on my MacBook is the routers IP. Maybe something is wrong with my DNS server on the router itself? But that shouldn't matter, right?
What is the full output if you dig or nslookup from the Mac Terminal?
 
Code:
nslookup obdev.at
Server:        192.168.1.1
Address:    192.168.1.1#53

Name:    obdev.at
Address: 0.0.0.0

However I just saw that Safari on my MacBook blocks it, Chrome doesn't. On my iPhone none of those get blocked. I'm really confused.


Looked into it even more now, and it seems like Chrome is not honoring the hosts file? I thought this is only happening if the hosts file is on the computer not on the router itself.
 
Last edited:
Welp. All I had to do was add www.obdev.at to the hosts.add file. Thanks for helping dave!

Seems like this only helped on my MacBook but not my iPhone. I'm going insane.
 
Some browsers/OS's take it upon themselves to ignore your local DNS server and go directly to their own preferred server. I suspect Chrome is going directly to 8.8.8.8. You could use DNSFilter to force all devices to use the router.
 
Would I need to add every single device there and also force the Custom DNS to my routers IP?

Thanks so much for your help btw! Much appreciated!

Bildschirmfoto 2020-08-11 um 16.17.09.png


And also, what about the DHCP DNS Settings and WAN DNS Settings?
Bildschirmfoto 2020-08-11 um 16.18.33.png
Bildschirmfoto 2020-08-11 um 16.18.38.png


Would I need to change all of them just to block a website with the hosts file?
 
Everything's fine the way you have it in your screenshots. Does that fix your problem (remember to flush the DNS cache on the clients)?
 
That did the trick! With the enabled DNSFilter it now works like a charm. Thanks so much! :)
I am totally lost. (Newbie here)
Can you write a step by step?
Much appreciated.

*Nevermind I got it working. :-D
 
Last edited:
Similar threads
Thread starter Title Forum Replies Date
T Set static IP and hostname for hosts Routers 8

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top