I have a Beaglebone Black system on our boat in France which is connected to the internet via a WiFi hotspot. To allow me to connect to it with ssh it is set up to create ssh tunnels to a couple of places where I have logins.
I used to run something similar on an ancient eeePc, on that system it remained permanently accessible but on the Beaglebone Black it only allows me to connect some of the time.
I have to repeatedly try to connect over a few minutes to get connected:-
halon$ ssh -p 51234 localhost ssh_exchange_identification: Connection closed by remote host halon$ ssh -p 51234 localhost ssh: connect to host localhost port 51234: Connection refused halon$ while true; do ssh -p 51234 localhost; sleep 60; done ssh: connect to host localhost port 51234: Connection refused ssh: connect to host localhost port 51234: Connection refused chris@localhost's password:
It's not that the ssh processes on the BBB are dying, they've been running for several days:-
chris@beaglebone$ ps -ef | grep ssh root 968 1 0 May04 ? 00:00:00 /usr/sbin/sshd -D root 1262 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk root 1263 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk root 1264 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk root 3288 1264 0 11:13 ? 00:00:00 /usr/bin/ssh -L 34227:127.0.0.1:34227 -R 34227:127.0.0.1:34228 -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk root 9614 1262 0 18:17 ? 00:00:00 /usr/bin/ssh -L 34448:127.0.0.1:34448 -R 34448:127.0.0.1:34449 -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk root 9727 968 3 18:20 ? 00:00:00 sshd: chris [priv] chris 9752 9727 0 18:20 ? 00:00:00 sshd: chris@pts/0 root 18064 1263 0 May08 ? 00:00:01 /usr/bin/ssh -L 61875:127.0.0.1:61875 -R 61875:127.0.0.1:61876 -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk
So what could be making the tunnels work some of the time but not all of the time?
On 09/05/14 17:25, Chris Green wrote:
I have a Beaglebone Black system on our boat in France which is connected to the internet via a WiFi hotspot. To allow me to connect to it with ssh it is set up to create ssh tunnels to a couple of places where I have logins.
I used to run something similar on an ancient eeePc, on that system it remained permanently accessible but on the Beaglebone Black it only allows me to connect some of the time.
I have to repeatedly try to connect over a few minutes to get connected:-
halon$ ssh -p 51234 localhost ssh_exchange_identification: Connection closed by remote host halon$ ssh -p 51234 localhost ssh: connect to host localhost port 51234: Connection refused halon$ while true; do ssh -p 51234 localhost; sleep 60; done ssh: connect to host localhost port 51234: Connection refused ssh: connect to host localhost port 51234: Connection refused chris@localhost's password:
It's not that the ssh processes on the BBB are dying, they've been running for several days:-
chris@beaglebone$ ps -ef | grep ssh root 968 1 0 May04 ? 00:00:00 /usr/sbin/sshd -D root 1262 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk root 1263 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk root 1264 1 0 May04 ? 00:00:01 /usr/lib/autossh/autossh -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk root 3288 1264 0 11:13 ? 00:00:00 /usr/bin/ssh -L 34227:127.0.0.1:34227 -R 34227:127.0.0.1:34228 -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk root 9614 1262 0 18:17 ? 00:00:00 /usr/bin/ssh -L 34448:127.0.0.1:34448 -R 34448:127.0.0.1:34449 -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk root 9727 968 3 18:20 ? 00:00:00 sshd: chris [priv] chris 9752 9727 0 18:20 ? 00:00:00 sshd: chris@pts/0 root 18064 1263 0 May08 ? 00:00:01 /usr/bin/ssh -L 61875:127.0.0.1:61875 -R 61875:127.0.0.1:61876 -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk
So what could be making the tunnels work some of the time but not all of the time?
I'm not an expert, but to me it doesn't look like that ssh's are staying alive.
These processes
968 May04 /usr/sbin/sshd -D 1262 May04 /usr/lib/autossh/autossh -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk 1263 May04 /usr/lib/autossh/autossh -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk 1264 May04 /usr/lib/autossh/autossh -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk
all have been running since May 4.
18064 May08 /usr/bin/ssh -L 61875:127.0.0.1:61875 .... was May 8th
All the rest are started today. So, sshd process 968 has been running since the 4th. ssh process 18064 has been running since 8th. However, all the other ssh's have been started today.
I note you're using autossh. This will restart ssh if and when it thinks the ssh tunnel has failed. So perhaps either your sshs are failing, or autossh thinks they're failing and restarts them.
You're connecting to port 51234. This is served by this process root 9614 1262 0 18:17 ? 00:00:00 /usr/bin/ssh -L 34448:127.0.0.1:34448 -R 34448:127.0.0.1:34449 -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk
This process started today. It's parent process 1262 was started on the 4th. So the sshs are not running for ages - they're new.
Causes? Could it be that AutoSSh thinks that the SSH connection is too slow and kills it? Some sort of inactivity timeout? Other routing problems?
I'd suggest ensuring logs are turned on for autossh, ssh and sshd if they support it and examining the logs.
Good luck!
Steve
On Fri, May 09, 2014 at 10:07:13PM +0100, steve-ALUG@hst.me.uk wrote:
On 09/05/14 17:25, Chris Green wrote:
So what could be making the tunnels work some of the time but not all of the time?
I'm not an expert, but to me it doesn't look like that ssh's are staying alive.
You're right! I hadn't looked hard enough.
These processes
968 May04 /usr/sbin/sshd -D 1262 May04 /usr/lib/autossh/autossh -N -R 51234:localhost:22 -l chris cheddar.halon.org.uk 1263 May04 /usr/lib/autossh/autossh -N -R 51235:localhost:22 -l isbdnet3 shell.gridhost.co.uk 1264 May04 /usr/lib/autossh/autossh -N -R 51236:localhost:22 -l timetode shell.gridhost.co.uk
all have been running since May 4.
18064 May08 /usr/bin/ssh -L 61875:127.0.0.1:61875 .... was May 8th
All the rest are started today.
... and that one that started on May 8th seems to work all the time.
So, as you say, the other ssh processes are getting restarted by autossh for some reason.
Wierdly both the 51235 and the 51236 process are, as you can see, connecting via the same intermediate platform at shell.gridhost.co.uk so why they're acting differently is anybody's guess.
Thank you!