记一次阿里云DNS不干人事

发布于 2025-03-11  3 次阅读


1.问题描述:

在香港VPS写了一个脚本,用来给女朋友抓取youtube上的chiikawa更新,今天看日志总是证书报错:

Unable to download API page: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.youtube.com'. (_ssl.c:1137) (caused by CertificateVerifyError("[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.youtube.com'. (_ssl.c:1137)")); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U

一顿折腾,又是同步时间,又是更新证书、升级python的。后来nslookup www.youtube.com了以下:

root@yxvm-8136216:~# nslookup www.youtube.com
Server:         223.5.5.5
Address:        223.5.5.5#53

Non-authoritative answer:
Name:   www.youtube.com
Address: 31.13.68.169
Name:   www.youtube.com
Address: 2001::1

这解析地址给我干哪来了,还是油管吗?

不禁想起刘海柱那句话:

阿里dns把youtube的域名解析到了facebook,导致证书验证错误,遂使用谷歌自家DNS 8.8.8.8

2.永久修改debian11 DNS

写保护锁定 resolv.conf 文件

1. 删除 resolv.conf 文件

rm -f /etc/resolv.conf

2. 创建并编辑 resolv.conf 文件

editor /etc/resolv.conf

3. 填写上指定的 DNS 服务器

nameserver 8.8.8.8

4. 设置写保护锁定 resolv.conf 文件

chattr +i /etc/resolv.conf

此时 resolv.conf 文件会被锁定, 重启系统后不会被覆盖。

如果想要解锁可以运行:

chattr -i /etc/resolv.conf

参考:https://www.vdj.me/archives/252.html