I want to access the SSH server on a Raspberry Pi (with Raspbian OS) from an SSH client on a X86_64 computer with Ubuntu 14.04, both located inside the same home LAN.
I am able to SSH from the Raspberry Pi using the following command: ssh pi@73.***.***.***
; where 73.***.***.***
is the internet-routable IP address assigned to me by the ISP. But when I try ssh [email protected]
the terminal immediately returns: ssh: Could not resolve hostname pi.local: Name or service not known
. Similarly, when I try ssh [email protected]
the terminal returns ssh: Could not resolve hostname raspberrypi.local: Name or service not known
.
Furthermore, when I try ssh pi@raspberrypi
then the terminal prompts me to input the password for pi@raspberrypi. After I enter the password then nothing happens; there's no error message, there's no feedback at all. There is just a blinking cursor at the start of a blank line. The blinking cursor is NOT after a shell prompt ie. it does not appear after the foo@localhost:~$
prompt. There are the similar results when I try ssh [email protected]
as when I tried ssh pi@raspberrypi
.
I want and I think I should be able to do SSH by specifying the local IP address or the hostname, instead of relying on the public IP address. If it's possible, how can I achieve this? Somebody suggested that I should add an entry to the (Ubuntu) computer's hosts file in order to resolve the name resolution issue. I am quite clueless about the subject of host files and I do not know how to proceed. Can somebody please help?
You can edit file hosts that is located in etc directory:
At the end of the file you put the follow line:
Remeber that 192.168.xxx.xxx needs to be the IP address of your raspberry.
There's a file in your /etc directory named hosts. Add the entries to the file to resolve the hostnames. You may associate
raspberrypi
with192.168.2.16
so as to make your system to resolveraspberrypi
to192.168.2.16
. By default there's only one entry in the file which islocalhost
associated to127.0.0.1
. The syntax is pretty simple consisting of IP address and hostname only.Make sure you do not have a
#
in front of your entry or it'll be nothing more than a comment in a code.Every time you type in an IP address it gets resolved at system level using this file. If the hostname isn't found in this file the the hostname is forwarded to your default gateway for its resolution. It keeps on getting forwarded depending on the design of network at the end of which you finally receive an error
hostname could not be resolved
.You need to understand this hierarchy and find out where, exactly, is the problem. Since you're working with a LAN, I don't think it'd be so complicated.