From owner-freebsd-net@FreeBSD.ORG Tue Dec 14 18:12:32 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC1EB16A4CE; Tue, 14 Dec 2004 18:12:32 +0000 (GMT) Received: from mx01.bos.ma.towardex.com (mx01.bos.ma.towardex.com [65.124.16.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 930B643D64; Tue, 14 Dec 2004 18:12:32 +0000 (GMT) (envelope-from haesu@mx01.bos.ma.towardex.com) Received: by mx01.bos.ma.towardex.com (TowardEX ESMTP 3.0p11_DAKN, from userid 1001) id EF2712F944; Tue, 14 Dec 2004 13:12:31 -0500 (EST) Date: Tue, 14 Dec 2004 13:12:31 -0500 From: James To: Andre Oppermann Message-ID: <20041214181231.GA80817@scylla.towardex.com> References: <20041213124051.GB32719@cell.sick.ru> <20041214015603.A75019@xorpc.icir.org> <20041214060341.A77720@xorpc.icir.org> <41BEF746.E8362858@freebsd.org> <20041214063118.B77933@xorpc.icir.org> <41BF07A3.8F1F505E@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41BF07A3.8F1F505E@freebsd.org> User-Agent: Mutt/1.4.1i cc: Luigi Rizzo cc: freebsd-net@freebsd.org cc: Max Laier Subject: Re: per-interface packet filters [summary] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 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, 14 Dec 2004 18:12:33 -0000 On Tue, Dec 14, 2004 at 04:32:51PM +0100, Andre Oppermann wrote: > See below. > > > > Wouldn't it be even better to have per-interface and global rules > > > after each other? This way your problem with the general rule > > > synching can be solved. > > > > this is what gleb suggested later today, but i don't think > > this solves the problem because sometimes you want the common > > processing to be at the beginning, sometimes at the end of the > > chain... Plus there is the issue of namespace -- when you do > > 'skipto 1000' is this a rule number in the global or the > > private chain ? Having only *one* chain (either public or > > private) solves the problem although at the price of some > > extra copies of the firewall code. > > I've got something in mind marrying the global/interface approach > based on my experience of managing large Cisco per-interface ACL's > (which is a royal pain to get right). The big problem of the per- > interface approach is the protection of the host itself (control > plane in Cisco speak). They have fixed it in newest IOS with so > called infrastructure ACL's but that is making life only a little > better. Yes, it's called receive path ACL. Even if you are using global approach (the way we are now), you still have to deal with receive path to protect your own router-destined traffic. The idea of receive path is to mainly increase the performance and ease the configuration -- there is *no* reason a transit traffic should go thru every rules of a global ruleset like the way it is now (yes, you can avoid this by using bunch of tricks in ipfw, but that is makeshift hack than "doing it right in the beginning" approach). The way we have approached this in the past is to install /32 host routes for each interface addr's and respective subnet and broadcast /32 addresses into the kernel RIB, destined to lo0 interface. Place your per-interface filter on 'lo0' interface and packets destined to router iteslf will be subject to loopback filter before making it onto upper layer protocol. Also, by creating a receive adjacency, you can completely get rid of the unnecessary hash lookups in ip_fastforward() that determine whether packet is destined to us or not. We are already doing an expensive radix lookup on the kernel RIB -- that alone is well enough to give us the information we need with respect to what needs to be done to the packet. -J -- James Jun TowardEX Technologies, Inc. Technical Lead Boston IPv4/IPv6 Web Hosting, Colocation and james@towardex.com Network design/consulting & configuration services cell: 1(978)-394-2867 web: http://www.towardex.com , noc: www.twdx.net