Ad-blocking with DD-WRT

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, 4, 5 ... 17, 18, 19  Next
Author Message
HowardZ
DD-WRT Guru


Joined: 18 Jun 2007
Posts: 706
Location: Maryland

PostPosted: Mon Sep 24, 2007 14:08    Post subject: Reply with quote
nemesisdb wrote:
I have a 16mb model with v24vpn installed. I don't have much free memory at the moment (around .5 to .Cool. Am I correct in assuming that I can't do this? Any alternative ways of doing it?


The host file is right around 0.5 MBytes
Sponsor
nemesisdb
DD-WRT User


Joined: 10 Oct 2006
Posts: 197

PostPosted: Mon Sep 24, 2007 14:11    Post subject: Reply with quote
When I see the ram breakdown, 2.8mb of the 13.2 which is available and in use, is listed as 'inactive.' What exactly does that mean?
moreins
DD-WRT User


Joined: 18 Nov 2006
Posts: 320
Location: Cali, Colombia

PostPosted: Wed Sep 26, 2007 3:53    Post subject: Reply with quote
hello
well, after a couple days of testing, the script has been working like a charm...is very effective...
i have a couple of questions though:

*my router gets the internet from a adsl modem. after, for example, a power outage, the adsl modem takes between 90 and 120 seconds to get a valid ip address from the ISP. By that time, the router has already tried to get the HOSTS file but since there is no internet, the router will have no HOSTS file whatsoever and the ad filter will not work. and i believe, after the adsl modem gets an ip address, the router will not recheck for the hosts file....
Is there any way to delay the script in the router, so it can download the hosts file after a couple minutes???

*using the router's gui or telnet, is there any way to check if the ad filter is working ok??? i dont mean to actually browse the internet and see if the ad's show or not. i mean to just log in to the router's telnet and see if the hosts file is loaded and the router is filtering ad sites...

thanks for the info!

moreins

_________________
WRT54GS v2.1 > v24-sp2 (01/01/09) mega
WRT54GS v5 > v24-sp2 (01/01/09) micro
PPTP, WDS link and SD Mod
infusion
DD-WRT Guru


Joined: 30 Aug 2006
Posts: 506

PostPosted: Wed Sep 26, 2007 7:27    Post subject: Reply with quote
@moreins

* Good point. Sure there is a way to make the script to wait some minutes. A count down maybe. There are certainly many ways to implement it, but I'm not able to do it. Maybe some adaption from somewhere...


* I don't know how to see if it's running without seeing if the file has been downloaded or opening the browser to see if it's really working... But wouldn't it be enough??
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Wed Sep 26, 2007 9:17    Post subject: Reply with quote
What about calling the script, created at boot on wanup?
_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
infusion
DD-WRT Guru


Joined: 30 Aug 2006
Posts: 506

PostPosted: Wed Sep 26, 2007 9:25    Post subject: Reply with quote
Good idea. It should solve the problem. Very Happy
moreins
DD-WRT User


Joined: 18 Nov 2006
Posts: 320
Location: Cali, Colombia

PostPosted: Wed Sep 26, 2007 12:45    Post subject: Reply with quote
cyberde wrote:
What about calling the script, created at boot on wanup?

hmmm...nice idea...
you got me on that one though... Embarassed how do i do that?

_________________
WRT54GS v2.1 > v24-sp2 (01/01/09) mega
WRT54GS v5 > v24-sp2 (01/01/09) micro
PPTP, WDS link and SD Mod
HowardZ
DD-WRT Guru


Joined: 18 Jun 2007
Posts: 706
Location: Maryland

PostPosted: Wed Sep 26, 2007 12:50    Post subject: Reply with quote
moreins wrote:

*using the router's gui or telnet, is there any way to check if the ad filter is working ok??? i dont mean to actually browse the internet and see if the ad's show or not. i mean to just log in to the router's telnet and see if the hosts file is loaded and the router is filtering ad sites...
moreins


cd /etc
ls -l hosts

this will show the size of the hosts file

tail -n 25 hosts

this will show the last 25 lines of the hosts file

head -n 25 hosts

this will show the first 25 lines of the hosts file
speedy3k
DD-WRT User


Joined: 19 Apr 2007
Posts: 180

PostPosted: Wed Sep 26, 2007 14:55    Post subject: Reply with quote
moreins wrote:
hello
well, after a couple days of testing, the script has been working like a charm...is very effective...
i have a couple of questions though:

*my router gets the internet from a adsl modem. after, for example, a power outage, the adsl modem takes between 90 and 120 seconds to get a valid ip address from the ISP. By that time, the router has already tried to get the HOSTS file but since there is no internet, the router will have no HOSTS file whatsoever and the ad filter will not work. and i believe, after the adsl modem gets an ip address, the router will not recheck for the hosts file....
Is there any way to delay the script in the router, so it can download the hosts file after a couple minutes???

*using the router's gui or telnet, is there any way to check if the ad filter is working ok??? i dont mean to actually browse the internet and see if the ad's show or not. i mean to just log in to the router's telnet and see if the hosts file is loaded and the router is filtering ad sites...

thanks for the info!

moreins


using the script that I posted, change the sleep 5 to sleep 180. (or whatever) this will delay the script from running for 3 min after startup. (the number is in seconds)
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Wed Sep 26, 2007 15:56    Post subject: Reply with quote
moreins wrote:
cyberde wrote:
What about calling the script, created at boot on wanup?

hmmm...nice idea...
you got me on that one though... Embarassed how do i do that?

Well the script posted by speedy3k, is set as a startup script... This scripts creates /tmp/dlhosts

So all you need to do is enter /tmp/dlhosts in the wanup script in the gui (Administration -> Commands -> Save as firewall script)

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
mickego
DD-WRT Novice


Joined: 26 Sep 2007
Posts: 5

PostPosted: Wed Sep 26, 2007 16:13    Post subject: Cron Job Reply with quote
I´m not running DD-Wrt, but a similar one in my Asus.
I use a Cron Job for downloading updated hosts.
It checks each 5´th minute if "hosts" is updated at all,
Update script puts in a unique entry in my host
which will be looked after when check if hosts are updated
if not, it will be updated.
Each week it will be forced updated to keep it up to date
moreins
DD-WRT User


Joined: 18 Nov 2006
Posts: 320
Location: Cali, Colombia

PostPosted: Wed Sep 26, 2007 16:34    Post subject: Reply with quote
cyberde, speedy3k, HowardZ, thanks for all the info...ill give it a try
_________________
WRT54GS v2.1 > v24-sp2 (01/01/09) mega
WRT54GS v5 > v24-sp2 (01/01/09) micro
PPTP, WDS link and SD Mod
infusion
DD-WRT Guru


Joined: 30 Aug 2006
Posts: 506

PostPosted: Thu Sep 27, 2007 18:07    Post subject: Reply with quote
I'm still struggling with this. I got it working, but I didn't like the script download every time the router starts. So I changed the script to save the file "hosts" to /mmc, then it survives reboot, but I can't get it working this way. What am I missing?

Code:
logger WAN UP Script Executing
sleep 5
test -s /tmp/dlhosts
if [ $? == 1 ] ; then
echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | tr -d '\015\032' | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /mmc/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
cru a Gethosts "30 6 * * 1 /tmp/dlhosts"
infusion
DD-WRT Guru


Joined: 30 Aug 2006
Posts: 506

PostPosted: Fri Sep 28, 2007 8:20    Post subject: Reply with quote
cyberde wrote:
You can also save the hosts file on, let's say an SD card and create an symbolic link in /tmp/hosts to /mmc/etc/hosts for example... Should work...


I want to keep "hosts"in /mmc. How can I create a "symbolic link"? And Why to do it, since you can save it directly to the /mmc folder?
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Fri Sep 28, 2007 13:42    Post subject: Reply with quote
infusion wrote:
cyberde wrote:
You can also save the hosts file on, let's say an SD card and create an symbolic link in /tmp/hosts to /mmc/etc/hosts for example... Should work...


I want to keep "hosts"in /mmc. How can I create a "symbolic link"? And Why to do it, since you can save it directly to the /mmc folder?

You want to do that because you actually need /etc/hosts to contain the information. Since /etc/hosts is a symbolic link to /tmp/hosts you need to create a symbolic link from /tmp/hosts to /mmc/hosts. Otherwise DNSMasq doesn't know where to look ;)

So you could try this:
Code:
rm /tmp/hosts
ln -s /tmp/hosts /mmc/hosts

Note that I havn't tried it yet.

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
Goto page Previous  1, 2, 3, 4, 5 ... 17, 18, 19  Next Display posts from previous:    Page 4 of 19
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum