Python 的 socket.gethostbyaddr() 在 linux 上返回空的别名列表
我在 Windows 和 Linux 上都尝试过 Python2 和 Python3。它可以在 Windows 上运行,但不能在 Linux(Ubuntu 和 RedHat)上使用相同的 IP 进行解析。我还在这两个系统上进行了wireshark 捕获,我们清楚地看到包含所有别名的DNS 答案。
import socket
print(socket.gethostbyaddr('192.168.11.1'))
在 Windows 上,我得到这样的答案,这是可以的:
('test123.com', ['alias1.test123.com', 'alias2.test123.com'], ['192.168.11.1'])
在linux上我得到:
('alias1.test123.com', [], ['192.168.11.1'])
有人知道修复吗?