Help:Range blocks

From Sit
Jump to: navigation, search

Range blocks are technical restrictions applied through Special:Blockip to a group of IP addresses that prevent them from editing, creating new accounts, sending email through the wiki interface, et cetera. Registered accounts editing from these IP addresses will also be blocked, unless you check the box to only block anonymous editors.

Range blocking is enabled on all Wikimedia wikis; to enable it on other wikis, add "$wgSysopRangeBans = true;" in LocalSettings.php.

To block an IP range from Special:Blockip, enter the first IP address in the range followed by a forward slash and a Classless inter-domain routing (CIDR) suffix. You should avoid performing range blocks unless you understand what you are doing, or you may end up blocking tens of thousands of people who are not the problem!


Technical explanation

CIDR notation is written as the IP address, a slash, and the CIDR affix (for example, the IPv4 "" or IPv6 "a3:b:c1:d:e:f:1:21/24"). The CIDR affix is the number of starting digits every IP address in the range have in common when written in binary.

For example: "" is binary "00001010.00001010.00000001.00100000", so will match the first 27 digits ("00001010.00001010.00000001.00100000"). The IP addresses, when converted to binary, all have the same 27 first digits and will be blocked if is blocked.

As the CIDR affix increases, the block affects fewer IP addresses (see table of example ranges). CIDR affixes are not the same for IPv4 addresses as they are for IPv6 addresses.

Calculating the CIDR affix

You can use the table of sample ranges below to guess the range, use a computer script, or manually calculate the range.

Conversion to binary

The first step in manually calculating a range is to convert the first and last IP address to binary representation. (This assumes you're not using a computer script, which can probably calculate the range for you anyway.) An IP address is composed of four groups of eight ones and zeros. Each group represents a number from 0 to 255. To convert a number to binary, you can use a reference table or know the value of each binary digit:

1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1

Proceeding from left to right, fill in '1' if the number is at least that value, and subtract that value (if it's not, fill in '0' and don't subtract). For example, to calculate 240:

  1. 240 is at least 128, so place 1 and subtract 128.
  2. 112 (240-128) is at least 64, so place 1 and subtract 64.
  3. 48 (112-64) is at least 32, so place 1 and subtract 48.
  4. 16 (48-32) is at least 16, so place 1 and subtract 16.
  5. Since the remaining value is zero, all the remaining places are '0'.

Thus, 240 is 1111 0000 because it can be represented as 128+64+32+16+0+0+0+0.

Calculate range

  1. Place both IP addresses one atop the other, and count how many starting digits are exactly alike. This is the CIDR affix.
  2. Double-check! Being off by one digit could extend your block by thousands of addresses.

The example below calculates the CIDR range between and Note that this is a simple example; some groups of IP addresses do not so neatly fit CIDR affixes, and need multiple different-sized blocks to block the exact range.

IP addresses:
Convert to binary:
  0100 0101.1101 0000.0000 0000.0000 0000
  0100 0101.1101 0000.0000 0000.1111 1111
Count identical first numbers:
  0100 0101.1101 0000.0000 0000.0000 0000
  0100 0101.1101 0000.0000 0000.1111 1111
            24 digits
CIDR range:


Table of sample ranges

The table below shows the IP blocks each CIDR suffix affects. Note that MediaWiki only supports blocking CIDR suffixes 16–32.

CIDR Start Range End Range Total addresses Bits selected in IP address 4,294,967,296 ********.********.********.******** 2,147,483,648 0*******.********.********.******** 268,435,456 0100****.********.********.******** 67,108,864 01000101.********.********.******** 2,197,152 01000101.110*****.********.******** 1,048,576 01000101.1101****.********.******** 524,288 01000101.11010***.********.******** 262,144 01000101.110100**.********.******** 131,072 01000101.1101000*.********.******** 65,536 01000101.11010000.********.******** 32,768 01000101.11010000.0*******.******** 16,384 01000101.11010000.00******.******** 8,192 01000101.11010000.000*****.******** 4,096 01000101.11010000.0000****.******** 2,048 01000101.11010000.00000***.******** 1,024 01000101.11010000.000000**.******** 512 01000101.11010000.0000000*.******** 256 01000101.11010000.00000000.******** 128 01000101.11010000.00000000.0******* 64 01000101.11010000.00000000.00****** 32 01000101.11010000.00000000.000***** 16 01000101.11010000.00000000.0000**** 8 01000101.11010000.00000000.00000*** 4 01000101.11010000.00000000.000000** 2 01000101.11010000.00000000.0000000* 1 01000101.11010000.00000000.00000000


External links

Personal tools