![ssh:无法解析主机,getent hosts 给出的答案很奇怪](https://linux22.com/image/1145049/ssh%EF%BC%9A%E6%97%A0%E6%B3%95%E8%A7%A3%E6%9E%90%E4%B8%BB%E6%9C%BA%EF%BC%8Cgetent%20hosts%20%E7%BB%99%E5%87%BA%E7%9A%84%E7%AD%94%E6%A1%88%E5%BE%88%E5%A5%87%E6%80%AA.png)
当我尝试克隆 GitHub repo 时,出现上述错误。
$ ssh -vvv [email protected]
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
[snip]
debug2: resolve_addr: could not resolve name github.com as address: Name or service not known
ssh: Could not resolve host "github.com"
使用 HTTPS 也可以。通过任何非 SSH 方法访问 github 都可以:
$ ping github.com
PING github.com (192.30.253.113) 56(84) bytes of data.
64 bytes from 192.30.253.113: icmp_seq=1 ttl=44 time=109 ms
SSH 与许多其他域通信正常。
经过谷歌搜索,我发现getent
了
$ getent hosts github.com
fe80::4cdd:72ff:fe74:ae1 github.com.myhotspot.lan
所以我猜测路由器以某种方式劫持了一些东西,但我的 Linux fu 不够强大,无法弄清楚如何测试或修复它。