Could not resolve hostname root nodename nor servname provided or not known

Техника
2018-07-05 01:36:17 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
2018-07-05 01:36:17 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2018-07-05 01:36:17 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
2018-07-05 01:36:17 MANAGEMENT: >STATE:1530743777,RESOLVE,,,,,,
2018-07-05 01:36:17 RESOLVE: Cannot resolve host address: YOUR_SERVER_IP:1194 (nodename nor servname provided, or not known)
2018-07-05 01:36:17 MANAGEMENT: >STATE:1530743777,RESOLVE,,,,,,
2018-07-05 01:36:17 RESOLVE: Cannot resolve host address: YOUR_SERVER_IP:1194 (nodename nor servname provided, or not known)
2018-07-05 01:36:17 Could not determine IPv4/IPv6 protocol
2018-07-05 01:36:17 SIGUSR1[soft,init_instance] received, process restarting
2018-07-05 01:36:17 MANAGEMENT: >STATE:1530743777,RECONNECTING,init_instance,,,,,
2018-07-05 01:36:17 MANAGEMENT: CMD 'hold release'
2018-07-05 01:36:17 MANAGEMENT: CMD 'hold release'
2018-07-05 01:36:17 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
2018-07-05 01:36:17 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts

5b3d4c3701e15030506606.png

настройки VPN сервера
5b3d4ef0d6899640956428.png

Linux Problem Overview


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

However, I can log into the server with,

ssh @[ 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.

Linux Solutions


Solution 1 — Linux

If you’re on Mac, restarting the DNS responder fixed the issue for me.

sudo killall -HUP mDNSResponder

Solution 2 — Linux

I had the same issue connecting to a remote machine. but I managed to login as below:

ssh -  myName
ssh -l myName -  hostname

Solution 3 — Linux

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.

Дополнительно:  Need to manually fix problems in checksur

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:

Then I am able to input my password and connect.

Solution 4 — Linux

In my case I was trying ssh like this

ssh pedro.168.2.179:22 

when the correct format is:

ssh pedro.168.2.179 -p  

Solution 5 — Linux

If you need access to your VPN from anywhere in the world you need to register a domain name and have it point to the public ip address of your VPN/network gateway. You could also use a Dynamic DNS service to connect a hostname to your public ip.

If you only need to ssh from your Mac to your Raspberry inside your local network, do this: On your Mac, edit /etc/hosts. Assuming the Raspberry has hostname «berry» and ip «172.16.0.100», add one line:

# ip           hostname
   berry

Solution 6 — Linux

Solution 7 — Linux

For me, the problem was a typo on my ~/.ssh/config file. I had:

Host host1:
  HostName 
   jlyonsmith

The problem was the : after the host1 — it should not be there. ssh gives no warnings for typos in the ~/.ssh/config file. When it can’t find host1 it looks for the machine locally, can’t find it and prints the cryptic error message.

Дополнительно:  Скачать программу для android для получения root прав

Solution 8 — Linux

If your command is:


You will also face the same error

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

when you miss the option -i /path/to/pemfile of ssh

So Command should be:

$ ssh -  - path//pemfile user@[hostip/hostname]

Solution 9 — Linux

enter image description here

enter image description here

Solution 10 — Linux

I needed to connect to remote Amazon server

ssh: Could not resolve hostname <hostname.com>: nodename nor servname provided, or not known

Solution For Mac OSX

Pinging the host resolved the issue. I am using Mac OSX Seirra.

Now problem resolved. Able to connect to the server.

Note: I tried this solution also. But it didn’t work out. Then ping resolved the issue.

Solution 11 — Linux

It seems that some apps won’t read symlinked /etc/hosts (on macOS at least), you need to hardlink it.

ln /path/to/hosts_file /etc/hosts

Solution 12 — Linux

This was happening to me when trying to access Github. The problem is that I was in the habit of doing:

But, if you are having this error from the question, removing ssh:\\ may resolve the issue. It solved it for me!

Note that you will have to do a git remote remove <xyz> and re-add the remote url without ssh:\\.

Solution 13 — Linux

Just as you have gotten. It seems, the solution for me at least, was to add a .local extension to the hostname when connecting from my mac via ssh.

To anyone reading this, try adding a .local as the suffix to your hostname you are trying to connect to. That should solve the issue on a local network.

Solution 14 — Linux

Try this, considering your allowed ports. Store your .pem file in your Documents folder for instance.


 /Documents
 400 mycertificate.pem
ssh -i  [email protected] -p 80

Solution 15 — Linux

I got this error by using a .yml inventory file in ansible that was not properly formatted. For multiple hosts in a group, each hostname needs to end in a hard colon «:». Otherwise ansible runs the host names together and produces this ssh error.

Solution 16 — Linux

When I try to SSH to a host on the network named storage, I get a DNS resolution failure:

$ ssh storage
ssh: Could not resolve hostname storage: Name or service not known

But when I query DNS with host, it works

$ host storage
storage has address 192.168.20.103

How is it that host can find the IP but ssh cannot?

Дополнительно:  J. S. EGGERS

asked Feb 10, 2017 at 6:03

jldugger's user avatar

You don’t mention anything about your OS and your system configuration, so I have to keep it general, with an eye on Linux: MacOS details are somewhat different, and Windows even more, but the general concepts are the same.

  • host queries DNS, so basically it looks in /etc/resolv.conf and queries the servers listed there, possibly attaching a domain name if the hostname is not already fully qualified. It ignores every other possible source, but beware that these days many systems run a local caching DNS server (usually dnsmasq) which reads /etc/hosts and other sources before querying other DNS servers, so if host queries that local server, results from /etc/hosts can creep in.

  • hosts: files dns
    

    this means: look in /etc/hosts and then query the DNS (/etc/resolv.conf again). Other possible sources are the obsolete nis and netinfo services, LDAP, active directory, you name them.

chicks's user avatar

10 gold badges27 silver badges36 bronze badges

answered Feb 10, 2017 at 9:01

Dario's user avatar

8 silver badges11 bronze badges

Consider the example :

root@gw:~# cat /etc/hostname
gw.analytics.example.net
    git:master=⚡ ssh gw.analytics.example.io -l root -i ~/.ssh/id_rsa.pub
ssh: Could not resolve hostname gw.analytics.example.io: nodename nor servname provided, or not known

Even though I have the DNS entry correct and able to resolve them manually.

    git:master=⚡ dig gw.analytics.example.io

; <<>> DiG 9.9.7-P3 <<>> gw.analytics.example.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56491
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;gw.analytics.example.io.   IN  A

;; ANSWER SECTION:
gw.analytics.example.io. 263    IN  A   10.17.71.2

;; Query time: 2 msec
;; SERVER: 192.168.254.1#53(192.168.254.1)
;; WHEN: Mon Oct 02 10:47:04 +08 2017
;; MSG SIZE  rcvd: 69

So I’ve changed the hostname of the box as per the DNS name I am trying to ssh.It works fine.

root@gw:~# cat /etc/hostname
gw.analytics.example.io

and I am able to login

git:master=⚡ ssh gw.analytics.example.io -l root -i ~/.ssh/id_rsa.pub
root@gw:~# hostname
gw.analytics.example.io
root@gw:~# uptime
 03:13:59 up 46 min,  2 users,  load average: 0.39, 0.49, 0.35
root@gw:~#

Оцените статью
Master Hi-technology
Добавить комментарий