If you uncheck yes. I don't know where the problem come from. I made a test between 2 connections with the exactly same script. It works on the first and not on the second. Will compare the config of both later.
I have unchecked Code: Intercept DNS Port (UDP 53) rebooted the router, verified that the adblock script worked correctly, but, by loggin in the router, i still can resolve the blocked domains. If i write the static dns into the hosts file, it works perfectly (i.e. ping #blocked.com# resolves as 0.0.0.0) If i run dnsmasq with the option Code: --address=/<domain>/[domain/]<ipaddr> (i.e. dnsmasq --address=/www.google.com/0.0.0.0) I can still ping google. Am I doing something wrong, or there is a bug somewhere?
I tried check and uncheck and the results were the same. On the router which the script works i'm not on ND firmware. On my Buffalo i am. Are you on ND ?
No. I'm on a Sparklan WX-6615GT with Tomato SpeedMod Firmware v1.19.8502 (NOT ND) Maybe an old dnsmasq version (with some bug)? maybe newer firmware include a more recent dnsmasq? Thank you again for your help.
You're welcome. Don't know if it's an old version, you have to check the changelog. I'll try the Yaqui adblock as an alternative. http://www.linksysinfo.org/forums/showthread.php?p=339164#post339164
It doesn't work either will build Tomato Firmware v1.23.8510 RAF. Where did you find your file ? /tmp/hosts ? I don't have such file. There's a difference between my two routers. On the WRT (which is working) i have that : and on the Buffalo i've got that : Even if it's the stricly same script. :frown:
Hi! the file /tmp/hosts is the file created by the script and then removed by the istruction Code: rm $GENFILE* so if you comment it, you will find the file. When I'll be back home (I'm at work now), I'll check the command line of the running dnsmasq process and i'll let you now.
It's really strange. I've just erase nvram on my buffalo and my linksys to flash them with the 8510RAF version and i only put the script and reboot both. It's working on the linksys and not on the Buffalo.
I am experiencing the same thing even with my script. I am able to ping "blocked sites" from within the router. Not sure why that is. :\
It works again. I downgrade to 8025 victek mod (non ND) Be careful to not put manual dns into your network interface under windows. The router can ping website but on my laptop it goes to 0.0.0.0.
xcooling Tomato domain blocking script Hi xcooling Thanks to you and everyone else offering solutions but I am having trouble with the script - partially. I have been using MVPS HOSTS file on a Win XP machine but now want to offer the same protection to all users via Tomato firmware router. I particularly started investigating these options because OpenDNS uses a proxy for mail.google.com, and wanted to bypass the OpenDNS cache using the HOSTS file, but still want to block various google tracking methods including cookies, ad servers and js files. One day I find an alternative to GMail. Somehow the OpenDNS google caching issue seems to have cleared up as I do not see google.navigation.opendns.com in my firewall logs, even though mail.google.com is no longer in the HOSTS file, and browser DNS cache has been cleared. Anyway, I ran the script for the smallest block list (pgl.yoyo.org/adservers) and rebooted the router but the there is no blocking of the listed domains. /tmp/etc/hosts remains unchanged Router message log reveals 03/02/2009 12:27:31 <13>Feb 3 12:25:59 root: ADBLOCK Unique Hosts Blocked 2552 03/02/2009 12:27:31 <30>Feb 3 12:25:58 dnsmasq[536]: read /etc/hosts - 0 addresses 03/02/2009 12:27:31 <13>Feb 3 12:25:58 root: ADBLOCK Ignor Fail Safe What can I do to get it functioning?
Did you try to go to one of the sites (via web browser) listed in pgl.yoyo.org's list? And are you sure the list is populated? If not, try my script.. it will report in the log if the list is populated and formatted correctly.
Do you know if the adblocking script will works if i don't use the WAN port as i'm connecting my AP to a switch by LAN ?
xcooling Tomato domain blocking script Yes, I connected to several sites on the pgl.yoyo.org's list after router reboot. I assume the list is not populated? It would be in /tmp/etc/ ? I may have incorrectly edited the script. I commented out 3 of the 4 ad block URLs with a single "#" to speed up testing. I now believe that I should have disabled by using "0". I have corrected this. But still I see no populated file in /tmp/etc/ Router message logs reveal: 04/02/2009 15:29:24 <26>Feb 4 15:27:50 dnsmasq[570]: FAILED to start up 04/02/2009 15:29:24 <26>Feb 4 15:27:50 dnsmasq[570]: illegal repeated keyword at line 2565 of /tmp/hosts 04/02/2009 15:29:19 <13>Feb 4 15:27:45 root: ADBLOCK Ignor Fail Safe 04/02/2009 15:29:19 <30>Feb 4 15:27:45 dnsmasq[209]: exiting on receipt of SIGTERM 04/02/2009 15:29:19 <13>Feb 4 15:27:45 root: ADBLOCK Got Source Files 04/02/2009 15:29:19 <13>Feb 4 15:27:45 root: ADBLOCK Load http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts I might try your script but I am wary of running one script after another without fully understanding what is happening. Also I was sold on the dnsmasq approach over the HOSTS method based on an unproven hunch.
xcooling Tomato domain blocking script Also I just spotted a whole load of these entries in the router log from last night 04/02/2009 00:01:54 <27>Feb 4 00:00:14 dnsmasq[22275]: bad address at /etc/hosts line 2490 04/02/2009 00:01:54 <27>Feb 4 00:00:14 dnsmasq[22275]: bad address at /etc/hosts line 2491 04/02/2009 00:01:54 <27>Feb 4 00:00:14 dnsmasq[22275]: bad address at /etc/hosts line 2492 04/02/2009 00:01:54 <27>Feb 4 00:00:14 dnsmasq[22275]: bad address at /etc/hosts line 2493 These appeared at about the time when the PC lost the ability to connect to domains through a browser following a crash in Firefox3 after trying to upload a tiny file (it happens sometimes). I was able to ping domains though.
I would suggest looking at those line numbers if you know how to use vi in the busybox/router shell : look up those lines and see how they are formatted. It may be something xcooling's script that is not formatting correctly, I do use a couple different sed statements in my script, I noticed the [0-9]www[0-9] were not being removed using xcooling's statements. I updated my scripts page awhile ago, I have had & used the dnsmasq method posted now in my thread, and it is working great.
Do you mean look at the lines in the HOSTS file using vi? I have looked using WinSCP. HOSTS is empty. If your script does basically the same then I will erase the other script and try yours.
Do you mean look at the lines in the HOSTS file using vi? I have looked using WinSCP. HOSTS is empty. If your script does basically the same then I will erase the other script and try yours.
Many thanks yaqui - your dnsmaq script worked. I didn't change my dnsmasq entries in the "Dnsmasq Custom Configuration" in Tomato. I was wondering if that was the reason why the other script did not work. I see two new files in /tmp/ i.e. HOSTS and ADBLOCK.sh. I had been looking in /tmp/etc/ before In the message log I see my nameservers listed twice each. Is that correct? Should they be specified in "Dnsmasq Custom Configuration" or the Basic > Network > Static DNS section or both? Real happy it works Edited and added this: I will add to this. I ran the script with only first 2 lists selected and not OPTIMISE. I noticed the domains were matched with 0.0.0.0 from a quick look it looked like top levels were blocked only and not subdomains (but I did not look to carefully) I then ran with OPTIMISE as "Y" and included 3rd ad block list as "Y" This time only the domains appeared in the list and no IP I noted this error in the log: 06/02/2009 03:48:03 <26>Feb 6 03:46:27 dnsmasq[741]: illegal repeated keyword at line 20290 of /tmp/hosts There was also a file in /tmp/ which was empty inside but was listed in WINSCP as about 200K (it later disappeared when rebooting) I then ran with again and this time the domains are listed with "127.0.0.1" Later with all 4 lists as "Y" it's 0.0.0.0 again but What are they supposed to be: 0.0.0.0 or 127.0.0.1? I also noted that it is not fully optimised e.g. both 4d5.net and banners.4d5.net appear. Surely, the 2nd item is not necessary? But it seems that listed domains are resolving Something missing . . . Update After several reboots I figured that the lists take some time to update. I have a lot less space on my router though... Can I get that space back by setting the lists to "N" or do I need to delete the hosts, script_wanup.sh, ADBLOCK.sh, script_brau.sh and switch-start files? Hosts is populated but not blocking. Is something missing? .. Just found the cause of one error The 2 lines below appeared in the script and in the custom dnsmasq form and so was duplicated in the hosts file. This may be why the other scripts did not work cache-size=2048 log-async=5
The above feature confuses me. If there are no files kept, then why does the script use several MB of memory? Not complaining, as the script works great. Just wondering, though.
I just list my nameserves under the static dns section, not both. Be careful using all the lists or which lists you choose! Unless you added memory to your router, I doubt it will be able to handle all 4 lists, that last list alone is over 2.5M ! That is why the lists will NOT format correctly. When you reboot, my script is run again in wan-up, thus deleting any previous data... But you must do this: If you wish to CLEAR ALL data then pick "N" for all the lists, save, then reboot. Or just keep it light and just chose the first 2 lists, or just the first list. Again you might not be meeting the memory requirements in the router, so the lists might not be formatted/used correctly. Even if the log is reporting that the format is correct, the entire list format may not be correct because my format test does not check the entire list (only a portion of it), I did that because checking the entire list (depending on size) would take way too long! It's more meant to be a "quick glance" at the list.
To those of you with memory problems, I still don't think you will be able to use all 4 lists but: I updated my script to v2.7: v2.7 Better Memory Management - Delete Duplicates after each download.
I have done that now because I didn't get it to work another way - so far. My router reports 13M free memory and this is after having HOSTS populated by the first two block lists. I assume that spare memory is needed to run other functions on the lists such as formatting. It sounds like clearing HOSTS manually would cause a problem? I can't see how though. I reboot my router at least once a day. So is it pulling the same lists everytime? I can spare the bandwidth but I would like to be polite to the list suppliers. The MVPS list does not update that frequently. Is it possible to control the update frequency (other than by removing the script for a period)? I believe that the error was due to having the nameservers specified twice. After correcting that the lists now block.
This is good alternative to xcooling's adblock script. I just give it a try and no problems at all as with xcoolings script. der_Kief
yaqui, thanks for v2.8 I ran it with OPTIMISE="N" and have a few questions about the results and possibilities 1. I see that sitetracker.com is listed near the top of list and later on subdomains of sitetracker.com are listed. I presume that subdomains are not necessary when the top level is blocked. Is there a script to clean up the list - either for the router or in Windows? 2. I see that .victoriassecret.com is listed near the top of list. I cannot find it listed by MVPS nor pgl.yoyo.or but MVPS does list the subdomain www25.victoriassecret.com. Has some operation been done on that subdomain but not other subdomains? 3. Is there a file where I can permanently store certain IP+DomainName combinations that would work with dnsmasq? I want map to mail.google.com with the IPs which it is associated with, e.g. like 66.249.91.99 and 66.249.91.147 because OpenDNS is routing Gmail to its own cache at google.navigation.opendns.com. 4. "whitesite1.com" presumably is a site which bypasses the host list? Is it possible to have a whitelist sites specified in a file or do all whitelisted sites have to be specified in your WAN Up script?
The "cleaning up" is part of the sed statements. There is no way to sort through all subdomains which one person may want/not want. Example.. let's say you have a site like ads.yahoo.com - the sed statement to take out the subdomain "ads" would then end up blocking all of yahoo.com!!! This is also a good example of part of the problem I am addressing above, this sed statement: sed -i -e '/^www[0-9]./ s/^www[0-9].//' $GEN That what is taking out the "www25" as with all the other wwwnumbers (The dot should actually be escaped and removed too, I will correct that.) But the end result is you should whitelist victoriassecret.com in the whitelist site variables - as you are talking about below. You should look into setting up CIFS or JFFS2 for more permanent files. The whitelist is actually removing the entries, I suppose you could have a list of entries that you want removed and have the script read the list. Your victoriassecret.com is a good example of something that could be whitelisted...
Adding additional URLS to block Is it possible to add some URL to be blocked to a text file (say in jffs)? What modifications are needed for the script? I am newbie with scripting.
Try whitelisting t.hulu.com . Worked for me. Well, I take that back. It did work when I tried it and now it isn't. Shrug?
I guess a better question would be, is there a way to whitelist an internal IP address? I am streaming Hulu and Netflix etc via Playon to my Xbox. Since I don't browse the web on that machine, and ads in hulu are fine with me, is there a way I can exclude it from this script?
Only option I know of is to have that machine bypass the DNS Server inside the router. If its only one machine, set it up with a static IP address, and set the DNS servers on it to match your ISP's DNS servers. This will bypass all the ad blocking in the router.
Hello everyone, I want to try this script, but I have a question: I'm already using one script in WanUp section, which does the FTP backup. Here it is: Code: USER="..." PASS="..." PORT=21 SERVER="..." RPATH="..." RPATH_DATE="rstats\`date +%Y.%m.%d-%H.%M.%S\`.tar" LPATH="/tmp/rstats.tar" /bin/sleep 10 if [ ! -s /tmp/backup-rstats ] ; then echo -e "#!/bin/sh\nkillall -1 rstats\nsleep 3\ntar -cf \"$LPATH\" /tmp/var/lib/misc/rstats-*\nftpput -u \"$USER\" -p \"$PASS\" -P $PORT $SERVER \"$RPATH\" \"$LPATH\"\nftpput -u \"$USER\" -p \"$PASS\" -P $PORT $SERVER \"$RPATH_DATE\" \"$LPATH\"\nrm \"$LPATH\"" > /tmp/backup-rstats chmod 777 /tmp/backup-rstats echo -e "#!/bin/sh\nservice rstats stop\nftpget -u \"$USER\" -p \"$PASS\" -P $PORT $SERVER \"$LPATH\" \"$RPATH\"" > /tmp/restore-rstats echo -e "if [ \$? != 0 ] ; then\n logger RStats Restore Failed... will retry in 5 minutes\nled amber on\n cru a rstats \"*/5 * * * * /tmp/restore-rstats\"\n return 1\nfi\nled amber off\ntar -xf \"$LPATH\" -C /\nrm \"$LPATH\"\nservice rstats start\ncru a rstats \"1 */1 * * * /tmp/backup-rstats\"" >> /tmp/restore-rstats echo -e "logger RStats Data Restored\nrm /tmp/restore-rstats" >> /tmp/restore-rstats chmod 777 /tmp/restore-rstats /tmp/restore-rstats fi So, will this ad blocking script interfere with the other one? Can I just copy-paste the ad blocking script after the FTP backup script? Or maybe the ad blocking script must go first and FTP backup script after that? Thanks!
Issue with pgl.yoyo.org Looks like the HTML in the file downloaded from http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts might have changed? Not sure but I was getting an error on line 413 (cant remember exact line number) Took a look at what was happening and found this line in the /tmp/hosts file address=/Adserverhostnamesforblockingads(format:hosts--inhostsfileformat)</title After I looked at the html that was coming out of the yoyo site i found that the title tag opened then a CR and the text of the title was on the next line. The clean up routine didn't handle that. I did a quick and dirty clean up for that line. I added a sed command right after the "stripping" section. Code: ##strip source file [B]sed -i -e '/Ad server hostnames/d' $GENFILE[/B] sed -i -e '/^[0-9A-Za-z]/!d' $GENFILE All seems to be well now, like I said quick and dirty.
Hi: I'm pretty new to Tomato, and loving it so far. I've done a block copy and paste of this script. (anything to get rid of those annoying ads.. Thanks bunches. ) I am pretty sure I copied everything correctly, but I've got some sort of error, and want to know if this means that the script terminated. (google ad page showed nothing), but I got these termination errors in the log file. Dec 31 19:00:09 RobnetHome daemon.notice miniupnpd[109]: HTTP listening on port 5000 Dec 31 19:00:09 RobnetHome daemon.err miniupnpd[109]: chain upnp not found Dec 31 19:00:11 RobnetHome daemon.notice miniupnpd[109]: received signal 15, good-bye Dec 31 19:00:12 RobnetHome daemon.notice miniupnpd[146]: HTTP listening on port 5000 May 27 23:08:39 RobnetHome user.notice root: ADBLOCK Downloaded http://www.mvps.org/winhelp2002/hosts.txt May 27 23:08:41 RobnetHome user.notice root: ADBLOCK Load http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts May 27 23:08:41 RobnetHome user.notice root: ADBLOCK Got Source Files May 27 23:08:41 RobnetHome daemon.info dnsmasq[100]: exiting on receipt of SIGTERM May 27 23:08:41 RobnetHome user.notice root: ADBLOCK Ignor Fail Safe May 27 23:09:10 RobnetHome daemon.crit dnsmasq[374]: error at line 413 of /tmp/hosts May 27 23:09:10 RobnetHome daemon.crit dnsmasq[374]: FAILED to start up May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: started, version 2.47 cachesize 150 May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: compile time options: no-IPv6 GNU-getopt no-RTC no-DBus no-I18N no-TFTP May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: DHCP, IP range 192.168.1.50 -- 192.168.1.254, lease time 1d May 27 23:09:10 RobnetHome user.notice root: ADBLOCK Ignor Fail Safe May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: reading /etc/resolv.dnsmasq May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: using nameserver 4.2.2.3#53 May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: using nameserver 4.2.2.2#53 May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: using nameserver 4.2.2.1#53 May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: read /etc/hosts - 0 addresses May 27 23:09:10 RobnetHome daemon.info dnsmasq[377]: read /etc/hosts.dnsmasq - 1 addresses May 27 23:09:12 RobnetHome user.notice root: ADBLOCK Unique Hosts Blocked 15931 May 27 23:09:17 RobnetHome cron.err crond[94]: time disparity of 20724669 minutes detected May 27 23:09:18 RobnetHome daemon.info dnsmasq[377]: DHCPREQUEST(br0) 192.168.1.53 00:21:63:69:60:64 May 27 23:09:18 RobnetHome daemon.info dnsmasq[377]: DHCPACK(br0) 192.168.1.53 00:21:63:69:60:64 TamLaptop Is the failure at line 4xx anything to be majorly concerned about. This is the first script I've installed, and if I screwed up something, please let me know. Thanks.
Is this script still working??? I just reset my router to the default settings and installed the script and I still get ads... Not even one ad is being blocked. How long should it take for ads to start being blocked?
Ok guru's; here is an interesting one for you. I have been running a variation of the ad blocking script for over 2 years, but now I need to make a change. What I need to do is exclude ONE address on the internal network from the ad blocking from the host file. Don't ask the reason, it is valid. I disable the ad blocking(remove the WAN UP script and reboot the router) and things work correctly. I re-enable and things go no working. I do not want to DMZ the computer either. I do not want to manually edit the host file every time it updates. If I can not exclude this ONE computer from the host blocking, I will have to update each machine manually with a host file. Things are MUCH easier when the router just updates itself on its own. So what do you think? Is this even possible? Thank you
I noticed a substantial drop in available free router memory yesterday. After a bit of searching I discovered that the PGLSOURCE, and HSFSOURCE URL's weren't working anymore. For things to get working properly again, change following two URL's http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts http://www.it-mate.co.uk/downloads/hosts.txt into these URL's http://pgl.yoyo.org/as/serverlist.php?showintro=0;hostformat=hosts http://support.it-mate.co.uk/downloads/hosts.txt
Aah... this is the one that I've been looking for... Replace the ads with some pics/neutral picture instead of Error message. To make this happen, you need the 192.168.1.5 as an apache server right? Is it possible to just point out to a picture like spin.gif in the router (let say 192.168.1.1/spin.gif if the router in the 192.168.1.1) So that another server (192.168.1.5) in this case wouldn't be necessary... Any other solution/choices?...
this iz not quite how should be. can we haz pizelserv intstead of sending ads to 127.0.1 ? how to put pizelserv on tomato ?
There are binary versions of pixelserv posted in this thread http://www.linksysinfo.org/forums/showthread.php?t=62758 most recent at end only for teddy_bear tomato versions.. You can store in on /jffs/ and start it from an init script. You also have to move the router default web server off port 80, or use a recent teddy_bear version that will allow a secondary IP address to also use port 80. Your adblock script must be modified to direct to the IP that pixelserv is listening on. Tomato/dd-wrt user redhat27 has developed a clever method to insert the binary via a dd-wrt custom nvram, http://www.dd-wrt.com/phpBB2/viewtopic.php?t=71036 I don't think this is possible with Tomato, I use ram disk to /var to test/develop and /jffs for non volatile use. Because the c-code is mainly common library calls it would add very little to the highly compressed firmware filesystem if recompiling or using a firmware mod kit with tomato...
wow thanks a lot i did not expect response i do not have 8mb router so will try on 4mb seems like much simpler elegant approach than intalling whole optware !
I used this method to create pixelserv on NVRAM using TeadyBear USB v26 VPN r1 firmware. Can some one please post the Wan Up script I should use that blocks ads and forwards them to this router-hosted pixelserv? What else (if anything) do I have to do to get this working besides executing the blue part, adding the firewall script, and adding the Wan Up script I am requesting? (Do I have to upload the 1 pixel transparent gif, or does the blue code actually make it for me?) Thanks. Edit: I have 8mb WRTSL54GS if that makes a difference. Also, Off-Topic, does anyone know of a non-Japanese firmware that allows my router to be a Windows-compatible VPN server (PPTP) which can be configured through the GUI? (having to install Open VPN is not quite as convenient) I don't even care about USB support.
read my sig Why did you bring this old thread back to life ? ^^; For the VPN server, I don't know, I use TomatoUSB (K24) with VPN Mod.
Sorry, I didn't notice the date and this thread seemed most relevant from the search. I had read everything in your sig, but still wanted it hand-fed to me ...am I to assume that all I have to do (after executing the create code and setting the firewall script) is paste in the Web Up script that you have posted on top of that long post, and that it is pre-configured to work with the NV-ram? ...or do I have to understand and make changes to all those options you talk about in the rest of that post? Thanks.
How do we test if this script works? I've tried going to milliondollarhomepage.com and all ads have loaded.