dnsmasq_sniproxy_install
dnsmasq_sniproxy_install copied to clipboard
每一次更换IP解锁配置就失效
每次都要重新安装,有什么好的办法?
可以尝试一下只重启服务
已尝试,依旧失效,只能重新安装
求助大佬,DNS解锁机ip变更后,如何让Sniproxy和Dnsamq变更地址?还是它会自动变更?
ip变更时,只需要更新dnsmasq的目标解析IP就可以了,例如批量替换1.2.3.4
到5.6.7.8
:
sed -i "s/1.2.3.4/5.6.7.8/g" /etc/dnsmasq.d/custom_netflix.conf
替换完重启使其生效 systemctl restart dnsmasq
现在可以使用autoupdateip.sh
脚本,来实现自动变更dnsmasq配置文件中的IP,具体说明见脚本内容底部
现在可以使用
autoupdateip.sh
脚本,来实现自动变更dnsmasq配置文件中的IP,具体说明见脚本内容底部
这个脚本在哪里?
这个脚本在哪里?
在仓库,刚提交
好的。很期待这个脚本!这样ip被奈飞Ban后不用每次都卸载重装叻
可以先测试一下,有问题再反馈哦
这个脚本在哪里?
在仓库,刚提交
我在仓库也没有找到脚本
https://github.com/myxuchangbin/dnsmasq_sniproxy_install/blob/master/autoupdateip.sh
名字给你说错了,是autoupdateip.sh
名字给你说错了,是
autoupdateip.sh
bash autoupdateip.sh ddns网址 tail: cannot open '/tmp/autochangeip.log' for reading: No such file or directory
已更新,请重试一下
ip变更时,只需要更新dnsmasq的目标解析IP就可以了,例如批量替换
1.2.3.4
到5.6.7.8
:sed -i "s/1.2.3.4/5.6.7.8/g" /etc/dnsmasq.d/custom_netflix.conf
替换完重启使其生效systemctl restart dnsmasq
最近正好换ip,试了下自动脚本,脚本运行了没有报错,但是查看文件并没有修改成功。最终还是靠这个手动命令改成功了,然后Restart后生效叻!
定时任务是否设置正确
定时任务是否设置正确
和定时任务没关系。是我改了IP之后,运行bash autoupdateip.sh后,ip并没有修改成功
bash autoupdateip.sh 不带参数直接运行是改为本机的公网ip。难道他没识别到本机的公网ip改变了?
可以执行bash -x autoupdateip.sh
,看一下脚本运行过程,方便排错
可以执行
bash -x autoupdateip.sh
,看一下脚本运行过程,方便排错
root@22-12-30-1046:~# bash -x autoupdateip.sh
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
- export PATH
- [[ -f /etc/redhat-release ]]
- cat /etc/issue
- grep -Eqi debian
- cat /etc/issue
- grep -Eqi ubuntu
- release=ubuntu
- command -v wget
- '[' -n '' ']' ++ get_ip +++ ip addr +++ egrep -o '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}' +++ egrep -v '^192.168|^172.1[6-9].|^172.2[0-9].|^172.3[0-2].|^10.|^127.|^255.|^0.' +++ head -n 1 ++ local IP= ++ '[' -z ']' +++ wget -qO- -t1 -T2 ipv4.icanhazip.com ++ IP=129.150.39.XX ++ '[' -z 129.150.39.XX ']' ++ echo 129.150.39.XX
- newip=129.150.39.XX
- file=/etc/dnsmasq.d/custom_netflix.conf
- '[' '!' -e /etc/dnsmasq.d/custom_netflix.conf ']'
- IPREX='([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' ++ date +%Y-%m-%d-%H:%M
- time=2023-01-12-11:30 ++ grep netflix.com /etc/dnsmasq.d/custom_netflix.conf ++ grep -Eo '([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' ++ tail -n1
- oldip=129.150.39.XX
- '[' 129.150.39.XX '!=' 129.150.39.XX ']' root@22-12-30-1046:~#
我把ip的最后一位隐藏叻。这次因为没有改动ip,所以看日志好像是对的。等我慢点ip变更了,我再运行试试看,再把日志发给你看看
目前日志是没有问题的,等ip变更了再测试一下吧
目前日志是没有问题的,等ip变更了再测试一下吧
哈哈 成功了!感恩!!!