From owner-freebsd-net@freebsd.org Sat May 19 17:50:16 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30A79EDBE24 for ; Sat, 19 May 2018 17:50:16 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (unknown [IPv6:2a01:4f8:d12:604::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AAFC878026 for ; Sat, 19 May 2018 17:50:15 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id w4JHo7bd001746 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 19 May 2018 19:50:08 +0200 (CEST) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: ml@netfence.it Received: from [10.58.0.4] ([10.58.0.4]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTPS id w4JHnxjp017847 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 20 May 2018 00:49:59 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Proxy a TCP connection To: Andrea Venturoli , freebsd-net@freebsd.org References: <2346bc5f-1ca3-3b6a-ac1a-c496e94eb969@netfence.it> <5AFF7970.2090206@grosbein.net> <5a063bba-4d41-40eb-ee50-76849baaed3d@netfence.it> From: Eugene Grosbein Message-ID: <5B0063C1.9040000@grosbein.net> Date: Sun, 20 May 2018 00:49:53 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <5a063bba-4d41-40eb-ee50-76849baaed3d@netfence.it> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00, LOCAL_FROM, RDNS_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * -0.0 SPF_PASS SPF: sender matches SPF record * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2018 17:50:16 -0000 20.05.2018 0:26, Andrea Venturoli wrote: >> Additional advantage of this approach is that >> internal hosts will see real public IP address of connecting external host >> instead of your own. > > This is exactly what I don't want, as, unfortunately, we have some devices which will refuse connections unless they come from their own subnet. I'm fine with net/bounce for cases like yours. It does not have any docs but works just fine. Use: bounce [-a localaddr | -b localaddr] [-d] [-q] [-p localport] [-t timer] machine port -a specifies listening IP address (or all, if the switch is not used) -p is for listening port, if differs from target one -b specifies IP address to bind to when connecting as client to target machine:port (or let system choose one) -d should be used when "machine" is FQDN to resolve it each time new connection is forwarded (or at start only by default) -q to supress syslogging for each forwarded connection -t to establish limit for connection life time, in seconds