Chapterبەش 5 · Lectureوانە 5.4

Subnet Masks: Binary, Dotted Decimal and Prefixماسکی ژێرڕایەڵە: دووانی، شێوەی دەیی‌خاڵدار و پێشگر

A subnet mask is a run of 1s over the network part of an address, then 0s over the host part. Learn the rule that makes a number a mask, the nine values a mask octet can have, the three ways to write a mask (binary, dotted decimal and prefix length) and how to convert between them, then use the bitwise AND to find a network ID and to decide whether another computer is on the same network.

ڕیزێک 1ـە لە سەر ناونیشانێک، پاشان 0 لە سەر . فێری ئەو یاسایە ببە کە ژمارەیەک دەکات بە ، ئەو نۆ بەهایەی دەتوانێت هەیبێت، سێ شێوەی نووسینی (، و ) و گۆڕین لە نێوانیاندا، پاشان AND بەکار بهێنە بۆ دۆزینەوەی و بۆ ئەوەی بزانیت تر لەسەر هەمان یان نا.

13 min read13 خولەک خوێندنەوە · 14 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Explain what a subnet mask does and why it is called a mask.
  • Tell valid masks from invalid ones, using the rule and the nine octet values.
  • Convert a mask between binary, dotted decimal and prefix length.
  • Find a network ID with the bitwise AND and decide whether two addresses are on the same network.
  • ڕوونی بکەیتەوە چی دەکات و بۆچی بە ئینگلیزی پێی دەگوترێت mask.
  • دروست لە هەڵە جیا بکەیتەوە، بە یاساکە و نۆ بەهاکەی .
  • لە نێوان ، و بگۆڕیت.
  • بە AND بدۆزیتەوە و بزانیت دوو ناونیشان لەسەر هەمان یان نا.

What a subnet mask doesماسکی ژێرڕایەڵە چی دەکات

You met the subnet mask in IP Addresses and MAC Addresses: it tells a device which part of an IP address is the network and which part is the host. Like an IPv4 address it has 32 bits in four octets, but its pattern is special: 1s under the network part, then 0s under the host part. A subnet is a smaller network made by dividing a bigger one; its mask shows where the network part ends (Subnetting Step by Step).

پێشتر لە ناونیشانەکانی IP و ناونیشانەکانی MAC ناسیوە: بە ئامێرێک دەڵێت کام بەشی و کام بەش . وەک ناونیشانێکی ⁦32⁩ هەیە لە چوار ، بەڵام شێوەکەی تایبەتە: 1 لە ژێر ، پاشان 0 لە ژێر . بچووکترە کە بە دابەشکردنی گەورەتر دروست دەبێت؛ نیشان دەدات لە کوێ کۆتایی دێت (ژێرڕایەڵەسازی هەنگاو بە هەنگاو).

Example: the mask 255.255.255.0 is 11111111.11111111.11111111.00000000 in binary — 24 ones, then 8 zeros. So the first 24 bits of the address are the network part, and you can write the address and its mask together as 192.168.1.1/24. In short, the mask separates the network part from the host part, so that a device knows which addresses are on its own network.

نموونە: ⁦255.255.255.0⁩ بە دەبێتە 11111111.11111111.11111111.00000000 — ⁦24⁩ یەک، پاشان 8 سفر. کەواتە ⁦24⁩ یەکەمی ناونیشانەکە و دەتوانیت ناونیشان و پێکەوە وەک ⁦192.168.1.1/24⁩ بنووسیت. بە کورتی، لە جیا دەکاتەوە، بۆ ئەوەی ئامێرەکە بزانێت کام ناونیشانانە لەسەر خۆین.

Two rows of 32 bit cells. IP address 192.168.1.1: 11000000.10101000.00000001.00000001, the first 24 bits green, the last 8 orange. Subnet mask 255.255.255.0: 24 green 1s, then 8 white 0s. A bracket under the first 24 bits: network part, 24 ones; under the last 8: host part, 8 zeros. Bottom: 24 ones → written 192.168.1.1/24.دوو ڕیزی 32 خانەی بیت. ناونیشانی IP 192.168.1.1: 11000000.10101000.00000001.00000001، 24 بیتی یەکەم سەوز و 8ـی کۆتایی پرتەقاڵی. ماسکی ژێرڕایەڵە 255.255.255.0: 24 یەکی سەوز، پاشان 8 سفری سپی. کەوانەیەک لە ژێر 24 بیتی یەکەم: بەشی ڕایەڵە، 24 یەک؛ لە ژێر 8ـی کۆتایی: بەشی میوانگر، 8 سفر. خوارەوە: 24 یەک ← دەنووسرێت 192.168.1.1/24.
The 1s of the mask cover the network part; the 0s cover the host part.1ـەکانی دادەپۆشن و 0ـەکان .CêIT

Why is it called a mask?بۆچی بە ئینگلیزی پێی دەگوترێت mask؟

In computing, a mask is a pattern of bits that covers some bits and lets others through — like a stencil or masking tape when you paint. Where the subnet mask has a 1, the address bit shows through; where it has a 0, the bit is covered and becomes 0. What is left is the network part: the network ID.

لە کۆمپیوتەردا mask شێوەیەکی کە هەندێک دادەپۆشێت و هەندێکی تر تێدەپەڕێنێت — وەک قاڵبێکی ڕەنگکردن یان شریتی چەسپاو کاتێک ڕەنگ دەکەیت. لە شوێنی 1ـی ، ناونیشانەکە دەردەکەوێت؛ لە شوێنی 0، دادەپۆشرێت و دەبێتە 0. ئەوەی دەمێنێتەوە : .

A mask over a faceدەمامکێک لە سەر ڕوخسار

Put a mask over a face and it hides some parts and shows others. Put the subnet mask over an address and the host part is hidden, while the network's real “face” — its network ID — stays visible. So the mask works as a separator: it separates the network part from the host part.

دەمامکێک بخە سەر ڕوخسارێک: هەندێک بەش دەشارێتەوە و هەندێکی تر نیشان دەدات. بخە سەر ناونیشانێک: دەشاردرێتەوە و «ڕوخساری» ڕاستەقینەی — — دیار دەمێنێت. بۆیە وەک لێکجیاکەرەوە کار دەکات: لە جیا دەکاتەوە.

Where the analogy stops workingسنووری ئەم نموونەیە

The idiom “mask off” (showing your true character) is only a memory aid. The technical word comes from bit masks: patterns used with the AND operation.

دەستەواژەی mask off (نیشاندانی ڕاستەقینەی خۆت) تەنیا یارمەتیدەرێکی بیرهێنانەوەیە. وشە تەکنیکییەکە لە ماسکی هاتووە: شێوەگەلێک کە لەگەڵ کاری AND بەکار دێن.

The last octet of 192.168.10.77/26 drawn three times. Top: the address bits 0 1 0 0 1 1 0 1 (77). Middle: the mask 192 as a stencil — two green windows over the first two bits, six dark covers over the rest. Bottom: what shows through — 0 1 0 0 0 0 0 0 (64). Note: a 1 in the mask lets the address bit through; a 0 covers it and gives 0.دوایین هەشتەی 192.168.10.77/26 سێ جار کێشراوە. سەرەوە: بیتەکانی ناونیشانەکە 0 1 0 0 1 1 0 1 (77). ناوەڕاست: ماسکی ژێرڕایەڵەی 192 وەک قاڵبێک — دوو پەنجەرەی سەوز لە سەر دوو بیتی یەکەم و شەش داپۆشەری تاریک لە سەر ئەوانی تر. خوارەوە: ئەوەی دەردەکەوێت — 0 1 0 0 0 0 0 0 (64). تێبینی: 1 لە ماسکی ژێرڕایەڵەدا بیتی ناونیشانەکە تێدەپەڕێنێت؛ 0 دایدەپۆشێت و 0 دەدات.
Windows let the network bits through; covers turn the host bits into 0.پەنجەرەکان تێدەپەڕێنن؛ داپۆشەرەکان دەکەن بە 0.CêIT

The rule: ones first, then zerosیاساکە: سەرەتا 1ـەکان، پاشان 0ـەکان

Not every 32-bit number is a mask. The rules: 1s and 0s must not be mixed; if there are 1s, they are on the left; if there are 0s, they are on the right. In other words, a mask is one contiguous run of 1s followed by 0s — RFC 4632 says the mask “must be left contiguous”. So 10101010 01010101 11110000 00001111 is not a mask, and neither is 00000000 00000000 00000000 11111111, whose 1s are on the right. 11111111 00000000 00000000 00000000 and 11111111 11111111 11111111 00000000 are valid masks.

هەموو ژمارەیەکی ⁦32⁩ نییە. یاساکان: 1 و 0 نابێت تێکەڵ بن؛ ئەگەر 1 هەبێت، لە لای چەپن؛ ئەگەر 0 هەبێت، لە لای ڕاستن. بە واتایەکی تر، یەک ڕیزی بەتەنیشت یەکەوەی 1ـە کە 0 بە دوایدا دێت — ⁦RFC 4632⁩ دەڵێت دەبێت لە چەپەوە بەتەنیشت یەکەوە بێت. بۆیە 10101010 01010101 11110000 00001111 نییە، 00000000 00000000 00000000 11111111ـیش نییە، چونکە 1ـەکانی لە لای ڕاستن. 11111111 00000000 00000000 00000000 و 11111111 11111111 11111111 00000000 دروستن.

Can 255.255.255.32 be a mask? No: 32 is 00100000, and a 1 after 0s breaks the run. A quick test: every octet must be one of the nine values on the next screen, and after the first octet that is not 255, every octet must be 0.

ئایا ⁦255.255.255.32⁩ دەتوانێت بێت؟ نەخێر: ⁦32⁩ دەبێتە 00100000 و 1ـێک لە دوای 0ـەکان ڕیزەکە دەپچڕێنێت. تاقیکردنەوەیەکی خێرا: هەموو دەبێت یەکێک بێت لە نۆ بەهاکەی پەڕەی داهاتوو و لە دوای یەکەم کە ⁦255⁩ نەبێت، هەموو تر دەبێت 0 بن.

Five masks as 32 bit cells. Valid (tick): 255.255.255.0 and 255.255.240.0 — ones, then zeros. Invalid (cross), with the offending 1s in orange: 255.255.255.32 — a 1 after a 0; 0.0.0.255 — ones on the right; 170.85.240.15 (10101010 01010101 11110000 00001111) — ones and zeros mixed. Rule: a mask must be one unbroken run of 1s from the left, then only 0s.پێنج ماسکی ژێرڕایەڵە وەک 32 خانەی بیت. دروست (✓): 255.255.255.0 و 255.255.240.0 — 1ـەکان، پاشان 0ـەکان. هەڵە (✗)، 1ـە هەڵەکان بە پرتەقاڵی: 255.255.255.32 — 1ـێک لە دوای 0؛ 0.0.0.255 — 1ـەکان لە لای ڕاست؛ 170.85.240.15 (10101010 01010101 11110000 00001111) — 1 و 0 تێکەڵ. یاسا: دەبێت ماسکی ژێرڕایەڵە یەک ڕیزی بێ‌پچڕانی 1 بێت لە چەپەوە، پاشان تەنیا 0.
Two valid masks and three numbers that are not masks.دوو دروست و سێ ژمارە کە نین.CêIT

Only nine values per octetتەنیا نۆ بەها بۆ هەر هەشتەیەک

Because the 1s must come first, a mask octet can only take nine values. Start with 00000000 = 0 and add one 1 at a time from the left: each new 1 adds the next place value — 128, then 64, 32, 16, 8, 4, 2 and 1 (binary place values). So the nine values are 0, 128, 192, 224, 240, 248, 252, 254 and 255. Learn them by heart: they make every conversion fast.

چونکە دەبێت 1ـەکان یەکەم بن، تەنیا دەتوانێت نۆ بەها وەربگرێت. لە ⁦00000000 = 0⁩ دەست پێ بکە و هەر جارە یەک 1 لە چەپەوە زیاد بکە: هەر 1ـێکی نوێ دواتر زیاد دەکات — ⁦128⁩، پاشان ⁦64⁩، ⁦32⁩، ⁦16⁩، 8، 4، 2 و 1 (بەها خانەییەکانی دووانی). کەواتە نۆ بەهاکە بریتین لە 0، ⁦128⁩، ⁦192⁩، ⁦224⁩، ⁦240⁩، ⁦248⁩، ⁦252⁩، ⁦254⁩ و ⁦255⁩. لەبەریان بکە: هەموو گۆڕینێک خێرا دەکەن.

A staircase of nine rows under the place values 128 64 32 16 8 4 2 1. Row 0: 00000000 = 0. Row 1: 10000000 = 128 (+128). Row 2: 11000000 = 192 (+64). Row 3: 11100000 = 224 (+32). Row 4: 11110000 = 240 (+16). Row 5: 11111000 = 248 (+8). Row 6: 11111100 = 252 (+4). Row 7: 11111110 = 254 (+2). Row 8: 11111111 = 255 (+1). The green 1s form a staircase from the left.پەیژەیەکی نۆ ڕیزی لە ژێر بەها خانەییەکانی 128 64 32 16 8 4 2 1. ڕیزی 0: 00000000 = 0. ڕیزی 1: 10000000 = 128 (+128). ڕیزی 2: 11000000 = 192 (+64). ڕیزی 3: 11100000 = 224 (+32). ڕیزی 4: 11110000 = 240 (+16). ڕیزی 5: 11111000 = 248 (+8). ڕیزی 6: 11111100 = 252 (+4). ڕیزی 7: 11111110 = 254 (+2). ڕیزی 8: 11111111 = 255 (+1). 1ـە سەوزەکان لە چەپەوە پەیژەیەک دروست دەکەن.
Each step adds one 1 and the next place value.هەر پلەیەک یەک 1 و دواتر زیاد دەکات.CêIT

Three ways to write a maskسێ شێوەی نووسینی ماسکی ژێرڕایەڵە

The same mask can be written in three formats. Binary: 32 bits, such as 11111111.11111111.11110000.00000000. Dotted decimal: four decimal numbers, such as 255.255.240.0 — the form you type on a PC. Prefix: a slash and the number of 1s, such as /20 — the form that routers, Packet Tracer and CIDR addresses use (10.0.0.0/8, 192.168.1.0/24). /8, /16 and /24 are the old class masks, but any value from /0 to /32 is possible: /5 is 248.0.0.0 and /20 is 255.255.240.0.

هەمان بە سێ شێوە دەنووسرێت. : ⁦32⁩ ، وەک 11111111.11111111.11110000.00000000. : چوار ژمارەی ، وەک ⁦255.255.240.0⁩ — ئەو شێوەیەی لەسەر دەینووسیت. پێشگر: هێڵێکی لار و ژمارەی 1ـەکان، وەک /20 — ئەو شێوەیەی ، Packet Tracer و ناونیشانەکانی بەکاری دەهێنن (⁦10.0.0.0/8⁩، ⁦192.168.1.0/24⁩). /8، /16 و /24 بنەڕەتیی پۆلە کۆنەکانن، بەڵام هەر بەهایەک لە /0 تا /32 دەگونجێت: /5 دەبێتە ⁦248.0.0.0⁩ و /20 دەبێتە ⁦255.255.240.0⁩.

Why prefix? The network part is at the beginning — the front — of the address, and the number tells how many bits that front part has. So the number after the slash is the prefix length. It is never a “suffix”: the suffix would be the host part at the end.

بۆچی «پێشگر»؟ چونکە لە سەرەتای ناونیشانەکەدایە و ژمارەکە دەڵێت ئەو بەشەی پێشەوە چەند . بۆیە ئەو ژمارەیەی دوای هێڵە لارەکە دێت . هەرگیز «پاشگر» نییە: پاشگر دەبوو کە لە کۆتاییدایە.

A table of six masks in three formats. /8 = 11111111 00000000 00000000 00000000 = 255.0.0.0; /16 = 255.255.0.0; /24 = 255.255.255.0; /5 = 11111000 00000000 00000000 00000000 = 248.0.0.0; /20 = 11111111 11111111 11110000 00000000 = 255.255.240.0; /26 = 255.255.255.192. The 1s are green. Note: prefix length = number of 1s; each group of 8 bits = one decimal number.خشتەیەکی شەش ماسکی ژێرڕایەڵە بە سێ شێوە. /8 = 11111111 00000000 00000000 00000000 = 255.0.0.0؛ /16 = 255.255.0.0؛ /24 = 255.255.255.0؛ /5 = 11111000 00000000 00000000 00000000 = 248.0.0.0؛ /20 = 11111111 11111111 11110000 00000000 = 255.255.240.0؛ /26 = 255.255.255.192. 1ـەکان سەوزن. تێبینی: درێژیی پێشگر = ژمارەی 1ـەکان؛ هەر گرووپێکی 8 بیت = یەک ژمارەی دەیی.
The same six masks as prefix, binary and dotted decimal.هەمان شەش وەک پێشگر، و .CêIT

Converting step by stepگۆڕین هەنگاو بە هەنگاو

There are four conversions, and the nine values do most of the work:

چوار جۆر گۆڕین هەیە و نۆ بەهاکە زۆربەی کارەکە دەکەن:

  1. Binary → prefixدووانی ← پێشگر

    Count the 1s and write the total after a slash: 11111111 11111111 11000000 00000000 → 8 + 8 + 2 = /18.

    1ـەکان بژمێرە و کۆکەیان لە دوای هێڵێکی لار بنووسە: 11111111 11111111 11000000 00000000 ← 8+8+2=188 + 8 + 2 = 18، واتە /18.

  2. Prefix → binaryپێشگر ← دووانی

    Write P ones, then 0s until there are 32 bits: /18 → eighteen 1s, then fourteen 0s.

    P یەک بنووسە، پاشان 0 تا ⁦32⁩ تەواو دەبێت: /18 ← هەژدە 1، پاشان چواردە 0.

  3. Binary ↔ dotted decimalدووانی و شێوەی دەیی‌خاڵدار

    Cut the bits into four octets and read each one with the nine values: 11000000 = 192, so the mask above is 255.255.192.0. Backwards, write each number as its 8 bits.

    بکە بە چوار و هەریەکەیان بە نۆ بەهاکە بخوێنەوە: ⁦11000000 = 192⁩، بۆیە سەرەوە دەبێتە ⁦255.255.192.0⁩. بە پێچەوانەوە، هەر ژمارەیەک بە 8 بنووسە.

  4. Dotted decimal ↔ prefixشێوەی دەیی‌خاڵدار و پێشگر

    Add the 1s of each octet: 255.248.0.0 → 8 + 5 + 0 + 0 = /13. Backwards, split the prefix into octets: /18 = 8 + 8 + 2 + 0 → 255.255.192.0.

    1ـەکانی هەر کۆ بکەرەوە: ⁦255.248.0.0⁩ ← 8+5+0+0=138 + 5 + 0 + 0 = 13، واتە /13. بە پێچەوانەوە، پێشگرەکە بەسەر دابەش بکە: 18=8+8+2+018 = 8 + 8 + 2 + 0 ← ⁦255.255.192.0⁩.

A triangle of three boxes: binary 11111111.11111111.11000000.00000000 at the top, dotted decimal 255.255.192.0 bottom left, prefix /18 bottom right. Arrows in both directions with the methods: binary → prefix, count the 1s (8 + 8 + 2 = 18); prefix → binary, write 18 ones then 14 zeros; binary → decimal, each octet with the nine values (11000000 = 192); decimal → binary, each number back to 8 bits; decimal → prefix, add the 1s (255 → 8, 192 → 2); prefix → decimal, split 18 = 8 + 8 + 2 + 0.سێگۆشەیەک لە سێ چوارگۆشە: دووانی 11111111.11111111.11000000.00000000 لە سەرەوە، شێوەی دەیی‌خاڵدار 255.255.192.0 لە خوارەوەی چەپ و پێشگری /18 لە خوارەوەی ڕاست. تیر بە هەردوو ئاڕاستەدا لەگەڵ ڕێگاکان: دووانی ← پێشگر، 1ـەکان بژمێرە (8 + 8 + 2 = 18)؛ پێشگر ← دووانی، 18 یەک و پاشان 14 سفر بنووسە؛ دووانی ← دەیی، هەر هەشتەیەک بە نۆ بەهاکە (11000000 = 192)؛ دەیی ← دووانی، هەر ژمارەیەک بۆ 8 بیت؛ دەیی ← پێشگر، کۆی 1ـەکان (255 ← 8، 192 ← 2)؛ پێشگر ← دەیی، دابەشکردنی 18 = 8 + 8 + 2 + 0.
Every conversion goes through one of six arrows.هەموو گۆڕینێک بە یەکێک لەم شەش تیرەدا دەڕوات.CêIT

Converting step by stepگۆڕین هەنگاو بە هەنگاو

Worked conversions: /18, /28 and /13نموونەی گۆڕین: /18، /28 و /13

Three masks in all three formatsسێ بە هەر سێ شێوەکە
BinaryCount the 1sژماردنی 1ـەکانPrefixپێشگرDotted decimal
11111111 11111111 11000000 000000008 + 8 + 2/18255.255.192.0
11111111 11111111 11111111 111100008 + 8 + 8 + 4/28255.255.255.240
11111111 11111000 00000000 000000008 + 5/13255.248.0.0

Check yourself in each row: the binary has as many 1s as the prefix says, and every decimal number is one of the nine values. Backwards, /13 means thirteen 1s and nineteen 0s; /28 means twenty-eight 1s and four 0s.

لە هەر ڕیزێکدا خۆت بپشکنە: ئەوەندە 1ـی تێدایە کە پێشگرەکە دەڵێت و هەموو ژمارەیەکی یەکێکە لە نۆ بەهاکە. بە پێچەوانەوە، /13 واتە سێزدە 1 و نۆزدە 0؛ /28 واتە بیست و هەشت 1 و چوار 0.

AND: how a computer finds the network IDAND: کۆمپیوتەر چۆن ناسەڕایەڵە دەدۆزێتەوە

How does a computer use the mask? It does a bitwise AND: it puts the address and the mask one under the other and compares the bits in pairs. 1 AND 1 = 1; every other pair gives 0 — the same rule as an AND gate. The result is the network ID: the network bits stay and the host bits become 0.

چۆن بەکار دەهێنێت؟ کاری AND لە سەر ئەنجام دەدات: ناونیشان و لە ژێر یەکتر دادەنێت و جووت جووت بەراورد دەکات. ⁦1 AND 1 = 1⁩؛ هەموو جووتەکانی تر 0 دەدەن — هەمان یاسای گەیتی AND. ئەنجامەکە : دەمێننەوە و دەبن بە 0.

A shortcut by octet: where the mask is 255, copy the address octet; where it is 0, write 0; only an octet with another value needs the bits. For 192.168.10.77/26 the mask is 255.255.255.192, so only the last octet needs work: 77 AND 192 = 64. The network ID is 192.168.10.64. The same check tells you whether two PCs joined by one cable can talk (Same network, same mask).

ڕێگەیەکی کورت بە : لە شوێنی ⁦255⁩ـی ، ناونیشانەکە کۆپی بکە؛ لە شوێنی 0، 0 بنووسە؛ تەنیا ئەو بەهایەکی تری هەیە پێویستی بە هەیە. بۆ ⁦192.168.10.77/26⁩، ⁦255.255.255.192⁩ـە، بۆیە تەنیا دوایین کاری دەوێت: 77∧192=6477 \land 192 = 64. ⁦192.168.10.64⁩ـە. هەمان پشکنین پێت دەڵێت ئایا دوو کە بە یەک کێبڵ بەستراون دەتوانن قسە لەگەڵ یەکتر بکەن (هەمان ڕایەڵە، هەمان ماسک: دوو ناونیشانەکە بپشکنە).

01001101  (77)∧   11000000  (192)01000000  (64)\begin{array}{r} 01001101 \;(77) \\ \land\;\, 11000000 \;(192) \\ \hline 01000000 \;(64) \end{array}

The last octet, bit by bit: only where both bits are 1 does the result have a 1.

دوایین ، بە : تەنیا لە شوێنێک کە هەردوو 1ـن، ئەنجامەکە 1ـە.

Animation in four steps for 192.168.10.77/26. Three rows of 32 bit cells: address, mask /26 (255.255.255.192) and network ID. 1: the rule — AND each bit: 1 AND 1 = 1, everything else = 0. 2: octets 1–3 — the mask is 255, so the address bits are copied: 11000000.10101000.00001010. 3: octet 4, bit by bit — 01001101 AND 11000000 = 01000000 (77 AND 192 = 64); the eight columns are outlined. 4: the network ID 192.168.10.64 — the host bits became 0: 192.168.10.64/26.
Animation in four steps for 192.168.10.77/26. Three rows of 32 bit cells: address, mask /26 (255.255.255.192) and network ID. 1: the rule — AND each bit: 1 AND 1 = 1, everything else = 0. 2: octets 1–3 — the mask is 255, so the address bits are copied: 11000000.10101000.00001010. 3: octet 4, bit by bit — 01001101 AND 11000000 = 01000000 (77 AND 192 = 64); the eight columns are outlined. 4: the network ID 192.168.10.64 — the host bits became 0: 192.168.10.64/26.
Address AND mask = network ID.ناونیشان AND = .CêIT

Why we need the mask: same network or not?بۆچی پێویستمان بە ماسکی ژێرڕایەڵە هەیە: هەمان ڕایەڵە یان نا؟

Take a small LAN: computer A (10.1.151.2/24) and server B (10.1.151.3/24) on one switch, a router at 10.1.151.1 as the default gateway, and computer C (203.0.113.23) somewhere on the Internet. When A sends something, it must decide: is the receiver on my own network, or must the packet go to the gateway? The mask answers.

وەربگرە: ⁦A (10.1.151.2/24)⁩ و ⁦B (10.1.151.3/24)⁩ لەسەر یەک ، لە ⁦10.1.151.1⁩ وەک و ⁦C (203.0.113.23)⁩ لە شوێنێکی . کاتێک A شتێک دەنێرێت، دەبێت بڕیار بدات: ئایا وەرگرەکە لەسەر خۆمە، یان دەبێت بچێت بۆ ؟ وەڵام دەداتەوە.

A ANDs its own address with its own mask: 10.1.151.0. Then it ANDs the receiver's address with the same mask — its own. For B the result is also 10.1.151.0: the same network, so A delivers directly (it finds B's MAC address with ARP). For C the result is 203.0.113.0: different, so A sends the packet to its default gateway, 10.1.151.1, and the router takes it from there (the sender’s decision).

A ناونیشانی خۆی بە خۆی AND دەکات: ⁦10.1.151.0⁩. پاشان ناونیشانی وەرگرەکە بە هەمان — هی خۆی — AND دەکات. بۆ B ئەنجامەکە دیسان ⁦10.1.151.0⁩ـە: هەمان ، بۆیە A ڕاستەوخۆ دەیگەیەنێت ( B بە ARP دەدۆزێتەوە). بۆ C ئەنجامەکە ⁦203.0.113.0⁩ـە: جیاوازە، بۆیە A بۆ ، ⁦10.1.151.1⁩، دەنێرێت و لەوێوە دەیبات (بڕیاری نێرەر).

A LAN: PC A (10.1.151.2/24) and server B (10.1.151.3/24) on a switch, joined to a router whose LAN address 10.1.151.1 is the default gateway; the router leads to the Internet, where PC C (203.0.113.23) is. Three result rows: A — 10.1.151.2 AND 255.255.255.0 = 10.1.151.0, my own network; B — 10.1.151.3 AND 255.255.255.0 = 10.1.151.0, same → send directly; C — 203.0.113.23 AND 255.255.255.0 = 203.0.113.0, different → send to 10.1.151.1.ڕایەڵەیەکی ناوچەیی: PCـی A (10.1.151.2/24) و ڕاژەکاری B (10.1.151.3/24) لەسەر سویچێک، بە ڕێدۆزێکەوە بەستراون کە ناونیشانی 10.1.151.1ـی دەروازەی بنەڕەتییە؛ ڕێدۆزەکە دەچێتە ئینتەرنێت، کە PCـی C (203.0.113.23) لەوێیە. سێ ڕیزی ئەنجام: A — 10.1.151.2 AND 255.255.255.0 = 10.1.151.0، ڕایەڵەکەی خۆم؛ B — 10.1.151.3 AND 255.255.255.0 = 10.1.151.0، هەمان ← ڕاستەوخۆ بینێرە؛ C — 203.0.113.23 AND 255.255.255.0 = 203.0.113.0، جیاواز ← بینێرە بۆ 10.1.151.1.
The sender uses its own mask on both addresses.نێرەر خۆی لە سەر هەردوو ناونیشانەکە بەکار دەهێنێت.CêIT
Secret of subnet maskSunny Classroom · Englishئینگلیزی · 309K viewsبینین · 7.2K likesلایک · Partبەشی 3:41–8:52 (ofلە 8:52)

How a computer uses its mask to decide whether another address is on its own network or must go through the default gateway.

چۆن بە بڕیار دەدات کە ناونیشانێکی تر لەسەر خۆیەتی یان دەبێت بە بڕوات.

Watch from 3:41: why the mask is needed, and how computer A tells a local address from a remote one.

لە ⁦3:41⁩ـەوە سەیر بکە: بۆچی پێویستە و A چۆن ناونیشانێکی ناوخۆیی لە ناونیشانێکی دوور جیا دەکاتەوە.

Why we need the mask: same network or not?بۆچی پێویستمان بە ماسکی ژێرڕایەڵە هەیە: هەمان ڕایەڵە یان نا؟

Practice: same network or not?ڕاهێنان: هەمان ڕایەڵە یان نا؟

AND both addresses with the same mask, then compareهەردوو ناونیشانەکە بە هەمان AND بکە، پاشان بەراوردیان بکە
AddressesناونیشانەکانMaskNetwork IDsSame network?هەمان ؟
192.168.1.100 · 192.168.1.130/26192.168.1.64 · 192.168.1.128Noنەخێر
192.168.1.100 · 192.168.1.30/25192.168.1.0 · 192.168.1.0Yesبەڵێ
10.1.151.2 · 10.1.152.2/2410.1.151.0 · 10.1.152.0Noنەخێر
10.1.151.2 · 10.1.152.2/1610.1.0.0 · 10.1.0.0Yesبەڵێ
172.16.45.200 · 172.16.47.9/20172.16.32.0 · 172.16.32.0Yesبەڵێ
172.16.45.200 · 172.16.48.9/20172.16.32.0 · 172.16.48.0Noنەخێر

The same two addresses can be on one network with one mask and on two networks with another: the mask, not the address alone, decides.

هەمان دوو ناونیشان دەتوانن بە یەک لە یەک بن و بە تر لە دوو : بڕیار دەدات، نەک تەنیا ناونیشانەکە.

Masks in Packet Tracerماسکی ژێرڕایەڵە لە Packet Tracerـدا

In Packet Tracer you type a PC's address and mask in dotted decimal (Desktop → IP Configuration: 10.1.151.2 and 255.255.255.0). When you rest the pointer on the PC, the tooltip shows the address with its prefix: 10.1.151.2/24. Router commands also print prefixes. So you need both formats, and fast conversion between them. You type them yourself in your first Packet Tracer network.

لە Packet Tracerـدا ناونیشان و PCـێک بە دەنووسیت (تابی Desktop، پاشان ⁦IP Configuration: 10.1.151.2⁩ و ⁦255.255.255.0⁩). کاتێک دەخەیتە سەر PCـەکە، پەنجەرە بچووکەکە ناونیشانەکە لەگەڵ پێشگرەکەی نیشان دەدات: ⁦10.1.151.2/24⁩. فەرمانەکانی پێشگر چاپ دەکەن. بۆیە پێویستت بە هەردوو شێوەکە و گۆڕینی خێرا لە نێوانیاندا هەیە. لە یەکەم ڕایەڵەی Packet Tracerـدا خۆت دەیاننووسیت.

A drawing of a Packet Tracer workspace: PC0 and PC1 joined through a 2960 switch. The mouse pointer rests on PC0 and a tooltip table shows Port Fa0, Link Up, IP address 10.1.151.2/24 (highlighted) and MAC address 0000.5E00.530A, then Gateway: 10.1.151.1. Note: typed 10.1.151.2 and mask 255.255.255.0 → shown as /24.وێنەیەکی شوێنی کاری Packet Tracer: PC0 و PC1 بە سویچێکی 2960 بەستراون. نیشاندەری ماوس لە سەر PC0ـە و خشتەیەکی بچووک دەرچە Fa0، بەستەر Up، ناونیشانی IP 10.1.151.2/24 (دیاریکراو) و ناونیشانی MAC 0000.5E00.530A نیشان دەدات، پاشان دەروازەی بنەڕەتی: 10.1.151.1. تێبینی: 10.1.151.2 و ماسکی ژێرڕایەڵە 255.255.255.0 نووسران ← وەک /24 نیشان دەدرێت.
Typed in dotted decimal, shown as a prefix.بە دەنووسرێت و وەک پێشگر نیشان دەدرێت.CêIT

Common mistakesهەڵە باوەکان

MistakeهەڵەWhat is trueڕاستییەکە
255.255.255.32 is a mask.⁦255.255.255.32⁩ .32 = 00100000: a 1 after 0s. A mask is 1s, then 0s.⁦32 = 00100000: 1⁩ـێک لە دوای 0. سەرەتا 1ـە، پاشان 0.
00000000 00000000 00000000 11111111 is a mask.⁦00000000 00000000 00000000 11111111⁩ .Its 1s are on the right; the 1s must start at the left.1ـەکانی لە لای ڕاستن؛ دەبێت 1ـەکان لە چەپەوە دەست پێ بکەن.
/24 means 24 hosts./24 واتە ⁦24⁩ .24 network bits; the 8 host bits give 254 hosts.⁦24⁩ ؛ 8 ⁦254⁩ دەدەن.
A mask octet can be any number from 0 to 255. دەتوانێت هەر ژمارەیەک بێت لە 0 تا ⁦255⁩.Only 0, 128, 192, 224, 240, 248, 252, 254 or 255.تەنیا 0، ⁦128⁩، ⁦192⁩، ⁦224⁩، ⁦240⁩، ⁦248⁩، ⁦252⁩، ⁦254⁩ یان ⁦255⁩.
AND means adding the two numbers.AND واتە کۆکردنەوەی دوو ژمارەکە.AND compares bit pairs: only 1 AND 1 gives 1.AND جووت جووت بەراورد دەکات: تەنیا ⁦1 AND 1⁩ دەبێتە 1.
Use the receiver's mask on the receiver's address. وەرگر لە سەر ناونیشانی وەرگر بەکار بهێنە.The sender uses its own mask on both addresses.نێرەر خۆی لە سەر هەردوو ناونیشانەکە بەکار دەهێنێت.
The number after the slash is a “suffix”.ئەو ژمارەیەی دوای هێڵە لارەکە «پاشگر»ە.It is the prefix length: the number of network bits.: ژمارەی .

Exercisesڕاهێنانەکان

ExerciseڕاهێنانPractice: three formatsڕاهێنان: سێ شێوەکە

Complete the table. Each row gives one format; write the other two. (1) binary 11111111 11111111 11000000 00000000; (2) 255.255.255.252; (3) /25; (4) /16; (5) 255.0.0.0; (6) binary 11111111 11111111 11111100 00000000; (7) 255.254.0.0; (8) /27.

خشتەکە تەواو بکە. هەر ڕیزێک یەک شێوە دەدات؛ دوو شێوەکەی تر بنووسە. ⁦(1)⁩ 11111111 11111111 11000000 00000000؛ ⁦(2) 255.255.255.252⁩؛ ⁦(3)⁩ /25؛ ⁦(4)⁩ /16؛ ⁦(5) 255.0.0.0⁩؛ ⁦(6)⁩ 11111111 11111111 11111100 00000000؛ ⁦(7) 255.254.0.0⁩؛ ⁦(8)⁩ /27.

Hintئاماژە

Count the 1s per octet with the nine values: 255 = 8, 254 = 7, 252 = 6, 248 = 5, 240 = 4, 224 = 3, 192 = 2, 128 = 1.

1ـەکانی هەر بە نۆ بەهاکە بژمێرە: ⁦255 = 8⁩، ⁦254 = 7⁩، ⁦252 = 6⁩، ⁦248 = 5⁩، ⁦240 = 4⁩، ⁦224 = 3⁩، ⁦192 = 2⁩، ⁦128 = 1⁩.

Show answerوەڵامەکە پیشان بدە
RowڕیزPrefixپێشگرBinaryDotted decimal
1/1811111111 11111111 11000000 00000000255.255.192.0
2/3011111111 11111111 11111111 11111100255.255.255.252
3/2511111111 11111111 11111111 10000000255.255.255.128
4/1611111111 11111111 00000000 00000000255.255.0.0
5/811111111 00000000 00000000 00000000255.0.0.0
6/2211111111 11111111 11111100 00000000255.255.252.0
7/1511111111 11111110 00000000 00000000255.254.0.0
8/2711111111 11111111 11111111 11100000255.255.255.224
ExerciseڕاهێنانValid or not?دروستە یان نا؟

Which of these are valid masks? Give the prefix of each valid one: 255.255.255.128, 255.255.128.255, 255.240.0.0, 255.255.255.250, 252.0.0.0.

کامیان دروستن؟ پێشگری هەر دروستێک بنووسە: ⁦255.255.255.128⁩، ⁦255.255.128.255⁩، ⁦255.240.0.0⁩، ⁦255.255.255.250⁩، ⁦252.0.0.0⁩.

Show answerوەڵامەکە پیشان بدە
  • 255.255.255.128 → valid, /25
  • 255.255.128.255 → invalid: 1s after 0s
  • 255.240.0.0 → valid, /12
  • 255.255.255.250 → invalid: 250 is not one of the nine values
  • 252.0.0.0 → valid, /6
  • ⁦255.255.255.128⁩ ← دروستە، /25
  • ⁦255.255.128.255⁩ ← هەڵەیە: 1 لە دوای 0
  • ⁦255.240.0.0⁩ ← دروستە، /12
  • ⁦255.255.255.250⁩ ← هەڵەیە: ⁦250⁩ یەکێک نییە لە نۆ بەهاکە
  • ⁦252.0.0.0⁩ ← دروستە، /6
ExerciseڕاهێنانAND practiceڕاهێنانی AND

Find the network ID with AND: (a) 172.16.45.200/20; (b) 10.217.123.7/20.

بە AND بدۆزەوە: ⁦(a) 172.16.45.200/20⁩؛ ⁦(b) 10.217.123.7/20⁩.

Show answerوەڵامەکە پیشان بدە
  • /20 = 255.255.240.0. (a) 45 AND 240 = 32 → network ID 172.16.32.0
  • (b) 123 AND 240 = 01111011 AND 11110000 = 01110000 = 112 → network ID 10.217.112.0
  • /20 = ⁦255.255.240.0. (a) 45 AND 240 = 32⁩ ← : ⁦172.16.32.0⁩
  • ⁦(b) 123 AND 240 = 01111011 AND 11110000 = 01110000 = 112⁩ ← : ⁦10.217.112.0⁩

Summaryپوختە

  • A subnet mask is 32 bits: 1s over the network part, then 0s over the host part. It separates the two parts.
  • The 1s must be one unbroken run from the left; 255.255.255.32 is not a mask.
  • A mask octet has nine possible values: 0, 128, 192, 224, 240, 248, 252, 254, 255.
  • Three formats: binary, dotted decimal (255.255.240.0) and prefix length (/20 = the number of 1s).
  • Address AND mask = network ID: 192.168.10.77 AND 255.255.255.192 = 192.168.10.64.
  • A sender ANDs both addresses with its own mask: same result → deliver directly; different → send to the default gateway.
  • ⁦32⁩ : 1 لە سەر ، پاشان 0 لە سەر . ئەم دوو بەشە لە یەک جیا دەکاتەوە.
  • دەبێت 1ـەکان یەک ڕیزی بێ‌پچڕان بن لە چەپەوە؛ ⁦255.255.255.32⁩ نییە.
  • نۆ بەهای هەیە: 0، ⁦128⁩، ⁦192⁩، ⁦224⁩، ⁦240⁩، ⁦248⁩، ⁦252⁩، ⁦254⁩، ⁦255⁩.
  • سێ شێوە: ، ⁦(255.255.240.0)⁩ و (/20 = ژمارەی 1ـەکان).
  • ناونیشان AND = : ⁦192.168.10.77 AND 255.255.255.192 = 192.168.10.64⁩.
  • نێرەر هەردوو ناونیشانەکە بە خۆی AND دەکات: ئەنجامی وەک یەک ← ڕاستەوخۆ بیگەیەنە؛ جیاواز ← بینێرە بۆ .
The conversion triangle again: binary 11111111.11111111.11000000.00000000, dotted decimal 255.255.192.0 and prefix /18, with the six methods on the arrows.سێگۆشەی گۆڕین دیسان: دووانی 11111111.11111111.11000000.00000000، شێوەی دەیی‌خاڵدار 255.255.192.0 و پێشگری /18، لەگەڵ شەش ڕێگاکە لە سەر تیرەکان.
One mask, three formats, six arrows.یەک ، سێ شێوە، شەش تیر.CêIT

More words you will meet in the next networking lessons, all in the CêIT term list:

وشەی تر کە لە وانەکانی داهاتووی ئەم کۆرسەدا تووشیان دەبیت، هەموویان لە لیستی زاراوەکانی CêITـدان:

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Subnetting Step by Stepژێرڕایەڵەسازی هەنگاو بە هەنگاو

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.

Appearanceڕووکار

Modeدۆخ
Styleشێواز
Coloursڕەنگەکان

Saved on this device only.تەنیا لەسەر ئەم ئامێرە پاشەکەوت دەکرێت.