עזרה: חסימות טווח

From mediawiki.org
This page is a translated version of the page Help:Range blocks and the translation is 36% complete.
Outdated translations are marked like this.
PD הערה: כאשר אתם עורכים דף זה, אתם מסכימים לשחרר את תרומתכם תחת רישיון CC0. למידע נוסף ראו את דפי העזרה בנושא נחלת הכלל. PD
למידע על חסימות טווח IPv6 ראו Help:Range blocks/IPv6 .

חסימת טווח מונעת ממשתמשי קבוצת כתובות IP עריכה, יצירת חשבונות, שליחת דוא"ל ועוד בממשק ויקי, והיא מוחלת באמצעות Special:Block. אם תסמנו את התיבה "החלת החסימה גם על משתמשים רשומים המשתמשים בכתובת IP זו", גם חשבונות קיימים לא יוכלו לערוך מכתובות אלו.

לחסימת טווח IP באמצעות Special:Block, הזינו את הכתובת הראשונה בטווח ואחריה קו נטוי (/) וסיומת CIDR (Classless inter-domain routing, מוסבר להלן). אל תחסמו טווח אם אינכם בטוחים, שכן החסימה עלולה להשפיע על עשרות אלפי בלתי־מעורבים או אפילו מיליונים מהם!

דף זה דן בעיקר בחסימות IPv4; לחסימות IPv6 – להן אופי דומה אך לא זהה – ראו /IPv6.

הסבר בשפה פשוטה

כתובות ה־IP מחולקות ל'גושים' (בלוקים) של מספרים, למשל – בין 148.20.57.0 ל־148.20.57.255; לאחר שהגענו ל־255, המספר הבא הוא 148.20.58.0.

ניתן לחלק את הכתובות לגושים בגדלים שונים. גודל הגוש הקטן ביותר השימושי הוא 4, למשל:

148.20.57.0 - 148.20.57.3,
148.20.57.4 - 148.20.57.7,
148.20.57.8 - 148.20.57.11, ...

מכל גוש שבו 4 מספרים ניתן להקצות למחשבים רק שניים, שכן המספר הראשון והאחרון מוקצים לשימושים שונים בתקשורת רשת. גושים אלו הם 'ברמה 30', וניתן לכותבם בקיצור כך (בהתאמה):

148.20.57.0/30,
148.20.57.4/30,
148.20.57.8/30, ...

גודל הגוש הבא הוא 8, למשל:

148.20.57.0 - 148.20.57.7,
148.20.57.8 - 148.20.57.15,
148.20.57.16 - 148.20.57.23, ...

מכל גוש של 8 ניתן להקצות למחשבים רק 6, שכן המספר הראשון והאחרון מוקצים לתקשורת רשת כאמור. ניתן לכותבם בקיצור כך (בהתאמה):

148.20.57.0/29,
148.20.57.8/29,
148.20.57.16/29, ...

וכך הלאה – גודל הגוש מוכפל בכל פעם: 16, 32, 64, 128, 256...

גוש של 16 – 148.20.57.0/28
גוש של 32 – 148.20.57.0/27
גוש של 64 – 148.20.57.0/26
גוש של 128 – 148.20.57.0/25
גוש של 256 – 148.20.57.0/24

אז יש לנו כתובת IP ואנחנו רוצים לחסום את הטווח (הגוש) – איך נדע באיזה טווח להשתמש? נניח שיש לנו בעיה עם 148.20.57.34: נוכל לבדוק מיהם בעלי כתובת ה־IP בקישור הבא: http://arin.net/whois/?queryinput=148.20.57.34. נניח שהאתר מגלה לנו שהכתובת שייכת, לצד המון אחרות בטווח /17, למשרד הביטחון. אנחנו ממש לא רוצים לחסום גוש גדול של משרד הביטחון! כלל האצבע הוא – חסמו מעט ככל הניתן. נחסום טווח רק אם יש לנו בעיה עם מגוון כתובות בתוכו.

יש כלי שיכול לעזור לנו להחליט:

toolforge:ftools/general/ip-range-calc.html

ניכנס לאתר ונזין 148.20.57.34 בשורת התיבות הראשונה. כעת, נבחר בשורה "A Network Prefix Length" – אורך קידומת הרשת, נזין בה 27 (כך שיתקבלו 32 כתובות) ונלחץ על "Calculate Network Information" – חישוב פרטי רשת. כך נוכל לראות מהו טווח 32 הכתובות שכולל את 148.20.57.34. בשורה הראשונה מוצגת כתובת הרשת, באחרונה כתובת השידור (אנ'), ובאמצע הכתובות הזמינות לשימוש בטווח. בכלי זה ניתן לבדוק טווחים בטרם הפעלת החסימה.


הסבר טכני

סימון CIDR נכתב ככתובת IP, קו נטוי וסיומת CIDR: לדוגמה, עבורIPv4 – "10.2.3.41/24"; עבור IPv6 – "a3:bc00::/24". סיומת CIDR היא מספר הספרות ההתחלתיות המשותפות לכל הכתובות בטווח בצורתן הבינארית.

לדוגמה: "10.10.1.32" הוא, בשיטה הבינארית, "00001010.00001010.00000001.00100000", והביטוי 10.10.1.32/27 מציין התאמה ב־27 הספרות הראשונות: "00001010.00001010.00000001.00100000". The IP addresses 10.10.1.3210.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 sample ranges). CIDR suffixes are not the same for IPv4 addresses as they are for IPv6 addresses; the same CIDR suffix in IPv4 blocks =79,228,162,514,264,337,593,543,950,336 times as many addresses in IPv6.

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:

Binary digit:   1   1   1   1   1   1   1   1
Value: 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 32.
  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 suffix.
  2. Double-check! Being off by one digit could extend your block by thousands of addresses.

The example below calculates the CIDR range between 69.208.0.0 and 69.208.0.255. 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:
  69.208.0.0
  69.208.0.255
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:
  69.208.0.0/24

Table of sample ranges

The table below shows the IPv4 blocks each CIDR suffix affects. Note that MediaWiki only supports blocking CIDR suffixes 16 - 32 in IPv4 and 19 (formerly 64) - 128 in IPv6 by default (subject to $wgBlockCIDRLimit ). See /IPv6 for an IPv6 range table.

Example IP4 ranges
CIDR Start Range End Range Total addresses Bits selected in IP address
69.208.0.0/0 0.0.0.0 255.255.255.255 4,294,967,296 ********.********.********.********
69.208.0.0/1 0.0.0.0 127.255.255.255 2,147,483,648 0*******.********.********.********
69.208.0.0/4 64.0.0.0 79.255.255.255 268,435,456 0100****.********.********.********
69.208.0.0/8 69.0.0.0 69.255.255.255 16,777,216 01000101.********.********.********
69.208.0.0/11 69.192.0.0 69.223.255.255 2,097,152 01000101.110*****.********.********
69.208.0.0/12 69.208.0.0 69.223.255.255 1,048,576 01000101.1101****.********.********
69.208.0.0/13 69.208.0.0 69.215.255.255 524,288 01000101.11010***.********.********
69.208.0.0/14 69.208.0.0 69.211.255.255 262,144 01000101.110100**.********.********
69.208.0.0/15 69.208.0.0 69.209.255.255 131,072 01000101.1101000*.********.********
69.208.0.0/16 69.208.0.0 69.208.255.255 65,536 01000101.11010000.********.********
69.208.0.0/17 69.208.0.0 69.208.127.255 32,768 01000101.11010000.0*******.********
69.208.0.0/18 69.208.0.0 69.208.63.255 16,384 01000101.11010000.00******.********
69.208.0.0/19 69.208.0.0 69.208.31.255 8,192 01000101.11010000.000*****.********
69.208.0.0/20 69.208.0.0 69.208.15.255 4,096 01000101.11010000.0000****.********
69.208.0.0/21 69.208.0.0 69.208.7.255 2,048 01000101.11010000.00000***.********
69.208.0.0/22 69.208.0.0 69.208.3.255 1,024 01000101.11010000.000000**.********
69.208.0.0/23 69.208.0.0 69.208.1.255 512 01000101.11010000.0000000*.********
69.208.0.0/24 69.208.0.0 69.208.0.255 256 01000101.11010000.00000000.********
69.208.0.0/25 69.208.0.0 69.208.0.127 128 01000101.11010000.00000000.0*******
69.208.0.0/26 69.208.0.0 69.208.0.63 64 01000101.11010000.00000000.00******
69.208.0.0/27 69.208.0.0 69.208.0.31 32 01000101.11010000.00000000.000*****
69.208.0.0/28 69.208.0.0 69.208.0.15 16 01000101.11010000.00000000.0000****
69.208.0.0/29 69.208.0.0 69.208.0.7 8 01000101.11010000.00000000.00000***
69.208.0.0/30 69.208.0.0 69.208.0.3 4 01000101.11010000.00000000.000000**
69.208.0.0/31 69.208.0.0 69.208.0.1 2 01000101.11010000.00000000.0000000*
69.208.0.0/32 69.208.0.0 69.208.0.0 1 01000101.11010000.00000000.00000000


Default limitation

The default MediaWiki installation limits range blocks to no larger than /16 IPv4 rangeblocks (65,536 addresses). To block larger ranges $wgBlockCIDRLimit needs to be set accordingly in LocalSettings.php .

Known problems

One important already-known problem caused by any range-block, is that as side-effect they also block some trusted registered groups, like wiki administrators, users who do not need to be patrolled by others, and trusted bots. Details: phabricator:T309328

References

External links

  • Subnet Calculator can help calculate prefix length and subnet mask for IPv4 and IPv6.