dnsmasq_sniproxy_install icon indicating copy to clipboard operation
dnsmasq_sniproxy_install copied to clipboard

每一次更换IP解锁配置就失效

Open xiaoliyay opened this issue 2 years ago • 23 comments

每次都要重新安装,有什么好的办法?

xiaoliyay avatar Oct 02 '22 10:10 xiaoliyay

可以尝试一下只重启服务

myxuchangbin avatar Oct 02 '22 14:10 myxuchangbin

已尝试,依旧失效,只能重新安装

xiaoliyay avatar Oct 03 '22 10:10 xiaoliyay

求助大佬,DNS解锁机ip变更后,如何让Sniproxy和Dnsamq变更地址?还是它会自动变更?

jackiehj avatar Nov 25 '22 16:11 jackiehj

ip变更时,只需要更新dnsmasq的目标解析IP就可以了,例如批量替换1.2.3.45.6.7.8sed -i "s/1.2.3.4/5.6.7.8/g" /etc/dnsmasq.d/custom_netflix.conf 替换完重启使其生效 systemctl restart dnsmasq

myxuchangbin avatar Jan 01 '23 05:01 myxuchangbin

现在可以使用autoupdateip.sh脚本,来实现自动变更dnsmasq配置文件中的IP,具体说明见脚本内容底部

myxuchangbin avatar Jan 01 '23 05:01 myxuchangbin

现在可以使用autoupdateip.sh脚本,来实现自动变更dnsmasq配置文件中的IP,具体说明见脚本内容底部

这个脚本在哪里?

jackiehj avatar Jan 01 '23 06:01 jackiehj

这个脚本在哪里?

在仓库,刚提交

myxuchangbin avatar Jan 01 '23 06:01 myxuchangbin

好的。很期待这个脚本!这样ip被奈飞Ban后不用每次都卸载重装叻

jackiehj avatar Jan 01 '23 06:01 jackiehj

可以先测试一下,有问题再反馈哦

myxuchangbin avatar Jan 01 '23 06:01 myxuchangbin

这个脚本在哪里?

在仓库,刚提交

我在仓库也没有找到脚本

jackiehj avatar Jan 01 '23 06:01 jackiehj

https://github.com/myxuchangbin/dnsmasq_sniproxy_install/blob/master/autoupdateip.sh

myxuchangbin avatar Jan 01 '23 06:01 myxuchangbin

名字给你说错了,是autoupdateip.sh

myxuchangbin avatar Jan 01 '23 06:01 myxuchangbin

名字给你说错了,是autoupdateip.sh

bash autoupdateip.sh ddns网址 tail: cannot open '/tmp/autochangeip.log' for reading: No such file or directory

jackiehj avatar Jan 01 '23 07:01 jackiehj

已更新,请重试一下

myxuchangbin avatar Jan 01 '23 08:01 myxuchangbin

ip变更时,只需要更新dnsmasq的目标解析IP就可以了,例如批量替换1.2.3.45.6.7.8sed -i "s/1.2.3.4/5.6.7.8/g" /etc/dnsmasq.d/custom_netflix.conf 替换完重启使其生效 systemctl restart dnsmasq

最近正好换ip,试了下自动脚本,脚本运行了没有报错,但是查看文件并没有修改成功。最终还是靠这个手动命令改成功了,然后Restart后生效叻!

jackiehj avatar Jan 10 '23 18:01 jackiehj

定时任务是否设置正确

myxuchangbin avatar Jan 11 '23 12:01 myxuchangbin

定时任务是否设置正确

和定时任务没关系。是我改了IP之后,运行bash autoupdateip.sh后,ip并没有修改成功

jackiehj avatar Jan 11 '23 13:01 jackiehj

bash autoupdateip.sh 不带参数直接运行是改为本机的公网ip。难道他没识别到本机的公网ip改变了?

jackiehj avatar Jan 11 '23 13:01 jackiehj

可以执行bash -x autoupdateip.sh,看一下脚本运行过程,方便排错

myxuchangbin avatar Jan 12 '23 03:01 myxuchangbin

可以执行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:~#

jackiehj avatar Jan 12 '23 03:01 jackiehj

我把ip的最后一位隐藏叻。这次因为没有改动ip,所以看日志好像是对的。等我慢点ip变更了,我再运行试试看,再把日志发给你看看

jackiehj avatar Jan 12 '23 03:01 jackiehj

目前日志是没有问题的,等ip变更了再测试一下吧

myxuchangbin avatar Jan 12 '23 09:01 myxuchangbin

目前日志是没有问题的,等ip变更了再测试一下吧

哈哈 成功了!感恩!!!

jackiehj avatar Jan 12 '23 13:01 jackiehj