一个伪linux粉丝的blog

  1. 首页
  2. network
  3. 正文

router anti ads

18 12 月, 2013 2841点热度 0人点赞 0条评论

简介----家里的路由器是可折腾的wrt54gs,刷了tomato固件,使用超过6年,以前利用了自定义dnsmasq和Access Restriction限制访问,抵挡了一些广告,同时使用了火狐浏览器加上abp插件屏蔽了大部分的广告,加上一些自定义屏蔽广告,世界很清净。

最近 偶尔用下家中LD的电脑,发现N多广告,很不爽。网上搜了一圈,最近发现路由器除了我之前用过的dnsmasq加几条语句,还可以深度配合abblock的广告规则,直接屏蔽更多的广告,从此adblock plus插件退役,IE、chrome等浏览器也不会遭遇广告了,达到原来abp插件的效果。

  • 以前的设置

路由器dnsmasq部分也设置了一些很基本的语句,如

address=/.vnet.cn/127.0.0.1
server=/.google.com/8.8.8.8
server=/.google.com.hk/8.8.8.8
address=/qiye.qq.com/127.0.0.1
......
路由器Access Restriction章节也做了一些广告屏蔽什么的,如

^a.baidu.com
^baidutv.baidu.com
^bar.baidu.com
^pro.letv.com
^images.sohu.com
......

  • 最新方法,dnsmasq+abp规则

1, 在路由器tomato固件为例,在管理章节--脚本--wan up,部分,拷上以下代码


#!/bin/sh
logger WAN up script executing
if test -s /tmp/dnsmasq.ads
then
rm /tmp/dnsmasq.ads
fi

touch /etc/dnsmasq.custom
logger Downloading China Lazy List
wget -O - http://adblock-chinalist.googlecode.com/svn/trunk/adblock-lazy.txt | grep ^\|\|[^\*]*\^$ |
sed -e 's:||:address\=\/:' -e 's:\^:/127\.0\.0\.1:' > /tmp/dnsmasq.ads
grep conf-file /etc/dnsmasq.custom ||
echo -e "\nconf-file=/tmp/dnsmasq.ads" >> /etc/dnsmasq.custom
logger Restarting dnsmasq
killall -9 dnsmasq
dnsmasq --conf-file=/etc/dnsmasq.custom

脚本的意思,就是开机之后,自动获取反广告列表,并且在路由器上拦截

2. 启用内置dns及截获dns端口

img1-dns

.3. 重启路由器生效,或者手动运行以上命令,
从此各种浏览器都告别大部分广告了。

 

参考

http://leosutopia.is-programmer.com/posts/40961.html

http://mlingting.com/5621.html

相关文章:

  1. debian Shadowsocks-libev
  2. how to install open source Tengine
  3. kloxo lighttpd failed
  4. grep awk cut sort uniq sort
标签: 暂无
最后更新:17 1 月, 2017

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 332篇
  • Uncategorized / 116篇
  • unix/linux / 121篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
postgres dreamhost 邮件归档 网站运营 Google k8s kernel ssh 天翼live jira 浏览器 nexus Nginx kubectl ldap docker dreamhost空间 openssl 虚拟主机 VPS deepseek gitlab 泰国 squid Google Voice debian wget Ubuntu d90 google-chrome

COPYRIGHT © 2008-2025 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang