From owner-freebsd-questions@FreeBSD.ORG Mon Mar 21 07:56:38 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60A4816A4CE for ; Mon, 21 Mar 2005 07:56:38 +0000 (GMT) Received: from vs3.bgnett.no (vs3.bgnett.no [194.54.96.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3AA943D1F for ; Mon, 21 Mar 2005 07:56:37 +0000 (GMT) (envelope-from peter@bgnett.no) Received: from amidala.datadok.no.bgnett.no (amidala.datadok.no [194.54.103.98]) by vs3.bgnett.no (8.12.9p2/8.12.9) with ESMTP id j2L7uPBM069892; Mon, 21 Mar 2005 08:56:26 +0100 (CET) (envelope-from peter@bgnett.no) To: "Eugene M. Minkovskii" References: <20050320093159.GA3213@mccme.ru> <861xaamf9t.fsf@amidala.datadok.no> <20050321071227.GA29429@mccme.ru> From: peter@bgnett.no (Peter N. M. Hansteen) Date: Mon, 21 Mar 2005 08:54:35 +0100 In-Reply-To: <20050321071227.GA29429@mccme.ru> (Eugene M. Minkovskii's message of "Mon, 21 Mar 2005 10:12:38 +0300") Message-ID: <86eke9fn7o.fsf@amidala.datadok.no> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-bgnett.no-virusscanner: Found to be clean X-Envelope-To: emin@mccme.ru, freebsd-questions@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: OpenBSD's pf and traffic X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2005 07:56:38 -0000 "Eugene M. Minkovskii" writes: > block in log on $ext_ip inet from any to $ext_ip label $ext_ip > pass in on $ext_ip inet from any to $ext_ip port 22 keep sate > > As you can see, ssh packets match to all rule and pass in because > last rule win. Does it mean, that I can't see ssh's packet using > command > # pfctl -sl here you label the blocked packets but not the ones you pass, which means your ssh packets would count toward the packets passed counter only. > And if I use > > block in log on $ext_ip inet from any to $ext_ip label $ext_ip > pass in on $ext_ip inet from any to $ext_ip port 22 keep sate label $ext_ip > > ... I see label twice ? No. But both rules would increment the $ext_ip counter, which means that your $ext_ip counter would be essentially packet totals. Last matching rule wins (with state instead of sate it would work), so each packet increments the relevant counters only once. > Perhaps you know where I can find workable example of this? Randal Schwartz has a nice article called "Monitoring Net Traffic with OpenBSD's Packet Filter" at http://www.samag.com/documents/s=9053/sam0403j/0403j.htm -- Peter N. M. Hansteen, member of the first RFC 1149 implementation team http://www.blug.linux.no/rfc1149/ http://www.datadok.no/ http://www.nuug.no/ "First, we kill all the spammers" The Usenet Bard, "Twice-forwarded tales"