From owner-freebsd-net@freebsd.org Tue Feb 23 13:25:18 2016 Return-Path: Delivered-To: freebsd-net@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 81776AB097F for ; Tue, 23 Feb 2016 13:25:18 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 546171081; Tue, 23 Feb 2016 13:25:18 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.15.2/8.15.2) with ESMTPS id u1NDPGJu066638 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 23 Feb 2016 06:25:16 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.15.2/8.15.2/Submit) with ESMTP id u1NDPGee066635; Tue, 23 Feb 2016 06:25:16 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Tue, 23 Feb 2016 06:25:16 -0700 (MST) From: Warren Block To: Julian Elischer cc: Ian Smith , freebsd-net@freebsd.org, galtsev@kicp.uchicago.edu Subject: Re: gateway machine port redirect question In-Reply-To: <56CC04D8.6060206@freebsd.org> Message-ID: References: <43887.128.135.52.6.1456021321.squirrel@cosmo.uchicago.edu> <56CA5519.4080000@freebsd.org> <20160222175549.L51785@sola.nimnet.asn.au> <56CC04D8.6060206@freebsd.org> User-Agent: Alpine 2.20 (BSF 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Tue, 23 Feb 2016 06:25:16 -0700 (MST) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2016 13:25:18 -0000 On Mon, 22 Feb 2016, Julian Elischer wrote: > I Believe the problem is as follows: > > there are two machines inside the NAT'd lan, A and B, (local addresses) . > The NAT machine is X on the outside and Y on the inside. > B is also visible to the outside world as the Nat'd address C (which may or > may not be the same as X). > > A wants to be able to send a request to address C and have it bounce back to > B, (with a source address of Y). > The reply to Y should in turn be bounced back to A. > > This is quite complicated and while I am sure we could work out how it > should be done I can't just rattle off an answer. It probably requires > two instances of NAT a regular NAT on the external interface, and a > reverse nat on the inside interface, triggering on outgoing packets. > turning them around Um... I think that is effectively what those few lines of PF I posted do. Granted, it is probably a lot easier with PF. There is a server inside my LAN. I needed to access it by its outside address regardless of whether the client was inside or outside. And the excerpts I posted earlier work. It is actually just three things in addition to the standard gateway NAT: 1. The NAT for the LAN to the inside server 2. The redirect from the LAN to the inside server 3. The redirect from the outside to the inside server