|
本帖最后由 wmjan 于 2017-10-6 15:18 编辑
hosts扶墙:接下来一段时间不会再更新了!原贴:https://github.com/sy618/hosts
<新常态>:9.19号封锁升级,YouTube、Facebook已经被加入特殊照顾名单,待遇与*.twitter.com相同。若使用官方IP(ipv4)经过防火墙时一旦探测到相关域名的CA证书,对应IP通信百分之百被拦截切断。若使用sni服务器IP反代部分域名也会被拦截,但并不是全部IP都会被拦截,能用的IP很少。拦截只针对经过出口路由上。不远将来全面部署CA证书拦截等技术,到时候hosts将成为历史!!
========================================================================================
特别感谢tianbaoha的斐讯K3 官方固件root版本 安装插件 entware及详细指导
特别感谢vokins的hosts项目:https://github.com/vokins/yhosts
小白请先移步K3官方固件root版使用教程——基础篇
项目特点:
重要提示:兲朝上网请通过https加密连接访问!该脚本和方法只适用于斐讯K3 官方固件root版本
例:网址前面都要加https,如果安装后打不开,请刷新缓存在电脑cmd里运行
# https://www.google.com.hk/
# https://www.facebook.com/
# https://www.youtube.com/
# https://twitter.com/
一、光扶墙,不去广告
在PuTTY登陆路由后输入
- touch /opt/etc/fq_update
- chmod 755 /opt/etc/fq_update
复制代码
使用WinSCP修改/opt/etc/fq_update文件为以下代码(没找到的话刷新一下):
- #!/bin/sh
- ###仅限斐讯K3官方固件root版本使用###
- mkdir /opt/etc/dnsmasq.d
- rm -f /opt/etc/dnsmasq.d/*
- # 更新dnsmasq规则
- wget --no-check-certificate -qO - https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq -O /opt/etc/dnsmasq.d/fq.conf
- # 重启dnsmasq服务
- killall dnsmasq
复制代码
手动启动&更新方法:
复制以下所有代码,在PuTTy命令行里直接右键回车(就粘贴运行所有命令)
定时更新方法:
使用WinSCP修改/opt/etc/crontabs/admin文件加入以下代码
- 5 6 * * * /opt/etc/fq_update >/dev/null 2>&1 # update fq
复制代码
二、扶墙去广告
准备:
开始之前请确保已经安装entware-ng环境
在PuTTY登陆路由后输入
opt install
然后选y即可安装完成
已经安装过的请略过
复制以下所有代码,在PuTTy命令行里直接右键回车(就粘贴运行所有命令)
- opkg install coreutils-uniq
- touch /opt/etc/fqad_update
- chmod 755 /opt/etc/fqad_update
复制代码
使用WinSCP修改/opt/etc/fqad_update文件为以下代码(没找到的话刷新一下):
- #!/bin/sh
- mkdir -p /tmp/dns /opt/etc/dnsmasq.d
- rm -f /opt/etc/dnsmasq.d/*
- cd /tmp/dns
- # dnsmasq
- wget --no-check-certificate -qO fq.txt https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq
- wget --no-check-certificate -qO ad.txt https://raw.githubusercontent.com/vokins/yhosts/master/dnsmasq/union.conf
- wget --no-check-certificate -qO easylistchina.txt https://c.nnjsx.cn/GL/dnsmasq/update/adblock/easylistchina.txt
- cat fq.txt ad.txt easylistchina.txt > fqad.txt
- sort fqad.txt | uniq > /opt/etc/dnsmasq.d/fqad.conf
- # hosts
- echo "addn-hosts=/opt/etc/hosts_noad" > /opt/etc/dnsmasq.d/dnsmasq.conf
- wget --no-check-certificate -qO yhosts.txt https://raw.githubusercontent.com/vokins/yhosts/master/hosts
- wget --no-check-certificate -qO malwaredomainlist.txt http://www.malwaredomainlist.com/hostslist/hosts.txt
- wget --no-check-certificate -qO adaway.txt http://77l5b4.com1.z0.glb.clouddn.com/hosts.txt
- cat yhosts.txt adaway.txt malwaredomainlist.txt > noad.txt
- sort noad.txt | uniq > /opt/etc/hosts_noad
- sed -i '/^@/d;/^:/d' /opt/etc/hosts_noad
- rm -f /tmp/dns/*.txt
- killall dnsmasq
复制代码
V21.5.37.246版本可用,如果是以前的版本请在以上代码killall dnsmasq下一行加上以下代码:
- /usr/sbin/dnsmasq --conf-dir=/opt/etc/dnsmasq.d -n -i br0 -r /tmp/resolv.conf
复制代码
手动启动&更新方法:
复制以下所有代码,在PuTTy命令行里直接右键回车(就粘贴运行所有命令)
定时更新方法:
使用WinSCP修改/opt/etc/crontabs/admin文件加入以下代码
- 5 6 * * * /opt/etc/fqad_update >/dev/null 2>&1 # update fqad
复制代码
结尾:成功的不要忘了加个分,失败的请检查
|
评分
-
查看全部评分
|