Single-Area OSPFv2

CCNA 200-301 v2.0 · Live Feb 3, 2027 (v1.1 valid through Feb 2, 2027) Cisco Packet Tracer

مقصدObjectiveObjective

اس لیب میں آپ single-area OSPFv2 کانفیگر کرنا سیکھیں گے — ڈائنامک راؤٹنگ کا سب سے اہم پروٹوکول۔ Neighbor adjacency اور route exchange خود دیکھیں گے۔Is lab mein aap single-area OSPFv2 configure karna seekhenge — dynamic routing ka sab se ahem protocol. Neighbor adjacency aur route exchange khud dekhoge.In this lab you'll configure single-area OSPFv2 — the most important dynamic routing protocol. You'll see neighbor adjacency and route exchange with your own eyes.

آسان مثالSimple AnalogySimple Analogy

Static route میں آپ خود ہر راستہ لکھتے ہیں — شہر چھوٹا ہو تو ٹھیک ہے۔ لیکن شہر بڑا ہو تو بہتر ہے کہ ہر ڈاک خانہ خود نقشہ بنائے۔ OSPF یہی کرتا ہے: راؤٹرز آپس میں hello کہتے ہیں، دوستی (neighbor) بناتے ہیں، اور پورا نقشہ (link-state database) خود بنا لیتے ہیں۔ راستہ بند ہو تو فوراً نیا ڈھونڈ لیتے ہیں۔Static route mein aap khud har rasta likhte hain — sheher chhota ho to theek. Lekin bara sheher ho to har dak khana apne aap naksha banaye to behtar. OSPF yehi karta hai: routers aapas mein hello kehte hain, dosti (neighbor) banate hain, aur poora naksha (link-state database) khud bana lete hain. Rasta band ho to foran naya dhoond lete hain.With static routes you type every path yourself — fine for a small town. But in a big city it's better if every post office builds its own map. OSPF does exactly that: routers greet each other with hello packets, become neighbors, and build the full map (link-state database) themselves. If a path goes down, they find a new one instantly.

سیٹ اپLab SetupLab Setup

R1 S0/0/0 سے R2 S0/0/0 (192.168.20.0/30)۔ دونوں راؤٹرز area 0 میں ہیں۔ Devices: 2x Router 2911 (R1, R2), 2x PC۔ PC1: 192.168.10.10/24، گیٹ وے 192.168.10.1۔ PC2: 192.168.30.10/24، گیٹ وے 192.168.30.1۔R1 S0/0/0 se R2 S0/0/0 (192.168.20.0/30). Dono routers area 0 mein hain. Devices: 2x Router 2911 (R1, R2), 2x PC PC1: 192.168.10.10/24, gateway 192.168.10.1. PC2: 192.168.30.10/24, gateway 192.168.30.1.R1 S0/0/0 to R2 S0/0/0 (192.168.20.0/30). Both routers are in area 0. Devices: 2x Router 2911 (R1, R2), 2x PC. PC1: 192.168.10.10/24, gateway 192.168.10.1. PC2: 192.168.30.10/24, gateway 192.168.30.1.

اقداماتStepsSteps

Step 1

R1 پر OSPF۔ OSPF process 1 شروع کرو، router-id سیٹ کرو (ہر راؤٹر کی پہچان)۔R1 par OSPF. OSPF process 1 start karo, router-id set karo (har router ki pehchan).OSPF on R1. Start OSPF process 1 and set a router-id (each router's identity).

enable
configure terminal
router ospf 1
router-id 1.1.1.1

Step 2

پھر network command سے بتاؤ کہ کون سے interfaces OSPF میں حصہ لیں گے — wildcard mask الٹا ہوتا ہے (0.0.0.255)۔Phir network command se batayo ke kaun se interfaces OSPF mein hissen — wildcard mask ulta hota hai (0.0.0.255)Then use the network command to say which interfaces join OSPF — the wildcard mask is inverted (0.0.0.255).

network 192.168.10.0 0.0.0.255 area 0
network 192.168.20.0 0.0.0.255 area 0
exit

Step 3

R2 پر OSPF۔ R2 پر بھی وہی process، مگر الگ router-id۔R2 par OSPF. R2 par bhi same process, alag router-id.OSPF on R2. Same process on R2, but a different router-id.

enable
configure terminal
router ospf 1
router-id 2.2.2.2

Step 4

دونوں راؤٹرز hello packets سے neighbor بنیں گے اور routes کا تبادلہ کریں گے۔Dono routers hello packets se neighbor banenge aur routes exchange karengeBoth routers will become neighbors via hello packets and exchange routes.

network 192.168.20.0 0.0.0.255 area 0
network 192.168.30.0 0.0.0.255 area 0
exit

Step 5

Testing: پہلے show ip ospf neighbor — state FULL ہونی چاہیے۔ پھر PC1 سے PC2 کو ping کرو۔Testing: Pehle show ip ospf neighbor — state FULL honi chahiye. Phir PC1 se PC2 ping karo.Testing: first check show ip ospf neighbor — state should be FULL. Then ping PC2 from PC1.

Step 6

پھر serial cable نکالو اور دیکھو کہ OSPF فوراً route ہٹا دیتا ہے۔Phir serial cable nikalo aur dekho ke OSPF foran route hata deta hai.Then remove the serial cable and watch OSPF instantly remove the route.

تصدیقVerifyVerify

show ip ospf neighbor سے adjacency دیکھو۔ show ip route میں O والے routes کنفرم کرو۔show ip ospf neighbor se adjacency dekho. show ip route mein O wale routes confirm karo.Check adjacency with show ip ospf neighbor. Confirm the O routes in show ip route.

show ip ospf neighbor
show ip route

خرابی دور کرناTroubleshootingTroubleshooting

⚠️ OSPF neighbor نہیں بن رہا (neighbor table خالی)۔OSPF neighbor nahi ban raha (neighbor table khali).OSPF neighbor won't form (neighbor table empty).

✅ دونوں طرف area number ایک (0) ہونا چاہیے۔ Hello/dead timers بھی match کرنے چاہئیں۔Dono taraf area number same (0) hona chahiye. Hello/dead timers bhi match karne chahiye.The area number must be the same (0) on both sides. Hello/dead timers must match too.

⚠️ Neighbor بن گیا لیکن routes کا تبادلہ نہیں ہو رہا۔Neighbor ban gaya lekin routes exchange nahi ho rahe.Neighbors are up but routes aren't being exchanged.

✅ network command کا wildcard mask ٹھیک کرو۔ 192.168.10.0 کے لیے 0.0.0.255 ہے، 0.0.0.0 نہیں۔network command ka wildcard mask theek karo. 192.168.10.0 ke liye 0.0.0.255 hai, 0.0.0.0 nahi.Fix the wildcard mask in the network command. For 192.168.10.0 it's 0.0.0.255, not 0.0.0.0.

⚠️ دونوں راؤٹرز کا router-id ایک جیسا ہے۔Dono routers ka router-id same hai.Both routers have the same router-id.

✅ ہر راؤٹر کا router-id منفرد ہونا چاہیے۔ clear ip ospf process سے OSPF ری اسٹارٹ کرو۔Har router ka router-id unique hona chahiye. clear ip ospf process se OSPF restart karo.Each router's router-id must be unique. Restart OSPF with clear ip ospf process.

انٹرویو سوالاتInterview Q&AInterview Q&A

❓ OSPF RIP سے بہتر کیوں ہے؟OSPF RIP se behtar kyun hai?Why is OSPF better than RIP?

OSPF link-state پروٹوکول ہے — پورا ٹوپولوجی نقشہ بناتا ہے اور Dijkstra الگورتھم سے shortest path نکالتا ہے۔ RIP distance-vector تھا (صرف hop count)۔OSPF link-state protocol hai — poora topology map banata hai aur Dijkstra algorithm se shortest path nikalta hai. RIP distance-vector tha (sirf hop count).OSPF is a link-state protocol — it builds a full topology map and computes the shortest path with the Dijkstra algorithm. RIP was distance-vector (hop count only).

❓ OSPF neighbor بننے کی شرطیں کیا ہیں؟OSPF neighbor banne ki shartein kya hain?What are the conditions for OSPF neighbor adjacency?

Hello اور dead intervals دونوں طرف ایک جیسے ہونے چاہئیں، area number ایک ہو، authentication match کرے، اور subnet/mask ایک ہو۔Hello aur dead intervals dono taraf same hone chahiye, area number same ho, authentication match kare, aur subnet/mask same ho.Hello and dead intervals must match on both sides, the area number must be the same, authentication must match, and the subnet/mask must be the same.