ssh port forwarding freezes after 10 simultaneous connections

7,398

Solution 1

FYI, I had a very similar issue, and bumping up MaxSessions to 100 fixed it. I'm the only one using SSH on this server, so that high limit isn't an issue for me.

Solution 2

On the server, have a look at MaxStartups in sshd_config.

From the man page:

MaxStartups

     Specifies the maximum number of concurrent unauthenticated con-
     nections to the sshd daemon.  Additional connections will be
     dropped until authentication succeeds or the LoginGraceTime
     expires for a connection.  The default is 10.

     Alternatively, random early drop can be enabled by specifying the
     three colon separated values ``start:rate:full'' (e.g.,
     "10:30:60").  sshd will refuse connection attempts with a proba-
     bility of ``rate/100'' (30%) if there are currently ``start''
     (10) unauthenticated connections.  The probability increases lin-
     early and all connection attempts are refused if the number of
     unauthenticated connections reaches ``full'' (60).

Solution 3

Are you sure you have setup the local forwarding correctly? Should the destination of your port forwarding be remotemachine instead of localhost?

ssh -vvv -N remotemachine -L 5223:remotemachine:8188
Share:
7,398

Related videos on Youtube

Marko Kevac
Author by

Marko Kevac

Updated on September 17, 2022

Comments

  • Marko Kevac
    Marko Kevac over 1 year

    I am using port forwarding to utilize proxy server which is on remote machine.

    Remote machine hostname is remotemachine. Proxy is listening on 8118 port. I am translating this port to local port 5223.

    ssh -vvv -N remotemachine -L 5223:localhost:8118
    

    Everything is fine if I don't use more than 10 simultaneous connections, when ssh just freezes. It no longer send data trough port forwarding.

    I.e. ab -c 10 -t 5 -X 'localhost:5223' 'http://www.google.ru/' works, but ab -c 20 -t 5 -X 'localhost:5223' 'http://www.google.ru/' causes ssh to freeze

    MaxSessions 30 parameter in /etc/ssh/sshd_config didn't helped at all.

    What can I do to remove this 10 connection limit?

    Nothing interesting in -vvv output =(

  • Marko Kevac
    Marko Kevac about 14 years
    I am sure. It could be anything that remote machine understands. localhost or remotemachine or any other host name.
  • Marko Kevac
    Marko Kevac about 14 years
    I have opened two tunnels. One from 5223, other from 5224 port. Than I executed two ab programs with 11 concurent connections each. Everything is fine. 12 and more don't work - ssh tunnel freezes.
  • riwi
    riwi about 14 years
    @Marko - Maybe, it's an ab issue rather than a ssh issue?
  • Marko Kevac
    Marko Kevac about 14 years
    Nope. Chrome freezes because tunneled proxy don't work. It's something with ssh.
  • riwi
    riwi about 14 years
    Could the issue be with your proxy server? What have you done to prove that your proxy server is not causing the "freeze" that you're experiencing.
  • YwH
    YwH almost 14 years
    MaxStartups looks like it only applies to unauthenticated connections, which doesn't seem to be the limit he is running into (his all appear authenticated).