找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 14327|回复: 12

dnsmasq的妙用:屏蔽广告及其他

[复制链接]
发表于 2012-12-12 18:13 | 显示全部楼层 |阅读模式
本帖最后由 99010 于 2012-12-12 20:21 编辑

参考https://www.right.com.cn/forum/thread-100129-1-3.html帖子做个自动更新脚本。
1。在根目录建一个文件夹hostsx,添加脚本upHostsX,内容如下脚本:
  1. #!/bin/sh

  2. rm -f /hostsx/HostsX.orzhosts
  3. wget http://hostsx.googlecode.com/svn/trunk/HostsX.orzhosts -P /hostsx
  4. /etc/init.d/dnsmasq restart
复制代码
脚本权限0755

2。在网络--DHCP/DNS--HOSTS和解析文件

额外的HOSTS文件那里填上:
  1. /hostsx/HostsX.orzhosts
复制代码
保存应用

3。运行脚本
  1. /hostsx/upHostsX
复制代码
4。添加计划任务,在/etc/crontabs/root里面添加一行
  1. 0 6 * * * /hostsx/upHostsX
复制代码
注:每天早上6点自动更新HostsX.orzhosts

我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2012-12-12 18:14 | 显示全部楼层
自己沙发
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2012-12-12 18:22 | 显示全部楼层
本帖最后由 99010 于 2012-12-12 18:25 编辑

屏蔽ISP劫持广告

在win或者openwrt的命令行运行nslookup,随便nslookup几个不存在的域名地址,比如:nslookup www.abcd963.com

记下返回的IP地址(这样是为了获得ISP广告服务器的IP,例如广西联通的广告IP为“220.250.64.18”)


修改/etc/config/dhcp,在config dnsmasq里面添加:
  1. list bogusnxdomain     '220.250.64.18'
复制代码
保存

重启dnsmasq:
  1. /etc/init.d/dnsmasq restart
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-12-12 19:39 | 显示全部楼层
添加计划任务要修改哪个文件呢?说清楚点啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-12-14 12:04 | 显示全部楼层
好东西,我设置一下看看!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-12-15 17:44 | 显示全部楼层
厉害,标记一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2012-12-18 16:35 | 显示全部楼层
这个技术要学习下,回家自己改下在用的路由,等效果再回复。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2013-8-2 11:35 | 显示全部楼层
http://hostsx.googlecode.com/svn/trunk/HostsX.orzhosts这个网站打开就是下面的内容
title HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx

start "" http://9bu.org/hostsx
goto :eof

;version=HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
;hostsxversion=HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
;author=HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
;description=HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
@HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
#HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
HostsX 新版本已发布,此版本已淘汰,请即刻更新!http://9bu.org/hostsx
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-3-5 23:01 来自手机 | 显示全部楼层
好东西,谢谢分享。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-4-11 22:31 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-4-11 22:37 | 显示全部楼层
  1. #!/bin/sh

  2. rm -f /hostsx/HostsX.orzhosts
  3. wget http://smarthosts.googlecode.com/svn/trunk/hosts -P /hostsx
  4. /etc/init.d/dnsmasq restart
复制代码
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2015-1-20 22:15 | 显示全部楼层
不知道还能不能呢个用
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2015-1-21 11:58 | 显示全部楼层
mark一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-25 19:06

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表