What's new

AdBlocking with combined hosts file

  • 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!

I'd also like to thank thelonelycoder for doing the work and sharing this, all up and running now on my RT-N66, all my browsing seems to ad free now but the 'in app' ads on my Lumia920 Windows phone 8 remain.
Thanks jakey, makes me happy it works for others too.
You use a Windows phone. It may have its own cache stored somewhere deep? Do a reboot and look again.

Just as a reminder for all on Windows Systems. You need to flush the DNS Cache when you tinker with your Routers.
In a command prompt enter
Code:
ipconfig/flushdns
and hit Enter.
On Win 7/8 Systems this generally needs Administrator privileges (hit Windowskey and type cmd, in the list right-click on cmd.exe and choose "run as Administrator).
Also clear your browsers cache after this.
 
I always have to power off and on the router to reboot otherwise if using the CLI or GUI to reboot the SD card always mounts as sdb1, now with my Linux STB I would use the fstab to make sure devices mount the same every time.


RMerlin recommends that (where possible) assign the SDCARD with a label

Code:
 tune2fs -L my_label_name  /dev/xxxn

then on reboot the SDCARD will always be mounted by name - unless you fall foul of the spurious bug when the mount sometimes uses my_label_name(1)

NOTE: You will need to use /mnt/my_label_name in your scripts rather than the device name.

Regards,
 
So... I'm running an AC68U with .39 and have found out the hard way that Entware doesn't like it :( I have optware back on it, got my snmp back up and running but would really like to try out this code on it.

Since I don't have Entware, what changes would be needed to the script?

My thanks in advance to anyone that would be willing to help!
 
With the help of TeHashX and my local linux guy (no beard though) I was able to get the script up and running on my A68U! Thank you!

Also thanks to this thread I got a SFTP service running and am able to edit and create scripts now in windows where I feel much safer :D

dnsmasq, snmp, what's next?

My thanks again to all the good people here!
 
With the help of TeHashX and my local linux guy (no beard though) I was able to get the script up and running on my A68U! Thank you!

Also thanks to this thread I got a SFTP service running and am able to edit and create scripts now in windows where I feel much safer :D

dnsmasq, snmp, what's next?

My thanks again to all the good people here!

Can you post the coding for the scripts used with Optware's syntax? This would help others with the RT-AC68U/R (like me.)

Thanks in advance.
 
Doh! Sorry about not posting the particulars, was caught up in my happy dance.

I've attached a zip file with the jffs files, you will still need to follow the instructions and set the permissions and what not. Keep in mind that these files are pre the latest change.

The only major difference between the Entware and Optware version as explained to me is that the post-mount file doesn't need:

if [ $1 = "/tmp/mnt/sda1" ]
then
ln -sf $1/entware /tmp/opt
fi

Sorry I'm not familiar enough with the forum interface yet to put that in one of the fancy code boxes but you can find the explanation for this here: http://forums.smallnetbuilder.com/showthread.php?t=16052

One thing though and I'm going to put this in a different post as well just to make sure it isn't missed and hopefully we can get an answer, but I noticed that after running router with these files in the correct locations DHCP failed. I had to remove the files and reboot in order to get DHCP running again.

It could and probably is something I did in the scripts that caused the issue but you may want to hold off on this until we get a resolution.
 

Attachments

  • dnsmasq.zip
    1.9 KB · Views: 332
What do I need to do to update an existing install to the new scripts?

Just replace the code in the two files listed below with the code in my first post in this thread, the old code is at the bottom of that post in italics for reference
/jffs/scripts/post-mount
/jffs/scripts/update-hosts.sh

Then reboot or enter
Code:
sh /jffs/scripts/update-hosts.sh
in the console.
 
Sorry I'm not familiar enough with the forum interface yet to put that in one of the fancy code boxes

Mark your text and klick on the hash tag (#), it'll put your code into the fancy box!
 
Sorry for duplication but wanted to make sure this was seen by the gurus.

Particulars: AC68U .39 firmware

Attached are copies of the files from my jffs directories. Ran everything and all the file built, everything seemed fine. When I got home my phone (Android) and laptop tried to connect neither could get an IP address from the DHCP server running on the AC68U.

Set laptop to static and was able to connect. Rebooted router, tried again with phone and laptop no joy.

Set laptop to static and disabled DHCP on router, rebooted. Enabled DHCP and tried again with phone and laptop, no joy

Set laptop to static, rebooted router, tried again, again no joy

Set laptop to static, changed permissions on files in jffs directories to try to make them no exe, (chmod a-x [filename]) looked like it worked but after reboot still no joy

set laptop to static, used WinSCP to pull the files from jffs/config and scripts and rebooted. DHCP was now issuing addresses.

I am 99.99% sure that I did something wrong in the scripts. If any log files or anything else is needed to troubleshoot this please let me know!

Thanks!
 

Attachments

  • dnsmasq.zip
    1.9 KB · Views: 288
I am 99.99% sure that I did something wrong in the scripts.
Just rename /jffs/configs/dnsmasq.conf to dnsmasq.conf.add
With the file named dnsmasq.conf in this directory you completely replace the dynamically generated router file with your entries in that file. Naming it dnsmasq.conf.add will append to the routers dnsmasq.conf.

Then reboot or do
Code:
sh /jffs/scripts/update-hosts.sh
You can use my modified files attached in this post. Happy Antiblocking!
Edit 1: The attached file to this post may only work for ToddT's setup as he uses a subfolder in sda1 to store the hosts file.
 
Last edited:
So 2 questions.

1. To confirm, I screwed up and didn't name the file correctly

2. Do the files in the zip include the sweet changes in edit 3? :D
 
Guess I should of looked before I leaped :p As to #2 it looks like you included the mods.
You're welcome. A courtesy of a lonely swiss guy...
 
You rock man, thank you so much! I will have a patty melt (for the swiss cheese) and a brew (cause, well, its a brew!) in your honor tonight!
 
thelonleycoder, please check out the dnsmasg.conf.add in the attached. I changed the filename to match what is referenced in the other files.

Want to make sure it's good for any others that may try to use the scripts
 
Last edited:
Want to make sure it's good for any others that may try to use the scripts
ToddT, I don't think your Adblocking works with your setup.
Best you start from scratch and do as instructed in my first post.
Make sure your paths and file names are correct.
Keep in mind your hosts file is /mnt/sdb1/adblock/hosts.clean and not
/mnt/sdb1/adblock/hosts.adblock as stated in your dnsmasq.conf.add file.
 
Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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