i have found the IP range - that i want to ban in iptables the way i write x.x.x.x/xx format. Please how to know what that x.x.x.x/xx should be? I have found some online tool where i enter the range and it return it, but unable, these tools like https://www.calculator.net/ip-subnet-calculator.html only have field for single IP and subnet mask.

Update: currently this calculator should work: https://community.spiceworks.com/tools/subnet-calc/ and set "Number of subnets" to 1


First keep in mind that a range is a set of arbitrary contiguous IP address and does not always match a CIDR network.

In your case it does, though.

So what you need is to find the smallest 'supernet` of the two addresses.

To do so you can refer to my answer here.

Doing the math for your range we get: = 01111000.01001100.00000000.00000000 = 01111000.01001111.11111111.11111111

The common part is 01111000.010011, I.E. 14 bits long

So your network is 01111000.01001100.00000000.00000000 /14 =

The broadcast address is the network address + all 1 in the host part. I.E. 01111000.01001111.11111111.11111111 which is the last address in your range.

Conclusion :
the IP range IP range - correspond to

  • It always matches /0.
    – Ron Trunk
    Aug 4 '20 at 10:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.