ipfw | including external IP txt file
Tim Daneliuk
tundra at tundraware.com
Sat Apr 4 20:20:34 UTC 2020
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 at tundraware.com
PGP Key: http://www.tundraware.com/PGP/
More information about the freebsd-questions
mailing list