Open czxinshui opened 4 years ago
已修改成优先通过网络获取ipv6地址,我不具备ipv6环境,麻烦测试下,有结果请反馈!多谢!
你好,第245行代码 ''' ip addrshow eth0 | grep "inet6.*global" | awk '{print $2}' | awk -F"/" '{print $1}' ''').readlines() # 这个返回值是一个list 是不是查看eth0的IPV6,我群晖的IVP6地址是ovs_eth0 请问我这边是否需要修改
Traceback (most recent call last): File "/volume1/@appstore/py3k/usr/local/lib/python3.5/urllib/request.py", line 1240, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1083, in request self._send_request(method, url, body, headers) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1128, in _send_request self.endheaders(body) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1079, in endheaders self._send_output(message_body) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 911, in _send_output self.send(msg) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 854, in send self.connect() File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1229, in connect super().connect() File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 826, in connect (self.host,self.port), self.timeout, self.source_address) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/socket.py", line 693, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/volume1/@appstore/py3k/usr/local/lib/python3.5/socket.py", line 732, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/volume2/homes/water/aliddns/aliddns.py", line 306, in
你好,更新一下脚本,现在已经改成优先从网络获取ipv6,不是从本地获取了,再看下是否还有问题?
你好,还是一样,都是这个代码Traceback (most recent call last): File "/volume1/@appstore/py3k/usr/local/lib/python3.5/urllib/request.py", line 1240, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1083, in request self._send_request(method, url, body, headers) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1128, in _send_request self.endheaders(body) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1079, in endheaders self._send_output(message_body) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 911, in _send_output self.send(msg) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 854, in send self.connect() File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 1229, in connect super().connect() File "/volume1/@appstore/py3k/usr/local/lib/python3.5/http/client.py", line 826, in connect (self.host,self.port), self.timeout, self.source_address) File "/volume1/@appstore/py3k/usr/local/lib/python3.5/socket.py", line 693, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/volume1/@appstore/py3k/usr/local/lib/python3.5/socket.py", line 732, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/volume2/homes/water/aliddns/aliddns.py", line 306, in
你好,还是无法运行成功
能不能做一个IPV6群晖专享的,
确定你的群晖有ipv6环境?我看错误提示是域名解析失败了。。
有啊。用原来没改的代码还是可以用的 https://drive.google.com/file/d/1MHpslKya-0UCat2Dexou_qZZjqo6qf_o/view?usp=sharing
留个邮箱,我给你看下吧。。。
在群晖上运行,脚本首行可以输出正确的 ipv6 地址,但之后却会报如下错误
xxxx:3a1:xxxx:5060::xxxx
开始处理: RR:xxx DomainName:xxx.xx
Traceback (most recent call last):
File "/volume3/C/projects/nastools/aliddns2.py", line 318, in <module>
print("本机IP: " + ip)
TypeError: Can't convert 'NoneType' object to str implicitly
re.search 会使得 ipv6 地址变成 none,绕过就可以设置成功
def get_Local_ipv6_address_win():
"""
Get local ipv6
"""
# pageURL = 'https://ip.zxinc.org/ipquery/'
# pageURL = 'https://ip.sb/'
pageURL = 'https://api-ipv6.ip.sb/ip'
content = urllib.request.urlopen(pageURL).read()
webContent = content.decode("utf8")
print(webContent)
ipv6_pattern = '(([a-f0-9]{1,4}:){7}[a-f0-9]{1,4})'
m = re.search(ipv6_pattern, webContent)
if webContent is not None:
return webContent
else:
return None
TypeError: Can't convert 'NoneType' object to str implicitly 昨晚也是报这个错,命令行少了参数
今天用这个版本设置成功了
你好,群晖的有时候会获取到2个IPV6的地址,一个F开头,一个24开头。F的是内网地址,24是公网地址,请问能否加一条命令,只读24开头的IPV6