Discussion:
How to use inetnum to block spam?
(too old to reply)
nospam
2005-10-30 03:58:28 UTC
Permalink
I'm using a CIDR based access control list to reject spam
from China and Korea like this:

check_client_access cidr:/etc/postfix/spam_china_korea.cidr

In the spam_china_korea.cidr file are subnets
defined like this:

58.14.0.0/15 REJECT WE REJECT SPAM FROM ASIA!!!
58.16.0.0/13 REJECT WE REJECT SPAM FROM ASIA!!!

Now when I receive spam from numerous other countries,
I do a "whois" on the IP address of the sender. In the
output of whois there is an inetnum like these:


inetnum: 60.48.0.0 - 60.54.255.255
inetnum: 84.136.0.0 - 84.191.255.255


How can I convert these into a format that will work
with the cidr mappings of postfix?
Birre
2005-11-09 12:13:46 UTC
Permalink
Post by nospam
I'm using a CIDR based access control list to reject spam
check_client_access cidr:/etc/postfix/spam_china_korea.cidr
In the spam_china_korea.cidr file are subnets
58.14.0.0/15 REJECT WE REJECT SPAM FROM ASIA!!!
58.16.0.0/13 REJECT WE REJECT SPAM FROM ASIA!!!
Now when I receive spam from numerous other countries,
I do a "whois" on the IP address of the sender. In the
inetnum: 60.48.0.0 - 60.54.255.255
inetnum: 84.136.0.0 - 84.191.255.255
How can I convert these into a format that will work
with the cidr mappings of postfix?
The cidr for 60.48 is 60.48.0.0/13 , and will have the range
60.48.0.0 - 60.55.255.255

Telekom Malaysia has the range 60.48.0.0 - 60.54.255.255
And China (Ningbo) has 60.55.0.0 - 60.55.255.255 ( 60.55.0.0/16 )

But since you REJECT them all with the message .... FROM ASIA , you can just use

60.48.0.0/13
84.136.0.0/10

Many times this is easy, other times the head gooes empty :-/

84.136.0.0 - 84.191.255.255 is easy, you just split 84.0.0.0/8
into 4 networks, and need 2 more network bits.

Sometimes you need what you ask for, a calculator.

Here is one:

<http://www.subnet-calculator.com/cidr.php>

/bb

Loading...