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

How a Packet Finds Its Way: Gateways and Routing Tablesپاکێت چۆن ڕێگای خۆی دەدۆزێتەوە: دەروازەی بنەڕەتی و خشتەکانی ڕێدۆزی

Follow a packet from one network to another. Learn how a host decides between local delivery and its default gateway, why MAC addresses change at every hop while IP addresses stay, what a router does with every frame, how a routing table works (next hop, exit interface, metric, longest prefix match, default route), how to read route print and show ip route, and the difference between static and dynamic routing.

بەدوای بڕۆ لە بۆ تر. فێر ببە چۆن لە نێوان گەیاندنی ناوخۆیی و بڕیار دەدات، بۆچی لە هەر دەگۆڕێن بەڵام دەمێننەوە، چی لە هەر دەکات، چۆن کار دەکات (، ، ، ، )، چۆن route print و show ip route دەخوێنیتەوە و جیاوازیی نێوان و .

23 min read24 خولەک خوێندنەوە · 21 stepsهەنگاو

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

  • Explain IP routing as a layer-3 job shared by hosts and routers.
  • Decide, with the mask, whether a host sends directly (ARP for the target) or to its default gateway (ARP for the gateway).
  • Show how MAC addresses change and IP addresses stay at every hop, including serial links without MAC addresses.
  • List the router’s five steps and use a routing table: next hop, exit interface, metric, longest prefix match, default route.
  • Read route print and show ip route, and compare static and dynamic routing.
  • IP وەک کارێکی چینی 3 ڕوون بکەیتەوە کە و بەشی تێدا دەکەن.
  • بە بڕیار بدەیت ڕاستەوخۆ دەنێرێت ( بۆ ئامانج) یان بۆ ( بۆ ).
  • نیشان بدەیت چۆن دەگۆڕێن و لە هەر دەمێننەوە، لەگەڵ بەستەری زنجیرەیی بەبێ .
  • پێنج هەنگاوەکەی بژمێریت و بەکار بهێنیت: ، ، ، ، .
  • route print و show ip route بخوێنیتەوە و و بەراورد بکەیت.

IP routing: from the sender to the receiverڕێدۆزیی IP: لە نێرەرەوە بۆ وەرگر

IP routing is the whole process of delivering IP packets from the host that sends them to the host that should receive them, across any number of networks. Its key element is the IP address, which lives in the network layer, so routing is one of the jobs of layer 3. IP addressing names the source and destination of every packet, and its rules group addresses into networks — this grouping is what makes routing possible, because a router can keep one line per network instead of one line per device.

IP هەموو ئەو پرۆسەیەیە کە IP لەو دەیاننێرێت دەگەیەنێتە ئەو دەبێت وەریان بگرێت، بە ناو هەر ژمارەیەک . توخمی سەرەکیی کە لە دەژی، بۆیە یەکێکە لە کارەکانی چینی 3. ناونیشاندانی IP سەرچاوە و مەبەستی هەموو دیاری دەکات و یاساکانی ناونیشانەکان دەکەنە کۆمەڵە — ئەم کۆمەڵکردنە دەکاتە شتێکی گونجاو، چونکە دەتوانێت بۆ هەر یەک دێڕ هەڵبگرێت لە جیاتی یەک دێڕ بۆ هەر ئامێرێک.

Routing needs hosts and routers together. Each device makes one small decision with network-layer logic: the sender decides whether the destination is local or must go to its gateway, and each router decides the next step. The lower layers still do their part: the data-link layer encapsulates the packet in a frame for each link and decapsulates it at the other end, and the physical layer moves the bits (Encapsulation and PDUs).

پێویستی بە و پێکەوە هەیە. هەر ئامێرێک بە لۆژیکی بڕیارێکی بچووک دەدات: نێرەر بڕیار دەدات مەبەستەکە ناوخۆییە یان دەبێت بچێت بۆ ، هەر هەنگاوی داهاتوو هەڵدەبژێرێت. چینەکانی خوارەوەش بەشی خۆیان دەکەن: بۆ هەر بەستەرێک لە دەپێچێتەوە () و لە سەرەکەی تر هەڵیدەوەشێنێتەوە ()، دەگوازێتەوە (پێچانەوە و PDUـەکان).

PC1 (10.1.1.1) sends a packet to PC2 (172.16.9.9) through routers R1, R2 and R3. Speech bubbles: PC1 “Not in my network: send to my gateway (R1).” R1 “My routing table says: next is R2.” R2 “My routing table says: next is R3.” R3 “That network is mine: deliver to PC2.” A green bar: the IP packet stays the same, from 10.1.1.1 to 172.16.9.9.PC1 (10.1.1.1) پاکێتێک لە ڕێی ڕێدۆزەکانی R1، R2 و R3ـەوە بۆ PC2 (172.16.9.9) دەنێرێت. قسەکان: PC1 «لە ڕایەڵەکەی من نییە: بۆ دەروازەی بنەڕەتییەکەم (R1) بینێرە.» R1 «خشتەی ڕێدۆزییەکەم دەڵێت: دواتر R2.» R2 «خشتەی ڕێدۆزییەکەم دەڵێت: دواتر R3.» R3 «ئەو ڕایەڵەیە هی منە: بیگەیەنە PC2.» شریتێکی سەوز: پاکێتی IP وەک خۆی دەمێنێتەوە، لە 10.1.1.1ـەوە بۆ 172.16.9.9.
Routing is a chain of small decisions; the IP packet itself does not change. زنجیرەیەک بڕیاری بچووکە؛ خودی IP ناگۆڕێت.CêIT

The sender’s decision: same network or not?بڕیاری نێرەر: هەمان ڕایەڵە یان نا؟

Before a host sends a packet it compares the destination with its own network: it ANDs its own address with its mask, ANDs the destination with the same mask, and compares the two results (how the AND works).

پێش ئەوەی بنێرێت، مەبەستەکە لەگەڵ خۆی بەراورد دەکات: ناونیشانی خۆی لەگەڵ AND دەکات، مەبەستەکەش لەگەڵ هەمان AND دەکات و دوو ئەنجامەکە بەراورد دەکات (AND چۆن کار دەکات).

  • Local (same network): the host delivers directly. It finds the destination’s MAC address — from its ARP cache or with an ARP request — and puts the packet in a frame addressed to that MAC.
  • Remote (another network): the host sends the packet to its default gateway. It finds the gateway’s MAC address the same way and frames the packet to it. The destination IP address in the packet does not change.
  • ناوخۆیی (هەمان ): ڕاستەوخۆ دەیگەیەنێت. مەبەستەکە دەدۆزێتەوە — لە یان بە — و دەخاتە ناو کە بۆ ئەو MACـە ناونیشان کراوە.
  • دوور ( تر): بۆ دەنێرێت. بە هەمان ڕێگا دەدۆزێتەوە و لە بۆی دەنێرێت. مەبەست لە ناو ناگۆڕێت.
Flowchart. Aram-PC 192.168.1.10/24 sends to destination D. Diamond: is D on my network (AND both with my mask)? Yes, local: 1 ARP for D itself (“Who has D?”), 2 frame to D’s MAC — example D = 192.168.1.20. No, remote: 1 ARP for the gateway (“Who has 192.168.1.1?”), 2 frame to the gateway’s MAC — example D = 203.0.113.7. Footer: either way the IP packet keeps D as its destination; only the frame’s MAC address differs.هێڵکاری بڕیار. Aram-PC 192.168.1.10/24 بۆ مەبەستی D دەنێرێت. لاکێشەی بڕیار: ئایا D لە سەر ڕایەڵەکەی منە (هەردووکیان بە ماسکی ژێرڕایەڵەکەم AND دەکرێن)؟ بەڵێ، ناوخۆیی: 1 ARP بۆ خودی D («D هی کێیە؟»)، 2 فرەیم بۆ MACـی D — نموونە D = 192.168.1.20. نەخێر، دوور: 1 ARP بۆ دەروازەی بنەڕەتی («192.168.1.1 هی کێیە؟»)، 2 فرەیم بۆ MACـی دەروازەی بنەڕەتی — نموونە D = 203.0.113.7. خوارەوە: لە هەردوو حاڵەتدا پاکێتی IP هەر D وەک مەبەست هەڵدەگرێت؛ تەنیا ناونیشانی MACـی فرەیمەکە جیاوازە.
Same network? ARP for the target. Another network? ARP for the gateway.هەمان ؟ بۆ ئامانجەکە. تر؟ بۆ .CêIT

Why not simply ARP for the far destination? Because ARP works only inside one local network: its request is a broadcast, and routers do not forward broadcasts (ARP for remote destinations). Put simply, the host first gets the MAC address and then “puts the data in a box” — it attaches the MAC addresses: that box is the frame.

بۆچی ڕاستەوخۆ بۆ مەبەستە دوورەکە ناکات؟ چونکە تەنیا لە ناو یەک ناوخۆییدا کار دەکات: و نانێرن (ARP بۆ مەبەستی دوور). بە زمانێکی سادە، سەرەتا بەدەست دەهێنێت، پاشان « لەقتووی دەدات» — واتە پێوە دەلکێنێت: ئەو قتووە .

The default gateway: the way out of a networkدەروازەی بنەڕەتی: ڕێگای دەرچوون لە ڕایەڵەیەک

A host knows only the addresses of its own network. For everything else it follows one simple rule: “If the destination is not on my network, send the packet to my gateway.” The default gateway is the exit point for data going to another network and the entry point for data coming back. It is given as an IP address, such as 192.168.1.1, and it is usually a router — more exactly, the router’s interface inside that LAN. So the IP address of that interface must be set as the default gateway on every host of the LAN.

تەنیا ناونیشانەکانی خۆی دەزانێت. بۆ هەموو شتێکی تر یەک یاسای سادە پەیڕەو دەکات: «ئەگەر مەبەستەکە لە سەر من نەبوو، بۆ بنێرە.» خاڵی دەرچوونی بەرەو تر و خاڵی هاتنەژوورەوەی کاتێک دەگەڕێتەوە. وەک دەدرێت (بۆ نموونە ⁦192.168.1.1⁩) و بە زۆری — بە وردی، ئەو کە لە ناو ئەو . بۆیە ئەو دەبێت لە هەموو ئەو وەک دابنرێت.

Two networks joined by router R1. Left, network 192.168.2.0/24 with PCs 192.168.2.20 and 192.168.2.31 on a switch; right, network 192.168.3.0/24 with PCs 192.168.3.5 and 192.168.3.42. The router’s left interface is .1 in the left network and its right interface is .1 in the right network. Notes: gateway on every PC on the left 192.168.2.1, on the right 192.168.3.1.دوو ڕایەڵە کە ڕێدۆزی R1 پێکیانەوە دەبەستێت. چەپ، ڕایەڵەی 192.168.2.0/24 بە کۆمپیوتەرەکانی 192.168.2.20 و 192.168.2.31 لە سەر سویچێک؛ ڕاست، ڕایەڵەی 192.168.3.0/24 بە کۆمپیوتەرەکانی 192.168.3.5 و 192.168.3.42. نێوبەستەی چەپی ڕێدۆزەکە لە ڕایەڵەی چەپدا .1ـە و نێوبەستەی ڕاستی لە ڕایەڵەی ڕاستدا .1ـە. تێبینی: دەروازەی بنەڕەتیی هەموو کۆمپیوتەرێکی چەپ 192.168.2.1ـە، هی ڕاست 192.168.3.1.
One router, two interfaces, two networks — and two different gateway addresses.یەک ، دوو ، دوو — و دوو ناونیشانی جیاوازی .CêIT

Many networks give the gateway the first host address (.1, as in 192.168.0.1 or 192.168.1.1) because it is neat and easy to remember — but this is a habit, not a rule: .254 is also common. And a LAN needs a gateway only if its hosts must reach other networks; an isolated LAN works without one.

زۆر یەکەم ناونیشانی (.1، وەک ⁦192.168.0.1⁩ یان ⁦192.168.1.1⁩) دەدەنە ، چونکە ڕێک و پێکە و ئاسان لە بیر دەمێنێت — بەڵام ئەمە نەریتە، نەک یاسا: .254ـیش باوە. هەروەها تەنیا ئەو کاتە پێویستە کە دەبێت بگەنە تر؛ جیاکراوە بەبێ ئەویش کار دەکات.

The default gateway: the way out of a networkدەروازەی بنەڕەتی: ڕێگای دەرچوون لە ڕایەڵەیەک

A town with one gateشارۆچکەیەک بە یەک دەروازە

Every network is a walled townهەر ڕایەڵەیەک شارۆچکەیەکی شوورادارە

Picture each network as an old walled town with one gate, like the citadels of Kurdistan. People inside visit each other directly. Anyone who wants to leave — or to come in from outside — must pass through the gate. The router is that gate, and its address is the one every host writes down as its “default gateway”: the gate it uses by default when it does not know a better way.

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

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

A real router can have many “gates” — one interface per network — and a big network can have several routers. Each host still has one default gateway.

ڕاستەقینە دەتوانێت چەندین «دەروازە»ی هەبێت — بۆ هەر — و گەورە دەتوانێت چەند هەبێت. هێشتا هەر یەک هەیە.

An original drawing of a walled town with battlements. Inside, five PCs; two of them talk directly with a green double arrow (“Inside: hosts talk directly”). The only gate is labelled “the gate = the router”. A blue road leads out of the gate to a cloud “other networks”, and a dashed road comes back: “out and in only through the gate”. Footer: its address, for example 192.168.1.1, is what every host stores as its default gateway.وێنەیەکی ڕەسەنی شارۆچکەیەکی شوورادار. لە ناوەوە پێنج کۆمپیوتەر؛ دوانیان بە تیرێکی سەوزی دوولایەنە ڕاستەوخۆ قسە دەکەن («لە ناوەوە: میوانگرەکان ڕاستەوخۆ قسە دەکەن»). تاکە دەروازەکە: «دەروازە = ڕێدۆز». ڕێگایەکی شین لە دەروازەکەوە دەچێت بۆ هەورێکی «ڕایەڵەکانی تر» و ڕێگایەکی پچڕپچڕ دەگەڕێتەوە: «دەرچوون و هاتنەژوورەوە تەنیا لە دەروازەوە». خوارەوە: ناونیشانەکەی، بۆ نموونە 192.168.1.1، ئەوەیە کە هەموو میوانگرێک وەک دەروازەی بنەڕەتی هەڵیدەگرێت.
The router is the network’s gate: traffic leaves and enters only through it. دەروازەی : هاتوچۆ تەنیا لەوێوە دەردەچێت و دێتە ژوورەوە.CêIT

Where a computer keeps its gatewayکۆمپیوتەر دەروازەی بنەڕەتییەکەی لە کوێ هەڵدەگرێت

Most computers receive their address, mask, gateway and DNS server automatically from DHCP (DHCP). On a computer with fixed settings, in Windows 11 you type them in Settings → Network & internet → Ethernet → IP assignment → Edit → Manual → IPv4 (the older Internet Protocol Version 4 (TCP/IPv4) Properties window still works too). Example: IP address 192.168.1.2, mask 255.255.255.0, gateway 192.168.1.254; its neighbours 192.168.1.3 and 192.168.1.4 use the same gateway. To check the result, run ipconfig:

زۆربەی ناونیشان، ، و بە شێوەی خۆکار لە وەردەگرن (DHCP). لە ڕێکخستنی جێگیردا، لە ⁦Windows 11⁩ـدا لە Settings → Network & internet → Ethernet → IP assignment → Edit → Manual → IPv4 دەیاننووسیت (پەنجەرە کۆنەکەی ⁦Internet Protocol Version 4 (TCP/IPv4) Properties⁩ـیش هێشتا کار دەکات). نموونە: ⁦192.168.1.2⁩، ⁦255.255.255.0⁩، ⁦192.168.1.254⁩؛ دراوسێکانی ⁦192.168.1.3⁩ و ⁦192.168.1.4⁩ هەمان بەکار دەهێنن. بۆ پشکنینی ئەنجامەکە، ipconfig جێبەجێ بکە:

Windows 11: confirming the gateway⁦Windows 11⁩: دڵنیابوونەوە لە دەروازەی بنەڕەتیBATType in a terminalلە تێرمیناڵدا بینووسە
ipconfig
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 1

Run it in Command Prompt or Terminal; ipconfig /all also shows the MAC address, DHCP and DNS servers.

لە Command Prompt یان Terminalـدا جێبەجێی بکە؛ ipconfig /all ، و نیشان دەدات.

Hop by hop: MAC addresses change, IP addresses stayباز بە باز: ناونیشانەکانی MAC دەگۆڕێن، ناونیشانەکانی IP دەمێننەوە

To deliver a packet, both kinds of address are needed. The IP addresses name the original sender and the final receiver. The frame on each link carries two MAC addresses: the MAC of the device that sends it on this link and the MAC of the next device. Follow a packet from PC1 (192.168.1.2) through routers R0, R1 and R2 to PC2 (192.168.4.5): PC1 frames it to R0’s G0/0/0 interface, its default gateway. R0 removes that frame (decapsulation) and builds a new one, from its own outgoing interface to R1’s interface, and so on to PC2.

بۆ گەیاندنی ، هەردوو جۆری ناونیشان پێویستن. نێرەری یەکەم و وەرگری کۆتایی دەناسێنن. سەر هەر بەستەرێک دوو هەڵدەگرێت: MACـی ئەو ئامێرەی لەم بەستەرەدا دەینێرێت و MACـی ئامێری دواتر. لە ⁦PC1⁩ـەوە ⁦(192.168.1.2)⁩ بە ⁦R0⁩، ⁦R1⁩ و ⁦R2⁩دا بۆ ⁦PC2 (192.168.4.5)⁩ بەدوا بکەوە: ⁦PC1⁩ دەیخاتە بۆ ⁦G0/0/0⁩ـی ⁦R0⁩، کە . ⁦R0⁩ ئەو لادەبات () و یەکێکی نوێ دروست دەکات، لە دەرچوونی خۆیەوە بۆ ⁦R1⁩. بەم شێوەیە بەردەوام دەبێت تا ⁦PC2⁩.

Five frames. PC1 (192.168.1.2), routers R0, R1 and R2 and PC2 (192.168.4.5) in a row; every interface shows the last byte of its MAC address (0A, 1A/1B, 2A/2B, 3A/3B, 4A). Hop 1: the frame goes from …53-0A (PC1) to …53-1A (R0). Hop 2: from …53-1B (R0) to …53-2A (R1). Hop 3: from …53-2B (R1) to …53-3A (R2). Hop 4: from …53-3B (R2) to …53-4A (PC2). A table grows row by row; its IP column says 192.168.1.2 → 192.168.4.5 in every row. Last frame: MAC addresses change at every hop, the IP addresses stay the same, as long as no router does NAT.
Five frames. PC1 (192.168.1.2), routers R0, R1 and R2 and PC2 (192.168.4.5) in a row; every interface shows the last byte of its MAC address (0A, 1A/1B, 2A/2B, 3A/3B, 4A). Hop 1: the frame goes from …53-0A (PC1) to …53-1A (R0). Hop 2: from …53-1B (R0) to …53-2A (R1). Hop 3: from …53-2B (R1) to …53-3A (R2). Hop 4: from …53-3B (R2) to …53-4A (PC2). A table grows row by row; its IP column says 192.168.1.2 → 192.168.4.5 in every row. Last frame: MAC addresses change at every hop, the IP addresses stay the same, as long as no router does NAT.
New frame, new MAC addresses at every hop — the same IP packet all the way. نوێ و نوێ لە هەر — هەمان IP بە درێژایی ڕێگاکە.CêIT

So the MAC addresses change at every hop, while the source and destination IP addresses stay the same for the whole trip. One exception: a router that does NAT, like a home router, rewrites the source IP address of packets going to the Internet (NAT). The same story with letters instead of numbers is in OSI Layers 1–3.

کەواتە لە هەر دەگۆڕێن، بەڵام سەرچاوە و مەبەست بە درێژایی گەشتەکە وەک خۆیان دەمێننەوە. یەک ئاوارتە: کە دەکات، وەک ماڵەوە، سەرچاوەی ئەو دەگۆڕێت کە دەچن بۆ (وەرگێڕانی ناونیشانی ڕایەڵە). هەمان چیرۆک بە پیت لە جیاتی ژمارە لە چینەکانی 1 تا 3ی OSIدایە.

Packet Traveling - How Packets Move Through a NetworkPractical Networking · Englishئینگلیزی · 949K viewsبینین · 19K likesلایک · Partبەشی 0:45–14:11 (ofلە 14:38)

Follow one packet from a host through a switch and a router to another host: ARP, MAC address tables and the routing table, with every address shown at every step.

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

Watch 0:45–14:11: the MAC addresses change at every hop, while the IP addresses stay the same.

لە ⁦0:45⁩ تا ⁦14:11⁩ سەیر بکە: لە هەر دەگۆڕێن، بەڵام وەک خۆیان دەمێننەوە.

What a router does with every frameڕێدۆز چی لە هەر فرەیمێک دەکات

  1. Check the frameپشکنینی فرەیمەکە

    Is it for me, and is it intact? The router processes a frame only if its destination MAC address is the router’s own (or a broadcast or multicast it listens to) and the FCS — a check number in every frame — shows no damage on the way. Otherwise the frame is discarded.

    ئایا بۆ منە و تەندروستە؟ تەنیا ئەو پرۆسێس دەکات کە مەبەستی هی خودی بێت (یان یان کە گوێی لێ دەگرێت) و FCS — ژمارەیەکی پشکنین لە هەموو — هیچ تێکچوونێک لە ڕێگادا نیشان نەدات. ئەگینا فڕێ دەدرێت.

  2. Unwrapهەڵوەشاندن

    The router removes the data-link header and trailer — the two old MAC addresses go away — and keeps the packet.

    سەرە و کۆتاییی لادەبات — دوو کۆنەکە دەڕۆن — و دەهێڵێتەوە.

  3. Decideبڕیاردان

    It compares the destination IP address with its routing table and finds the best matching route. The route gives the exit interface and, for a remote network, the next-hop router.

    IPـی مەبەست لەگەڵ بەراورد دەکات و باشترین ڕێگەی گونجاو دەدۆزێتەوە. ڕێگەکە و، بۆ دوور، دەدات.

  4. Rewrapپێچانەوە

    It lowers the TTL by 1 (a packet that reaches 0 is dropped), updates the header checksum and puts the packet in a new frame that suits the outgoing link: on an Ethernet interface, with its own MAC as the source and the next device’s MAC — found with ARP if needed — as the destination.

    1 کەم دەکاتەوە ( کە بگاتە 0 فڕێ دەدرێت)، سەرەکە نوێ دەکاتەوە و دەخاتە ناو نوێ کە لەگەڵ بەستەری دەرچوون دەگونجێت: لە سەر ، بە MACـی خۆی وەک سەرچاوە و MACـی ئامێری دواتر — ئەگەر پێویست بوو بە دەدۆزرێتەوە — وەک مەبەست.

  5. Sendناردن

    It transmits the frame out of the exit interface of the matched route.

    لە ڕێگە گونجاوەکەوە دەنێرێت.

Five boxes in a row: 1 Check — FCS OK, to my MAC (or broadcast/multicast)? else discard. 2 Unwrap — remove the old frame, the packet is left. 3 Decide — look up the destination IP in the routing table; no route: drop and send ICMP. 4 Rewrap — TTL minus 1, new frame, new MACs (ARP if needed). 5 Send — out of the exit interface of the route. Below: an Ethernet frame “Eth: to R1 | IP: to 172.16.2.9 | data | FCS” comes in on G0/0, and an HDLC frame “HDLC: to R2 | IP: to 172.16.2.9 | data | FCS” goes out on S0/0/0. The packet inside is the same; the frame around it is new.پێنج سندوق لە ڕیزێکدا: 1 پشکنین — FCS دروستە، بۆ MACـی منە (یان پەخشکردن/فرەپەخش)؟ ئەگینا فڕێدان. 2 هەڵوەشاندن — فرەیمی کۆن لادەبات، پاکێتەکە دەمێنێتەوە. 3 بڕیار — بەدوای IPـی مەبەستدا لە خشتەی ڕێدۆزیدا دەگەڕێت؛ ڕێگە نییە: فڕێدان و ناردنی ICMP. 4 پێچانەوە — TTL کەم 1، فرەیمی نوێ، MACـی نوێ (بە ARP). 5 ناردن — لە نێوبەستەی دەرچوونی ڕێگاکەوە. لە خوارەوە: فرەیمێکی Ethernet «Eth: بۆ R1 | IP: بۆ 172.16.2.9 | دراوە | FCS» لە G0/0ـەوە دێت و فرەیمێکی HDLC «HDLC: بۆ R2 | IP: بۆ 172.16.2.9 | دراوە | FCS» لە S0/0/0ـەوە دەردەچێت. پاکێتی ناوەوە هەمانە؛ فرەیمی دەوری نوێیە.
Check, unwrap, decide, rewrap, send — for every frame.پشکنین، ، بڕیار، ، ناردن — بۆ هەر .CêIT

What a router does with every frameڕێدۆز چی لە هەر فرەیمێک دەکات

Which route is “best”?کام ڕێگە «باشترینە»؟

When a routing table holds more than one route to the same network, the router must pick one. If the routes come from different sources — say a static route and OSPF — it first trusts the source with the lower administrative distance (administrative distance). Between routes of the same routing protocol it uses the metric — a number that measures how good a path is — and picks the lowest. Each routing protocol measures differently: RIP counts hops (the number of routers on the way; 15 at most), OSPF uses a cost computed from the interface bandwidth (by default 100 Mb/s divided by the interface speed), and EIGRP combines the bandwidth and the delay — the time a packet takes to cross the path — not the delay alone. How these metrics are measured is taught in Routing protocols.

کاتێک زیاتر لە یەک ڕێگەی بۆ هەمان هەبێت، دەبێت یەکێکیان هەڵبژێرێت. ئەگەر ڕێگەکان لە سەرچاوەی جیاوازەوە هاتبن — بۆ نموونە و — سەرەتا متمانە بەو سەرچاوەیە دەکات کە ـی کەمترە (مەودای بەڕێوەبەری). لە نێوان ڕێگەکانی هەمان بەکار دەهێنێت — ژمارەیەک کە باشیی ڕێگایەک دەپێوێت — و کەمترینیان هەڵدەبژێرێت. هەر بە جۆرێکی جیاواز دەپێوێت: دەژمێرێت (ژمارەی سەر ڕێگا؛ زۆرترین ⁦15⁩)، پشت بە دەبەستێت کە لە ـی حیساب دەکرێت (بە بنەڕەت ⁦100 Mb/s⁩ دابەش لە سەر خێراییی )، ـیش و دواکەوتن ⁦(delay)⁩ — ئەو کاتەی دەیبات تا ڕێگاکە ببڕێت — تێکەڵ دەکات، نەک تەنیا دواکەوتن. ئەم چۆن دەپێورێن لە پرۆتۆکۆڵەکانی ڕێدۆزیدا دەخوێنرێت.

The routing tableخشتەی ڕێدۆزی

A routing table is a set of rules, in table form, that tells a router where to send packets. When a device sends data, every packet carries where it comes from and where it goes; the router reads the destination address in the packet header and compares it with the table. Each line — a route — names a destination network, the next hop (the next router, if the network is not directly connected), the exit interface, and a metric for choosing between routes. Together this is the routing information a router needs.

کۆمەڵێک یاسایە بە شێوەی خشتە کە بە دەڵێت بۆ کوێ بنێرێت. کاتێک ئامێرێک دەنێرێت، هەر هەڵگری ئەوەیە لە کوێوە دێت و بۆ کوێ دەچێت؛ ناونیشانی مەبەست لە سەرەی دەخوێنێتەوە و لەگەڵ خشتەکە بەراوردی دەکات. هەر دێڕێک — ڕێگەیەک — ناوی مەبەست، ( دواتر، ئەگەر ڕاستەوخۆ نەبەسترابێت)، و بۆ هەڵبژاردن لە نێوان ڕێگەکاندا دەبات. ئەمانە پێکەوە ئەو زانیارییەی ـن کە پێویستی پێیەتی.

Router R1 receives a packet to 172.16.2.9 on G0/0. Its routing table has three columns — destination network, next hop, exit interface: 172.16.1.0/24 none (connected) G0/0; 172.16.2.0/24 172.16.4.2 S0/0/0 (highlighted); 172.16.3.0/24 172.16.5.3 S0/0/1; 172.16.4.0/24 none (connected) S0/0/0; 172.16.5.0/24 none (connected) S0/0/1. Step 1 Matching: 172.16.2.9 is inside 172.16.2.0/24. Step 2 Forwarding: out of S0/0/0 to the next router 172.16.4.2. A green arrow runs from R1 out of S0/0/0 to R2 (172.16.4.2).ڕێدۆزی R1 پاکێتێک بۆ 172.16.2.9 لە G0/0ـەوە وەردەگرێت. خشتەی ڕێدۆزییەکەی سێ ستوونی هەیە — ڕایەڵەی مەبەست، بازی دواتر، نێوبەستەی دەرچوون: 172.16.1.0/24 نییە (بەستراو) G0/0؛ 172.16.2.0/24 172.16.4.2 S0/0/0 (دیاریکراو)؛ 172.16.3.0/24 172.16.5.3 S0/0/1؛ 172.16.4.0/24 نییە (بەستراو) S0/0/0؛ 172.16.5.0/24 نییە (بەستراو) S0/0/1. هەنگاوی 1 گونجاندن: 172.16.2.9 لە ناو 172.16.2.0/24دایە. هەنگاوی 2 ناردن: لە S0/0/0ـەوە بۆ ڕێدۆزی دواتر 172.16.4.2. تیرێکی سەوز لە R1ـەوە لە S0/0/0ـەوە دەچێت بۆ R2 (172.16.4.2).
Matching, then forwarding: 172.16.2.9 → route 172.16.2.0/24 → out of S0/0/0 to 172.16.4.2.گونجاندن، پاشان ناردن: ⁦172.16.2.9⁩ ← ڕێگەی ⁦172.16.2.0/24⁩ ← لە ⁦S0/0/0⁩ـەوە بۆ ⁦172.16.4.2⁩.CêIT

Worked example: a packet arrives at R1 on G0/0 with destination 172.16.2.9. R1 compares it with the networks in its table: 172.16.2.9 belongs to 172.16.2.0/24. The table says, in effect: “Any packet for network 172.16.2.0: send it out of interface S0/0/0 to the next router, 172.16.4.2.” Lines marked “none” are networks R1 is connected to itself; for those it delivers directly on that interface.

نموونەیەکی کارکراو: لە ⁦G0/0⁩ـەوە دەگاتە ⁦R1⁩ بە مەبەستی ⁦172.16.2.9⁩. ⁦R1⁩ بەراوردی دەکات لەگەڵ ناو خشتەکەی: ⁦172.16.2.9⁩ سەر بە ⁦172.16.2.0/24⁩ـە. خشتەکە لە ڕاستیدا دەڵێت: «هەر بۆ ⁦172.16.2.0⁩ هات، لە ⁦S0/0/0⁩ـەوە بینێرە بۆ بەرانبەر، ⁦172.16.4.2⁩.» ئەو دێڕانەی «نییە»یان تێدایە ئەو کە ⁦R1⁩ خۆی پێیانەوە بەستراوە؛ بۆ ئەوانە ڕاستەوخۆ لە سەر ئەو دەیگەیەنێت.

The routing tableخشتەی ڕێدۆزی

The parcel officeبەشکۆی ناردنی کاڵا

A parcel office in Sulaimaniبەشکۆیەکی ناردنی کاڵا لە سلێمانی

You want to send a parcel from Sulaimani to Erbil, so you write the destination address on it and take it to a parcel office. The staff look only at the destination. Their own instructions say: “Every parcel for Erbil goes to driver no. 3.” They hand it to driver 3, and their job is done. Here the parcel is the packet, the address is the destination IP address, the office is the router, the office’s instructions are the routing table, and driver 3 is the next hop with its exit interface.

دەتەوێت کاڵایەک لە سلێمانییەوە بۆ هەولێر بنێریت، بۆیە ناونیشانی مەبەستی لە سەر دەنووسیت و دەیبەیتە بەشکۆیەکی ناردنی کاڵا. فەرمانبەرەکان تەنیا سەیری مەبەستەکە دەکەن. ڕێنماییەکانی خۆیان دەڵێن: «هەر کاڵایەک بۆ هەولێر بێت دەدرێت بە شۆفێری ژمارە 3.» دەیدەنە شۆفێری 3 و کارەکەیان تەواو دەبێت. لێرەدا کاڵاکە ، ناونیشانەکە مەبەستە، بەشکۆکە ، ڕێنماییەکانی بەشکۆکە و شۆفێری 3 لەگەڵ .

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

A real router decides in microseconds, for millions of packets, and its “instructions” can change by themselves when routing protocols learn new paths.

ڕاستەقینە لە چەند میکرۆچرکەیەکدا بۆ ملیۆنان بڕیار دەدات و «ڕێنماییەکانی» دەتوانن بە خۆیان بگۆڕێن کاتێک ڕێگای نوێ فێر دەبن.

An original illustration. A parcel labelled “To: Erbil, from Sulaimani” (parcel = packet, address = destination IP) goes into a parcel office. Inside, the instructions: Erbil → driver 3 (highlighted), Duhok → driver 1, Kirkuk → driver 2, anything else → driver 4; office = router, instructions = routing table. Arrows lead to three vans; the van “driver 3 → Erbil” is highlighted. Footer: driver 3 = the next hop and exit interface, “anything else” = the default route; the office only hands the parcel to the right driver, and each router only chooses the next step.وێنەیەکی ڕەسەن. کاڵایەک بە نووسینی «بۆ: هەولێر، لە سلێمانییەوە» (کاڵا = پاکێت، ناونیشان = IPـی مەبەست) دەچێتە ناو بەشکۆیەکی کاڵا. لە ناوەوە ڕێنماییەکان: هەولێر ← شۆفێری 3 (دیاریکراو)، دهۆک ← شۆفێری 1، کەرکووک ← شۆفێری 2، هەر شوێنێکی تر ← شۆفێری 4؛ بەشکۆ = ڕێدۆز، ڕێنمایی = خشتەی ڕێدۆزی. تیرەکان دەچن بۆ سێ ئۆتۆمبێل؛ ئۆتۆمبێلی «شۆفێری 3 ← هەولێر» دیاری کراوە. خوارەوە: شۆفێری 3 = بازی دواتر و نێوبەستەی دەرچوون، «هەر شوێنێکی تر» = ڕێگەی بنەڕەتی؛ بەشکۆکە تەنیا کاڵاکە دەداتە شۆفێرە دروستەکە و هەر ڕێدۆزێکیش تەنیا هەنگاوی داهاتوو هەڵدەبژێرێت.
The office reads only the destination and hands the parcel to the right driver.بەشکۆکە تەنیا مەبەستەکە دەخوێنێتەوە و کاڵاکە دەداتە شۆفێرە دروستەکە.CêIT

The routing tableخشتەی ڕێدۆزی

When several routes matchکاتێک چەند ڕێگەیەک دەگونجێن

A destination can fit more than one route: 10.1.2.7 is inside 10.0.0.0/8, inside 10.1.2.0/24 and — like every address — inside the default route 0.0.0.0/0. Routers always use the most specific route, the one with the longest prefix: here /24. This rule is called longest prefix match. Administrative distance and metric only decide between routes with the same prefix length.

مەبەستێک دەتوانێت لەگەڵ زیاتر لە یەک ڕێگە بگونجێت: ⁦10.1.2.7⁩ لە ناو ⁦10.0.0.0/8⁩دایە، لە ناو ⁦10.1.2.0/24⁩دایە و — وەک هەموو ناونیشانێک — لە ناو ⁦0.0.0.0/0⁩دایە. هەمیشە وردترین ڕێگە بەکار دەهێنن، ئەوەی درێژترین ـی هەیە: لێرەدا /24. ئەم یاسایە پێی دەگوترێت . و تەنیا لە نێوان ڕێگەکانی هەمان درێژیی بڕیار دەدەن.

A table of three routes: 10.0.0.0/8 next hop 192.168.9.2; 10.1.2.0/24 next hop 192.168.9.3; 0.0.0.0/0 next hop ISP (default). Note: longer prefix = smaller, more exact network; the router compares the destination with every route and takes the longest match. Three packets: 10.1.2.7 matches /8, /24 and /0, so /24 wins → 192.168.9.3; 10.9.9.9 matches /8 and /0, so /8 wins → 192.168.9.2; 198.51.100.7 matches only /0 → default route to the ISP.خشتەیەکی سێ ڕێگە: 10.0.0.0/8 بازی دواتر 192.168.9.2؛ 10.1.2.0/24 بازی دواتر 192.168.9.3؛ 0.0.0.0/0 بازی دواتر ISP (بنەڕەت). تێبینی: پێشگری درێژتر = ڕایەڵەیەکی بچووکتر و وردتر؛ ڕێدۆزەکە مەبەستەکە لەگەڵ هەموو ڕێگەکان بەراورد دەکات و گونجانی درێژترین پێشگر هەڵدەبژێرێت. سێ پاکێت: 10.1.2.7 لەگەڵ /8، /24 و /0 دەگونجێت، /24 دەباتەوە ← 192.168.9.3؛ 10.9.9.9 لەگەڵ /8 و /0، /8 دەباتەوە ← 192.168.9.2؛ 198.51.100.7 تەنیا لەگەڵ /0 ← ڕێگەی بنەڕەتی بۆ ISP.
The longest matching prefix wins; the default route catches everything else.درێژترین گونجاو دەباتەوە؛ هەموو شتێکی تر دەگرێت.CêIT

Hop, next hop and exit interfaceباز، بازی دواتر و نێوبەستەی دەرچوون

In English, to hop is to jump on one foot. In networking, a hop is one jump of a packet from one device to the next: each time it passes a router, “it hopped to the next node”. The next hop in a route is the IP address of the neighbouring router interface that the packet is handed to. An interface is something that sits between two things and joins them — a TV remote is the interface between you and the TV — and a router port is called the exit interface when a route sends packets out of it. An exit interface is always a port of this router, never of the neighbour, even when both routers use the same port name.

لە ئینگلیزیدا hop واتە بازدان لە سەر یەک پێ. لە یەک بازدانی لە ئامێرێکەوە بۆ ئامێرێکی تر: هەر جارێک بە تێدەپەڕێت، «بازی دا بۆ گرێی دواتر». لە ڕێگەیەکدا ئەو دراوسێیە کە دەدرێتێ. شتێکە کە لە نێوان دوو شتدایە و پێکیانەوە دەبەستێت — کۆنترۆڵی تەلەفزیۆن نێوان تۆ و تەلەفزیۆنەکەیە — و کاتێک ڕێگەیەک لەوێوە دەنێرێت، پێی دەگوترێت . هەمیشە ئەم ، هەرگیز هی دراوسێ نییە، تەنانەت ئەگەر هەردوو هەمان ناوی بەکار بهێنن.

R1 wants to reach network 10.2.2.0/24 behind R2. R1 (Se0/3/0, 10.0.0.1) and R2 (Se0/3/0, 10.0.0.2) are joined by a serial link. Left box: exit interface — a port of R1 itself, “send it out of my Se0/3/0”, route 10.2.2.0/24 → Serial0/3/0. Right box: next hop — the neighbour’s IP address, “hand it to 10.0.0.2 (R2)”, route 10.2.2.0/24 via 10.0.0.2. Footer: same port name on both routers, but an exit interface always means the sending router’s own port.R1 دەیەوێت بگاتە ڕایەڵەی 10.2.2.0/24 لە پشت R2ـەوە. R1 (Se0/3/0، 10.0.0.1) و R2 (Se0/3/0، 10.0.0.2) بە بەستەرێکی زنجیرەیی پێکەوە بەستراون. سندوقی چەپ: نێوبەستەی دەرچوون — دەرچەیەکی خودی R1، «لە Se0/3/0ـی خۆمەوە بینێرە»، ڕێگەی 10.2.2.0/24 لە ڕێی Serial0/3/0. سندوقی ڕاست: بازی دواتر — ناونیشانی IPـی دراوسێ، «بیدە بە 10.0.0.2 (R2)»، ڕێگەی 10.2.2.0/24 via 10.0.0.2. خوارەوە: هەمان ناوی دەرچە لە هەردوو ڕێدۆزەکە، بەڵام نێوبەستەی دەرچوون هەمیشە دەرچەی خودی ڕێدۆزی نێرەرە.
Next hop = the neighbour’s address; exit interface = my own port. = ناونیشانی دراوسێ؛ = خۆم.CêIT

A route can name either one, as the two route entries in the picture show. How such routes are typed on a Cisco router is taught in Static routes in the Routing and Switching course.

ڕێگەیەک دەتوانێت ناوی هەر یەکێکیان ببات، وەک دوو ڕێگەکەی ناو وێنەکە نیشانی دەدەن. چۆنیەتیی نووسینی ئەم ڕێگانە لە سەر Cisco لە ڕێگە جێگیرەکانـی خولی و دەخوێنرێت.

Match, default route, or dropگونجان، ڕێگەی بنەڕەتی، یان فڕێدان

After unwrapping a packet and reading its destination, a router meets one of three cases. 1 — A route matches: network 10.1.2.0 is in the table, so the router re-wraps the packet and sends it towards 10.1.2.0. 2 — No matching route, but a default route: 172.16.2.0 is not in the table, but a default route (0.0.0.0/0, “anything else”) points to 192.168.1.2, so the packet goes there. 3 — No route and no default route: the router drops the packet. It does not forward it or return it — but it does tell the sender, with an ICMP Destination Unreachable message (ICMP). How a router gets its default route is taught in The default route.

دوای و خوێندنەوەی مەبەستەکەی، تووشی یەکێک لە سێ حاڵەت دەبێت. 1 — ڕێگەیەک دەگونجێت: ⁦10.1.2.0⁩ لە خشتەکەدایە، بۆیە دووپاتە دەپێچێتەوە و بەرەو ⁦10.1.2.0⁩ دەینێرێت. 2 — ڕێگەی گونجاو نییە، بەڵام هەیە: ⁦172.16.2.0⁩ لە خشتەکەدا نییە، بەڵام (⁦0.0.0.0/0⁩، «هەر شتێکی تر») ئاماژە بە ⁦192.168.1.2⁩ دەکات، بۆیە دەچێت بۆ ئەوێ. 3 — نە ڕێگە، نە : فڕێ دەدات. نایناردات و نایگەڕێنێتەوە — بەڵام بە پەیامی Destination Unreachableـی نێرەر ئاگادار دەکاتەوە (ICMP). چۆن وەردەگرێت لە ڕێگەی بنەڕەتیدا دەخوێنرێت.

Three lanes, each with a packet entering a router. 1, a route matches: a packet to 10.1.2.5 — route 10.1.2.0/24, re-wrap and forward to network 10.1.2.0. 2, no route but a default route: a packet to 172.16.2.7 — not in the table, use 0.0.0.0/0, forward to 192.168.1.2. 3, no route and no default route: a packet to 203.0.113.9 — drop the packet and send ICMP Destination Unreachable to the source.سێ ڕێڕەو، لە هەریەکەیاندا پاکێتێک دەچێتە ناو ڕێدۆزێکەوە. 1، ڕێگەیەک دەگونجێت: پاکێتێک بۆ 10.1.2.5 — ڕێگەی 10.1.2.0/24، دووپاتە بیپێچەوە و بینێرە بۆ ڕایەڵەی 10.1.2.0. 2، ڕێگە نییە بەڵام ڕێگەی بنەڕەتی هەیە: پاکێتێک بۆ 172.16.2.7 — لە خشتەکەدا نییە، 0.0.0.0/0 بەکار بهێنە، بینێرە بۆ 192.168.1.2. 3، نە ڕێگە نە ڕێگەی بنەڕەتی: پاکێتێک بۆ 203.0.113.9 — پاکێتەکە فڕێ بدە و Destination Unreachableـی ICMP بۆ سەرچاوە بنێرە.
Every lookup ends in one of three ways: forward on a route, forward on the default route, or drop.هەموو گەڕانێک بە یەکێک لە سێ شێوە کۆتایی دێت: ناردن بە ڕێگەیەک، ناردن بە ، یان فڕێدان.CêIT

Your computer has a routing table tooکۆمپیوتەرەکەتیش خشتەی ڕێدۆزیی هەیە

Hosts also keep a small routing table. Usually it holds only the host’s own network (directly connected) and a default route to the default gateway — hosts usually know no remote networks. In Windows, route print (or netstat -r) shows it. A shortened Windows 11 example for host 192.168.1.2 behind gateway 192.168.1.254:

بچووک هەڵدەگرن. بە زۆری تەنیا خۆی (ڕاستەوخۆ بەستراو) و بۆ تێدایە — بە زۆری هیچ دوور نازانن. لە Windowsـدا route print (یان netstat -r) نیشانی دەدات. نموونەیەکی کورتکراوەی ⁦Windows 11⁩ بۆ ⁦192.168.1.2⁩ لە پشت ⁦192.168.1.254⁩:

Windows 11: route print (IPv4 only, shortened)⁦Windows 11: route print⁩ (تەنیا ⁦IPv4⁩، کورتکراوە)BATType in a terminalلە تێرمیناڵدا بینووسە
route print -4
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 1

route print without -4 also prints the IPv6 route table; netstat -r shows the same tables.

route print بەبێ ⁦-4⁩ ⁦IPv6⁩ـیش دەنووسێت؛ netstat -r هەمان خشتەکان نیشان دەدات.

The Active Routes of route print with two rows highlighted. Notes below: 0.0.0.0 / 0.0.0.0 is the default route, “anything else → gateway 192.168.1.254”; 192.168.1.0 / 255.255.255.0 On-link is my own LAN, delivered directly with ARP; 127.0.0.0/8 is loopback, the /32 lines are my own address and my broadcast, 224.0.0.0/4 is multicast; no remote networks: a normal host knows only its LAN and its gateway.Active Routesـی route print بە دوو دێڕی دیاریکراو. تێبینییەکانی خوارەوە: 0.0.0.0 / 0.0.0.0 ڕێگەی بنەڕەتییە، «هەر شتێکی تر ← دەروازەی بنەڕەتی 192.168.1.254»؛ 192.168.1.0 / 255.255.255.0 On-link ڕایەڵەی ناوچەییەکەی خۆمە، ڕاستەوخۆ بە ARP دەگەیەنرێت؛ 127.0.0.0 خۆگەڕانەوەیە، دێڕەکانی ماسکی 255.255.255.255 ناونیشان و پەخشکردنی خۆمن، 224.0.0.0 فرەپەخشە؛ هیچ ڕایەڵەیەکی دوور نییە: میوانگرێکی ئاسایی تەنیا ڕایەڵەی ناوچەییەکەی و دەروازەی بنەڕەتییەکەی دەزانێت.
Two lines do the real work: the default route and the local network.دوو دێڕ کارە ڕاستەقینەکە دەکەن: و ناوخۆییەکە.CêIT

On-link means “deliver directly on this link” — no gateway is needed. The metric is set automatically from the interface speed; the lowest metric wins when two routes match equally. Adding and deleting routes on Windows is in route add, delete and change.

⁦On-link⁩ واتە «ڕاستەوخۆ لە سەر ئەم بەستەرە بیگەیەنە» — هیچ پێویست نییە. بە شێوەی خۆکار لە خێراییی دادەنرێت؛ کاتێک دوو ڕێگە وەک یەک دەگونجێن، کەمترین دەباتەوە. زیادکردن و سڕینەوەی ڕێگە لە Windowsـدا لە route add، delete و changeدایە.

A router’s table: show ip routeخشتەی ڕێدۆزێک: show ip route

On a Cisco router, show ip route prints the routing table. Here is the table of a local router: its LAN 192.168.1.0/24 on G0/0, a link 192.168.2.0/24 to a remote router (192.168.2.2) on G0/1, and two networks behind that remote router, 10.1.1.0/24 and 10.1.2.0/24, learned with RIP. The next hop for both is 192.168.2.2. In this course we only read the table; configuring routers is in the Routing and Switching course (The routing table and route sources).

لە Ciscoـدا، show ip route دەنووسێت. ئەمە خشتەی ناوخۆییە: ⁦192.168.1.0/24⁩ لە سەر ⁦G0/0⁩، بەستەری ⁦192.168.2.0/24⁩ بۆ دوور ⁦(192.168.2.2)⁩ لە سەر ⁦G0/1⁩، هەروەها دوو لە پشت ئەو دوورەوە، ⁦10.1.1.0/24⁩ و ⁦10.1.2.0/24⁩، کە بە فێر بووە. بۆ هەردووکیان ⁦192.168.2.2⁩ـە. لەم خولەدا تەنیا خشتەکە دەخوێنینەوە؛ ڕێکخستنی لە خولی و (خشتەی ڕێدۆزی و سەرچاوەکانی ڕێگە).

Cisco IOS: a local router’s routing tableCisco IOS: خشتەی ڕێدۆزیی ڕێدۆزێکی ناوخۆییTEXT
R1# show ip route
The line “R 10.1.1.0 [120/1] via 192.168.2.2, 00:00:08, GigabitEthernet0/1” with brackets: R = how it was learned (R = RIP; C connected, L local, S static); 10.1.1.0 = the destination network (mask from the heading line); [120/1] = administrative distance 120 for RIP and metric 1 = one hop; 192.168.2.2 = next hop, the neighbour router’s address; 00:00:08 = age, learned 8 seconds ago; GigabitEthernet0/1 = exit interface, a port of this router.دێڕی «R 10.1.1.0 [120/1] via 192.168.2.2, 00:00:08, GigabitEthernet0/1» بە کەوانە: R = چۆن فێر بوو (R واتە RIP؛ C بەستراو، L ناوخۆیی، S جێگیر)؛ 10.1.1.0 = ڕایەڵەی مەبەست (ماسکی ژێرڕایەڵە لە دێڕی سەرەوەیە)؛ [120/1] = مەودای بەڕێوەبەری 120 بۆ RIP و پێوانە 1 = یەک باز؛ 192.168.2.2 = بازی دواتر، ناونیشانی ڕێدۆزی دراوسێ؛ 00:00:08 = تەمەن، 8 چرکە لەمەوبەر فێر بوو؛ GigabitEthernet0/1 = نێوبەستەی دەرچوون، دەرچەیەکی ئەم ڕێدۆزە.
One route line: source, network, [distance/metric], next hop, age, exit interface.یەک دێڕی ڕێگە: سەرچاوە، ، [/]، ، تەمەن، .CêIT

C lines are the router’s own connected networks, L lines its own interface addresses (/32), and R lines routes learned from RIP. In [120/1], 120 is the administrative distance — how much the router trusts RIP — and 1 is the metric, one hop. Current routers show GigabitEthernet interfaces and the L lines; older screenshots show FastEthernet and no L lines. Every code letter is explained in The route codes.

دێڕەکانی C بەستراوی خودی ، دێڕەکانی L ناونیشانی خۆی ⁦(/32)⁩، دێڕەکانی Rـیش ئەو ڕێگانەن کە لە فێر بووە. لە ⁦[120/1]⁩ـدا، ⁦120⁩ — چەند متمانەی بە هەیە — و 1 ، یەک . ئێستا GigabitEthernet و دێڕەکانی L نیشان دەدەن؛ وێنە کۆنەکان FastEthernet نیشان دەدەن و دێڕی Lـیان نییە. هەموو پیتێکی کۆد لە کۆدەکانی ڕێگەدا ڕوون کراوەتەوە.

How routers learn routes: static and dynamicڕێدۆزەکان چۆن ڕێگەکان فێر دەبن: جێگیر و بزۆک

A router knows its directly connected networks by itself. For remote networks there are two ways. With static routing, an administrator types every route: in a line of routers A–B–C, where C has networks 10.1.1.0/24 and 10.1.2.0/24, router A is told “next hop 192.168.2.2 (B)” and router B “next hop 192.168.1.2 (C)” for both networks. With dynamic routing, the routers run a routing protocol and share the routes they know: C tells B “I have 10.1.1.0 and 10.1.2.0”, B learns them with next hop 192.168.1.2, and A learns them from B with next hop 192.168.2.2. Static routes are simple but do not adapt when a link fails; routing protocols adapt by themselves.

ڕاستەوخۆ بەستراوی خۆی بە خۆی دەناسێت. بۆ دوور دوو ڕێگا هەیە. لە ـدا بەڕێوەبەرێک هەموو ڕێگەیەک دەنووسێت: لە ڕیزێک ⁦A–B–C⁩ـدا کە C ⁦10.1.1.0/24⁩ و ⁦10.1.2.0/24⁩ی هەیە، بۆ هەردوو بە A دەگوترێت « ⁦192.168.2.2 (B)⁩» و بە B « ⁦192.168.1.2 (C)⁩». لە ـدا کار پێ دەکەن و ئەو ڕێگانەی دەیانزانن هاوبەش دەکەن: C بە B دەڵێت «⁦10.1.1.0⁩ و ⁦10.1.2.0⁩م هەیە»، B بە ⁦192.168.1.2⁩ فێریان دەبێت و A لە Bـەوە بە ⁦192.168.2.2⁩ فێریان دەبێت. سادەن بەڵام کاتێک بەستەرێک دەپچڕێت خۆیان ناگونجێنن؛ بە خۆیان دەگونجێن.

Two panels with routers A, B and C in a line (A .2.1 — .2.2 B .1.1 — .1.2 C) and C connected to networks 10.1.1.0/24 and 10.1.2.0/24. Static routing: A and B each have a label “typed by hand”, with the routes 10.1.x.0/24 → 192.168.2.2 under A and 10.1.x.0/24 → 192.168.1.2 under B. Dynamic routing: curved arrows from C to B and from B to A show the routes being shared: C tells B “I have 10.1.1.0 and 10.1.2.0”; B tells A. Footer: hosts need neither; a default gateway is enough for them.دوو بەش بە ڕێدۆزەکانی A، B و C لە ڕیزێکدا (A .2.1 — .2.2 B .1.1 — .1.2 C) و C بە ڕایەڵەکانی 10.1.1.0/24 و 10.1.2.0/24ـەوە بەستراوە. ڕێگە جێگیرەکان: A و B هەریەکەیان نیشانەی «بە دەست نووسراو»ی هەیە، لە ژێر A ڕێگەی 10.1.x.0/24 → 192.168.2.2 و لە ژێر B 10.1.x.0/24 → 192.168.1.2. ڕێدۆزیی بزۆک: تیری چەماوە لە Cـەوە بۆ B و لە Bـەوە بۆ A هاوبەشکردنی ڕێگەکان نیشان دەدەن: C بە B دەڵێت «10.1.1.0 و 10.1.2.0م هەیە»؛ B بە A دەڵێت. خوارەوە: میوانگرەکان پێویستیان بە هیچیان نییە؛ دەروازەی بنەڕەتی بەسە بۆیان.
Static: typed by an administrator. Dynamic: shared by a routing protocol.جێگیر: بەڕێوەبەرێک دەینووسێت. بزۆک: هاوبەشی دەکات.CêIT

Configuring both kinds is taught in the Routing and Switching course: Static routes and Routing protocols.

ڕێکخستنی هەردوو جۆرەکە لە خولی و دەخوێنرێت: ڕێگە جێگیرەکان و پرۆتۆکۆڵەکانی ڕێدۆزی.

Try it yourselfخۆت تاقی بکەرەوە

  1. Watch the addressesسەیری ناونیشانەکان بکە

    Open the CêIT network lab, load “Three networks and two routers” and ping from one end to the other. In the event log, follow the packet: the IP addresses stay the same, each router lowers the TTL, reads its routing table and builds a new frame.

    تاقیگەی ڕایەڵەی CêIT بکەرەوە، «Three networks and two routers» باربکە و لە سەرێکەوە سەرەکەی تر بکە. لە تۆماری ڕووداوەکاندا بەدوای بڕۆ: وەک خۆیان دەمێننەوە، هەر TTL کەم دەکاتەوە، دەخوێنێتەوە و نوێ دروست دەکات.

  2. Break the gatewayدەروازەکە تێک بدە

    Load “Two networks joined by a router”, delete PC1’s default gateway and ping a PC in the other network. Then ping a PC in PC1’s own network. Which one still works, and why?

    «Two networks joined by a router» باربکە، ⁦PC1⁩ بسڕەوە و لە تر بکە. پاشان لە خودی ⁦PC1⁩ بکە. کامیان هێشتا کار دەکات و بۆچی؟

  3. Read your own tableخشتەی خۆت بخوێنەرەوە

    On your own computer run ipconfig and route print -4. Find your default gateway in both, and the 0.0.0.0 line. Then run tracert to a website and see your gateway as hop 1 (tracert).

    لە سەر خۆت ipconfig و route print -4 جێبەجێ بکە. لە هەردووکیاندا بدۆزەرەوە، هەروەها دێڕی ⁦0.0.0.0⁩. پاشان tracert بۆ جێبەجێ بکە و وەک 1 ببینە (tracert).

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

MistakeهەڵەWhat is trueڕاستییەکە
“A PC uses ARP to find the MAC address of a server on the Internet.”« بە لە دەدۆزێتەوە.»ARP works only inside one LAN. For a remote destination the PC ARPs for its default gateway. تەنیا لە ناو یەک کار دەکات. بۆ مەبەستی دوور بۆ دەکات.
“The IP addresses change at each router.”« لە هەر دەگۆڕێن.»The MAC addresses change; the IP addresses stay — unless a router does NAT. دەگۆڕێن؛ دەمێننەوە — مەگەر بکات.
“Every interface with an IP address has a MAC address.”«هەر کە هەبێت هەیە.»Serial (HDLC/PPP) and loopback interfaces have IP addresses but no MAC address. زنجیرەیی ⁦(HDLC/PPP)⁩ و خۆگەڕانەوە هەیە بەڵام نییە.
“The next hop is my router’s own port.”« خودی منە.»That is the exit interface. The next hop is the neighbour router’s IP address.ئەوە . دراوسێیە.
“If there is no route, the router sends the packet back.”«ئەگەر ڕێگە نەبێت، دەگەڕێنێتەوە.»It drops the packet and sends an ICMP Destination Unreachable message to the source. فڕێ دەدات و پەیامی Destination Unreachableـی بۆ سەرچاوە دەنێرێت.
“The first matching line of the routing table wins.”«یەکەم دێڕی گونجاوی دەباتەوە.»The longest prefix match wins, wherever it is in the table. دەباتەوە، لە هەر شوێنێکی خشتەکەدا بێت.
“Every LAN must have a gateway.”«هەموو دەبێت هەبێت.»Only a LAN whose hosts must reach other networks needs one.تەنیا ئەو دەبێت بگەنە تر پێویستی پێیەتی.

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

ExerciseڕاهێنانLocal or remote?ناوخۆیی یان دوور؟

Dilan’s PC is 10.20.30.40/24 with gateway 10.20.30.1. For each destination, say whether the PC ARPs for the destination or for the gateway: (a) 10.20.30.99 (b) 10.20.31.5 (c) 8.8.8.8.

دیلان ⁦10.20.30.40/24⁩ـە بە ⁦10.20.30.1⁩. بۆ هەر مەبەستێک بڵێ بۆ مەبەستەکە دەکات یان بۆ : (أ) ⁦10.20.30.99⁩ (ب) ⁦10.20.31.5⁩ (ج) ⁦8.8.8.8⁩.

Show answerوەڵامەکە پیشان بدە

With /24 the network is 10.20.30.0. (a) 10.20.30.99 → 10.20.30.0: local, ARP for 10.20.30.99. (b) 10.20.31.5 → 10.20.31.0: remote, ARP for the gateway 10.20.30.1. (c) 8.8.8.8 → 8.8.8.0: remote, ARP for the gateway.

بە /24 ⁦10.20.30.0⁩ـە. (أ) ⁦10.20.30.99⁩ ← ⁦10.20.30.0⁩: ناوخۆیی، بۆ ⁦10.20.30.99⁩. (ب) ⁦10.20.31.5⁩ ← ⁦10.20.31.0⁩: دوور، بۆ ⁦10.20.30.1⁩. (ج) ⁦8.8.8.8⁩ ← ⁦8.8.8.0⁩: دوور، بۆ .

ExerciseڕاهێنانAddresses on every hopناونیشانەکان لە هەر بازێکدا

PC1 (192.168.1.2) sends to PC2 (192.168.4.5) through R0, R1 and R2, all joined by Ethernet. Fill in a table with one row per hop: source MAC, destination MAC, source IP, destination IP. What does each device do during encapsulation and decapsulation?

⁦PC1 (192.168.1.2)⁩ بۆ ⁦PC2 (192.168.4.5)⁩ لە ڕێی ⁦R0⁩، ⁦R1⁩ و ⁦R2⁩ـەوە دەنێرێت، هەموویان بە بەستراون. خشتەیەک پڕ بکەرەوە بە یەک دێڕ بۆ هەر : MACـی سەرچاوە، MACـی مەبەست، IPـی سەرچاوە، IPـی مەبەست. هەر ئامێرێک لە کاتی و چی دەکات؟

Show answerوەڵامەکە پیشان بدە
HopSource MACMACـی سەرچاوەDestination MACMACـی مەبەستIP
1PC1R0 G0/0/0 (the gateway)⁦R0 G0/0/0⁩ ()192.168.1.2 → 192.168.4.5
2R0 (outgoing interface)⁦R0⁩ ( دەرچوون)R1192.168.1.2 → 192.168.4.5
3R1R2192.168.1.2 → 192.168.4.5
4R2 (interface in PC2’s LAN)⁦R2⁩ ( لە ⁦PC2⁩)PC2192.168.1.2 → 192.168.4.5

The host (PC1) decides local or remote, ARPs for the gateway and puts the packet in the first frame; PC2 removes the last frame. Each router checks the frame (FCS, its own MAC), removes it, looks up the route, lowers the TTL, builds a new frame — with ARP for the next MAC — and sends it. Only the MAC addresses change. (If R0–R1 were a serial link, hop 2 would have an HDLC or PPP frame with no MAC addresses.)

⁦(PC1)⁩ بڕیار دەدات ناوخۆییە یان دوور، بۆ دەکات و دەخاتە یەکەم ؛ ⁦PC2⁩ دوایین لادەبات. هەر دەپشکنێت (FCS، MACـی خۆی)، لای دەبات، بەدوای ڕێگەدا دەگەڕێت، TTL کەم دەکاتەوە، نوێ دروست دەکات — بە بۆ MACـی دواتر — و دەینێرێت. تەنیا دەگۆڕێن. (ئەگەر ⁦R0–R1⁩ بەستەرێکی زنجیرەیی بوایە، 2 HDLC یان PPPـی بەبێ دەبوو.)

ExerciseڕاهێنانUse the routing tableخشتەی ڕێدۆزی بەکار بهێنە

R1’s table: 172.16.1.0/24 connected G0/0; 172.16.2.0/24 via 172.16.4.2 S0/0/0; 172.16.3.0/24 via 172.16.5.3 S0/0/1; 0.0.0.0/0 via 172.16.4.2. Where does R1 send packets for (a) 172.16.2.9 (b) 172.16.1.77 (c) 203.0.113.50? And without the 0.0.0.0/0 line, what happens to (c)?

خشتەی ⁦R1⁩: 172.16.1.0/24 connected G0/0؛ 172.16.2.0/24 via 172.16.4.2 S0/0/0؛ 172.16.3.0/24 via 172.16.5.3 S0/0/1؛ 0.0.0.0/0 via 172.16.4.2. ⁦R1⁩ بۆ کوێ دەنێرێت بۆ (أ) ⁦172.16.2.9⁩ (ب) ⁦172.16.1.77⁩ (ج) ⁦203.0.113.50⁩؟ بەبێ دێڕی 0.0.0.0/0، چی بەسەر (ج) دێت؟

Show answerوەڵامەکە پیشان بدە
  • (a) Out of S0/0/0 to the next hop 172.16.4.2.
  • (b) Directly out of G0/0: 172.16.1.0/24 is connected (R1 uses ARP for 172.16.1.77).
  • (c) Only the default route matches: to 172.16.4.2. Without it, R1 drops the packet and sends ICMP Destination Unreachable to the source.
  • (أ) لە ⁦S0/0/0⁩ـەوە بۆ ⁦172.16.4.2⁩.
  • (ب) ڕاستەوخۆ لە ⁦G0/0⁩ـەوە: ⁦172.16.1.0/24⁩ بەستراوە (⁦R1⁩ بۆ ⁦172.16.1.77⁩ دەکات).
  • (ج) تەنیا دەگونجێت: بۆ ⁦172.16.4.2⁩. بەبێ ئەو، ⁦R1⁩ فڕێ دەدات و Destination Unreachableـی بۆ سەرچاوە دەنێرێت.
ExerciseڕاهێنانExplain in your own wordsبە وشەی خۆت ڕوونی بکەرەوە

Explain with the parcel-office picture what a router does with a packet, and name the networking idea behind each part (parcel, address, office, instructions, driver no. 3, “anything else”).

بە وێنەی بەشکۆی کاڵا ڕوونی بکەرەوە چی بە دەکات و ناوی بیرۆکەی لە پشت هەر بەشێک بهێنە (کاڵا، ناونیشان، بەشکۆ، ڕێنمایی، شۆفێری ژمارە 3، «هەر شوێنێکی تر»).

Show answerوەڵامەکە پیشان بدە

Parcel = packet; address = destination IP; office = router; instructions = routing table; driver no. 3 = the next hop and exit interface for that destination; “anything else” = the default route. The office reads only the destination, matches it against its instructions and hands the parcel to one driver — it does not drive to Erbil itself, just as a router only chooses the next hop.

کاڵا = ؛ ناونیشان = IPـی مەبەست؛ بەشکۆ = ؛ ڕێنمایی = ؛ شۆفێری ژمارە 3 = و بۆ ئەو مەبەستە؛ «هەر شوێنێکی تر» = . بەشکۆکە تەنیا مەبەستەکە دەخوێنێتەوە، لەگەڵ ڕێنماییەکانی بەراوردی دەکات و کاڵاکە دەداتە یەک شۆفێر — خۆی ناچێت بۆ هەولێر، هەروەک تەنیا هەڵدەبژێرێت.

Summaryکورتە

  • IP routing delivers packets from sender to receiver across networks; it is a layer-3 job done by hosts and routers together, while layer 2 frames each hop.
  • A host ANDs with its mask: local → ARP for the destination; remote → ARP for the default gateway, the router interface in its LAN.
  • At every hop the MAC addresses change and the IP addresses stay (unless NAT); serial HDLC/PPP hops have no MAC addresses at all.
  • A router: check the frame (FCS, MAC) → unwrap → decide with the routing table (longest prefix match) → rewrap (TTL − 1; ARP on LANs) → send.
  • A route = destination network + next hop + exit interface + metric. No match → default route; no default route → drop + ICMP Destination Unreachable.
  • route print shows a host’s table, show ip route a router’s. Routes are typed (static) or shared by routing protocols (dynamic).
  • IP لە نێرەرەوە بە ناو دەگەیەنێتە وەرگر؛ کارێکی چینی 3ـیە کە و پێکەوە دەیکەن، چینی 2ـیش هەر لە دەپێچێتەوە.
  • لەگەڵ AND دەکات: ناوخۆیی ← بۆ مەبەست؛ دوور ← بۆ ، ئەو کە لە .
  • لە هەر دەگۆڕێن و دەمێننەوە (مەگەر هەبێت)؛ زنجیرەیی ⁦HDLC/PPP⁩ هیچ نییە.
  • : پشکنینی (FCS، MAC) ← ← بڕیار بە () ← (⁦TTL − 1⁩؛ لە ) ← ناردن.
  • ڕێگە = مەبەست + + + . گونجان نییە ← ؛ نییە ← فڕێدان + Destination Unreachableـی .
  • route print خشتەی نیشان دەدات، show ip route هی . ڕێگەکان دەنووسرێن (جێگیر) یان هاوبەشیان دەکەن (بزۆک).

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

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

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

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

TCP and UDPTCP و UDP

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.تەنیا لەسەر ئەم ئامێرە پاشەکەوت دەکرێت.