Skip to contentSkip to conversation

Blocking a range of source IPs to a specific port

DISCUSSION R. DuFresne 3 participants 3 messages Aug 1, 2005 – Aug 2, 2005 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · James Harrison

Hi,

I'm trying to use iptables to block a range of source IP addresses, but I can't figure out how to specify ranges- i'm trying to block everything from 172.150-250.*.* on port 8676- can someone help me out with the rule for this?

Thanks,
James Harrison

For part of the address space 172.128.0.0 - 172.191.255.255 you can block on 172.128.0.0/10. To get the full range, you might use one of the online IP calculators to figger in the who shebang.

Thanks,

Ron DuFresne
- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
admin & senior security consultant: sysinfo.com
http://sysinfo.com
Key fingerprint = 9401 4B13 B918 164C 647A E838 B2DF AFCC 94B0 6629

...We waste time looking for the perfect lover
instead of creating the perfect love.

-Tom Robbins <Still Life With Woodpecker>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFC7ofust+vzJSwZikRAiqwAKDViUli7EhuVDadxre3WztiG5DzCgCeOZOy frORKRIbZK84nXrsIz7ncHM=
=VZIa
-----END PGP SIGNATURE-----

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 2 lines · James Harrison

However i'm still completely confused on the whole 0/9 issue- what does this specify?

We're talking about the notation 172.128.0.0/9 or shorter 172.128/9 or similar. The part after the slash is the subnetmask (netmask). It is the number of binary 1s starting from the left. 9 means the same as 255.128.0.0. The first octett has all bits set to 1 => 255, the second only the first bit => 128 and all others are 0 => 0 ;)

HTH,

Joerg

#6 lore raw
In reply to a message not in the archive

you can use ipset
http://ipset.netfilter.org/

Regards,

Sp0oKeR

Quoted 11 lines · James Harrison

Hi,

I'm trying to use iptables to block a range of source IP addresses, but I can't figure out how to specify ranges- i'm trying to block everything from 172.150-250.*.* on port 8676- can someone help me out with the rule for this?

Thanks,
James Harrison