I am trying to establish a remote SSH session using Putty into the Raspberry Pi running my Lightning Network node without success (connecting from the local network works fine).

The related port of my fixed IP is open and seems to correctly forward to the Raspberry, however, when I try to connect with Putty, the connection is rejected ('Server unexpectedly closed connection.').

Can anyone more familiar with such setups help me figure out how I can connect with Putty?

1 Answer 1


About your specific setup we would need more information to trouble-shoot but here are some general network debugging steps I take -

Start at the lowest level

RPIs come with SSH enabled by default last I checked so this is just a sanity check step.

First make sure that the Raspberry Pi is allowing SSH connections (you mentioned you already did this so just for brevity) from your local network -

From another machine on the same local network as the RPI -

$ curl -v {{put your rpi local IP address here}}:22

which shows if the port is open because if it is you should see something along the lines of * Recv failure: Connection reset by peer. If the port is not open the failure from above should be something along the lines of failed: Connection refused.

In the first case your server responded on 22 but did not accept the connection (since it is a curl and not an attempt to SSH in)

If that is successful you can of course follow up with an SSH attempt to verify you have access -

$ ssh {{user}}@{{local ip}}

Move outside the network

Since you were able to SSH in locally (if you were not then getting to this step is irrelevant) the next step is to disconnect from your Wifi or local network and then test your router / firewall settings.

You can do this for example by tethering on to your phones internet connection and issuing the same commands as above, replacing the IP address on the local network above with the your external IP address. You can get your external IP address by Googling "What is my IP".

Finally, repeat the steps above to first test that the port is responding and second test that the connection is being allowed.

As you mentioned before the main culprit is not forwarding ports on the router. Additionally you will need to set up your lnd.conf to listen on the externalip as well as instructing the RPC service or REST service to listen on that external IP as well unless you are using something more advanced like a reverse proxy.

  • thanks! So locally, everything reacts as it should. curl -v {externalip}:9735 gets connected, and breaks with "connection was reset" afterwards. In lnd.conf, externalip is set to the correct one, restlisten= . Does that make sense?
    – richey
    Feb 14, 2019 at 5:15
  • The problem isn't in LND yet it is that your port is not forwarded like I mentioned. You need to go in to your router and forward the port from the RPI to the external port (your external IP address)
    – PW Kad
    Feb 14, 2019 at 17:01
  • I just mentioned the lnd.conf because invariably that is the next thing you will run in to once that works.
    – PW Kad
    Feb 14, 2019 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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