SSH Through Firewall Using Putty
I'm trying to ssh to my raspberry pi (note: i know the connection works, I have tested it on non firewall'd networks).
I'm behind a school firewall, but port 22 is open.
My pi uses port 2000 (for obscuring purposes).
How would i go about doing this? Would creating a vpn(openvpn?) be an easier solution?
Would Configuring putty to tunnel be the best decision and how would i go about doing this?
Also i am new, if im doing anything wrong please let me know
72 Answers
If I understand well your question, you are trying to ssh to your Raspberry Pi from your school through port 2000 which is closed on the school firewall and only port ssh (TCP 22) is allowed. You have two options:
- Change your Raspberry Pi listening port to 22.
- Set up a laptop/desktop/VM in your home network (that can access your Raspberry Pi on port 2000) with regular ssh service (port TCP 22) then:
- Use it as a "proxy" by doing SSH to this machine and then SSH to your Raspberry Pi
- SSH directly through the newly created machine using the following command:
ssh -L 9999:Raspberry_Pi_LOCAL_IP:2000 VM_PUBLIC_IP_ADDRESS
For example if VM_PUBLIC_IP_ADDRESS is 151.101.129.69 (took IP address of superuser.com as an example) and your Raspberry_Pi_LOCAL_IP is 192.168.1.10 the command would look like:
ssh -L 9999:192.168.1.10:2000 151.101.129.69
- Then all you need is to ssh to your localhost on port 9999
ssh user@localhost -p 9999
Or by using Putty directly, but make sure you change the port to 9999 and hostname/IP to localhost or 127.0.0.1
1You could do a port forwarding on your internet router (at home) from port 22 (on your public IP address) to port 2000 (on your Raspberry Pi IP address).
This way when you ssh from your school (using port 22) you will be using your router's public IP address assigned by your service provider. The router will forward packets received on port 22 to your Raspberry Pi IP address on port 2000.