Skip to content
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

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

Open
xiaoliyay opened this issue Oct 2, 2022 · 23 comments
Open

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

xiaoliyay opened this issue Oct 2, 2022 · 23 comments

Comments

@xiaoliyay
Copy link

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

@myxuchangbin
Copy link
Owner

可以尝试一下只重启服务

@xiaoliyay
Copy link
Author

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

@jackiehj
Copy link

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

@myxuchangbin
Copy link
Owner

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

@myxuchangbin
Copy link
Owner

myxuchangbin commented Jan 1, 2023

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

@jackiehj
Copy link

jackiehj commented Jan 1, 2023

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

这个脚本在哪里?

@myxuchangbin
Copy link
Owner

这个脚本在哪里?

在仓库,刚提交

@jackiehj
Copy link

jackiehj commented Jan 1, 2023

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

@myxuchangbin
Copy link
Owner

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

@jackiehj
Copy link

jackiehj commented Jan 1, 2023

这个脚本在哪里?

在仓库,刚提交

我在仓库也没有找到脚本

@myxuchangbin
Copy link
Owner

@myxuchangbin
Copy link
Owner

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

@jackiehj
Copy link

jackiehj commented Jan 1, 2023

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

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

@myxuchangbin
Copy link
Owner

已更新,请重试一下

@jackiehj
Copy link

ip变更时,只需要更新dnsmasq的目标解析IP就可以了,例如批量替换1.2.3.45.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后生效叻!

@myxuchangbin
Copy link
Owner

定时任务是否设置正确

@jackiehj
Copy link

定时任务是否设置正确

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

@jackiehj
Copy link

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

@myxuchangbin
Copy link
Owner

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

@jackiehj
Copy link

可以执行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
Copy link

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

@myxuchangbin
Copy link
Owner

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

@jackiehj
Copy link

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

哈哈 成功了!感恩!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants