0

On network A we have hosts 192.168.0.1, 192.168.0.2 and 192.168.0.3. On a separate physical network B I want the above hosts to appear to be on the local network for a set of specific ports (same ports on all the hosts).

I have got a working SSH connection (Client on A, Server on B) and the host on B has GatewayPorts=clientspecified (and service restarted).

The host on B has multiple IP addresses defined that match the ones above.

The SSH connection is opened with -R 192.168.0.1:1234:192.168.0.1:1234 -R 192.168.0.2:1234:192.168.0.2:1234 -R 192.168.0.2:1234:192.168.0.2:1234

According to -v the ports are successfully bound.

Opening a connection from any host on Network B to any of the mentioned addresses on port 1234 always connects to the same host on network A - i.e. not (necessarily) the one wanted.

According to -v the incoming connection is on the correct IP address but it forwards to the wrong one.

Is this a bug in SSH or am I doing something wrong?

Please see the diagram here (I can't post an image apparently) http://dev.dj-djl.com/images/port%20forwarding%20over%20ssh.png

5
  • Should this be on Server Fault?
    – DJL
    Dec 18, 2013 at 11:24
  • A diagram would help
    – Lawrence
    Dec 18, 2013 at 12:32
  • @Lawrence I've added a diagram now
    – DJL
    Dec 18, 2013 at 15:48
  • Can't suggest a solution at the moment - can't think what's going on, however, a few more bits of information that may be helpful: - does it work if you use three separate ssh sessions? - what does netstat -anp | grep :1234 on the ssh server show? - how are the machines on 192.168.1.x routing to 192.168.0.x?
    – tenorkev
    Dec 21, 2013 at 9:29
  • Just an update (sorry for the delay) using separate session does work. It's a bit of a headache to maintain but it's better than nothing
    – DJL
    Jan 14, 2014 at 14:03

0

You must log in to answer this question.

Browse other questions tagged .