0

I am trying to SSH outside the LAN. Someone told me I have to use the Public IP because the Private IP won't allow you to access the device except if you are in the LAN.

Suppose I want to access a machine in China. I know that the Public IP is linked to the modem and the router linked to the modem. Only the router will distributed a unique Private IP to each machine. So suppose there are three machines and I want to access one of them.

With SSH, do I need to Public and the Private IP to access that machine? Can I do this just in using the ssh command line?

J.Doe
  • 53

1 Answers1

0

What you’re looking for is port forwarding.

Option 1. If your router/gateway have public ip simply setup port forwarding on device interface/cli from public-ip:port to internal-host-ip:port. Don’t forget to open port (default 22, but most likely already used by router) on the firewall

Option 2. Setup dynamicdns.

Option 3. Use port mapping service like portmap.io. It will generate you openvpn configuration site. Then simply setup tcp mapping between external address portmap.io will provide you and port 22 on the machine you want to access.