Check if `/etc/resolv.conf` is empty on the server you're `ssh`-ing to. Several times I found this to be related to an empty `/etc/resolv.conf` file

If non root, you can just check on the server by trying some `ping` or `telnet` (80) on a public hostname, i.e.:

 root@bananapi ~ # telnet www.google.com 80
 telnet: could not resolve www.google.com/80: Name or service not known

After adding nameserver records to `/etc/resolv.conf`:

 root@bananapi ~ # telnet www.google.com 80
 Trying 74.125.195.104...
 Connected to www.google.com.
 Escape character is '^]'.
 GET / HTTP/1.0
 
 HTTP/1.0 302 Found
 Location: http://www.google.ro/?gws_rd=cr&ei=8fStVZ-hMIv6UvX6iuAK

However, you should also check why `/etc/resolv.conf` was empty (this is usually populated with nameserver records by the dhcp client on the server, if applicable.