Openssh troubleshooting

From wikinotes

ssh: Could not resolve hostname

  • restarting firewalls on both sides, and using an ip-addr instead of a hostname fixed this. (... but why the firewall restarts? ...)
# example
ssh: Could not resolve hostname tbrink: Name or service unknown

This is likely a firewall issue. Disabling firewalls on both sides changes the error. Try watching eth0 output with tcpdump to determine what needs to be opened.

tcpdump -n -i eth0

18:04:18.063043 IP 192.168.1.116.60267 > 192.168.1.1.53: 58167+ A? tbrink.Holocron. (33)
18:04:18.063091 IP 192.168.1.116.60267 > 192.168.1.1.53: 19506+ AAAA? tbrink.Holocron. (33)
18:04:18.085706 IP 192.168.1.1.53 > 192.168.1.116.60267: 58167 NXDomain 0/1/0 (108)
18:04:18.090193 IP 192.168.1.1.53 > 192.168.1.116.60267: 19506 NXDomain 0/1/0 (108)
18:04:18.090332 IP 192.168.1.116.39017 > 192.168.1.1.53: 176+ A? tbrink. (24)
18:04:18.090376 IP 192.168.1.116.39017 > 192.168.1.1.53: 13518+ AAAA? tbrink. (24)
18:04:18.114474 IP 192.168.1.1.53 > 192.168.1.116.39017: 176 NXDomain 0/1/0 (99)
18:04:18.118954 IP 192.168.1.1.53 > 192.168.1.116.39017: 13518 NXDomain 0/1/0 (99)

ssh: No Route to Host

Confirm requested ip address is correct.
If you are using a hostname, try using the ip address

ssh 192.168.1.122
ssh: connect to host 192.168.1.122 port 22: No route to host
tcpdump -n -i eth0

18:08:12.931893 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28
18:08:13.938387 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28
18:08:14.951705 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28
18:08:15.965160 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28
18:08:16.978370 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28
18:08:17.991705 ARP, Request who-has 192.168.1.122 tell 192.168.1.116, length 28

Host key verification failed

You need to create the known_hosts entry.

# not terribly safe, but you can retrieve and set the known_hosts file automatically
ssh-keyscan -H -t rsa ip_or_ipalias  >> ~/.ssh/known_hosts