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

前端 未结 15 2332
忘掉有多难
忘掉有多难 2020-12-12 09:34

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 re

15条回答
  •  佛祖请我去吃肉
    2020-12-12 10:27

    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.

提交回复
热议问题