QoS Deep-Dive: MQC, Policing vs Shaping
CCIE Enterprise Infrastructure EVE-NG / GNS3
مقصدObjectiveObjective
اس سبق کے بعد آپ MQC کے ذریعے ٹریفک کو classify اور mark کر سکیں گے، اور policing اور shaping کو صحیح طرح استعمال کر پائیں گے۔Is lesson ke baad aap MQC ke zariye traffic ko classify aur mark kar sakenge, aur policing aur shaping ko sahi tarah use kar payenge.After this lesson you will be able to classify and mark traffic with MQC, and use policing and shaping correctly.
آسان مثالSimple AnalogySimple Analogy
QoS ایسا ہے جیسے ہسپتال کی emergency lane — ایمبولینس ٹریفک میں بھی سب سے پہلے گزرتی ہے۔ Classification طے کرتا ہے ایمبولینس کون ہے، marking اس کی lane پر رنگ لگاتا ہے، policing جرمانہ کرتی ہے، shaping رفتار کم کرواتا ہے۔QoS aisa hai jaise hospital ki emergency lane — ambulance traffic mein bhi sab se pehle guzarti hai. Classification tay karta hai ambulance kaun hai, marking us ki lane par rang lagata hai, policing fine karti hai, shaping speed kam karwata hai.QoS is like a hospital's emergency lane — the ambulance goes first even in traffic. Classification decides who the ambulance is, marking paints its lane, policing issues fines, shaping forces you to slow down.
سیٹ اپLab SetupLab Setup
دو روٹرز لیں جن کے درمیان bandwidth-limited لنک ہو (جیسے 2 Mbps)۔ ٹریفک generate کریں: FTP download اور voice جیسا UDP stream۔Do routers lein jin ke darmiyan bandwidth-limited link ho (jaise 2 Mbps). Traffic generate karein: FTP download aur voice jaisa UDP stream.Use two routers connected by a bandwidth-limited link (e.g. 2 Mbps). Generate traffic: FTP download, plus voice-like UDP stream.
اقداماتStepsSteps
Step 1
Class-map بنائیں: ایک voice کے لیے (DSCP EF)، ایک critical data کے لیے (ACL 101)، اور class-default جو ہمیشہ موجود ہوتا ہے۔Class-map banayein: ek voice ke liye (DSCP EF), ek critical data ke liye (ACL 101), aur class-default jo hamesha maujood hota hai.Create class-maps: one for voice (DSCP EF), one for critical data (ACL 101), and class-default which always exists.
class-map match-all VOICE match ip dscp ef class-map match-all CRITICAL match access-group 101 class-map class-default
Step 2
Policy-map میں ٹریفک mark کریں: voice کو DSCP EF، critical data کو AF31۔ Marking source کے سب سے قریب ہونی چاہیے۔Policy-map mein traffic mark karein: voice ko DSCP EF, critical data ko AF31. Marking source ke sab se qareeb honi chahiye.Mark traffic in the policy-map: give voice DSCP EF, critical data AF31. Marking should happen as close to the source as possible.
policy-map MARKING class VOICE set dscp ef class CRITICAL set dscp af31
Step 3
بینڈوتھ guarantee کریں: voice کو priority queue، critical data کو 40%، اور باقی سب کے لیے fair-queue۔Bandwidth guarantee karein: voice ko priority queue, critical data ko 40%, aur baqi sab ke liye fair-queue.Guarantee bandwidth: priority queue for voice, 40% for critical data, fair-queue for everything else.
policy-map WAN-EDGE class VOICE priority percent 30 class CRITICAL bandwidth percent 40 class class-default fair-queue
Step 4
Policing مثال: voice کو 1 Mbps تک limit کریں — اضافی ٹریفک فوری drop۔ Policing inbound rate control کے لیے بہترین ہے۔Policing example: voice ko 1 Mbps tak limit karein — extra traffic fori drop. Policing inbound rate control ke liye behtareen hai.Policing example: limit voice to 1 Mbps — excess is dropped immediately. Policing is ideal for inbound rate control.
class VOICE police 1000000 187500 187500 conform-action transmit exceed-action drop
Step 5
Shaping مثال: critical ٹریفک کو 500 Kbps تک limit کریں — اضافی drop نہیں، queue میں جاتا ہے۔ سست WAN لنکس پر outbound کے لیے بہترین۔Shaping example: critical traffic ko 500 Kbps tak limit karein — extra drop nahi, queue mein jata hai. Slow WAN links par outbound ke liye behtareen.Shaping example: limit critical traffic to 500 Kbps — excess is queued, not dropped. Ideal for outbound on slow WAN links.
class CRITICAL shape average 500000
Step 6
Policy outbound لگائیں۔ دیکھیں کس class پر drops آ رہے ہیں — load کے باوجود voice صاف رہنی چاہیے۔Policy outbound lagayein. Dekhen kis class par drops aa rahe hain — load ke bawajood voice saaf rehni chahiye.Apply the policy outbound. Observe which classes get drops — voice should stay clean even under load.
interface GigabitEthernet0/0 service-policy output WAN-EDGE show policy-map interface
Step 7
Statistics verify کریں: drop ہوئے packets، queue میں packets۔ NBAR بھی ٹیسٹ کریں — ACLs کے مقابلے میں زیادہ smart classification۔Statistics verify karein: drop hue packets, queue mein packets. NBAR bhi test karein — ACLs ke muqable mein zyada smart classification.Verify statistics: dropped packets, queued packets. Also test NBAR as a smarter classification alternative to raw ACLs.
show policy-map interface GigabitEthernet0/0 | include drops show ip nbar protocol-discovery
تصدیقVerifyVerify
یقین کریں کہ classes متوقع ٹریفک match کر رہی ہیں، voice کو priority مل رہی ہے، policer اضافی voice drop کر رہا ہے، shaper اضافی ٹریفک queue کر رہا ہے (drop نہیں)، اور statistics میں drops نظر آ رہے ہیں۔Yaqeen karein ke classes mutawaqqa traffic match kar rahi hain, voice ko priority mil rahi hai, policer extra voice drop kar raha hai, shaper extra traffic queue kar raha hai (drop nahi), aur statistics mein drops nazar aa rahe hain.Confirm classes match expected traffic, voice gets priority, policer drops excessive voice, shaper queues (not drops) excess, and drops appear in statistics.
show policy-map interface show class-map
خرابی دور کرناTroubleshootingTroubleshooting
⚠️ Policy-map لگائی ہے لیکن ٹریفک class میں match نہیں ہو رہا۔Policy-map lagayi hai lekin traffic class mein match nahi ho raha.Policy-map applied but traffic not matching the class.
✅ Match conditions چیک کریں — ممکن ہے DSCP پہلے سے upstream mark ہو رہا ہو، یا match-all vs match-any logic غلط ہو۔Match conditions check karein — mumkin hai DSCP pehle se upstream mark ho raha ho, ya match-all vs match-any logic ghalat ho.Check match conditions — DSCP marking may happen upstream (traffic is already marked), or match-all vs match-any logic is wrong.
⚠️ Shaping کی وجہ سے بہت زیادہ delay آ رہا ہے۔Shaping ki wajah se bohat zyada delay aa raha hai.Shaping causes very high delay.
✅ یہ نارمل ہے — shaping اضافی ٹریفک کو queue کرتا ہے۔ Latency-sensitive ٹریفک کے لیے policing استعمال کریں یا shaped rate کم کریں۔Ye normal hai — shaping extra traffic ko queue karta hai. Latency-sensitive traffic ke liye policing use karein ya shaped rate kam karein.Normal — shaping queues excess. For latency-sensitive traffic use policing instead, or reduce the shaped rate.
انٹرویو سوالاتInterview Q&AInterview Q&A
❓ Policing اور shaping میں کیا فرق ہے؟Policing aur shaping mein kya farq hai?What is the difference between policing and shaping?
Policing اضافی ٹریفک کو فوری drop کرتا ہے، shaping اسے queue میں رکھتا ہے اور کم رفتار سے بھیجتا ہے — smooth لیکن تاخیر بڑھتی ہے۔Policing extra traffic ko fori drop karta hai, shaping use queue mein rakhta hai aur kam speed se bhejta hai — smooth lekin delay barhta hai.Policing drops excess traffic immediately; shaping queues it and sends it out at a lower rate — smooth but adds delay.
❓ Class-map، policy-map اور service-policy کا آپس میں کیا تعلق ہے؟Class-map, policy-map aur service-policy ka aapas mein kya taaluq hai?How do class-map, policy-map, and service-policy relate?
Class-map ٹریفک کو منتخب کرتا ہے (match ACL/DSCP/etc)۔ Policy-map ہر class کے لیے عمل طے کرتا ہے (police، shape، bandwidth)۔ Service-policy اسے انٹرفیس پر لگاتا ہے۔Class-map traffic ko select karta hai (match ACL/DSCP/etc). Policy-map har class ke liye action tay karta hai (police, shape, bandwidth). Service-policy use interface par lagata hai.Class-map selects the traffic (match ACL/DSCP/etc). Policy-map defines the action (police, shape, bandwidth) per class. Service-policy applies it to the interface.