0

I want to ssh to my Raspberry pi that will be on a different network from my home network. ON my home network router, I set up port forwarding: Set the WAN and LAN start and end ports to 22, set the protocol to TCP. The WAN Host IP address (start & end) set to 192.168.x.x (it is going to be static so i set the same start/end address), and the LAN host IP address to my static IP inside my home network. Now, from inside my home network, how do I ssh to the rpi? Is it>>> ssh username@public_ip_address?

asked Jun 28, 2019 at 11:28
3
  • 4
    Possible duplicate of Setting up SSH over internet on my Pi Commented Jun 28, 2019 at 12:40
  • As far as I understand you want to connect to your RasPi on the internet from a device on your local network. Does the RasPi have a public ip address? Can you ping it from the local device? Please address me with @Ingo, otherwise I won't see your reply. Commented Jun 29, 2019 at 11:38
  • I'm voting to close this question because the author didn't provide any clarifications. Commented Nov 25, 2019 at 20:22

1 Answer 1

1

You must use 0.0.0.0 for translate an unknown IP address (because it can be dynamic). Redirect all TCP input traffic from all IP addr port 22 to your host to destination 192.168.0.2 (from my example) and port 22 (change this port for prevent mass scanning)

enter image description here Where 92.x.x.x.x is PUBLIC IP and 192.168.0.2 is PRIVATE IP.

then use :

ssh -p 22 [email protected]

You must test this configuration from a device behind the N.A.T router. But you can access to your local SSH server with:

ssh -p 22 [email protected]

from a device that is on the same network as your 192.168.X.X/X network.

Note: example for IPv4 only.

answered Jun 28, 2019 at 12:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.