爱快创建OpenWrt虚拟机,自动优选ip

openwrt固件定制地址https://openwrt.ai/

爱快虚拟机要下载这个固件

483a1c9a272b278e88877.png

下面是虚拟机设置

d92902f35a868f471a011.png

接下来点击vnc,修改OpenWrt的网络ip

1、以root的身份登录;
2、修改/etc/config/network文件:
vim /etc/config/network
按i或者insert键,把 option gateway ‘192.168.1.1’改成自己需要的IP地址,如192.168.100.2,再按ESC键,再按:wq保存退出,重启即可。

进入OpenWrt的终端,下载优选ip一键脚本
项目地址:https://github.com/yonggekkk/openwrt_win64-ddns-cdnip

curl -ksSL https://gitlab.com/rwkgyg/cdnopw/raw/main/cdnopw.sh -o cdnopw.sh && bash cdnopw.sh

设置计划任务定时任务

每三个小时执行一次

1
2
3
4
5
6
7
8
30 0 * * * cd /root/cfipopw/ && bash cdnip.sh
30 3 * * * cd /root/cfipopw/ && bash cdnip.sh
30 6 * * * cd /root/cfipopw/ && bash cdnip.sh
30 9 * * * cd /root/cfipopw/ && bash cdnip.sh
30 12 * * * cd /root/cfipopw/ && bash cdnip.sh
30 15 * * * cd /root/cfipopw/ && bash cdnip.sh
30 18 * * * cd /root/cfipopw/ && bash cdnip.sh
30 21 * * * cd /root/cfipopw/ && bash cdnip.sh