|PD||Important note: When you edit this page, you agree to release your contribution into the public domain. If you don't want this or can't do this because of license restrictions, please don't edit. This page is one of the Public Domain Help Pages, which can be freely copied into fresh wiki installations and/or distributed with MediaWiki software; see Help:Contents for an overview of all pages. See Project:PD help/Copying for instructions.||PD|
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.
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!
IP address are broken up into blocks of numbers. The most common block is 256 numbers. An example of this would be 18.104.22.168 thru 22.214.171.124. Once it reaches 255 the next number is 126.96.36.199.
IP addresses can be broken up in to smaller or larger blocks. The smallest practical block is a block of 4. This could be one of the following:
188.8.131.52 - 184.108.40.206, or 220.127.116.11 - 18.104.22.168, or 22.214.171.124 - 126.96.36.199 etc.
Of this block of 4 numbers, only two can be assigned to a computer. The first and last numbers of any block are reserved for network communication. These are level 30 blocks and can be expressed like this:
188.8.131.52/30, or 184.108.40.206/30, or 220.127.116.11/30 etc.
The next largest bock is 8. They can be as follows:
18.104.22.168 - 22.214.171.124, or 126.96.36.199 - 188.8.131.52, or 184.108.40.206 - 220.127.116.11 etc.
In this block of 8 numbers only 6 can be assigned to a computer as, once again, the first and last numbers in a block are reserved for network communication. These can also be expressed as follows:
18.104.22.168/29, or 22.214.171.124/29, or 126.96.36.199/29 etc.
From this point on the number of IP addresses in a block continue to double. 16, 32, 64, 128, 256, etc.
A block of 16 would start 188.8.131.52/28. A block of 32 would start 184.108.40.206/27. A block of 64 would start 220.127.116.11/26. A block of 128 would start 18.104.22.168/25. A block of 256 would start 22.214.171.124/24.
So if you have an IP address and you want to block the range assigned how do you know which one to use? Let's say you have a problem with 126.96.36.199. You can lookup who has this IP address at http://ws.arin.net/whois/?queryinput=188.8.131.52 This tells us that this IP address is assigned, along with a LOT of others in a /17 range, to the Department of Defense. We certainly don't want to block a large block of the DoD! The rule of thumb is block as little a possible. Only block a range if there is a cluster of IP addresses giving a problem.
There's a calculator that is very useful for this: http://www.csgnetwork.com/ipinfocalc.html Go to this site and enter 184.108.40.206 into the first set of blanks. Now select Network Prefix Length and enter 27 (this will give a block of 32 addresses) and click Calculate Network Information. This will show us a bock of 32 IP addresses that include 220.127.116.11. (The first - network - and the last - broadcast - addresses will be displayed along with the usable addresses in the range.) You can use this tool to test ranges to be sure they are what you want before entering the information to initiate the block.
CIDR notation is written as the IP address, a slash, and the CIDR suffix (for example, the IPv4 "
10.2.3.41/24" or IPv6 "
a3:b:c1:d:e:f:1:21/24"). The CIDR suffix is the number of starting digits every IP address in the range have in common when written in binary.
For example: "
10.10.1.32" is binary "
10.10.1.32/27 will match the first 27 digits ("
00001010.00001010.00000001.00100000"). The IP addresses
10.10.1.63, when converted to binary, all have the same 27 first digits and will be blocked if
10.10.1.32/27 is blocked.
As the CIDR suffix increases, the block affects fewer IP addresses (see table of example ranges). CIDR suffixes are not the same for IPv4 addresses as they are for IPv6 addresses.
Calculating the CIDR suffix
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:
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:
- 240 is at least 128, so place 1 and subtract 128.
- 112 (240-128) is at least 64, so place 1 and subtract 64.
- 48 (112-64) is at least 32, so place 1 and subtract 32.
- 16 (48-32) is at least 16, so place 1 and subtract 16.
- 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.
- Place both IP addresses one atop the other, and count how many starting digits are exactly alike. This is the CIDR suffix.
- Double-check! Being off by one digit could extend your block by thousands of addresses.
The example below calculates the CIDR range between 18.104.22.168 and 22.214.171.124. Note that this is a simple example; some groups of IP addresses do not so neatly fit CIDR suffixes, and need multiple different-sized blocks to block the exact range.
IP addresses: 126.96.36.199 188.8.131.52 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: 184.108.40.206/24
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|
- IP Address Ranges Block gives you complete IP ranges for certain countries.
- Netmask calculator which helps in making the correct decision for range blocks.
- Rangeblock-Calculator gives you the range you should use when blocking.