Wednesday, May 31, 2017

Connecting to a Raspberry Pi behind a 3G Router

Experimenting with 3G router and '3' free 200MB/Mth data SIM and of course there is the NAT problem, so I did this:

http://zieren.de/raspberry-pi/reverse-ssh-through-3gnat/

/usr/bin/sshpass -p "password" ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=15 -N -R 22222:localhost:22 pi@my-house.ddns.net -p 1234

Then I can "ssh localhost -p 22222" on my local pi and get connected to the one behind the NAT. Excellent.