title: Why the forwarded SSH port still seem open even with the endpoint failing?
body: <p>I mount a SSH port forwarding tunnel to a remote server <code>RemoteServerSSH</code> and <strong>forward the <code>55555</code> port to a non-existing equipment</strong> (this is what I try to test).</p>
  
  <pre><code>$ hostname
  MyMachine
  </code></pre>
  
  <h3>Setting the forwarding tunnel</h3>
  
  <pre><code>$ ssh -q -N -p 22 -vvv \
      -i ~/.ssh/MyKey \
      -o Compression=yes \
      -o ServerAliveInterval=3 \
      -o serverAliveCountMax=3 \
      -L *:55555:RemoteDownItem:9100 user@RemoteServerSSH
  </code></pre>
  
  <h3>Testing the tunnel</h3>
  
  <p>When I <code>telnet</code> the device directly I got the correct behavior (not connected). However, when I try to <strong>reach it through the tunnel</strong>, telnet says it's connected:</p>
  
  <pre><code>$ telnet RemoteDownItem 9100   # Not Connected = OK
  $ telnet MyMachine 55555       # Connected! Why? should be same as above
  </code></pre>
  
  <p>When I measure the <code>telnet</code> time connection, it is instantaneous (<code>1ms</code>!).
  It is the SSH client that answers me, it does not cross the ssh tunnel! Why ?</p>
  
  <h3>Verbose</h3>
  
  <pre><code>...
  debug1: Local connections to *:55555 forwarded to remote address 10.220.9.183:9100
  debug3: channel_setup_fwd_listener: type 2 wildcard 1 addr NULL
  debug1: Local forwarding listening on 0.0.0.0 port 55555.
  debug2: fd 4 setting O_NONBLOCK
  debug3: fd 4 is O_NONBLOCK
  debug1: channel 0: new [port listener]
  debug3: sock_set_v6only: set socket 5 IPV6_V6ONLY
  debug1: Local forwarding listening on :: port 55555.
  debug2: fd 5 setting O_NONBLOCK
  debug3: fd 5 is O_NONBLOCK
  debug1: channel 1: new [port listener]
  debug2: fd 3 setting TCP_NODELAY
  debug3: packet_set_tos: set IP_TOS 0x10
  debug1: Requesting no-more-sessions@openssh.com
  debug1: Entering interactive session.
  
  
  debug1: Connection to port 55555 forwarding to 10.220.9.183 port 9100   requested.
  debug2: fd 6 setting TCP_NODELAY
  debug2: fd 6 setting    O_NONBLOCK debug3: fd 6 is O_NONBLOCK
  debug1: channel 2: new    [direct-tcpip]
  </code></pre>
  
  <h3>Question</h3>
  
  <p>Is there an SSH parameter to forward the telnet connection directly to the endpoint?</p>
  
  <h3>Project Related Question</h3>
  
  <p><a href="https://unix.stackexchange.com/q/351576/17362">Telnet connect to non-existing adress</a></p>