Router-on-a-Stick
CCNA 200-301 v2.0 · Live Feb 3, 2027 (v1.1 valid through Feb 2, 2027) Cisco Packet Tracer
مقصدObjectiveObjective
اس لیب میں آپ inter-VLAN روٹنگ سیکھیں گے — router-on-a-stick طریقے سے۔ ایک ہی راؤٹر انٹرفیس پر sub-interfaces بنا کر الگ VLANs کو آپس میں ملائیں گے۔Is lab mein aap inter-VLAN routing seekhenge — router-on-a-stick tareeqe se. Ek hi router interface par sub-interfaces bana kar alag VLANs ko aapas mein milayenge.In this lab, you'll learn inter-VLAN routing — the router-on-a-stick way. You'll create sub-interfaces on a single router interface to connect separate VLANs together.
آسان مثالSimple AnalogySimple Analogy
دو الگ محلے (VLANs) کے درمیان کوئی سیدھا راستہ نہیں — لیکن ایک چوکیدار (راؤٹر) ہے جس کے پاس دونوں محلوں کی چابیاں ہیں۔ ہر محلے کا ایک دروازہ راؤٹر کے ایک 'virtual' حصے سے جڑا ہے۔ Router-on-a-stick میں ایک ہی فزیکل کیبل پر راؤٹر کے اندر ورچوئل دروازے (sub-interfaces) بنتے ہیں — ہر VLAN کے لیے ایک۔Do alag mohallon (VLANs) ke darmiyan koi seedha rasta nahi — lekin ek chowkidar (router) hai jiske paas dono mohallon ki chabiyan hain. Har mohalle ka ek darwaza router ke ek 'virtual' hisse se jura hai. Router-on-a-stick mein ek hi physical cable par router ke andar virtual darwaze (sub-interfaces) bante hain — har VLAN ke liye ek.There is no direct road between two separate neighborhoods (VLANs) — but there's a guard (the router) who holds the keys to both. Each neighborhood's gate connects to a 'virtual' part of the router. In router-on-a-stick, virtual gates (sub-interfaces) are built inside the router over a single physical cable — one per VLAN.
سیٹ اپLab SetupLab Setup
R1 کا G0/0، SW1 کے Fa0/1 (ٹرنک) سے کنیکٹڈ۔ SW1: Fa0/2-3 = VLAN 10 (PC1، PC2)، Fa0/4-5 = VLAN 20 (PC3، PC4)۔ ڈیوائسز: 1x راؤٹر 2911 (R1)، 1x سوئچ 2960 (SW1)، 4x پی سی۔ PC1/PC2: 192.168.10.10، .11/24، گیٹ وے 192.168.10.1۔ PC3/PC4: 192.168.20.10، .11/24، گیٹ وے 192.168.20.1۔R1 ka G0/0, SW1 ke Fa0/1 (trunk) se connected. SW1: Fa0/2-3 = VLAN 10 (PC1, PC2), Fa0/4-5 = VLAN 20 (PC3, PC4). Devices: 1x Router 2911 (R1), 1x Switch 2960 (SW1), 4x PC PC1/PC2: 192.168.10.10, .11/24, gateway 192.168.10.1. PC3/PC4: 192.168.20.10, .11/24, gateway 192.168.20.1.R1's G0/0 connects to SW1's Fa0/1 (trunk). SW1: Fa0/2-3 = VLAN 10 (PC1, PC2), Fa0/4-5 = VLAN 20 (PC3, PC4). Devices: 1x Router 2911 (R1), 1x Switch 2960 (SW1), 4x PCs. PC1/PC2: 192.168.10.10, .11/24, gateway 192.168.10.1. PC3/PC4: 192.168.20.10, .11/24, gateway 192.168.20.1.
اقداماتStepsSteps
Step 1
راؤٹر R1 پر sub-interfaces۔ G0/0 پر دو sub-interfaces بناتے ہیں: .10 اور .20۔Router R1 par sub-interfaces. G0/0 par do sub-interfaces banate hain: .10 aur .20.Sub-interfaces on router R1. We create two sub-interfaces on G0/0: .10 and .20.
enable configure terminal interface g0/0 no shutdown exit
Step 2
ہر ایک پر encapsulation dot1Q سے بتاتے ہیں کہ یہ کون سے VLAN کا دروازہ ہے، پھر اس VLAN کا گیٹ وے IP لگاتے ہیں۔Har ek par encapsulation dot1Q se batate hain ke ye kaun se VLAN ka darwaza hai, phir us VLAN ka gateway IP lagate hain.On each we use encapsulation dot1Q to say which VLAN's gate it is, then assign that VLAN's gateway IP.
interface g0/0.10 encapsulation dot1Q 10 ip address 192.168.10.1 255.255.255.0 exit interface g0/0.20 encapsulation dot1Q 20 ip address 192.168.20.1 255.255.255.0 exit
Step 3
سوئچ SW1 پر ٹرنک + access پورٹس۔ راؤٹر کی طرف جانے والا پورٹ ٹرنک ہوگا (دونوں VLANs کا ٹریفک)۔Switch SW1 par trunk + access ports. Router ki taraf jane wala port trunk hoga (dono VLANs ka traffic).Trunk + access ports on switch SW1. The port toward the router will be a trunk (traffic for both VLANs).
enable configure terminal interface fa0/1 switchport mode trunk exit
Step 4
PCs والے پورٹس access میں اپنے اپنے VLAN میں۔PCs wale ports access mein apne apne VLAN mein.The PC ports will be access ports in their own VLANs.
interface range fa0/2 - 3 switchport mode access switchport access vlan 10 exit interface range fa0/4 - 5 switchport mode access switchport access vlan 20 exit
Step 5
ٹیسٹنگ: پہلے PC1 سے اپنا گیٹ وے پنگ کرو (192.168.10.1)۔Testing: Pehle PC1 se apna gateway ping karo (192.168.10.1).Testing: first ping your own gateway from PC1 (192.168.10.1).
Step 6
پھر PC1 سے ping 192.168.20.10 — دوسرے VLAN تک جانا چاہیے۔ یہی inter-VLAN روٹنگ ہے۔Phir PC1 se ping 192.168.20.10 — doosre VLAN tak jana chahiye. Yehi inter-VLAN routing hai.Then from PC1, ping 192.168.20.10 — it should reach the other VLAN. That's inter-VLAN routing.
تصدیقVerifyVerify
show ip interface brief سے sub-interfaces دیکھو۔ show vlans (یا show ip route) سے روٹنگ کنفرم کرو۔show ip interface brief se sub-interfaces dekho. show vlans (ya show ip route) se routing confirm karo.Check the sub-interfaces with show ip interface brief. Confirm routing with show vlans (or show ip route).
show ip interface brief show ip route
خرابی دور کرناTroubleshootingTroubleshooting
⚠️ PC اپنے گیٹ وے کو بھی پنگ نہیں کر پا رہا۔PC apne gateway ko bhi ping nahi kar pa raha.The PC can't even ping its own gateway.
✅ ہر sub-interface پر encapsulation dot1Q <vlan> لکھنا لازمی ہے۔ بھول جاؤ تو sub-interface کام نہیں کرے گا۔Har sub-interface par encapsulation dot1Q <vlan> likhna lazmi hai. Bhool jao to sub-interface kaam nahi karega.You must type encapsulation dot1Q <vlan> on every sub-interface. If you forget, the sub-interface won't work.
⚠️ Same VLAN میں پنگ ہو رہا ہے لیکن دوسرے VLAN تک نہیں جا رہا۔Same VLAN mein ping ho raha hai lekin doosre VLAN tak nahi ja raha.Ping works within the same VLAN but not to the other VLAN.
✅ Sub-interface کا VLAN ID اور سوئچ کے access پورٹ کا VLAN ID same ہونے چاہئیں۔Sub-interface ka VLAN ID aur switch ke access port ka VLAN ID same hone chahiye.The sub-interface's VLAN ID and the switch access port's VLAN ID must match.
⚠️ کچھ بھی پنگ نہیں ہو رہا، سب فیل۔Kuch bhi ping nahi ho raha, sab fail.Nothing pings — everything fails.
✅ سوئچ کا راؤٹر والا پورٹ ٹرنک موڈ میں ہونا چاہیے، access میں نہیں۔Switch ka router wala port trunk mode mein hona chahiye, access mein nahi.The switch port toward the router must be in trunk mode, not access.
انٹرویو سوالاتInterview Q&AInterview Q&A
❓ Router-on-a-stick کیا ہے اور کب استعمال ہوتا ہے؟Router-on-a-stick kya hai aur kab istemal hota hai?What is router-on-a-stick and when is it used?
Router-on-a-stick میں ایک فزیکل انٹرفیس پر multiple sub-interfaces بنتے ہیں، ہر VLAN کے لیے ایک۔ یہ چھوٹے نیٹ ورکس کے لیے سستا حل ہے؛ بڑے نیٹ ورکس میں Layer 3 سوئچ بہتر ہے۔Router-on-a-stick mein ek physical interface par multiple sub-interfaces bante hain, har VLAN ke liye ek. Ye chhote networks ke liye sasta hal hai; bare networks mein Layer 3 switch behtar hai.In router-on-a-stick, multiple sub-interfaces are built on one physical interface — one per VLAN. It's a cheap solution for small networks; for large networks a Layer 3 switch is better.
❓ encapsulation dot1Q کمانڈ کیوں ضروری ہے؟encapsulation dot1Q command kyun zaroori hai?Why is the encapsulation dot1Q command necessary?
encapsulation dot1Q 10 sub-interface کو بتاتا ہے کہ یہ VLAN 10 کا tagged ٹریفک ہینڈل کرے گا۔ اس کے بغیر راؤٹر کو پتا نہیں چلتا کہ فریم کون سے VLAN کا ہے۔encapsulation dot1Q 10 sub-interface ko batata hai ke ye VLAN 10 ka tagged traffic handle karega. Iske baghair router ko pata nahi chalta ke frame kaun se VLAN ka hai.encapsulation dot1Q 10 tells the sub-interface to handle VLAN 10's tagged traffic. Without it, the router doesn't know which VLAN the frame belongs to.