老毛子路由器添加dnsmasq去广告等

hiboy 老毛子 潘多拉固件 (荒野无灯在尾部)

一、手动添加

手动添加到自定义脚本的【在 WAN 上行/下行启动后执行】里,实现网络连接上时自动更新。也可以直接在命令行里直接运行。

#自由上网dnsmasq:
wget --no-check-certificate https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq -O /etc/storage/dnsmasq/dnsmasq.d/dnsfq.conf;sed -i "1 i\## update:$(date "+%Y-%m-%d %H:%M:%S")" /etc/storage/dnsmasq/dnsmasq.d/dnsfq.conf;restart_dhcpd

#去广告hosts:
wget --no-check-certificate https://raw.githubusercontent.com/vokins/yhosts/master/hosts -O /etc/storage/dnsmasq/hosts;sed -i "1 i\## update:$(date "+%Y-%m-%d %H:%M:%S")" /etc/storage/dnsmasq/hosts;restart_dhcpd

手动添加到定时任务crontab(在 系统管理 - 服务 -计划任务 (Crontab) 里)

#自由上网dnsmasq:
01 00 * * * wget --no-check-certificate https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq -O /etc/storage/dnsmasq/dnsmasq.d/dnsfq.conf;restart_dhcpd

#去广告hosts
02 00 * * * wget --no-check-certificate https://raw.githubusercontent.com/vokins/yhosts/master/hosts  -O /etc/storage/dnsmasq/hosts;restart_dhcpd

当然用SS的可以只添加yhosts的去广告

二、自动化脚本,不会手动添加的用以下一键脚本命令 适用 hiboy大和荒野无灯大的【padavan固件】

固件地址:http://www.right.com.cn/forum/thread-161324-1-1.html

一键运行命令fq+ad:

mkdir -p /etc/storage/dnsmasq/dns;wget --no-check-certificate https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/sh/setting.sh -O /etc/storage/dnsmasq/dns/setting.sh;sh /etc/storage/dnsmasq/dns/setting.sh

一键运行命令ad(在start.sh里把下载dnsmasq文件的部分注释掉了):

mkdir -p /etc/storage/dnsmasq/dns;wget --no-check-certificate http://www.samzz.tk/tmp/laomaozi/ad/ad.sh -O /etc/storage/dnsmasq/dns/setting.sh;sh /etc/storage/dnsmasq/dns/setting.sh

一键还原命令相同:

sh /etc/storage/dnsmasq/dns/del.sh

详细看https://github.com/sy618/hosts/tree/master/dnsmasq/sh

荒野无灯 潘多拉固件

因dnsmasq配置文件里conf-dir目录和hiboy的不同,添加计划任务略有不同,见下

#自由上网dnsmasq:
01 00 * * *wget --no-check-certificate https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq -O /etc/storage/dnsmasq/conf.d/dnsfq.conf;restart_dhcpd

#去广告hosts:
02 00 * * * wget --no-check-certificate https://raw.githubusercontent.com/vokins/yhosts/master/hosts -O /etc/storage/dnsmasq/hosts;restart_dhcpd

重点是一键脚本也完全适用荒野无灯!!原因是一键脚本是在配置文件里指定了新的规则文件目录,都是/etc/storage/dnsmasq/dns

来源

去广告项目:
https://github.com/vokins/yhosts

FQ项目:
https://github.com/sy618/hosts

标签: none

已有 3 条评论

  1. 0624更新:测试发现在计划任务里添加代码方法,写入路由更新日期那段无法执行,但是手动执行可以,尝试改为 MYDATE=$(date +%Y-%m-%d' '%H:%M:%S) ; echo '##updata:' "$MYD
    ATE" >> hosts 还是不执行,所以去掉; 原本dnsfq和 hosts的更新日期可作参考。

    1. 原本代码是 下载——添加更新时间——重启,现在去掉了中间的‘’添加更新时间‘’毫无影响

  2. Jet Jet

    githubcontent的link都404了。。

添加新评论

18luck 365bet 888zhenren aomenduchang aomenjinshayule baijiale bbin beplay bet007 betvictor betway bifa bst hg0088 bwin fenghuangyule jinbobao lebaijia long8 manbet quanxunwang shenbotaiyangcheng tengbohui ule vwin w88 wellbet WilliamHill yulepingtai laohuji