Ping 호스트 이름은 작동하지만 SSH는 로컬 시스템에 대해 작동하지 않습니다.

Ping 호스트 이름은 작동하지만 SSH는 로컬 시스템에 대해 작동하지 않습니다.

이것은 흥미로운 것입니다.

호스트 이름과 IP는 무엇입니까?

echo $hostname $(ipaddr)

TCA0080ALKVTAGB xx.xx.242.47

ping공장:

$ping $(hostname)

PING TCA0080ALKVTAGB (xx.xxx.242.47): 56 data bytes
64 bytes from xx.xxx.242.47: icmp_seq=0 ttl=64 time=0.049 ms
64 bytes from xx.xxx.242.47: icmp_seq=1 ttl=64 time=0.102 ms

ssh하다~ 아니다: 분명히 DNS 세계에서 길을 잃은 것 같습니다(동일한 호스트의 경우):

 $ssh $(hostname)

ssh: Could not resolve hostname tca0080alkvtagb: nodename nor servname provided, or not known

참고: 우리는 이미 다음을 비활성화했습니다 ipv6:

networksetup -setv6off Wi-Fi

에 있습니다 El Capitan.

궁금하신 사항은 다음과 같습니다 ipaddr.

 $type ipaddr
ipaddr is a function
ipaddr () 
{
    ifconfig -a | grep -A 6 en0 | grep "inet " | awk '{print $2}'
}

오! 언급하는 것을 무시하지 말자: sshIP 주소가 작동합니다:

ssh xx.xx.242.47
Last login: Mon Jan 16 12:24:08 2017 from xx.xx.242.47

업데이트

Telnet잘 작동합니다.

telnet $(hostname) 22

다음은 `ssh -vvv $(hostname) 출력입니다.

 $ssh -vvv $(hostname)

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /Users/boesc**/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
ssh: Could not resolve hostname tca0080alkvtagb: nodename nor servname provided, or not known

답변1

TL;DR: macos이즘..

ssh $(hostname).local 

공장. "손 빌려주기"에 대한 다음 Q&A를 참조하세요. https://stackoverflow.com/a/33506923/1056563

또한 여기에 언급된 대로 from : .local에 추가해야 합니다 .searchDNShttps://apple.stackexchange.com/a/197884/55242

관련 정보