From owner-freebsd-questions@freebsd.org Thu Dec 3 15:51:35 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 310B5A406D7 for ; Thu, 3 Dec 2015 15:51:35 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: from mail-yk0-x22e.google.com (mail-yk0-x22e.google.com [IPv6:2607:f8b0:4002:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA44A15D1 for ; Thu, 3 Dec 2015 15:51:34 +0000 (UTC) (envelope-from jjuanino@gmail.com) Received: by ykdv3 with SMTP id v3so90320325ykd.0 for ; Thu, 03 Dec 2015 07:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DPXlrbQ0Q9F8LPggJ+gLtTGVi4iKZD+bQt4Sp2VHrxM=; b=B0Oz0iMVlTjqSWV1AjGLF5YWnVbn4m33hQa4FI4ADuczN2wfMJp/EXxBJe6rHj5R0V 8AycxCZYawY7Cu25ayCoeUbhfGw0/4YqHnyGWW9yuQaoy0hF+BU4TV+15sGQqhrWLhBP XR0Mamxqf97VvU4g8ZHxfcCDM6SOs/0l4/aWWlVVyGzkJn/lpaBuw2q1QVnDFexK2bt/ HFSVH+MKN3l0roihUCU2iycErcsoHe80/t3O74bozulHNeSTI7GfnNYHQufoMkGXG/yA 1M4zKl2FLwym28/7Ajs/z6Pi0fpmN0BtvUwUVsT7p59I8G8wvBKIRUl5x/kTtOw3qEYG TYlA== MIME-Version: 1.0 X-Received: by 10.129.85.71 with SMTP id j68mr7174415ywb.28.1449157894020; Thu, 03 Dec 2015 07:51:34 -0800 (PST) Received: by 10.13.197.68 with HTTP; Thu, 3 Dec 2015 07:51:33 -0800 (PST) Date: Thu, 3 Dec 2015 16:51:33 +0100 Message-ID: Subject: How to mimic ssh por forwarding with compression From: =?UTF-8?B?Sm9zw6kgR2FyY8OtYSBKdWFuaW5v?= To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2015 15:51:35 -0000 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.