From owner-freebsd-questions@FreeBSD.ORG Thu Jan 15 09:22:37 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4CE1106566B for ; Thu, 15 Jan 2009 09:22:37 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from s2m-is-001.service2media.com (rev-130-102.virtu.nl [217.114.102.130]) by mx1.freebsd.org (Postfix) with ESMTP id 50D798FC0A for ; Thu, 15 Jan 2009 09:22:36 +0000 (UTC) (envelope-from pieter@degoeje.nl) Received: from nox-laptop.localnet ([10.0.1.45] RDNS failed) by s2m-is-001.service2media.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 15 Jan 2009 10:22:35 +0100 From: Pieter de Goeje To: Steve Bertrand Date: Thu, 15 Jan 2009 10:22:34 +0100 User-Agent: KMail/1.10.3 (Linux/2.6.27-11-generic; KDE/4.1.3; x86_64; ; ) References: <496E117D.8030306@itlegion.ru> <200901141801.45996.pieter@degoeje.nl> <496E1D22.9070106@ibctech.ca> In-Reply-To: <496E1D22.9070106@ibctech.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901151022.35187.pieter@degoeje.nl> X-OriginalArrivalTime: 15 Jan 2009 09:22:35.0464 (UTC) FILETIME=[CD42CC80:01C976F2] Cc: Artem Kuchin , freebsd-questions@freebsd.org Subject: Re: Blocking very many (tens of thousands) ip addresses in ipfw X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 09:22:38 -0000 On Wednesday 14 January 2009 18:13:06 Steve Bertrand wrote: > Pieter de Goeje wrote: > > On Wednesday 14 January 2009 17:23:25 Artem Kuchin wrote: > >> I need to block around 150000 ip addreses from acccess the server at all > >> at any port. The addesses are random, they are not nets. > >> These are the spammer i want to block for 24 hours. > >> The list is dynamically generated and regenerated every hour or so. > >> What is the most efficient way to do it? > >> At first i thought doing ipfw rules using 5 ips per rule, that would > >> result in 30000 rules! This will be too slow! > >> I need to something really quick and smart. Like matching the first > >> number from ip (195 from 192.1.2.3), > >> if it does not match - skip, if it does - compare the next one > >> and so on. > > > > Quoting ipfw(8): > > LOOKUP TABLES > > Lookup tables are useful to handle large sparse address sets, > > typically from a hundred to several thousands of entries. There may be > > up to 128 different lookup tables, numbered 0 to 127. > > > > net.inet.ip.fw.dyn_buckets should probably also be increased to > > efficiently handle 150k IPs. > > Please correct me if I'm wrong, but if the OP is going to drop all > traffic immediately from the 150k IPs, then dyn_buckets shouldn't come > into play, as there is no dynamic rule generated. > > Steve Ah nevermind then, I misread the manpage. I thought it also applied to normal tables. -- Pieter de Goeje