From owner-freebsd-pf@FreeBSD.ORG Wed Oct 12 18:00:33 2005 Return-Path: X-Original-To: freebsd-pf@freebsd.org Delivered-To: freebsd-pf@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1821816A41F for ; Wed, 12 Oct 2005 18:00:33 +0000 (GMT) (envelope-from dhartmei@insomnia.benzedrine.cx) Received: from insomnia.benzedrine.cx (insomnia.benzedrine.cx [62.65.145.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id E0A0643D45 for ; Wed, 12 Oct 2005 18:00:29 +0000 (GMT) (envelope-from dhartmei@insomnia.benzedrine.cx) Received: from insomnia.benzedrine.cx (dhartmei@localhost [127.0.0.1]) by insomnia.benzedrine.cx (8.13.4/8.12.11) with ESMTP id j9CHxcCE005531 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Wed, 12 Oct 2005 19:59:38 +0200 (MEST) Received: (from dhartmei@localhost) by insomnia.benzedrine.cx (8.13.4/8.12.10/Submit) id j9CHxbTE014937; Wed, 12 Oct 2005 19:59:37 +0200 (MEST) Date: Wed, 12 Oct 2005 19:59:37 +0200 From: Daniel Hartmeier To: Artemiev Igor Message-ID: <20051012175937.GA2605@insomnia.benzedrine.cx> References: <20051011121205.4dfa7cf2.ai@bmc.brk.ru> <20051011155421.4e3b69cb.ai@bmc.brk.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051011155421.4e3b69cb.ai@bmc.brk.ru> User-Agent: Mutt/1.5.10i Cc: freebsd-pf@freebsd.org Subject: Re: NAT states X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2005 18:00:33 -0000 On Tue, Oct 11, 2005 at 03:54:21PM +0400, Artemiev Igor wrote: > On Tue, 11 Oct 2005 05:37:48 -0500 > "Travis H." wrote: > > Oh, also another thing; do you initialize table somewhere? > > If it is empty, nothing will match NAT rule. > NAT state didn`t match, i see it by pfctl -vs state and packet dropped. > Consequently, nat is not working without an explicit rule for incoming > traffic lan->internet on $lanif, and incoming internet->lan on $extif, > in spite of created state and "pass" existing in nat rule. Why is that > so? Because a state entry does not allow a packet to pass _through_ the firewall, but only to pass on one interface (the interface the state was created on), in general. Imagine a case where you have three interfaces. You want to allow a particular connection to pass only between two of those interfaces, but never through the third. If a state entry would be a free ticket through the entire firewall, you wouldn't be able to enforce this. Create state on both interfaces, you'll end up with two states per connection, and it'll work. Daniel