My Linux laptop is on Verizon HomeFusion internet service and I am trying to configure so that I can SSH to a remote Raspberry Pi (through its router) that is using the Virgin mobile service.

Seems my meager understanding of SSH and ports is inadequate.

I have set up a reserved local IP on the Pi router and have forwarded a port to it (PiPort).

Verizon blocks the normal SSH port, 22, so I understand that I need to use a different SSH port (by editing ssh.conf and sshd.conf). These are my questions:

1) Does the SSH port on the local end (my laptop) need to be the same SSH port on the remote end (Pi) ?

2) Does the SSH port on the remote end (Pi) need to be the same port that is forwarded to the Pi local IP (i.e. remote SSH port = remote forwarded port)?

3) Do I use the ssh command: ssh -L local port:remote computer:remote port user@remote ip?

  1. No. You are connecting from your laptop to the Pi, not the other way round. Therefore, what matters are the remote ports on the router and on the Pi.

  2. Not necessarily. You probably can configure your remote router to forward connections on router port X to a different port Y on the Pi. This depends on your particular router's capabilities, but most routers available today should support this.

  3. No. You use ssh -p remoteRouterPort user@remoteRouterIP .

  • ok, suppose the (remote) pi local ip (192.168.x.x) is mapped to the remote router port 22 and the pi default ssh port is unchanged ( 22 ) should the following ssh to the pi work ? ssh -p 22 pi@108.102.x.y --where 108.102.x.y is the remote router's public ip (and I don't need to append ":22" to the 108.102.x.y" ? – Curt Apr 11 '16 at 19:11
  • Yes. However, if I'm understanding you correctly, the ISP has blocked port 22 - so you won't be able to connect to port 22 on the router (and if you can, you don't need to specify the port at all, as 22 is the default). – Xiong Chiamiov Apr 11 '16 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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