rfancn / aliyun-ddns-client

Python DDNS client for Aliyun
404 stars 137 forks source link

外网IP地址更改后,无法更新IP #10

Closed guigeng closed 7 years ago

guigeng commented 7 years ago

2016-12-27 12:22:45 [ERROR] Failed to fetch remote DomainRecords. 2016-12-27 12:22:45 [ERROR] Failed finding remote DomainRecord[@.xxx.com]

家里断电,路由器和电脑关掉。来电后,IP地址更改出错

rfancn commented 7 years ago

if you have debug=true in ddns.conf, it should print more information. And normally it because network is not reachable or the system time in your computer has big difference with what's in Aliyun server.

  1. pls make sure the firewall is disabled on your computer For redhat/centos6 # service stop iptables Or (redhat/centos7) # systemctl stop firewalld

  2. pls check current time in your computer, if it has big difference with the correct time, then: # date # ntpdate -u ntp.gwadar.cn

At last, if the issue caused by time difference, I would suggest you enable ntp service and take ntp.gwadar.cn as the ntp server in /etc/ntp.conf

guigeng commented 7 years ago

1.the firewalld is not enabled 2.the system time has updated 3.i have set debug=true in ddns.conf it already prints:

2016-12-27 15:02:59 [ERROR] Failed to fetch remote DomainRecords.
2016-12-27 15:02:59 [ERROR] Failed finding remote DomainRecord[@.xxx.com]
rfancn commented 7 years ago

Pls get the debug file from below URL and replace the one in aliyun-ddns-client dir. ftp://www.guanxigo.com/pub/yunresolver.py

Run 'python ddns.py' again and paste output here.

guigeng commented 7 years ago

2016-12-27 15:37:33 [ERROR] Failed to fetch remote DomainRecords. 2016-12-27 15:37:33 [ERROR] Failed finding remote DomainRecord[@.xxxcom] 2016-12-27 15:37:33 [ERROR] Failed to fetch remote DomainRecords. 2016-12-27 15:37:33 [ERROR] Failed finding remote DomainRecord[www.xxx.com] 2016-12-27 15:37:33 [ERROR] Failed to fetch remote DomainRecords. 2016-12-27 15:37:33 [ERROR] Failed finding remote DomainRecord[c.xxx.com]

下载ftp://www.guanxigo.com/pub/yunresolver.py这个之后,重新执行python ddns.py 仍然是这个

rfancn commented 7 years ago

Download nd replace them in aliyun-ddns-client dir, and try again, paste output here. ftp://www.guanxigo.com/pub/yunresolver.py ftp://www.guanxigo.com/pub/record.py

guigeng commented 7 years ago
# python ddns.py
2016-12-27 15:51:59 [ERROR] Failed to fetch remote DomainRecords
Traceback (most recent call last):
  File "ddns.py", line 70, in <module>
    main()
  File "ddns.py", line 49, in main
    remote_record = record_manager.fetch_remote_record(local_record)
  File "/opt/aliyun-ddns-client/record.py", line 130, in fetch_remote_record
    raise ex
AttributeError: 'X509' object has no attribute '_x509'
rfancn commented 7 years ago

It looks like to be openssl and cryptography library compatible issue, pls do following: sudo yum uninstall python-requests sudo pip uninstall pyopenssl cryptography requests sudo pip install requests

guigeng commented 7 years ago

the ip address has updated. thanks!

# python ddns.py 
200
{u'TotalCount': 1, u'PageNumber': 1, u'RequestId': u'F3BB9B2B-D73D-4078-972A-33E19E62EBEA', u'PageSize': 20, u'DomainRecords': {u'Record': [{u'Status': u'ENABLE', u'Locked': False, u'RR': u'@', u'DomainName': u'xxx.com', u'RecordId': u'3169688034200576', u'Value': u'1.1.1.1', u'TTL': 600, u'Line': u'default', u'Type': u'A'}]}}
2016-12-27 16:21:52 [INFO]  Successfully updated DomainRecord[@.xxx.com]
200
{u'TotalCount': 1, u'PageNumber': 1, u'RequestId': u'9F0DFEEB-A7DA-4039-8B9B-3B3132FC861E', u'PageSize': 20, u'DomainRecords': {u'Record': [{u'Status': u'ENABLE', u'Locked': False, u'RR': u'www', u'DomainName': u'xxx.com', u'RecordId': u'3169687791375360', u'Value': u'1.1.1.1', u'TTL': 600, u'Line': u'default', u'Type': u'A'}]}}
2016-12-27 16:21:52 [INFO]  Successfully updated DomainRecord[www.xxx.com]
200
{u'TotalCount': 1, u'PageNumber': 1, u'RequestId': u'87575157-E0A1-475A-A600-C40F8ED82BAB', u'PageSize': 20, u'DomainRecords': {u'Record': [{u'Status': u'ENABLE', u'Locked': False, u'RR': u'c', u'DomainName': u'xxx.com', u'RecordId': u'3178250787688448', u'Value': u'1.1.1.1', u'TTL': 600, u'Line': u'default', u'Type': u'A'}]}}
2016-12-27 16:21:53 [INFO]  Successfully updated DomainRecord[c.xxx.com]
rfancn commented 7 years ago

The pyopenssl version need >=0.14, the solution is upgrading the related packages to the latest version. sudo yum uninstall python-requests sudo pip uninstall pyopenssl cryptography requests sudo pip install requests

guigeng commented 7 years ago

pip uninstall pyopenssl cryptography requests

DEPRECATION: Uninstalling a distutils installed project (pyopenssl) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling pyOpenSSL-0.13.1: Successfully uninstalled pyOpenSSL-0.13.1 Uninstalling cryptography-1.3.1: Successfully uninstalled cryptography-1.3.1 Uninstalling requests-2.12.3: Successfully uninstalled requests-2.12.3 之前可以正常更新的。不知道为何突然出现这样的问题。 在yum remove python-requests的时候,certbot也被卸载了。我安装过certbot,现在改用acme.sh。应该不会有影响吧? 非常感谢!

Package Arch Version Repository Size

Removing: python-requests noarch 2.6.0-1.el7_1 @base 343 k Removing for dependencies: certbot noarch 0.9.3-1.el7 @epel 21 k python2-acme noarch 0.9.3-1.el7 @epel 784 k python2-certbot noarch 0.9.3-1.el7 @epel 1.6 M

rfancn commented 7 years ago

You had better avoid installing python packages using yum or rpm, use pip as possible as you can, for OS shipped python packages and it's related libraries usually are older than the one installed by pip. Basic rule is install all python packages by pip, avoid using yum or rpm unless there is strong reason to do that.

So exactly follow above order to remove and install packages are the correct way to clean the errors that mix up using OS python packages and PIP installed python packages. If new version of python package don't need certbot, then that library may got deprecated, that's fine.

SangCoding commented 5 years ago

No option interface in section: DomainRecord1 Traceback (most recent call last): File "ddns.py", line 79, in main() File "ddns.py", line 33, in main current_public_ip = DDNSUtils.get_interface_address(config.pifn_interface) File "/opt/aliyun-ddns-client/utils.py", line 86, in get_interface_address import netifaces as ni ImportError: No module named netifaces

rfancn commented 5 years ago

pip install netifaces

---原始邮件--- 发件人: "Wencheng Sang"notifications@github.com 发送时间: 2019年8月10日(星期六) 下午4:20 收件人: "rfancn/aliyun-ddns-client"aliyun-ddns-client@noreply.github.com; 抄送: "State change"state_change@noreply.github.com;"Ryan Fan"reg_info@qq.com; 主题: Re: [rfancn/aliyun-ddns-client] 外网IP地址更改后,无法更新IP (#10)

No option interface in section: DomainRecord1 Traceback (most recent call last): File "ddns.py", line 79, in main() File "ddns.py", line 33, in main current_public_ip = DDNSUtils.get_interface_address(config.pifn_interface) File "/opt/aliyun-ddns-client/utils.py", line 86, in get_interface_address import netifaces as ni ImportError: No module named netifaces

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.