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

qaxf6auux :

I am trying to set up a VPN with a Raspberry Pi, and the first step is gaining the ability to ssh into the device from outside my local network. For whatever reason, this is proving to be impossible and I haven't the slightest clue why. When I try to ssh into my server with user@hostname, I get the error:

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

However, I can log into the server with,

ssh user@[local IP]

The server is a Raspberry Pi Model B running the latest distribution of Raspbian and the machine I am trying to connect to it with is a Macbook Pro running Mavericks. ssh was enabled on the Raspberry Pi when I set up Raspbian.

I have perused Stack Overflow for hours trying to see if anyone else had this problem and I have not found anything. Every ssh tutorial I find says that I should just be able to set it up on the remote machine and log in from anywhere using a hostname, and I have never had success with that.

ekwaters :

Recently I came across the same issue. I was able to ssh to my pi on my network, but not from outside my home network.

I had already:

  • installed and tested ssh on my home network.
  • Set a static IP for my pi.
  • Set up a Dynamic DNS service and installed the software on my pi. I referenced these instructions for setting up the static ip, and there are many more instructional resources out there.

Also, I set up port forward on my router for hosting a web site and I had even port forward port 22 to my pi's static IP for ssh, but I left the field blank where you specify the application you are performing the port forwarding for on the router. Anyway, I added 'ssh' into this field and, VOILA! A working ssh connection from anywhere to my pi.

I'll write out my router's port forwarding settings.

(ApplicationTextField)_ssh     (external port)_22     (Internal Port)_22     (Protocal)_Both     (To IP Address)_192.168.1.###     (Enabled)_checkBox

Port forwarding settings can be different for different routers though, so look up directions for your router.

Now, when I am outside of my home network I connect to my pi by typing:

ssh pi@[hostname]

Then I am able to input my password and connect.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

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

SSH config explanation: Could not resolve hostname: nodename nor servname provided, or not known

Yarn: unable to clone private github repo. ssh: Could not resolve hostname github: nodename nor servname provided, or not known

Cannot push to Heroku 'fatal: unable to access..Could not resolve host: (nil); nodename nor servname provided, or not known'

Doctrine nodename nor servname provided, or not known on Docker

Django docker - could not translate host name "db" to address: nodename nor servname provided, or not known

Error: nodename nor servname provided, or not known (python sockets)

Net::HTTP SocketError: getaddrinfo: nodename nor servname provided, or not known

socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Ubuntu ssh: Could not resolve hostname myserver: Name or service not known

ssh: Could not resolve hostname server: Name or service not known

SSH host: Could not resolve hostname

Unable to ssh into Ubuntu 12.04 LTS [could not resolve hostname (hostname): Name or service not known

vscode python URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

AWS elastic search error "[Errno 8] nodename nor servname provided, or not known."

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

aiohttp concurrent GET requests lead to ClientConnectorError(8, 'nodename nor servname provided, or not known')

requests.exceptions.ConnectionError: ('Connection aborted.', gaierror(8, 'nodename nor servname provided, or not known'))

PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

AWS CLI and ECS query - HTTPSConnectionPool 443 error; Max retries exceeded; nodename nor servname provided, or not known

SQLSTATE[HY000][2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

SocketException: Failed host lookup: ‘....co’ (OS Error: nodename nor servname provided, or not known, errno = 8)

s.bind((host,port)) - nodename nor servname provided, or not known in Python 3.6

ssh: Could not resolve hostname git: Name or service not known fatal: Could not read from remote repository

Fedora 28 - ssh - Could not resolve hostname

ssh: Could not resolve hostname – High Sierra

fastlane error Failed to open TCP connection to olympus.itunes.apple.com:443 (getaddrinfo: nodename nor servname provided, or not known)

ListenAndServe returns net.DNSError "nodename nor servname provided"

Rails not sending mails in development via Mandrillapp (nodename nor servname provided)