SSHing to a Raspberry Pi behind a firewall (Eduroam)
The firewall at my university (Eduroam) prevents direct connections between two computer on the network on all ports. SSH-ing to an other computer is therefor not possible. However, when a connection is ESTABLISHED, this connection can be reused – for example the other way around! Let’s work on this.
Requirements: rpi, external server
Automate your ssh login from your rpi to your external server using (this link). Execute these commands using “sudo” because the startup script we’re going to edit is run as root.
edit /etc/rc.local and add:
ssh -fN -l [username] -R 2210:localhost:2222 [external server ip]
The 2222 is the ssh port on my rpi. Your rpi could use 22 (default) or any other port. The 2210 is the loopback port (per this link). Upon reset, this line should be processed without errors. Then, on the external server, connect back to the rpi using:
ssh -l pi -p 2210 localhost
and your ssh session is available!