从国内下载 OpenWrt 官方仓库的软件会比较慢,解决办法是使用国内镜像
我们来调整一下 OpenWrt 存储库的设置
OpenWrt Feed 在 /etc/opkg/distfeeds.conf
中设置
kige@openwrt:~# cd /etc/opkg
kige@openwrt:/etc/opkg# ls
customfeeds.conf distfeeds.conf keys
kige@openwrt:/etc/opkg# cat dist*
src/gz openwrt_core http://downloads.openwrt.org/releases/18.06.1/targets/ar71xx/nand/packages
src/gz openwrt_base http://downloads.openwrt.org/releases/18.06.1/packages/mips_24kc/base
src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.1/packages/mips_24kc/luci
src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.1/packages/mips_24kc/packages
src/gz openwrt_routing http://downloads.openwrt.org/releases/18.06.1/packages/mips_24kc/routing
src/gz openwrt_telephony http://downloads.openwrt.org/releases/18.06.1/packages/mips_24kc/telephony
我们更换成中科大的镜像,地址是:http://openwrt.proxy.ustclug.org
kige@openwrt:/etc/opkg# cp dist* distfeeds.conf.bak
kige@openwrt:/etc/opkg# sed -i s/downloads.openwrt.org/openwrt.proxy.ustclug.org/ /etc/opkg/distfeeds.conf
接下来还要做二件事:
-
把中科大镜像站域名加入 /etc/dnsmasq.d/custom.china.conf
直接修改 accelerated-domains.china.conf 不是好主意,更新文件时我们的修改会被覆盖。
custom.china.conf
包含了自定义的在国内DNS的域名 -
把中科大 OpenWrt 镜像的IP地址
202.141.178.13
加入 /etc/shadowsocks-libe/ip_custom.txtip_custom.txt
是自定义的路由器防火墙忽略的地址,这样即使全局翻墙,中科大OpenWrt镜像还是直连
如果你已经把本项目 clone 到了 Windows 下 C 盘根目录,并且按照 OpenWrt + Git Bash for Windows 快速切换翻墙模式 设置好了一键切换翻墙模式,那么你不用自己修改以上设置,只要如下操作就行了:
调出 Git Bash for Windows,执行命令:
MinGW64 ~$ cd /C/openwrt-fanqiang/openwrt/default
$ scp etc/dnsmasq.d/custom.china.conf router:/etc/dnsmasq.d/
$ scp etc/shadowsocks-libev/ip_custom.txt router:/etc/shadowsocks-libev/
$ ss-restart
$ feeds-cn
你可能猜到了 ss-restart 是自动登录路由器并重启 shadowsocks, 而 feeds-cn 则自动登录路由器并修改OpenWrt软件仓库 feeds 为国内镜像
这种直接在 OpenWrt 里执行命令的方法可比登录界面再去修改设置高效100倍。快点把你心爱的脚本分享出来,并提交到 https://github.com/softwaredownload/openwrt-fanqiang 这样任何人都可以一键使用你的脚本而不用去研究技术细节了
相关资源:
- https://github.com/softwaredownload/openwrt-fanqiang/tree/master/bin
- https://github.com/softwaredownload/openwrt-fanqiang/tree/master/openwrt/default/etc/dnsmasq.d
- https://github.com/softwaredownload/openwrt-fanqiang/tree/master/openwrt/default/etc/shadowsocks-libev
- https://openwrt.org/docs/guide-user/additional-software/opkg
- https://fanqiang.software-download.name/