1

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 pi@pi.local the terminal immediately returns: ssh: Could not resolve hostname pi.local: Name or service not known. Similarly, when I try ssh pi@raspberrypi.local 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 pi@192.168.2.16 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?

1
  • I have lost access to my home LAN for a few days. Until I return to my LAN, which has the necessary network configuration (ie. open ports), there is low probability I can accomplish the SSH. I will return to this project in a few days. – EricVonB Apr 18 '16 at 23:21
2

You can edit file hosts that is located in etc directory:

sudo nano /etc/hosts

At the end of the file you put the follow line:

192.168.xxx.xxx pi.local

Remeber that 192.168.xxx.xxx needs to be the IP address of your raspberry.

1

There's a file in your /etc directory named hosts. Add the entries to the file to resolve the hostnames. You may associate raspberrypi with 192.168.2.16 so as to make your system to resolve raspberrypi to 192.168.2.16. By default there's only one entry in the file which is localhost associated to 127.0.0.1. The syntax is pretty simple consisting of IP address and hostname only.

127.0.0.1 localhost

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.