浙江电信光猫获取IPV6并关闭防火墙

您所在的位置:网站首页 天翼网关的路由器怎么关闭 浙江电信光猫获取IPV6并关闭防火墙

浙江电信光猫获取IPV6并关闭防火墙

2024-07-12 10:53| 来源: 网络整理| 查看: 265

1 首先查看光猫背面的密码,记下来 2 (可选)打电话给10000改成桥接,理由是装摄像头外网访问,然后记录下来拨号账号(实测可以Wifi路由器加电脑多拨,自己配置拨号上网) 在这里插入图片描述 在这里插入图片描述

3 连上网线,访问192.168.1.1:8080,用户名useradmin,密码是光猫背面的密码,去安全-防火墙-启用IPV6 SESSION下面去掉钩子后保存 在这里插入图片描述 4 访问http://192.168.0.1/,去TP-Link里面关闭IPv6防火墙,打开DMZ主机 在这里插入图片描述 在这里插入图片描述 这样子做完后,电脑直接连光猫拨号就能获取IPv6地址,用于SunShine串流,配合阿里云DDNS进行远程桌面,实测IPv6地址比较稳定、每次拨号都会换一下,拨号后不断连不会变。 其次,设置为DMZ主机的电脑连上Wifi后,能够使用TP路由器的IPv6地址连接,但是电脑自身的IPv6地址无法Ping通,这个方案不需要改桥接。 附上常用链接 手柄测试:https://www.9slab.com/gamepad/home 本机ip获取 可用于DDNS:https://iden/ IPv6地址测试:https://www.test-ipv6.com/index.html.zh_CN IPv6地址测试:https://test-ipv4.com/ 被Ping测试:https://ipw.cn/ipv6ping/

SunShine需要打开设置:UPnP和Address Family 注意如果需要远程映射手柄,必须要安装sunshine-windows-installer.exe,便携版的sunshine-windows-portable.zip无法正确映射手柄 在这里插入图片描述 附上DDNS参考代码

import os, time # import socket from aliyunsdkcore.client import AcsClient from aliyunsdkalidns.request.v20150109.DescribeSubDomainRecordsRequest import DescribeSubDomainRecordsRequest from aliyunsdkalidns.request.v20150109.DeleteSubDomainRecordsRequest import DeleteSubDomainRecordsRequest from urllib.request import urlopen import json import requests # pip install aliyun-python-sdk-core-v3 # pip install aliyun-python-sdk-alidns==3.0.1 class DnsController: access_key_id = "***" access_key_secret = "***" region = "cn-hangzhou" # 时区 # record_type = "A" # ipv4 record_type = "AAAA" # ipv6 domain = "***" # 一级域名 name_ipv4 = ["***"] # 需要解析的二级域名 def __init__(self): self.client = AcsClient( self.access_key_id, self.access_key_secret, self.region ) # 添加新的域名解析记录 def add(self, DomainName, RR, Type, Value): from aliyunsdkalidns.request.v20150109.AddDomainRecordRequest import AddDomainRecordRequest request = AddDomainRecordRequest() request.set_accept_format('json') request.set_DomainName(DomainName) request.set_RR(RR) request.set_Type(Type) request.set_Value(Value) response = self.client.do_action_with_exception(request) print("Success update", RR + "." + DomainName, "at", Value, time.strftime(", %Y-%m-%d, %H:%M:%S.")) print(response) # 实现ddns def update_target_dns(self, ip_address): request = DescribeSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(self.domain) for item in self.name_ipv4: request.set_SubDomain(item + '.' + self.domain) response = self.client.do_action_with_exception(request) domain_list = json.loads(response) if domain_list['TotalCount'] == 0: self.add(self.domain, item, self.record_type, ip_address) else: if domain_list['DomainRecords']['Record'][0]['Value'].strip() != ip_address.strip(): request = DeleteSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(self.domain) request.set_RR(item) response = self.client.do_action_with_exception(request) print("Delete old DNS.") self.add(self.domain, item, self.record_type, ip_address) else: print("DNS exists,", item + '.' + self.domain, "at", ip_address, time.strftime(", %Y-%m-%d, %H:%M:%S.")) #%% import os import re def getIPv6Address(): output = os.popen("ipconfig /all").read() result = re.findall(r"(([a-f0-9]{1,4}:){7}[a-f0-9]{1,4})", output, re.I) if len(result)>0 and len(result[0][0])>0: res = result[0][0].strip() else: print('reconnect') result = os.popen("rasdial 宽带连接 *** ***").read() if result.find("Command completed successfully")>=0: res = getIPv6Address() return res def get_external_ip(): try: ip = requests.get('https://iden').text.strip() # ip = requests.get('https://v6.iden').text.strip() return ip except: return None #%% def main(): root_path = '.' log_path = root_path + '/ip_log.log' fa = open(log_path, 'a', encoding='utf-8') # cur_ip = socket.gethostbyname(socket.gethostname()) # cur_ip = get_external_ip() cur_ip = getIPv6Address() if not os.path.isfile(log_path) and fa.read().strip() == '': fa.write(cur_ip + '##') DnsController().update_target_dns(cur_ip) fa.close() return 0 with open(log_path, 'r', encoding='utf-8') as fr: old_ip = fr.read().strip('##').split('##')[-1] if old_ip != cur_ip or old_ip is None: # print('old:', old_ip) fa.write(cur_ip + '##') DnsController().update_target_dns(cur_ip) fa.close() if __name__ == '__main__': # main() DDNS = DnsController() # while True: # DDNS.update_target_dns(get_external_ip()) # time.sleep( 60 * 60 * 6 ) ip = getIPv6Address() DDNS.record_type = "AAAA" if ip.find(':')>0 else "A" DDNS.update_target_dns(ip) while True: try: if ip != getIPv6Address(): ip = getIPv6Address() DDNS.record_type = "AAAA" if ip.find(':')>0 else "A" print("IP change to", ip) DDNS.update_target_dns(ip) except Exception as e: print(e) time.sleep( 1 ) # time.sleep( 60 * 1 )


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3