为什么当我使用 ssh 连接带有域名的远程主机时会被拒绝?

为什么当我使用 ssh 连接带有域名的远程主机时会被拒绝?

我在我的域名上添加了两个 A DNS 记录,其 HOSTNAME 是@www

我想知道为什么我使用时会被拒绝davidzhu.xyz

$ ssh [email protected] 
ssh: connect to host davidzhu.xyz port 22: Connection refused

# This will success
$ ssh [email protected]
The authenticity of host 'www.davidzhu.xyz (144.202.12.21)' can't be established.
ED25519 key fingerprint is...

答案1

似乎按预期工作。两者都解析到同一个 IP

dig davidzhu.xyz +short
144.202.12.32

dig www.davidzhu.xyz +short
144.202.12.32

ssh 也有效

~
❯ ssh [email protected]
The authenticity of host 'davidzhu.xyz (144.202.12.32)' can't be established.
ED25519 key fingerprint is SHA256:NpOMboPt3497x7ISpCbqOf/oCu4FNMqtzcKQPELZvUw.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'davidzhu.xyz' (ED25519) to the list of known hosts.
[email protected]'s password:


~ took 10s
❯ ssh [email protected]
The authenticity of host 'www.davidzhu.xyz (144.202.12.32)' can't be established.
ED25519 key fingerprint is SHA256:NpOMboPt3497x7ISpCbqOf/oCu4FNMqtzcKQPELZvUw.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:64: davidzhu.xyz
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'www.davidzhu.xyz' (ED25519) to the list of known hosts.
[email protected]'s password:

我最好的猜测是缓存指向了一个旧的/过时的 IP

相关内容