Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2015 16:51:33 +0100
From:      =?UTF-8?B?Sm9zw6kgR2FyY8OtYSBKdWFuaW5v?= <jjuanino@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   How to mimic ssh por forwarding with compression
Message-ID:  <CAAVO5%2BKKH-eHjch7BSADneFJ6He5Viqekq1pgpF6ep8_=K45pA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi FreeBSD comunity,

I have two hosts with no ssh client nor server installed, let say
host_client and host_server. In host_server is running a net service
in port number 1540, which transfers huge amount of data to
host_client. I know that such data is heavily compressible.

The aim is make some port fowarding with compression between the two
hosts by mean of netcat or some similar tool (socat, etc). With netcat
we can do port forwarding in a easy way (backpipe is created with
mkfifo):

1) On server_host, run:

nc -l -p 9999 < /var/tmp/backpipe | nc localhost 1540 > /var/tmp/backpipe

2) In client_host, run:

nc -l -p 9999 < /var/tmp/backpipe | nc server_host 9999 > /var/tmp/backpipe

With this approach, you can configure client to connect to
client_host:9999, and magically works fine: the client succesfully
connects to server_host:1540 and can talk properly.


client_host:9999 <------------> server_host:9999 < ------------ ->
server_host:1540



Well, the idea is to compress the net traffic in the first step,
between client_host:9999 and server_host:9999. The improvement would
be huge.

I have tried the following, with no succes:

1) On server_host, run:

nc -l 9999 < /var/tmp/backpipe  | nc localhost 1540 | gzip > /var/tmp/backpipe

2) In client_host, run:

nc -l 9999 < /var/tmp/backpipe | nc server_host 9999 | gzip -dc >
/var/tmp/backpipe


But when I configure my client to point to client_host:9999, nothing
happens, and I get a conect timeout, as both client and server cannot
talk properly. Obviously, the problem is with gzip.

Any comment or suggestion will be welcome, regards.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAVO5%2BKKH-eHjch7BSADneFJ6He5Viqekq1pgpF6ep8_=K45pA>