Date: Sat, 4 Apr 2020 15:18:43 -0500 From: Tim Daneliuk <tundra@tundraware.com> To: freebsd-questions@freebsd.org Subject: Re: ipfw | including external IP txt file Message-ID: <d27ef7b1-0efb-2eba-e3ab-e203601dd777@tundraware.com> In-Reply-To: <00c3978d-c350-aec4-76fb-85718c4a6935@cloudzeeland.nl> References: <00c3978d-c350-aec4-76fb-85718c4a6935@cloudzeeland.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On 4/4/20 1:39 PM, Jos Chrispijn wrote:
> Can you tell me how I can best include text file T with blocked ip addresses to my ipfw rules set?
> this file contains ip addresses to be blocked in this format:
>
> .0.1.0/24
> 1.0.2.0/23
> 1.0.8.0/21
> 1.0.32.0/19
> 1.1.0.0/24
> 1.1.2.0/23
> 1.1.4.0/22
> 1.1.8.0/24
> 1.1.9.0/24
> 1.1.10.0/23
> etc
>
> I am already using a table(22) but don't want to alter that one but include the T file in let's say table(10) or something like that?
>
> Thanks for your comments,
> Jos
###
# Block Naughty IP Addresses/Spaces
###
# Use ipfw tables for efficiency
ipfw table 10 flush
for addr in `cat ${NAUGHTYFILE}`
do
ipfw -q table 10 add ${addr}
done
ipfw -q add deny all from table\(10\) to any via <interface name>
----------------------------------------------------------------------------
Tim Daneliuk tundra@tundraware.com
PGP Key: http://www.tundraware.com/PGP/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d27ef7b1-0efb-2eba-e3ab-e203601dd777>
