Run update-rc.d rssh defaults
after adding this file to /etc/init.d
on your Raspberry.
To SSH through NAT you should use "proxy" server (TARGET
in this script) with GatewayPorts yes
in its /etc/ssh/sshd_config
.
After configuring middle server just run ssh pi@example.com -p 2242
to connect to your Raspberry behind the NAT.