-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
padavan路由器自动更新dns #57
Comments
现在可以尝试一下这个,速度可能更快一些 |
对于Openwrt系统,可以这样: 40 4 * * * wget --no-check-certificate https://raw.hellogithub.com/hosts -O /tmp/github520.txt && sed -i '/# GitHub520 Host Start/,/# Github520 Host End/d' /etc/hosts ; cat /tmp/github520.txt >> /etc/hosts ; /etc/init.d/dnsmasq restart |
我也是padavan,设置后日志里没显示更新host |
日志不显示的,可以通过“内网LAN”-“DHCP服务器”-“自定义配置文件hosts”查看更新后的信息 |
#93 |
用了mylovesaber的方法确实成功了 |
不同的padavan版本可能不一样吧,不过我确实也很久没用host了(加了旁路由用adguardhome) |
这个方法打不开了 |
2022年5月18日,码云平台启动了代码审查机制,所有开源项目全部默认被屏蔽,而且有点政治不正确或者没选开源许可证就无法转为开源。。。你看github的吧,一样的: |
我的路由器是用的padavan固件,通过如下操作来自动更新路由器的hosts信息
打开浏览器进入路由器的管理页面找到:【高级设置->系统管理->服务栏】里面的计划任务 (Crontab),如下图:
添加以下订阅代码
0 6 * * * sed -i '/# GitHub520 Host Start/,/# Github520 Host End/d' /etc/storage/dnsmasq/hosts;wget --no-check-certificate https://raw.hellogithub.com/hosts -O /etc/storage/dnsmasq/hosts.bak;cat /etc/storage/dnsmasq/hosts.bak >> /etc/storage/dnsmasq/hosts;restart_dhcpd
##代码解释:
3.1 前面的0 6 是代表每天06:00更新一次,时间自己也可以根据cron格式更改。
3.2 sed -i '/# GitHub520 Host Start/,/# Github520 Host End/d' /etc/storage/dnsmasq/hosts 是删除用户自定义hosts中的失效内容
3.3 wget --no-check-certificate https://raw.hellogithub.com/hosts -O /etc/storage/dnsmasq/hosts.bak;cat /etc/storage/dnsmasq/hosts.bak >> /etc/storage/dnsmasq/hosts; 下载并添加hosts内容
3.4 restart_dhcpd 重启dhcp服务加载新的hosts
The text was updated successfully, but these errors were encountered: