ramkrishnan
Posts: 1
Joined: Tue Jan 14, 2020 5:07 pm

Reverse SSH failing for no reason

Tue Jan 14, 2020 5:19 pm

I have a remote server and a RPi 0. The Pi could have a dynamic IP while the server has a static IP.
So i have created a systemd service file to make sure that there is a reverse ssh tunnel created persistently upon reboot or re-connection.
But i have been recently facing some problems with it:
I am unable to reverse ssh into the pi from the server from time to time. when i run

Code: Select all

 netstat -tulpen
on the server i can see that there is an ssh connection from the pi's end to the respective port that i had mentioned and that the port is listening too. but still i am not able to access the pi from the server. can anyone please help me with the situation?

My remote.service file:

[Unit]
Description=Reverse SSH Service
After=network.target

[Service]

ExecStart=/usr/bin/ssh -NTC -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -R 6001:localhost:22 -i <location of the key file>/xxx.pem [email protected]_ip

Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Return to “Networking and servers”