You are on page 1of 52

‫‪History and Evolution‬‬

‫لديك اشتراك في األنترنت واردت ان تشاهد مبارة كرة قدم على الهواء مباشرة او دعيت الى مؤتمر عبر الفيديو‪ .‬ولكن كانت‬
‫الصورة التي تصل اليك في المبارة متقطعة واحيانا يسبقها الصوت‪.‬‬
‫ما هي ردة الفعل لديك؟‬
‫كان هذا قديما ليس قديما تماما بل قبل عقود قليلة‪.‬‬
‫األن الصورة واضحة وبدون اي تقطيع‪.‬‬
‫رائع!ذ‬
‫ما الذي حدث؟‬
‫)‪.class of service (CoS‬‬
‫دعني اقول لك ان في البداية ان ‪ QoS‬او ‪ Quality of Service‬هو القدرة على إيجاد العديد من ‪ priority‬للعديد من‬
‫التطبيقات‪ ،‬كذلك المستخدمين او البيانات او ضمان وجود جودة في إنسياب البيانات‪.‬‬
‫دعني اقول لك ان هناك العديد من الخصائص لكل ‪ .traffic class‬والذي من خالله يحدد كيف تعالج الشبكة الـ ‪packets‬‬
‫التي تنتمي الى ‪ .traffic class‬من تلك الخصائص‪:‬‬
‫‪ :Delay (or latency) ‬نستطيع القول انه الزمن الذي يستغرقه الـ ‪ packet‬حتى يصل الى ‪ endpoint‬بعد ارساله‬
‫من قبل المرسل‪.‬‬
‫‪ :Jitter (or delay variation) ‬وهو األختالف في التأخير في الوصول من ‪ packet‬الى اخر‪.‬‬
‫‪ :Packet drops ‬نسبة ما بين تلك الـ ‪ packets‬التي ترسل من المرسل وكم منها تم استقبالها‪.‬‬
‫‪Evolution of QoS‬‬
‫قبل العام ‪ 2000‬كنا نصنف انواع الـ ‪ traffic‬في الشبكات على انه ‪ voice‬والذي نطلق عليه بـ ‪ .real time‬يجب ان يكون‬
‫فيه كم كبير من الـ ‪ bandwidth‬كم انه يجب ان يكون هناك توقيت زمنى لوصول ‪ packets‬المتتالية‪.‬‬
‫بينما النوع الثاني كان هو ‪ data‬وكان يسمى بـ ‪ non-real-time‬واليهم فيه حجم ‪ .bandwidth‬كما انه اليهم التوقيت‬
‫الزمني الذي تصل فيه ‪.packets‬‬
‫مع الوقت ظهر ‪.video traffic‬‬
‫هناك العديد من انواع الـ ‪ packets‬مع العديد من اوقات الـ ‪ delay‬وكذلك ‪ loss tolerance‬كما يبين ذلك الشكل ادناه‪.‬‬

‫مع زيادة الطلب على شبكات ‪ Wireless‬التي اصبحت مع مرور السنوات اسياسية وتشكل ركيزة اساسية في معظم الشركات‬
‫والفنادق والمحالت التجارية كما في المنازل بالطبع‪ .‬واصبح معيار مهم فيها وهو ‪ bandwidth‬ايضا ‪throughput‬‬
‫خصائصها ايضا تعتمد على الموقع وكذلك ‪.power‬‬
‫بعد ذلك بمدة زمنية اصبحت ‪ QoS‬في تطوير مستمر للميزات التي لديها واصبح الطلب عليها اكبر‪.‬‬
‫مما خلق هناك العديد من المستويات من الخدمة من اجل ‪.end users‬‬
‫ولذلك بدأ ‪ network administrators‬في استخدام ميزات ‪ .QoS‬اعطانا ذلك جودة افضل‪.‬‬

‫‪QoS Basics and Concepts‬‬


‫الغاية الرئيسية من ‪ QoS‬وهي من اجل إدارة موارد الشبكة واستخدامها االستخدام األمثل من وصول افضل خدمة الى‬
‫‪ . end-user‬وهنا عندما تصل البيانات الى منفذ الشبكة فإنه تكون لها األولوية المتساوية‪ .‬وجود ‪ QoS‬يغيير من ذلك ويجعلها‬
‫غير متساوية في المعالجة‪.‬‬
‫في الطابور الطويل سيكون هناك اولوية المرور لـ ‪ packets‬معينة‪ .‬اي سيكون هناك تالعب في ‪.delay‬‬
‫‪User Expectations: QoS, QoE, and QoX‬‬
‫‪ QoS‬اي ان هناك مستويات معالجة مختلفة في الشبكة لمختلف الـ ‪ packets‬والتي نستطيع قياس ‪ latency, jitter‬وكذلك‬
‫يتم قياس ‪.packet loss‬‬
‫‪ quality of experience‬او ‪ :QoE‬هنا سوف يهتم اكثر واكثر باألداء لدى الشبكة‪.‬‬
‫مصطلح ‪ :QoX‬وهما ما يضم الجميع اي )‪(service, experience, and so on‬‬
‫‪QoE is what QoS Models: IntServ and DiffServ‬‬
‫عندما يمر ‪ packet‬ونريد تفضيله او وضع ميزات ‪ QoS‬عليه فإننا بحاجة الى مزيد من ‪ bandwidth‬ايضا تقليل نسبة‬
‫التأخير او ‪ .latency‬من المرسل الى المستقبل سوف يتولى بروتوكول رسم الدائرة يسمى‬
‫بـ ()‪.)Resource Reservation Protocol (RSVP‬‬
‫سيؤدي المطلوب في ذلك (‪ )IntServ and DiffServ models‬تناقش فيما بعد‪.‬‬
‫يعتبر ‪ IntServ‬احد تلك األدوات في الشبكات التي تعمل بشكل ديناميكي من اجل وضع القرارت‬
‫أو ()‪.)admission control (AC‬‬

‫‪Fundamental QoS Concepts and Toolset‬‬


‫بشكل عام سوف تقع ‪ QoS tools‬في احد التصنيفات التالية‪:‬‬
‫‪ Classification and marking tools:‬‬
‫نعم يجب ان نحدد اي صنف ينتمي ‪ traffic‬القادم وكيف سنعالجه‪ .‬هذه األدوات سوف تجعل الشبكة على علم بذلك‪.‬‬
‫‪ Policing, shaping, and markdown tools:‬‬
‫بعد ان نعرف ‪ packets‬القادمة سوف نكون بحاجة الى وضع المعالجة الالزمة لها من خالل انتقاءها‪ ،‬وايضا من الممكن ان‬
‫نقوم بعملية ‪ drop‬لبعضها‪ ،‬او ‪ delay‬او عملية ‪ re-mark‬كل ذلك من اجل تجنب التصادم‪.‬‬
‫‪ Congestion management or scheduling tools:‬‬
‫بعد ان يزيد ‪ traffic‬في الشبكة سنكون بحاجة الى استخدام الموارد المتوفرة بشكل امثل من خالل عمل ‪ queued‬اي في‬
‫انتظار توفر موارد جديدة‪.‬‬
‫‪Link-specific tools:‬‬
‫بعض ‪ Links‬لها معالجة خاصة في عملية‬
‫‪ fragmentation‬وكذلك ‪interleaving‬‬

‫في الشكل المقابل سوف نالحظ بيان لـ ‪QoS toolset‬‬


‫والتسلسل المنطقي لها والوظائف التي تؤديها‪.‬‬
Packet Headers
.header ‫ في‬marking ‫ لديها اماكن من الممكن ان نضع فيها‬IPv6 ‫ وكذلك‬IPv4 ‫كال من‬
‫ في الشكل ادناه يوضح كال‬.‫ اثناء مروره عبر الشبكات المختلفة‬packet ‫ تستخدم من اجل عملية وضع عالمة على‬bits ‫تلك‬
.packet headers ‫ في‬،IPv4 and IPv6 ‫من‬

MBZ ‫ في الشكل اعاله سوف تبقى‬.)Type of Service (ToS) byte( ‫ نطلق عليها‬8-bit ‫ يوجد لدينا‬IPv4 packet ‫في‬
.Traffic Class ‫ ونطلق عليها‬8-bit ‫ يوجد ايضا‬IPv6 ‫ بينما في‬.RFC ‫( الى صفر دائما وهذا من قبل‬Must Be Zero)
‫ وهي ما تعطي التصنف الذي كلما كان‬.)IP Precedence( ‫ او ما تسمى بـ‬IPP bits ‫ تعتبر‬3 bits ‫في كال النوعين اول‬
.‫ كما في الجدول ادناه‬.‫اعلى كان افضل‬
Type of Service IP Precedence
1000 minimize delay 000 Routine
0100 maximize throughput 001 Priority
0010 maximize reliability 010 Immediate
0000 minimize monetary cost 011 Flash
100 Flash Override
101 Critic/Critical
110 Internetwork Control
111 Network Control

‫ احتمال‬64 ‫ هذا سوف يعطينا‬.)DSCP bits( ‫ اخرى معها لتكون ما يسمى بـ‬3-bit ‫ يتم جمع‬.)classes of service( ‫او‬
TOS (Type of Service) ‫ ما يسمى بـ‬layer 3 ‫ وهنا يجب عدم الخلط حيث نطلق عليها في‬.)classes of service( ‫من‬
.‫) سوف نتطرق لها الحقا‬COS (Class of Service)( ‫ وهذا ما نطلق عليه بـ‬marking fields ‫ كذلك يوجد‬layer 2 ‫في‬

.DS Field (Differentiated Services) ‫ ليصبح‬TOS ‫ تم تغيير‬1998 ‫بعد ذلك وبالتحديد في‬
.‫ليصبح كما في الشكل ادناه‬
‫حيث ان اول ‪ 6bit‬عبارة عن ‪ DS‬وتستخدم في ‪ codepoint‬والتي سوف تؤثر على ()‪.)PHB (Per Hop Behavior‬‬
‫قد نطلق ‪ DSCP‬على ‪ ،codepoint‬وهي تمثل نفس ‪ precedence‬المستخدمه في ‪ TOS byte‬والتي تستخدم من اجل ‪.priority‬‬
‫دعني اوضح لك ‪.PHB‬‬
‫في الشكل ادناه لدينا ‪ 3 routers‬عندما نحتاج ان نضع إعدادات ‪ QoS‬من اجل تمييز ‪ VoIP packets‬وجعلها ذات اولوية‪ .‬سوف نضعها على‬
‫كل ‪.devices‬‬
‫لو انتهينا من اعداد كال من ‪ R1 and R3‬فقط‪ .‬فسوف تبقى المشكلة في ‪ R2‬انه سوف يعامل ‪ VoIP packets‬نفس المعاملة العادية‪.‬‬
‫لذلك من اجل ان تعمل ‪ QoS‬يجب ان تتم عملية اإلعداد على الجميع اي ‪.end-to-end‬‬
‫وهنا يوجد لدينا طريقتين هما‪:‬‬

‫الحجز اي ان كل جهاز في الشكل سوف يحجز الـ ‪ bandwidth‬من اجل ‪ phone call‬في الشبكة‪.‬‬ ‫‪‬‬
‫عمل إعدادات لكل جهاز على حدة من اجل وضع األولوية لـ ‪.VoIP packets‬‬ ‫‪‬‬
‫تبدو فكرة الحجز األقرب‪ .‬لكن ماذا لو ان احد ‪ routers‬فقد معلومات الحجز؟‬
‫الفكرة هي اجبار االجهزة على استخدام (‪ )reservations‬وذلك ‪ end-to-end QoS‬وهذا ما يسمى بـ ()‪.)IntServ (Integrated Services‬‬
‫على النقيض من ‪ IntSer‬نستخدم فكرة ()‪ )DiffServ (Differentiated Services‬والتي تعني وضع األولوية لتلك ‪ packets‬التي نريدها فقط‬
‫بدون حجز اي ‪.bandwidth‬‬
‫فكرة ‪ PHB‬ان تلك ‪ packets‬يجب ان يتم التعليم عليها بـ ‪ codepoint‬معين‪ .‬وهنا سوف تعامل معاملة خاصة اي ‪ QoS‬مثال في ‪ queuing‬او‬
‫في ‪ policing‬او حتى في ‪.shaping‬‬

‫‪Assured Forwarding PHB‬‬


‫هناك وظيفتين لـ ‪ PHB‬وهما‪:‬‬

‫‪Queueing‬‬ ‫‪‬‬
‫‪Congestion Avoidance‬‬ ‫‪‬‬
‫يوجد هناك اربع ‪ classes‬كل ‪ class‬يوضع في صف مختلف حيث يوجد احتمال ‪ drop‬عندما يكون الصف في حالة ‪ full‬تكون هناك احتمالية‬
‫‪ drop‬عالية‪.‬‬
‫حيث يوجد هناك ثالث مستويات من ‪ drop‬كما يلي في الجدول ادناه‪.‬‬
‫‪Drop‬‬ ‫‪Class 1‬‬ ‫‪Class 2‬‬ ‫‪Class 3‬‬ ‫‪Class 4‬‬
‫‪Low‬‬ ‫‪001010 010010‬‬ ‫‪011010‬‬ ‫‪100010‬‬
‫‪AF11‬‬ ‫‪AF21‬‬ ‫‪AF31‬‬ ‫‪AF41‬‬
‫‪Medium‬‬ ‫‪001100 010100‬‬ ‫‪011100‬‬ ‫‪100100‬‬
‫‪AF12‬‬ ‫‪AF22‬‬ ‫‪AF32‬‬ ‫‪AF42‬‬
‫‪High‬‬ ‫‪001110 010110‬‬ ‫‪011110‬‬ ‫‪100110‬‬
‫‪AF13‬‬ ‫‪AF23‬‬ ‫‪AF33‬‬ ‫‪AF43‬‬
‫‪Expedited Forwarding‬‬
‫وجود ()‪ )EF (Expedited Forwarding‬في ‪ PHB‬له وظيفتين هما‬

‫‪Queueing‬‬ ‫‪‬‬
‫‪Policing‬‬ ‫‪‬‬
‫الهدف هو ضوع ‪ packets‬في الصف الذي يكون فيه اقل ‪ delay‬وكذلك اقل عدد في ‪ .loss‬وهذا ما نريده في ‪ real-time applications‬مثال‬
‫‪VoIP‬‬
‫العديد من التطبيقات مثل ‪ FTP‬ال يهم فيها وجود أي ‪ .delay or jitter‬فهي تستهلك الكثير من الـ ‪.bandwidth‬‬
‫في المقابل هناك مثال ‪ VoIP‬تعتبر من التطبيقات التفاعلية وتستهلك القليل من الـ ‪ bandwidth‬ولكن في حالة ان نسبة التأخير عالية‬
‫سيكون األمر سيئ وسنصل الى حالة شبيهة بمحادثات الـ (‪.)walkie-talkie‬‬
‫األمر سوف ينطبق على ‪ jitter‬حيث سيسبب في ردأة الصوت او نقص الجودة‪.‬‬
‫هذا يجعلنا نقول انه البد من وجود ()‪.)QoS(Quality of Service‬‬
‫الخطوة األولى وهي الـ (‪.)classification‬‬
‫عندما يعبر ‪ packet‬عبر ‪ router‬لن يهم ‪ router‬من اين قادم ولكن يهمه الى اين متجه من اجل البحث في ‪ .routing table‬اما فيما‬
‫يخص ‪ QoS‬فإنه يهمنا معرفة تصنيف ‪ .packet‬بمعني ادق الى ‪ application‬ينتمي ذلك الـ ‪.packet‬‬
‫لماذا ذلك؟‬
‫من اجل ان يتم وضع عالمة على ‪ packet‬والقيام بتطبيق ‪ policy‬عليه‪.‬‬
‫هناك طريقتين من اجل عملية ‪ classification‬وهي‪:‬‬
‫‪Header inspection‬‬ ‫‪‬‬
‫‪Payload inspection‬‬ ‫‪‬‬
‫حيث ان هناك حقول في ‪ headers‬من الممكن ان تستدل على ‪ application‬من خاللها‪ .‬مثال في ‪ TCP‬يوجد ‪ port‬هو ‪ 23‬سوف‬
‫يدلنا على ان التطبيق هو ‪ .telnet‬بالمثل ‪ HTTP‬سوف نستخدم ‪.TCP port=80‬‬
‫فمن خالل فحص ‪ header‬سوف ننظر الى‪:‬‬
‫‪‬‬ ‫‪Layer 2: MAC addresses‬‬
‫‪‬‬ ‫‪Layer 3: source and destination IP addresses‬‬
‫‪‬‬ ‫‪Layer 4: source and destination port numbers and protocol‬‬
‫االمر سهل!‬
‫ليست كما تتوقع‪.‬‬
‫حيث ان بعض التطبيقات مثال تستخدم ‪ TCP port=80‬على انه ‪ destination port‬وهذا يعني ان التطبيق هو ‪.HTTP‬‬
‫لكن من الممكن ان يكون غير ذلك مثل (‪ )instant messaging‬او ‪ .IM‬وهذا يعني انه من التفتيش العميق داخل ‪.header‬‬
‫وهذا سوف يعني انه البد من البحث داخل ‪ payload‬ومعرفة الـ ‪.application‬‬
‫في ‪ Cisco IOS routers‬سوف يقوم بتفعيل ()‪ .)NBAR (Network-Based Application Recognition‬حيث انه بعد تفعيلها‬
‫على ‪ .interface‬فإن ‪ router‬سوف يعاين كل ‪ .incoming IP packets‬ومن ثم يحاول يطابقها مع ‪signatures and attributes‬‬
‫في )‪.PDLM (Packet Description Language Module‬‬
‫مثال‪:‬‬
‫قام ‪ NBAR‬بعملية اكتشاف وجود ‪ HTTP traffic‬ال يهم أي ‪ ports‬تم استخدامه‪ .‬لكن سيقوم بعملية مطابقة‪:‬‬

‫‪‬‬ ‫‪URL‬‬
‫‪‬‬ ‫)‪MIME type (zip le, image, etc‬‬
‫‪‬‬ ‫)‪User-agent (Mozilla, Opera, etc‬‬
‫فعندما يرى ‪ URL‬سوف يستخدم ‪ block websites‬واالختيار العام لـ ‪ classification‬والذي سنعرفه الحقا‪.‬‬
‫‪Configuration‬‬
‫من اجل اعداد ‪ MQC‬فإننا بحاجة الى معرفة التالي‪:‬‬
‫‪ class-map‬وهذا من اجل تحديد ‪ packet‬التي تطابق معيار معين وهي تلك التي تنتمى الى ‪ class‬معين‪.‬‬ ‫‪‬‬
‫‪ policy-map‬من اجل وضع ‪ action‬وتطبيقها على كل ‪.traffic class‬‬ ‫‪‬‬
‫‪ service-policy‬يستخدم من اجل ربط ‪ policy map‬وربطها بـ (‪ .)logical or physical interface‬أيضا تحديد‬ ‫‪‬‬
‫االتجاه الذي سوف تطبق فيه أي ‪.input or output‬‬
‫ التي نستخدمها‬topology ‫ من خالل‬telnet traffic ‫ وذلك لـ‬classify ‫ من اجل عملية‬access-list ‫في الشكل ادناه سوف نستخدم‬
.telnet server ‫ سيكون هو‬R2 ‫ بينما في‬client ‫ سوف يكون هو‬R1 ‫وهي‬
.R2 ‫ عندما تصل الى‬packets ‫فسوف نقوم بعملية تصنيف او فرز الـ‬
:‫كما يلي‬
R2(config)#ip access‐list extended TELNET
R2(config‐ext‐nacl)#permit tcp any any eq 23
.filtering ‫ من اجل عملية‬interface ‫ سوف نطبقها على‬.23 ‫ سوف يعبر باستخدام المنفذ‬packets ‫أي كل‬
.MQC (Modular Quality of Service Command-Line Interface) ‫عملية االعداد بالطريقة أعاله تستمى بـ‬
.marking, queueing, policing, shaping, …. ‫ مثل‬.QoS actions ‫ من اجل عملية اعداد‬policy-map ‫سوف نستخدم‬
:‫دعني اعرض لك التالي‬

.)TELNET( ‫ وتم تسميتها بـ‬class-map ‫اذا قمنا بإنشاء‬


R2(config)class‐map TELNET
R2(config‐cmap)#match access‐group name TELNET
:‫ كما يلي‬policy-map ‫االن دور انشاء‬
R2(config)#policy‐map CLASSIFY
R2(config‐pmap)#class TELNET
.TELNET ‫) وربطها بـ‬CLASSIFY( ‫تمت تسميتها بـ‬
.‫ لكن ببساطة هذا ما نريده‬.action ‫طبعا لن نطبق أي‬
R2(config)#interface FastEthernet 0/0
R2(config‐if)#service‐policy input CLASSIFY
:‫ دعنا نجرب ذلك‬telnet traffic ‫بعد عملية فرز‬
R1#telnet 192.168.12.2
Trying 192.168.12.2 ... Open
‫؟‬R2 ‫ما الذي سوف يحدث في‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: CLASSIFY
Class‐map: TELNET (match‐all)
11 packets, 669 bytes
5 minute offered rate 0 bps
Match: access‐group name TELNET
Class‐map: class‐default (match‐any)
3 packets, 206 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
.fa0/0 ‫ على المنفذ‬telnet traffic ‫ ما قمنا به ووجد‬router ‫لقد اكتشف‬
Classification with NBAR
:‫عملية اإلعداد بسيطة جدا كما يلي‬
R2(config)#interface FastEthernet 0/0
R2(config‐if)#ip nbar protocol‐discovery
:‫لنستعرض ذلك‬
R2#show ip nbar protocol‐discovery FastEthernet0/0
Last clearing of "show ip nbar protocol-discovery" counters 00:00:32

Input Output
----- ------
Protocol Packet Count Packet Count
Byte Count Byte Count
5min Bit Rate (bps) 5min Bit Rate (bps)
5min Max Bit Rate (bps) 5min Max Bit Rate (bps)
----------------- ------------------------ ------------------------
Total 0 0
0 0
0 0
0 0
:‫ كما يلي‬class-map ‫ في‬NBAR ‫دعنا االن نضع‬
R2(config)#class‐map NBAR‐TELNET
R2(config‐cmap)#match protocol telnet
:‫ كما يلي‬application ‫ ولكن على مستوى‬header ‫ لكن ليس في‬class-map ‫لنعيد استخدام‬
R2(config)#policy‐map CLASSIFY
R2(config‐pmap)#no class TELNET
R2(config‐pmap)#class NBAR‐TELNET
:‫لالستعراض كما يلي‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: CLASSIFY
Class‐map: NBAR‐TELNET (match‐all)
9 packets, 549 bytes
5 minute offered rate 0 bps
Match: protocol telnet
Class‐map: class‐default (match‐any)
3 packets, 180 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
.telnet ‫ التي تخص‬packets ‫ بعملية فرز‬NBAR ‫ وقام‬access-list ‫رائع! لقد استخدامنا‬
‫‪QoS Architectural Framework‬‬

‫دعنا نسرد اساسيات المهام التي يقدمها ‪ QoS‬كما يلي‪:‬‬


‫‪ Classification‬وفيها يحدد الى أي ‪ class‬ينتمي ‪ traffic‬لكل ‪.packet‬‬ ‫‪‬‬
‫‪ Marking‬وهي قيمة يتم كتابتها في ‪ header‬من اجل اإلشارة الى ‪ class‬لذلك ‪.traffic‬‬ ‫‪‬‬
‫)‪ Policing (dropping and markdown‬وفيها يتم تحديد اين ومتي يتم حذف ‪ .packets‬وعملية ‪ .re-mark‬وذلك في حالة كان‬ ‫‪‬‬
‫‪ traffic‬أكبر من الموارد المتوفرة‪.‬‬
‫‪ Shaping‬وهي عملية ابطأ لذلك ‪ traffic‬من اجل ان يتناسب مع ‪ bandwidth‬المتوفر‪.‬‬ ‫‪‬‬
‫‪ Queuing‬وهي عملية تخزين الـ ‪ packets‬في قوائم االنتظار عندما يكون ‪ ingress traffic‬اكبر من الموارد المتوفرة او ببساطة‬ ‫‪‬‬
‫‪.bandwidth‬‬
‫‪ Bandwidth allocation‬وهي عملية التأكد من ان ‪ traffic‬معينة تستخدم فقط تلك ‪ bandwidth‬المخصصة لها‪.‬‬ ‫‪‬‬
‫‪ Admission control‬تحديد ما إذا كان ‪ packet‬سوف يقبل او يرفض‪ ،‬وهذا بناء على الموارد المتوفرة‪.‬‬ ‫‪‬‬

‫في الشكل المقابل نالحظ ان لدينا ‪ packet‬تم استقباله‪.‬‬


‫وتم تطبيق ‪ QoS‬عليه‪.‬‬
‫ليكون لدينا كال من ‪ 1,2,6,7, and 12‬ال تمثل ‪.QoS‬‬
‫بينما سوف تمثل ‪ 3‬وهي عملية فرز الـ ‪.packets‬‬
‫ثم وضع ‪.mark‬‬
‫لتأتي تطبيق ‪.policy‬‬
‫وبالمثل في العملية العكسية سوف تحدث مع وجود إضافة‬
‫عملية ‪ shape‬على حسب الموارد المتوفرة‪.‬‬
‫او دعني أقول لك حسب ‪.bandwidth‬‬

‫‪Default Behaviors‬‬
‫تلك ‪ unclassified traffic‬التي لم تستوفي المعايير من اجل ان تطبق عليها ‪ QoS‬سوف تتم معالجتها بدون وجود أي ميزة لـ ‪.QoS‬‬
‫أي بطريقة ‪ first-in, first-out (FIFO) queue‬مع احتمالية ان يتم حذف تلك ‪ traffic‬في حالة كان ‪ output queue‬في حالة‬
‫‪.full‬‬
‫)‪Traffic Classification (Class Maps‬‬
‫هناك ثالث طرق من خاللها سوف نستطيع عمل ‪ classify traffic‬وهي كما يلي‪:‬‬
‫‪ Markings‬وفيها يتم عملية اختبار ‪ layer 2‬من خالل حقول ()]‪ )(class of service [CoS‬او اختبار ‪ layer 3‬من خالل‬ ‫‪‬‬
‫‪ IPP‬او إعدادات ()]‪.)differentiated services code point [DSCP‬‬
‫‪ Addressing‬وفيها سوف يتم فحص (‪ )source/destination interface‬او فحص (‪ ،)L2 destination address‬او‬ ‫‪‬‬
‫فحص (‪ )L3 source/destination address‬او فحص (‪.)source/L4 destination port‬‬
‫‪ Application signatures‬يوجد داخل ‪ packet‬المحتوى من الممكن من خالل فحصه نستطيع فرز نوع ‪.traffic‬‬ ‫‪‬‬
Definition of Policies (Policy Maps)
:‫ عليها من خالل احد التالي‬action ‫ فإننا بحاجة الى تطبيق‬QoS ‫ التي سوف تطبق عليها‬packets ‫بعد ان تمت معرفة‬
 Bandwidth allocation
 Queuing directives (priority queuing, fair queuing, queue length limits)
 Traffic shaping (rate limiting by queuing or delaying packets)
 Packet dropping (policing or rate limiting by dropping packets, random dropping, tail
dropping, or unconditional dropping)
 Marking packets (setting various header fields to certain values)
 Counting packets
 Compression of the packet header
 Admission decisions

Attaching Policies to Traffic Flows (Service Policy)


:‫ على احد المنافذ التالية‬policy ‫سوف تتطبق‬
 Main interfaces
 Subinterfaces
 Multilink Point-to-Point Protocol (MLPPP) bundles
 Virtual templates
 Virtual local-area networks (VLANs)
 Asynchronous Transfer Mode (ATM) or Frame Relay (FR) virtual circuits (VCs)

QoS Marking on Cisco IOS Router


.DSCP ‫ او في‬IPP ‫ وذلك في‬Type of Service byte ‫ او ما نطلق عليه‬TOS ‫ يعني اننا سوف نفعل‬Marking
‫ لكل‬R2 ‫ في‬mark ‫ وسوف نقوم بعملية‬R3 ‫ الى‬R1 ‫ من‬traffic ‫ سوف نرسل‬three routers ‫من خالل الشكل ادناه الذي فيه‬
:telnet traffic ‫ من خالل‬traffic
R2(config)#ip access‐list extended TELNET‐TRAFFIC
R2(config‐ext‐nacl)#permit tcp any any eq telnet
:class-map ‫ الى‬access-list ‫االن لنضيف‬
R2(config)#class‐map TELNET‐TRAFFIC
R2(config‐cmap)#match access‐group name TELNET‐TRAFFIC

:‫ من خالل التالي‬policy-map ‫ الى‬class-map ‫االن سوف نضيف‬


R2(config)#policy‐map MARKING
R2(config‐pmap)#class TELNET‐TRAFFIC
R2(config‐pmap‐c)#set precedence network
:‫ من خالل‬interface ‫ على‬policy-map ‫لنفعل‬
R2(config)#interface FastEthernet 0/0
R2(config‐if)#service‐policy input MARKING
:‫ كما يلي‬telnet ‫االن لنباشر عملية‬
R1#telnet 192.168.23.3
Trying 192.168.23.3 ... Open
:‫ كما يلي‬R2 ‫لنرى ما حدث في‬
R2#show policy‐map interface FastEthernet 0/0
Service‐policy input: MARKING
Class‐map: TELNET‐TRAFFIC (match‐all)
10 packets, 609 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name TELNET‐TRAFFIC
QoS Set
precedence 7
Packets marked 10
Class‐map: class‐default (match‐any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
.7 ‫ تساوي‬precedence ‫ لتكون فيها‬10 packets ‫ على‬mark ‫لقد تم وضع‬
:HTTP traffic ‫ وذلك في‬DSCP ‫ لكن عن طريق التالعب بقيمة‬packets ‫ لبعض‬marking ‫دعنا نحاول عمل‬
R2(config)#ip access‐list extended HTTP‐TRAFFIC
R2(config‐ext‐nacl)#permit tcp any any eq 80
:class-map ‫االن دور‬
R2(config)#class‐map HTTP‐TRAFFIC
R2(config‐cmap)#match access‐group name HTTP‐TRAFFIC
:policy-map ‫االن نضيف‬
R2(config)#policy‐map MARKING
R2(config‐pmap)#class HTTP‐TRAFFIC
R2(config‐pmap‐c)#set dscp af12
:‫ من خالل التالي‬traffic ‫لنقوم بتوليد بعض‬

R3(config)#ip http server


R1#telnet 192.168.23.3 80
Trying 192.168.23.3, 80 ... Open
:‫لنختبر ما حدث‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: MARKING
Class‐map: TELNET‐TRAFFIC (match‐all)
10 packets, 609 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name TELNET‐TRAFFIC
QoS Set
precedence 7
Packets marked 10
Class‐map: HTTP‐TRAFFIC (match‐all)
3 packets, 180 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name HTTP‐TRAFFIC
QoS Set
dscp af12
Packets marked 3
Class‐map: class‐default (match‐any)
99 packets, 5940 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
.re-mark traffic ‫ تقوم بعملية‬wireless controllers ‫ او حتى‬switches ‫بعض األجهزة مثل‬
‫ من اجل ان تطابق‬class maps ‫ وكذلك بعض‬policy-map ‫ سوف ننشئ بكل بساطة‬.Cisco IOS router ‫من اجل معرفة ذلك في‬
‫ سوف يجعلنا نقوم بعملية الفحص السريع ما ان كنا استقبلنا بشكل صحيح تلك‬.DSCP ‫ او في قيمة‬precedence ‫ما قمنا بعمله في‬
:‫ او ال كما يلي‬packets
R3(config)#class‐map AF12
R3(config‐cmap)#match dscp af12
R3(config)#class‐map PREC7
R3(config‐cmap)#match precedence 7
R3(config)#policy‐map COUNTER
R3(config‐pmap)#class AF12
R3(config‐pmap‐c)#exit
R3(config‐pmap)#class PREC7
R3(config‐pmap‐c)#exit
R3(config)#interface FastEthernet 0/0
R3(config‐if)#service‐policy input COUNTER
‫لقد انشأنا ‪ two class-maps‬احدها لـ ‪ DSCP AF12‬او من خالل ‪ precedence‬التي تساوي ‪ 7‬ولنستعرض كما يلي‪:‬‬
‫‪R3#show policy‐map interface FastEthernet 0/0‬‬
‫‪FastEthernet0/0‬‬
‫‪Service‐policy input: COUNTER‬‬
‫)‪Class‐map: AF12 (match‐all‬‬
‫‪4 packets, 240 bytes‬‬
‫‪5 minute offered rate 0 bps‬‬
‫)‪Match: dscp af12 (12‬‬
‫)‪Class‐map: PREC7 (match‐all‬‬
‫‪12 packets, 729 bytes‬‬
‫‪5 minute offered rate 0 bps‬‬
‫‪Match: precedence 7‬‬
‫)‪Class‐map: class‐default (match‐any‬‬
‫‪0 packets, 0 bytes‬‬
‫‪5 minute offered rate 0 bps, drop rate 0 bps‬‬
‫‪Match: any‬‬
‫هذا سوف يثبت ان ‪ R3‬استقبل ‪ marked packets‬بشكل صحيح‪.‬‬
‫?‪Why do we need QoS on LAN SWITCHES‬‬
‫بعض الناس تسأل لماذ نريد ‪ QoS‬في ‪ .LAN switches‬بما ان لدينا بالطبع ‪ bandwidth‬بما فيه الكفاية‪.‬‬
‫لإلجابة على تساؤلك دعني ادوضح ذلك من خالل الشكل ادناه‪.‬‬
‫لدينا في الشكل ادناه منافذ ‪ gigabits‬ما بين ‪ switches‬وكذلك المرسل‪.‬‬
‫تخيل لدنيا ‪ voice data‬او محادثة فيديو‪ ،‬وبحجم يفوق ‪ 400 Mbps‬مرسلة من ‪ hosts‬الى ‪ .server‬في الحقيقة ان ‪ link‬مابين‬
‫‪ server‬وما بين ‪ switch B‬لديه سعة فقط تصل الى ‪ .100 Mbps‬هذا يعني ان ‪ traffic‬سيكون مصيرها هو ‪.dropped‬‬

‫تخيل معي احد األمثلة األخرى على ‪ dropping‬الي ‪ traffic‬تفوق سعة ‪ .bandwidth‬هو ان لدينا ‪ 3 computers‬متصلة كال بـ‬
‫‪ switch‬على حده‪.‬‬
‫في الصباح الباكر دخل الجميع على ‪ system‬او لنقل على ‪ .server‬حجم ‪ traffic‬لكل ‪ host‬تصل الى حوالي ‪ 70 Mbps‬على سبيل‬
‫المثال‪ .‬هذا يعني ان حجم ‪ traffic‬سوف يصل الى ‪ 210 Mbps‬وهذا اكبر من الطاقة األستيعابية لـ ‪ Fa0/0 interface‬التي من‬
‫المكن لـ ‪ switch D‬استيعابها‪.‬‬
‫النتيجة الحتمية هي ‪.dropped‬‬
‫قد يقول قائل ‪ TCP‬لديه خاصية ‪ .retransmission‬نعم لكن ماذا لو كانت نوع البيانات هي ‪real-time applications‬؟‬
‫بالطبع الحل في المقام األول هو إضافة مزيد من ‪.bandwidth‬‬
‫لكن لدينا تطبيقات اخرى سوف تعمل على استهالك تلك الزيادة‪ .‬ما لم يكن هناك إعدادات لـ ‪.QoS‬‬
‫حيث ان ‪ QoS‬سوف يخبر ‪ switches‬من اجل وضع اولوية في حالة وجود اي ‪ .congestion‬اي سوف يستمر ‪ switches‬في‬
‫عملية ‪ forwarding‬لنوع معين من البيانات مثال ‪ VoIP‬بينما بقية ‪ data‬سوف يقوم بعملية ‪.dropped‬‬
‫باختصار هذا سوف يضمن لنا ان تطبيقات ‪ real-time‬سوف تعمل حتى لو حصل ‪ congestions‬ولو مؤقتا‪.‬‬

‫‪Classification and Marking Terminology‬‬


‫قد نستخدم مصطلح ‪ classification‬او مصطلح ‪ marking‬بالتبادل ولكن لكل منهم ‪ action‬مختلف‪.‬‬
‫‪ :Classification‬يعتبر ‪ action‬هو ترتيب ‪ packets‬الى انواع مختلفة من ‪ ،traffic‬ويتم تطبيق لكل منها ‪ policy‬مختلفة‪.‬‬ ‫‪‬‬
‫حيث ان عملية ‪ classification‬لتلك ‪ packets‬من الممكن ان يحدث بدون اي ‪.marking‬‬
‫)‪ :Marking (or re-marking‬هنا يتم كتابة قيمة معينة في ‪ .packet header‬ويتم في ‪ boundary‬للشبكة او بين شبكتين‬ ‫‪‬‬
‫مختلفتين‪.‬‬
‫دعنا نفند ‪ tools‬كل على حده‪:‬‬
‫‪ :Classifier tool‬يتم في البداية كما قلنا تحديد او فرز ‪ packets‬ومن ثم تطبيق ‪ policy‬عليها‪.‬‬ ‫‪‬‬
‫‪ :Marker tool‬كما ايضا قلنا انة يتم وضع قيمة في ‪ packet header‬او ‪ frame‬او ‪ ...‬ومن ثم اتخاذ القرار بناء على ذلك‪.‬‬ ‫‪‬‬
‫بعض المصطلحات التي سوف تستخدم في ‪:QoS‬‬
‫)‪ :Differentiated Services Code Point (DSCP‬وهو عبارة عن قيمة تتكون من ‪ 6 bits‬تكون في حقل ‪ ToS‬في‬ ‫‪‬‬
‫‪.Layer 3 IPv4‬‬

‫)‪ Class of Service (CoS‬يستخدم عادة في الربط مع )‪(Ethernet Layer 2 frames‬‬ ‫‪‬‬
‫يتكون من ‪ 3-bit‬بحيث ينتج لنا تقريبا ‪8 classes‬‬
‫اي من ‪ 0‬الى ‪.7‬‬
‫في حالة ‪ IEEE 802.1Q‬فإن القيمة تكون ‪.0‬‬

‫‪Class Selector (CS) code point‬‬ ‫‪‬‬


‫وقيمة ‪ 3 bits‬الموجودة في ‪.IP Precedence‬‬
‫حيث ان قيمة الحقول تأخذ قيمة‬
‫‪ PHB‬او (‪.)per-hop behaviors‬‬
‫)‪ Traffic Identifier (TID‬وهو عبارة عن ‪ 3 bit‬في حقل ‪ QoS Control‬حيث انه يستخدم في ‪Wi-Fi MAC frame‬‬ ‫‪‬‬
‫ويكون له ثمان قيم‪ ،‬تحدد األولوية‪.‬‬
‫)‪ Type of Service (ToS‬يوجد كحقل ‪ ،Layer 3 IPv4 packet‬يولد لدينا ‪ 8‬قيم حيث انه يحتوي على ‪ .3 bits‬والذي‬ ‫‪‬‬
‫تحدد من خالله األولوية‬
Marking Fields in Different Technologies
‫ التي يتم تغليفها‬tunnel headers ‫ او من الممكن ان تكون‬L2 or L3 ‫ من الممكن ان تكون‬Packet Headers ‫لدينا العديد من‬
.VPN tunnels ‫ او‬IPsec ‫ او‬MPLS ‫ او‬.GRE ‫ او بـ‬IP packets ‫بـ‬
‫ بسبب انه لدية القدرة على الوصول‬marking option ‫ يعتبر األكثر استخداما في‬IP precedence ‫ مع‬L3 packet marking
.end-to-end ‫بطريقة‬
Field Values and Interpretation
.Frame Relay (FR) ‫ وكذلك‬Asynchronous Transfer Mode (ATM) ‫ فقط يستخدم مثل‬single bit ‫قد يكون هناك‬
.‫ الجدول ادناه يلخص معظم الحاالت في ذلك‬8 classes ‫ الذي سوف يفرز لنا‬marking ‫ في‬3 bits ‫او قد يستخدم‬

Technology Layer Marking Field Field Width (Bits) Value Range


Ethernet (802.1Q/p) 2 CoS 3 0 to 7
802.11 WiFi 2 TID 3 0 to 7
Frame Relay (FR) 2 DE bit 1 0 to 1
ATM 2 CLP bit 1 0 to 1
MPLS 2 EXP 3 0 to 7
IPv4 and IPv6 3 IP Precedence 3 0 to 7
IPv4 and IPv6 3 DSCP 6 0 to 63
DE (Discard Eligible), CLP (Cell Loss Priority), EXP (Experimental) ‫حيث ان‬

.IPv6 headers ‫ وكذلك في‬IPv4 headers ‫ تستخدم في كال من‬DSCP ‫ في حقول‬6 bit ‫اذا يوجد‬
‫) حيث يوجد ثالثة اقسام من‬per-hop behaviors (PHBs)( ‫من الممكن ان نعبر عنها بقيمة رقمية او عن طريق اسماء خاصة نطلق عليها‬
:‫ وهي‬DSCP PHBs

.Best-Effort (BE or DSCP 0) 


Assured Forwarding (AFxy) 
Expedited Forwarding (EF) 
.‫هذا والشكل ادناه يوضح ذلك‬
‫الرمز ‪ AFxy‬وهو رمز معبر عن حروف متبوعا بـ ارقام من حيث ‪:AF‬‬

‫تعتبر اول خانة في ‪ AFxy‬وهي ‪ x‬ترمز لـ ‪ AF class‬ولها قيمة من ‪ 1‬إلى ‪.4‬‬ ‫‪‬‬
‫الخانة الثانية وهي ‪ y‬تشير الى مستوى ‪ drop preference‬داخل‬ ‫‪‬‬
‫كل ‪ .AF class‬حيث يعتبر ‪ 1‬هو )‪(lowest drop preference‬‬
‫بينما يعتبرالرقم ‪ 3‬هو الـ )‪.(highest drop preference‬‬
‫فمثال الرقم ‪ AF33‬سيكون هناك احتمالية ‪ dropped‬فيه اكثر من ‪ ،AF32‬والذي‬
‫بدوره سيكون اعلى من ‪.AF31‬‬
‫‪MPLS‬‬
‫من المعروف ان ‪ MPLS‬تقع ما بين ‪ layer 2 and Layer 3‬اي في الطبقة ‪ .2.5‬يتم إدخال ‪ 4-byte‬عبارة عن ‪label header‬‬
‫الى ‪ .IP packet‬فيما يخص ‪ CoS‬يتم وضع حقل عبارة عن ‪ 3-bit‬يسمى بـ ‪ .MPLS EXP (Experimental) bits‬كما في الشكل ادناه‪.‬‬
‫حيث ان القيمة المحتملة هي نفس الموجودة في ‪.IP precedence‬‬

‫‪Ethernet 802.1Q/p‬‬
‫يعتبر من األهمية بمكان عملية ‪ marking‬على‬
‫‪ Ethernet frames‬من خالل وضع ‪ 802.1p‬والتي‬
‫تعتبر )‪ .priority bits (CoS‬في الـ‬
‫‪ header‬كما في الشكل المقابل‪.‬‬
IPv4 and IPv6
.Traffic Class ‫ والتي تسمى بـ‬8-bit ‫ فلدينا‬IPv6 ‫ اما في‬.ToS ‫ والتي تعتبر‬8-bit ‫ لدينا‬IPv4 packet ‫في‬
‫ التي تليها لتشكل ما‬3 bits ‫ وتجمع مع‬.IP Precedence (IPP) ‫ ما هو معروف بـ‬3 bits ‫ يعتبر اول‬IPv4 and IPv6 ‫في كال الحقلين اي في‬
:‫ ومن اجل معرفة األوامر إلنجاز المهمة نستخدم‬.DiffServ Code Point (DSCP) bits ‫يعرف بـ‬

policy-map SET-DSCP
class DSCP-AF31
set dscp af31

Classification Tools
Layer 7 Classification
‫ كما في الشكل‬Data Payload ‫ وذلك النه في هذه الحالة نحتاج الى البحث العميق داخل‬marking ‫ وليس‬classification ‫وهنا سوف نعتمد فقط‬
.‫ او من خالل الطريقة الديناميكية‬static ‫ من الممكن ان يكون عملية الفرز بطريقة‬.‫ادناه‬

Class-Based Classification (Class Maps)


.CLI within a class map ‫ سوف تتم من خالل استخدام‬.MQC structure ‫يوجد لدينا كما نعرف اداه من اجل الفرز وهي‬
.AND, OR, and NOT ‫حيث ستتم المطابقة مع استخدام‬
:traffic classification ‫وكملخص نحدد الجمل التالية في‬

 Packet header markings


 Packet attributes, characteristics, or field values
 Protocols
 Addressing information
 Logical or Physical interface
 Ports
:‫وكمثال على ذلك‬
:Marking Tools ‫وكمثال على‬

Policing and Shaping Terminology


‫ فلهما نفس الطريقة‬traffic ‫) فيما يخص تحديد الـ‬traffic violations( ‫ من ادوات تحديد وايضا استجابة لـ‬Policers and Shapers ‫تعتبر‬
:)traffic violations( ‫ من األستجابة لـ‬Policers and Shapers ‫ولكن دعنا نفرق بين‬

dropping or re- ‫ مثال‬actions ‫ فإن بشكل عاجل يتم هنا اتخاذ األجراء أو‬traffic violations ‫ في حالة حدوث‬:Policers 
.‫ تفحص وتتخذ األجراء‬traffic ‫ فهي التأخر‬.excess traffic ‫ وذلك ألي‬marking
‫ حيث يتم تخزين الزائد ومن ثم تأخيره حتي‬.traffic ‫ حيث انها التحذف الـ‬.buffer ‫ وهنا تعتبر اداه مرنه حيث انها متصلة بـ‬Shapers 
.‫تتاح فرصة إرساله‬
:‫والجدول ادناه يوضح الفرق بينهما من خالل التالي‬
Policer Shaper
Causes TCP resends when traffic is dropped Typically delays (rather than drops) traffic;
involves fewer TCP resends
Inflexible and inadaptable; makes instantaneous Can adapt to network congestion by queuing
packet drop decisions excess traffic
An ingress or egress interface tool Typically an egress interface tool
Introduces no delay or jitter in a traffic Introduces delay and jitter if arriving traffic
stream exceeds the contracted (shaped) rate
Rate limiting without buffering Rate-limiting with buffering

Introduction to Policing
‫ قد يكون خط‬.‫ وتم تزويدك بباقة معينة فإنت بحاجة الى ان تدفع مقابل ذلك‬ISP ‫في حالة قررت األشتراك في احد باقات االنترنت وذهب الى‬
‫ لكنك لست بحاجة الى كل هذه السرعة او باألصح لن تدفع‬.100 Mbps ‫األشتراك العام لديه القدرة على تزويدك بمعدل معين قد يصل مثال الى‬
.‫مبلغ اكبر من الذي لديك‬
‫ ستكون هناك اتفاقية من خاللها سوف تمنح سرعة معينة بناء على المقابل المادي الذي‬.fiber ‫ستختار باقة اقل من السرعة القصوى لخط او لكبل‬
.CIR ‫( او اختصارا بـ‬Committed Information Rate) ‫ يسمى بـ‬ISP ‫ الذي سوف يمنح لك من قبل‬bit rate ‫ معدل‬.‫ستدفعه‬
.shaping ‫ او عن طريق‬policing ‫ سوف يكون من خالل احد من التالي اما‬bit ‫تحديد معدل‬
.traffic ‫ لتلك الفائض من الـ‬drop ‫ يقوم بعملية‬policing ‫األختالف بينهما من خالل ان‬
.‫ الحقا‬shaping ‫ سوف نتكلم عن‬.‫ فسوف يخزن الفائض‬shaping ‫اما‬
:‫ سوف يكون الخيار احد التالي‬policer ‫في حالة‬

 Allow the packet to pass.


 Drop the packet.
 Remark the packet with a different DSCP or IP precedence value.
‫في ‪ policing‬الـ ‪ action‬التي سوف تتطبق وهي‪:‬‬

‫‪ Conforming‬اي ان ‪ packet‬صمن حدود ‪ traffic contract‬اي األتفاقية التي ابرمت مع ‪.ISP‬‬ ‫‪‬‬
‫‪ Exceeding‬يعني ان ‪ packet‬قد زاد عن السعة المتوفرة او حدث ما يسمى بـ (‪.)excess burst‬‬ ‫‪‬‬
‫‪ Violating‬يعني انه تماما خارج ‪.traffic contract rate‬‬ ‫‪‬‬
‫مع ‪ action‬اعاله سوف يكون لدينا ‪ packet‬مثال فإن كان ضمن سعة ‪ bandwidth‬فإنه سوف يمر او ‪ conforming‬فإن زاد عن السعة او حالة‬
‫‪ exceeding‬سوف يتم عمل ‪ re-mark‬فإن زاد فسوف تتخذ حالة ‪ drop‬في حالة ‪.violating‬‬
‫‪Types of Policers‬‬
‫هناك العديد من الخوارزميات التي تعمل مع مع ‪ policers‬وهي‪:‬‬

‫‪ Single-Rate Two-Color Policers‬الفكرة األساسية وراء (‪ )token bucket‬انه سوف يتم توليد ‪ token‬من قبل نظام التشغيل‬ ‫‪‬‬
‫‪ .IOS‬ومن ثم يتم وضعه في ‪ .bucket‬نسمى ذلك بـ ‪ replenishing‬او تجديد الموارد‪.‬‬
‫كلما يصل ‪ packet‬فإن ‪ policer‬سوف يقوم بعملية فحصه ليرى فيما إذا كان هناك ‪ tokens‬كافية في ‪ .bucket‬فإن يتم السماح لـ‬
‫‪ packet‬بالمرور‪ .‬ما لم يكن فإن يتم حذفه‪ .‬كل ‪ token‬يمثل بـ ‪ byte‬واحد‪.‬‬
‫لكن السؤال كيف يتم حساب ‪ tokens‬في ‪bucket‬؟‬
‫الجواب حسب المعادلة التالية‪:‬‬
‫‪Packet arrival time ‐ Previous packet arrival time * Police Rate / 8‬‬
‫اي ان عدد ‪ tokens‬في ‪ bucket‬سوف تعتمد على الزمن بين وصول كل ‪ packet‬اخر ويكون بالثانية‪.‬‬
‫دعنا نوضح ذلك بمثال كما في الشكل ادناه‪:‬‬
‫تخيل لديك ‪ policer‬وكانت بقيمة ‪ .128000 bps‬وكان الزمن ما بين وصول ‪ packet‬واخر هو ‪ .1 second‬فإن ‪ policer‬سوف‬
‫تحسب كمايلي‪1 second * 128.000bps / 8 = 16.000 bytes :‬‬
‫لذلك سوف يوضع ‪ 16.000 tokens‬في ‪ .token bucket‬االن تخيل معي ‪ packet‬الثالث عندما يصل ففي حالة كان الزمن ما بين‬
‫وصول والثاني هو ‪ 0.5 second‬فإننا نحسب المعادلة‪0.5 second * 128.000bps / 8 = 8.000 bytes :‬‬
‫هذا سوف يعني اننا سوف نضع ‪ 8.000 tokens‬في ‪ .bucket‬اي كلما كان اكثر ‪ replenish‬في ‪ ،token bucket‬فإننا سوف نحصل‬
‫على عدد اقل من ‪ .tokens‬عندما يكون ‪ bucket‬في حالة ‪ full‬فإن ‪ tokens‬سوف تقسم وتحذف‪.‬‬

‫األن في حالة وصل ‪ packet‬فماذا سوف تعمل ‪policer‬؟‬


‫في حالة كان عدد ‪ bytes‬في ‪ packet‬اقل من او يساوي عدد ‪ tokens‬في ‪ .bucket‬فإن ‪ packet‬سوف ‪.conforming‬‬
‫لكن في حالة كان عدد ‪ bytes‬في ‪ packet‬اكبر من عدد ‪ tokens‬في ‪ ،bucket‬فإن ‪ packet‬سوف يدخل في حالة ‪.exceeding‬‬
‫بالتالي فإن ‪ policer‬سوف تترك ‪ tokens‬في ‪ bucket‬وتقوم بعملية ‪.exceeding packets‬‬
‫في ‪ single rate two-color‬اي ان لدينا خياران هما اما ‪ conforming‬اي عملية ‪ .forwarding‬او ‪ exceeding‬وهي تعني ‪.drop‬‬
‫‪Single-Rate Three Color Policer‬‬ ‫‪‬‬
‫ليست البيانات دائما في لديها مرونة كما في ‪ .VoIP‬فإننا سوف نرسل العديد من ‪ packets‬في وقت واحد سريع‪ .‬هذا سوف يجعل‬
‫‪ policer‬يصل الى حالة ‪ .burst‬اي وصول بيانات اكثر من الطاقة اإلستيعابية‪.‬‬
‫هنا يتم إضافة ‪ bucket‬اخر‪ .‬حيث يكون ‪ bucket‬األول من اجل ‪ Bc (committed burst) tokens‬والثاني‬
‫من اجل ‪ .Be (excess burst) tokens‬اي سيكون لدينا ثالث خيارات وهي‪:‬‬
‫‪o Conforming‬‬
‫‪o Exceeding‬‬
‫‪o Violating‬‬
‫من اجل فهم الموضوع سوف نالحظ الشكل المقابل‪.‬‬
‫لدينا ‪ .two buckets‬سوف نسمى األول ‪ bc‬والثاني ‪.be‬‬
‫باستخدام الصيغة المعروفة سابقا للحساب‪.‬‬
‫عندما يكون ‪ bc‬في حالة ‪ full‬فإننا سوف نسكب او ما نطلق‬
‫عليه (‪ )spillage‬في ‪ .be‬في حالة كان الثاني ‪ full‬ايضا‪،‬‬
‫فإن ‪ policer‬سوف تبدا تأخذ العمل كما يلي‪:‬‬
‫في حالة وصل ‪ packet‬وكان عدد ‪ bytes‬اقل من او يساوي ع‬
‫دد ‪ tokens‬في ‪ bc‬فإن ‪ packet‬سوف يعمل عليه ‪conforming‬‬
‫او ما نطلق عليه ‪ .forwarding‬في حالة كان عدد ‪ bytes‬في‬
‫‪ packet‬اكبر من ‪ bc‬فإننا ننظر هل ان عدد ‪ bytes‬اقل من او يساوي‬
‫عدد ‪ tokens‬في ‪ ،be‬فإن ‪ packet‬يكون في حالة ‪.exceeding‬‬
‫يقوم ‪ policer‬بعملية إزالة العدد المطلوب من ‪ tokens‬من ‪ be‬من‬
‫اجل احالل ما يقابلها من ‪ bytes‬اي ان الـ ‪ action‬في هذه الحالة‬
‫هي ‪.exceeding packets‬‬
‫لكن ماذا لو كان اكبر فإننا في هذه الحالة سوف نتجه الى ‪.violating‬‬
‫اليتم اخذ اي ‪ tokens‬ال من ‪ bc‬وال من ‪ be‬وهنا يكون ‪action‬‬
‫هو ‪.violating packets‬‬
‫ببساطة في حالة استخدام ‪ bc‬فإن الحالة هي ‪ .conforming‬في حالة استخدام ‪ be‬فإن الحالة هي ‪ .exceeding‬اما في حالة عدم‬
‫استخدام اي منها فإن الحالة هي ‪.violating‬‬
‫في الشكل ادناه يتم توليد ‪ Tokens‬بواسطة ‪ .IOS‬ويوضح ذلك بشكل اكبر‪.‬‬
‫في الشكل ادناه بعض المصطلحات التي نفسرها‪:‬‬

‫‪‬‬ ‫‪CIR: Committed information rate.‬‬


‫‪‬‬ ‫‪CBS: Committed burst size.‬‬
‫‪‬‬ ‫‪EBS: Excess burst size.‬‬
‫‪‬‬ ‫‪Tc: Token count of CBS.‬‬
‫‪‬‬ ‫‪Te: Token count of EBS.‬‬
‫‪‬‬ ‫‪B: Byte size of offered packet‬‬
‫‪Dual-Rate Three-Color Policers‬‬ ‫‪‬‬
‫الفكرة وهي انه لدينا فقط ‪ CIR‬وانما سيكون لدينا ايضا )‪ .PIR (Peak Information Rate‬وهذا جديد‪ .‬حيث انه في حالة كانت‬
‫‪ bytes‬الواصلة اكبر من ‪ CIR‬ولكن اقل من ‪ PIR‬فإننا نكون في حالة ‪ .exceeding‬لكن في حالة كانت ‪ bytes‬الموجودة في ‪packet‬‬
‫القادم اكبر من ‪ PIR‬فإننا ندخل في حالة ‪.violating‬‬
‫الشكل المقابل يوضح ذلك‪.‬‬
‫لدينا ‪ .two buckets‬حيث يسمى الثاني‬
‫‪ .PIR‬وهنا اليتم تعبئتة بواسطة الحمولة الزائدة‬
‫من ‪ bc‬ولكن يتم بشكل مباشر‪.‬‬
‫لكن كيف يكون لدينا ‪ two bucket‬ممتلئة؟‬
‫هنا سوف نقوم بعملية إعداد ‪ CIR‬وكذلك ‪.PIR‬‬
‫ففي حالة مثال كان لدينا ‪،CIR=128.000 bps‬‬
‫وكان لدينا ‪.PIR=256.000 bps‬‬
‫فإننا بالطبع النزال نستخدم نفس الصيغة المعروفة‬
‫سابقا‪.‬‬
‫حيث سيكون الناتج‬
‫هو ‪0.5 * 128.000 / 8 = 8.000 tokens‬‬
‫هنا لدينا ايضا حساب ‪ PIR‬وهي كما يلي‪:‬‬
‫‪ 0.5 * 256.000 / 8 = 16.000 tokens‬كما نرى‬
‫ان ‪ PIR‬سوف يكون لديه اكثر ‪tokens‬‬
‫من ‪ .bc bucket‬لكن كيف سيتم استخدام ‪ tokens‬المختلفة؟‬
‫سنقول انه في حالة كان عدد ‪ bytes‬في ‪ packet‬القادم اقل من او يساوي عدد ‪ tokens‬في ‪ Bc bucket‬فإن ‪ packet‬سوف يكون في‬
‫حالة ‪ .conforming‬حيث ان ‪ policer‬سوف يأخذ ‪ tokens‬المطلوبة من ‪ Bc bucket‬ويقوم بعملية ‪.action‬‬
‫لكن في حالة ‪ packet‬كان اكبر من ‪ Bc‬ولكن اقل من ‪ Be‬او بمعني اقل من ‪ .PIR‬فإن ‪ policer‬سوف يدخل في ‪ action‬ستكون هي‬
‫‪.exceeding‬‬
‫لكن ماذا لو كان اكبر من ‪ PIR‬فإننا في هذه الحالة سوف ندخل في حالة ‪.violating‬‬
‫بعض المصطلحات المستخدمة وهي‪:‬‬
‫‪ PIR: Peak information rate.‬‬
‫‪ PBS: Peak burst size.‬‬
‫‪ Tp: Token count of PBS.‬‬

‫وكمثال على ما سبق‪:‬‬


.‫الجدول ادناه للمقارنة‬

Single Rate, Two Color Single Rate, Three Color Dual-Rate, Three Color
1st bucket based on time difference of based on time difference of based on time difference of
refill arrival between 2 packets arrival between 2 packets arrival between 2 packets
no 2nd bucket Filled by spilled tokens from Same as the 1st bucket, but
2nd bucket available 1st bucket based on PIR rate
refill
conforming take tokens from 1st bucket take tokens from 1st bucket take tokens from bot buckets
Exceeding all packets that are not packets that are not packets that are not
conforming conforming, take tokens from conforming but enough
2nd bucket tokens in 2nd bucket
Violating not available All packets that are not All packets that are not
conforming or exceeding conforming or exceeding

.‫دعنا نوضح ذلك بالمثال التالي في الشكل ادناه‬

Single Rate Two-Color Policing


:‫ كما يلي‬class-map ‫ سوف نقوم بإنشاء‬.MQC (Modular QoS Command-Line Interface) ‫باستخدام‬
R2(config)#class‐map ICMP
R2(config‐cmap)#match protocol icmp
:‫ كما يلي‬ICMP traffic ‫ من اجل مطابقة‬NBAR ‫سوف نستخدم‬
R2(config)#policy‐map SINGLE‐RATE‐TWO‐COLOR
R2(config‐pmap)#class ICMP
R2(config‐pmap‐c)#police 128000
R2(config‐pmap‐c‐police)#conform‐action transmit
R2(config‐pmap‐c‐police)#exceed‐action drop
‫ او‬128000 bps ‫ ليكون‬policing ‫“ وتم بعدها إعداد‬SINGLE-RATE-TWO-COLOR” ‫ والتي تسمى‬policy-map ‫تم انشاء‬
‫ لذلك الـ‬drop ‫ سوف يتم عمل‬128 Kbps ‫ حيث انه عندما يزيد عن‬.action ‫ وثم إعداد‬.class-map ‫ تحت‬.)128 Kbps( ‫بالضبط‬
.packet
:‫بإمكانك عمل كل شي في سطر واحد كما يلي‬
R2(config‐pmap‐c)#police 128000 conform‐action transmit exceed‐action drop
.‫كال الخيارين صحيحين ولكن بطريقتين مختلفتين‬
:policer ‫ سوف يتم تفعيل‬interface ‫االن تحت‬
R2(config)#interface FastEthernet 0/0
R2(config‐if)#service‐policy input SINGLE‐RATE‐TWO‐COLOR
.policer ‫ لتلك‬activate ‫ من اجل عملية‬service-policy ‫سوف تحتاج الى استخدام‬
:‫ كما يلي‬R1 ‫ من‬traffic ‫لنعمل األن على توليد‬
R1#ping 192.168.12.2 repeat 999999
Type escape sequence to abort.
Sending 999999, 100‐byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!
:‫ كما يلي‬R2 ‫االن حان دور عرض حالة‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: SINGLE‐RATE‐TWO‐COLOR
Class‐map: ICMP (match‐all)
1603 packets, 314382 bytes
5 minute offered rate 18000 bps, drop rate 0 bps
Match: protocol icmp
police:
cir 128000 bps, bc 4000 bytes
conformed 1499 packets, 199686 bytes; actions:
transmit
exceeded 104 packets, 114696 bytes; actions:
drop
conformed 10000 bps, exceed 0 bps
Class‐map: class‐default (match‐any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
‫ بشكل اوتوماتيكي‬IOS ‫ في حالة عدم إعدادها فسوف تقوم‬.4000 bytes ‫ تم حسابها لتكون‬bc ‫ بدوره حيث ان‬policer ‫كما نالحظ فقد قام‬
.CIR ‫بعملية حساب القيمة بناء على معدل‬
Single Rate Three-Color Policing
:‫ كما يلي‬class-map ‫سوف نستخدم هنا‬
R2(config)#policy‐map SINGLE‐RATE‐THREE‐COLOR
R2(config‐pmap)#class ICMP
R2(config‐pmap‐c)#police 128000
R2(config‐pmap‐c‐police)#conform‐action transmit
R2(config‐pmap‐c‐police)#exceed‐action set‐dscp‐transmit 0
R2(config‐pmap‐c‐police)#violate‐action drop
.‫ واليزال االرسال ايضا مستمر‬0 ‫ الى‬DSCP ‫ عن ذلك فسوف يتم قيمة‬traffic ‫ فعندما تزيد‬128 kbps ‫ هنا تساوي‬CIR ‫قيمة‬
.three-Color ‫ لكن بـ‬single rate ‫ ونضع اعداد‬single rate ‫لنزيل اإلعدادات الخاصة بـ‬
R2(config‐if)#no service‐policy input SINGLE‐RATE‐TWO‐COLOR
R2(config‐if)#service‐policy input SINGLE‐RATE‐THREE‐COLOR
:‫االن حان وقت االختبار‬
R1#ping 192.168.12.2 repeat 999999
Type escape sequence to abort.
Sending 999999, 100‐byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!
‫ سوف يتم حذفها كما يلي‬packets ‫نعم بعض الـ‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: SINGLE‐RATE‐THREE‐COLOR
Class‐map: ICMP (match‐all)
4170 packets, 475380 bytes
5 minute offered rate 20000 bps, drop rate 0 bps
Match: protocol icmp
police:
cir 128000 bps, bc 4000 bytes, be 4000 bytes
conformed 2658 packets, 303012 bytes; actions:
transmit
exceeded 1470 packets, 167580 bytes; actions:
set‐dscp‐transmit default
violated 42 packets, 4788 bytes; actions:
drop
conformed 25000 bps, exceed 14000 bps, violate 0 bps
Class‐map: class‐default (match‐any)
9 packets, 576 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
.violated ‫ فإن مصيرها الى‬conformed or exceeded ‫تلك التي لم تلق‬

Dual Rate Three-Color Policing


:‫ كما يلي‬policer ‫االن حان دور الصنف الثالث من‬
R2(config)#policy‐map DUAL‐RATE‐THREE‐COLOR
R2(config‐pmap)#class ICMP
R2(config‐pmap‐c)#police cir 128000 pir 256000
R2(config‐pmap‐c‐police)#conform‐action transmit
R2(config‐pmap‐c‐police)#exceed‐action set‐dscp‐transmit 0
R2(config‐pmap‐c‐police)#violate‐action drop
.PIR=256 Kbps ‫ وايضا‬CIR=128 Kbps ‫األن‬
:‫ ونطبق األعدادات الجديدة‬.‫ السابقة‬single ‫لنلغى إعدادات‬
R2(config)#interface FastEthernet 0/0
R2(config‐if)#no service‐policy input SINGLE‐RATE‐THREE‐COLOR
R2(config‐if)#service‐policy input DUAL‐RATE‐THREE‐COLOR
:‫اختبار اإلعدادات‬
R1#ping 192.168.12.2 repeat 99999
Type escape sequence to abort.
Sending 99999, 100‐byte ICMP Echos to 192.168.12.2, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
:‫ولعرض النتائج كما يلي‬
R2#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy input: DUAL‐RATE‐THREE‐COLOR
Class‐map: ICMP (match‐all)
7472 packets, 851808 bytes
5 minute offered rate 29000 bps, drop rate 0 bps
Match: protocol icmp
police:
cir 128000 bps, bc 4000 bytes
pir 256000 bps, be 8000 bytes
conformed 3713 packets, 423282 bytes; actions:
transmit
exceeded 3715 packets, 423510 bytes; actions:
set‐dscp‐transmit default
violated 44 packets, 5016 bytes; actions:
drop
‫‪conformed 32000 bps, exceed 32000 bps, violate 0 bps‬‬
‫)‪Class‐map: class‐default (match‐any‬‬
‫‪0 packets, 0 bytes‬‬
‫‪5 minute offered rate 0 bps, drop rate 0 bps‬‬
‫‪Match: any‬‬
‫بعض ‪ packets‬اعاله تم عمل ‪ conforming‬عليها‪ ،‬بينما بعضها ‪ exceeding‬والبقية ‪.violating‬‬

‫‪QoS Traffic Shaping Explained‬‬


‫‪ Shaping‬وهي تقنية في ‪ QoS‬تستخدم من اجل إجبار طرف ما ان يخفض من معدل ‪ bits‬اقل من السعة لـ (‪.)physical interface‬‬
‫معظم ‪ ISP‬تستخدم اما ‪ shaping or policing‬من اجل الوصول الى )‪ (traffic contract‬مع الـ ‪.customers‬‬
‫في ‪ shaping‬يتم تخزين ‪ traffic‬التي تزيد عن معدل معين‪ .‬لكن في ‪ policing‬يتم حذف ما يزيد عن معدل معين‪.‬‬
‫مثال اتفقت مع مزود الخدمة على ان تصل خط ‪ fiber‬ولكن السرعة تكون ‪ .10 Mbps‬ففي حالة زادت عن المعدل المتفق عليه لديه خياران‬
‫وهما اما حذف ما يزيد وهذا ما نطلق عليه ‪ .policing‬والخيار الثاني وهو تخزين ما يزيد وهذا ما نطلق عليه ‪.shaping‬‬
‫لكن لماذا نتجه الى ‪shaping‬؟‬

‫‪ -1‬بدال من اإلنتظار في ‪ policer‬من اجل حذف او رمي الـ ‪ .traffic‬لما ال نقوم بعملية ‪ shape‬للمنفذ المتصل بـ ‪.ISP‬‬
‫‪ -2‬من اجل تجنب عمل ‪ blocking‬الي ‪ .egress‬حيث اننا سوف نتجه من ‪ high speed interface‬الى منفذ اقل‪ .‬وبالتالي‬
‫فإن ‪ traffic‬ستكون معرضة حتما للحذف‪.‬‬
‫يقوم ‪ routers‬بعملية إرسال ‪ bits‬كل ‪ .physical clock rate‬دعنا نضرب مثال على ذلك‪.‬‬
‫في حالة كان لدنيا ‪ serial link‬وكانت سعته ‪ .128 kbps‬فتخيل معي اننا نريد عمل ‪ shape‬له الى ‪ .64 kbps‬ففي حالة اردنا ذلك‬
‫فإننا سوف نحتاج على ان فقط بقدرة ‪ 50%‬وثم نوقف ‪ 50%‬ونرسل وهكذا‪.‬‬
‫مثال‪:‬‬
‫في حالة كان لدينا خط بسعة ‪ 128 kbps‬لكن تعتبر ‪ CIR‬هي ‪ .96 kbps‬فإن هذا سوف يعني اننا سوف نرسل بعدل ‪ 75%‬من الزمن ونتوقف‬
‫‪ 25%‬من الزمن وتحسب كما يلي (‪.)96 / 128 = 0.75‬‬
‫اظن اآلن اتضحت الصورة‪.‬‬
‫في الشكل المقابل لدينا )‪ ،(physical bitrate=128 kbps‬وقمنا‬
‫بعمل ‪ shape‬ليصبح ‪ .64 kbps‬في المحور العمودي سوف نالحظ‬
‫ان المعدل هو ‪ .128 kbps‬اما في المحور األفقي فإن لدينا الزمن والذي‬
‫يمثله من ‪ 0‬الى ‪ 1000‬ميلي ثانية‪ .‬تمثل الخطوط الخضراء الى عملية إرسال‬
‫‪ .Traffic‬حيث اننا نتوقف ونرسل‪.‬‬
‫اول ‪ 62.5 ms‬قمنا بعملية إرسال ‪ traffic‬وبعدها توقفنا لمدة‬
‫‪ .62.5 ms‬اول زمن بعده سيكون )‪.(62.5 + 62.5 = 125 ms‬‬
‫نسمى ذلك ‪ interval‬بـ )‪ .Tc (Time Interval‬سيكون لدينا ‪ 8 time intervals‬وكل منها يمثل ‪ .125 ms‬حيث ان المجموع‬
‫سيكون ‪.8*128ms=1000ms‬‬
‫معظم ‪ Cisco routers‬لديها المعدل ‪ Tc‬او اإلفتراضي بالقيمة ‪ .125 ms‬حيث اننا ارسلنا في السابق بمعدل ‪ 50%‬فقط‪ .‬وتوقفنا لمدة ‪.50%‬‬
‫هنا سيكون ‪ 50%‬من ‪ 128 kbps‬حيث يصبح معدل ‪ shaping‬هو ‪.64 kbps‬‬
‫وهنا سوف نحسب كما معدل ‪ bits‬في كل ‪ Tc‬والذي من خالله اصل الى معدل ‪ .shaping‬حيث تسمى‬
‫هذه القيمة بـ )‪ .Bc (committed burst‬هنا سيكون ‪ Bc‬هو ‪ 8.000 bits‬اي ان كل ‪ 125 ms‬سيتم ارسال ‪.8.000 bits‬‬
‫دعني الخص الموضوع كما يلي‪:‬‬
‫)‪ Tc (time interval‬وهو زمن بالميلي ثانية الذي نستطيع ارسال )‪.Bc (committed burst‬‬ ‫‪-‬‬
‫)‪ Bc (committed burst‬وهو حجم ‪ traffic‬الذي نرسله خالل ‪ TC‬ويقاس بـ ‪.bits‬‬ ‫‪-‬‬
‫)‪ CIR (committed information rate‬وهو معدل ‪ bits‬المعرفة في )‪(traffic contract‬والذي يتم اسقباله من ‪.ISP‬‬ ‫‪-‬‬
‫ولمعرفة الصيغ سيكون كما يلي‪:‬‬
‫‪Bc = Tc * CIR‬‬

‫‪Tc value:‬‬
‫‪Tc = Bc / CIR‬‬
‫دعنا نأخذ مثال اخر هو حالة كان معدل البيانات ‪ 256 kbps‬وكان لدينا ‪ shaping‬بمعدل يساوي ‪ .128 kbps‬فكم عدد ‪ bits‬التي سوف ترسل‬
‫‪TC‬؟‬
‫للجواب اوال لدينا المعطيات التالية وهي‪:‬‬
‫‪ CIR = 128 kbps‬ايضا لدينا ‪ TC‬افتراضيا تساوي ‪ .125 ms‬ولذلك نطبق المعادلة السابقة ليكون الناتج هو‪:‬‬
‫‪125 ms x 128 kbps = 16.000 bits‬‬
‫اي ان ‪ Bc = 16 bits‬حيث ان كل ‪ Tc‬سوف يتم ارسال ‪.16.000 bits‬‬
‫اي ان المفهوم اننا سوف نرسل ‪ 16.000 bits‬كل ‪ Tc‬ومن ثم سوف نتوقف حي‬
‫تنتهي ‪ Tc‬وتبدأ ‪ Tc‬جديدة‪ .‬الرائع في ‪ shaping‬وهي ان كل ‪ traffic‬سوف يرسل‬
‫حيث اننا سوف يتم تخزينة‪ .‬لكن على الجانب اآلخر سوف يتسبب ذلك في عملية تأخير‬
‫او ‪ delay‬وكذلك ‪ .jitter‬لنضرب المثل التالي‪:‬‬
‫في الشكل المقابل سوف يكون لدنيا نفس ‪ interface‬مع معدل ‪ bit‬هو ‪.128 kbps‬‬
‫وسيكون لدينا ‪.Tc=125 ms‬‬
‫عملية ‪ shaping‬سوف يتم اعدادها لتكون ‪ .64 kbps‬حيث اننا سوف نالحظ اننا‬
‫ناخذ ‪ 62 ms‬من اجل اإلرسال‪ .‬لكن كيف جاء هذا الرقم؟‬
‫لنأخذ التالي‪.125 ms * 64 kbps= 8.000 bits :‬‬
‫اآلن دعنا نحسب قيمة ‪ delay‬حسب المعادلة‪:‬‬
‫‪Delay = Bc / physical bitrate‬‬
‫‪8.000 / 128.000 = 0.0625‬‬
‫اي اننا سوف نأخذ كل ‪ 62.5 ms‬من اجل ارسال ‪ 8000 bits‬خالل منفذ بسعة ‪.128 kbps‬‬
‫بعد ان طبقا الصيغ السابقة رأينا كم من الوقت سوف نأخذ من اجل إرسال ‪ 8.000 bits‬من خالل منفذ بسعه ‪ .128 Kbp‬والذي يساوي ‪62.5 ms‬‬
‫وكلما كان سرعة ‪ link‬اكبر كان ‪ delay‬اقل‪ .‬وهذا ما يعكسه المنفذ ‪ T1‬الذي لديه سعة تصل الى ‪ .1.54 Mbps‬وحسب المعادلة سيكون لدينا‬
‫بالطبع الناتج ‪ 8.000 / 1.540.000 = 0.0051‬اي في النهاية أننا سوف نأخذ ‪ 5 ms‬من اجل إرسال ‪ 8000 bits‬من خالل منفذ ‪.T1‬‬

‫في النهاية قد يكون )‪ .(excess burst‬عندما اقوم بإعداد ‪ shaping‬سوف يكون لدي خيار هو ارسال اكثر من سعة ‪ Bc‬في بعض ‪.Tcs‬‬
‫هذا رائع جدا‪ .‬لكن كيف ذلك؟‬
‫تخيل معي الشكل المقابل ان لدينا ‪ .bucket‬قمنا بملئ ذلك بـ ‪ .tokens‬حيث تمثل كل ‪token‬‬
‫ما مقداره ‪ .1 bit‬بعدد ‪ bits‬التي سوف ترسل سوف نأخذ مقدارها ‪ tokens‬وهذا مطلوب‬
‫من اجل إرسال ‪ packet‬معين‪.‬‬
‫مثال لدي ‪ 120 bits‬سوف أخذ مقدارها ‪ 120 tokens‬من ‪ bucket‬الذي هو في األصل‬
‫سيكون ‪.Bc‬‬
‫عندما ‪ bucket‬يصبح فارغ لن نستطيع إرسال اي شيء‪ .‬بل سوف ننتظر حتي يأتي‬
‫‪ Tc‬التالية‪ .‬حيث سنقوم بعملية ملئ ‪ bucket‬بعدد معين من ‪ tokens‬ومن ثم نرسل مرة‬
‫اخرى‪.‬‬
‫هذا سوف يعني اننا لن نرسل اكثر من ‪.Bc‬‬

‫دعنا نأخذ المثال التالي‪:‬‬


‫ اخر وهو‬link ‫ وكذلك بواسطة‬serial ‫ متصلين بشكل مباشر مع بعضهما بواسطة‬two routers ‫حيث ان لدينا على سبيل المثال‬
.server ‫ بينما يمثل في الجهة اليمنى‬،client ‫ هو يمثل‬computer ‫ في الجهة اليسرى سيكون‬.FastEthernet
R1#
ip route 192.168.2.0 255.255.255.0 192.168.12.2

R2#
ip route 192.168.1.0 255.255.255.0 192.168.12.1
.128 kbps ‫ الى‬clock rate ‫سوف نعمل على وضع‬
.‫ من اجل المراقبة والقياس للسرعة‬iperf ‫ سوف نستخدم برنامج‬computers ‫في‬

R2(config)#interface Serial 0/0/0


R2(config‐if)#clock rate 128000
:‫ كما يلي‬iperf ‫ سوف نفتح‬server ‫ الذي يمثل‬computer ‫في‬
SERVER# iperf ‐s
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
:‫ كما يلي‬server ‫ القادمة من‬TCP ‫ سوف نجعله يستمع لـ‬client ‫ الذي يمثله‬computer ‫اما في‬
CLIENT# iperf ‐c 192.168.2.2 ‐P 8
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Client connecting to 192.168.2.2, TCP port 5001
TCP window size: 85.0 KByte (default)
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
[ 4] local 192.168.1.1 port 44344 connected with 192.168.2.2 port 5001
[ 5] local 192.168.1.1 port 44345 connected with 192.168.2.2 port 5001
[ 6] local 192.168.1.1 port 44346 connected with 192.168.2.2 port 5001
[ 7] local 192.168.1.1 port 44347 connected with 192.168.2.2 port 5001
[ 8] local 192.168.1.1 port 44348 connected with 192.168.2.2 port 5001
[ 3] local 192.168.1.1 port 44343 connected with 192.168.2.2 port 5001
[ 9] local 192.168.1.1 port 44349 connected with 192.168.2.2 port 5001
[ 10] local 192.168.1.1 port 44350 connected with 192.168.2.2 port 5001
:‫ ستكون النتيجة كما يلي‬server ‫ في‬.8 ‫ التي سوف يؤسسها وهي‬session ‫ الى عدد‬P ‫حيث يشير‬
Server#
[ ID] Interval Transfer Bandwidth
[ 4] 0.0‐136.2 sec 256 KBytes 15.4 Kbits/sec
[ 10] 0.0‐137.0 sec 256 KBytes 15.3 Kbits/sec
[ 11] 0.0‐138.0 sec 256 KBytes 15.2 Kbits/sec
[ 9] 0.0‐138.4 sec 256 KBytes 15.1 Kbits/sec
[ 5] 0.0‐148.0 sec 384 KBytes 21.3 Kbits/sec
[ 6] 0.0‐166.7 sec 384 KBytes 18.9 Kbits/sec
[ 8] 0.0‐171.4 sec 384 KBytes 18.4 Kbits/sec
[ 7] 0.0‐172.9 sec 384 KBytes 18.2 Kbits/sec
[SUM] 0.0‐172.9 sec 2.50 MBytes 121 Kbits/sec
‫ وهو ما‬.121 kbps ‫ لها جميعا هو‬throughput ‫ تم جمعها في النهاية ليكون‬.server ‫ وكذلك‬client ‫اي تم تأسيس ثمان اتصال منفردة مابين‬
.clock rate ‫ والذي يمثله‬128 kbps ‫يقترب من المعدل‬
.iperf ‫ الى‬throughput ‫ لتكون بحدود‬shaping ‫ من اجل اعداد‬MQC (Modular Quality of Service) ‫سوف نستخدم‬
:‫ سوف نستخدم التالي‬R1 ‫في‬
R1(config)#ip access‐list extended IPERF_CLIENT_SERVER
R1(config‐ext‐nacl)#permit ip host 192.168.1.1 host 192.168.2.2
---------------------------------------------------------------------
R1(config)#class‐map IPERF
R1(config‐cmap)#match access‐group name IPERF_CLIENT_SERVER
---------------------------------------------------------------------
R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 64000
:‫ على المنفذ كما يلي‬policy-map ‫االن لنفعل‬
R1(config)#interface Serial 0/0/0
R1(config‐if)#service‐policy output SHAPE_AVERAGE
:‫ مرة اخرى‬iperf ‫االن لنحاول عمل‬
CLIENT# iperf ‐c 192.168.2.2 ‐P 8
:64000 ‫ تذكر اننا حددنا الى‬.‫لنرى كم المجموع‬
SERVER#
[SUM] 0.0‐300.5 sec 2.12 MBytes 59.3 Kbits/sec
.R1 ‫ لنرى ذلك في‬.64 kbps ‫الرقم يقترب من‬

R1#show policy‐map interface Serial 0/0/0


Serial0/0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
1916 packets, 2815928 bytes
5 minute offered rate 41000 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/324/0
(pkts output/bytes output) 1592/2330664
shape (average) cir 64000, bc 256, be 256
target shape rate 64000
Class‐map: class‐default (match‐any)
102 packets, 7456 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/0/0
(pkts output/bytes output) 47/3319
.‫ التي انشأناها‬policy-map ‫ تلك‬packets ‫لقد طابقت‬
‫؟‬Tc ‫ لكن كيف سيتم حساب قيمة‬.256 bits ‫ الى‬Bc ‫ولقد تم حساب‬
Tc = Bc / CIR
256 / 64000 = 0.004.
.4 ms ‫ تصل الى‬Tc ‫ وجدنا ان قيمة‬Bc ‫باستخدام قيمة‬
:‫ كما يلي‬Be ‫ وكذلك قيم‬Tc ‫ لنالحظ مدى التغيير في قيم‬clock rate=256 kbps ‫دعنا نقوم بعملية التالعب بقيمة‬

R2(config)#interface Serial 0/0/0


R2(config‐if)#clock rate 256000
:‫لنقوم بعملية التغيير كما يلي‬
R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 128000
:‫الستعراض ما حدث من تغيير‬
R1#show policy‐map interface Serial 0/0/0
Serial0/0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
1916 packets, 2815928 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/324/0
(pkts output/bytes output) 1592/2330664
shape (average) cir 128000, bc 512, be 512
target shape rate 128000
:‫ كما يلي‬Tc ‫لنرى الزمن‬
512 / 128000 = 0.004
:‫ مرة اخرى‬client ‫ لنرى في‬Tc=4 ms ‫قيمة‬
CLIENT# iperf ‐c 192.168.2.2 ‐P 8
:‫لنرى النتيجة‬
SERVER#
[SUM] 0.0‐153.5 sec 2.25 MBytes 123 Kbits/sec
:512 kbps ‫ الى‬clock rate ‫دعنا نزود قيمة‬
R2(config)#interface Serial 0/0/0
R2(config‐if)#clock rate 512000
:‫ المتوفرة كما يلي‬bandwidth ‫ من قيمة‬50% ‫سوف نجعل القيمة عبارة عن‬
R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 256000
:‫ كما يلي‬router ‫لنرى في‬
R1#show policy‐map interface Serial 0/0/0
Serial0/0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
8380 packets, 12339992 bytes
5 minute offered rate 79000 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/1304/0
(pkts output/bytes output) 7076/10387712
shape (average) cir 256000, bc 1024, be 1024
target shape rate 256000
:Tc ‫لنرى قيمة‬
1024 / 256000 = 0.004
:client ‫ولنجرب في‬
CLIENT# iperf ‐c 192.168.2.2 ‐P 8

SERVER#
[SUM] 0.0‐93.8 sec 2.75 MBytes 246 Kbits/sec
.246 kbps ‫لقد اقتربنا من الرقم حيث وصلنا الى‬
.fastethernet ‫ سوف نستخدم‬serial ‫ اسرع؟ اي بدل‬interface ‫ماذا لو استخدمنا‬
R1(config)#no ip route 192.168.2.0 255.255.255.0 192.168.12.2
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.21.2
R2(config)#no ip route 192.168.1.0 255.255.255.0 192.168.12.1
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.21.1
.throughput ‫لنرى ما هو نوع‬
CLIENT# iperf ‐c 192.168.2.2 ‐P 8
SERVER#
[SUM] 0.0‐10.2 sec 116 MBytes 95.4 Mbits/sec
:100 Mbps ‫ بدال من‬1 Mbps ‫ ليكون‬shap ‫سوف نجعل‬
R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 1m
R1(config)#interface FastEthernet 0/0
R1(config‐if)#service‐policy output SHAPE_AVERAGE
:router ‫ التي سوف يحسبها‬Bc ‫كم قيمة‬
R1#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/0/0
(pkts output/bytes output) 0/0
shape (average) cir 1000000, bc 4000, be 4000
target shape rate 1000000
:Tc ‫لنحسب قيمة‬
4000 / 1000000 = 0.004 ms.
.4 ms ‫ايضا القيمة‬
.Tc=125 ms ‫ األقدم فإن قيمة‬IOS ‫ لكن في‬.‫ طبقا لذلك‬Bc ‫ وتحسب قيمة‬Tc=4 ms ‫ تفضل القيمة‬cisco IOS version ‫اي ان معظم‬
:iperf ‫مرة اخرى‬
CLIENT~# iperf ‐c 192.168.2.2 ‐P 8

SERVER#
[SUM] 0.0‐27.4 sec 3.12 MBytes 955 Kbits/sec
.1 Mbps ‫ وهذه قيمة قريبة من‬shaped = 955 kbps ‫رائع لقد اقتربنا من القيمة حيث وصلنا الى‬
:CIR=1 Mbps ‫ مع وجود‬Tc=10 ms ‫ اي‬.‫ ولم نتركها للقيم األفتراضية‬Tc and Bc ‫ماذا لو قمنا نحن بعملية وضع قيم‬
Bc = Tc * CIR
10 ms * 1000 Kbps = 10.000 bits
.Bc=10.000 bits ‫لقد حصلنا على‬
R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 1m 10000
:‫ سوف تكون النتيجة كما يلي‬router ‫في‬
R1#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
2496 packets, 3716912 bytes
5 minute offered rate 19000 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/189/0
(pkts output/bytes output) 2307/3430766
shape (average) cir 1000000, bc 10000, be 10000
target shape rate 1000000
:Tc=125 ms ‫لنأخذ مثال اخر بحيث ان قيمة‬
125 ms * 1000 Kbps = 125.000 bits

R1(config)#policy‐map SHAPE_AVERAGE
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape average 1000000 125000
:‫سوف نحصل على التالي‬
R1#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy output: SHAPE_AVERAGE
Class‐map: IPERF (match‐all)
2496 packets, 3716912 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name IPERF_CLIENT_SERVER
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/189/0
(pkts output/bytes output) 2307/3430766
shape (average) cir 1000000, bc 125000, be 125000
target shape rate 1000000
‫‪Peak Traffic Shaping on Cisco IOS‬‬
‫تدعم ‪ Cisco IOS‬نوعين من ‪ shaping‬وهما‬

‫‪‬‬ ‫‪shape average‬‬


‫ولقد شرحناه سابقا‪.‬‬
‫‪‬‬ ‫‪shape peak‬‬

‫‪ peak shaping‬تستخدم ‪ Be‬بطريقة مختلفة تماما‪ .‬حيث انه اليزال لدينا ‪ token bucket‬والذي يتم تخزينه عند مستوى ‪ Bc+Be‬لكن سوف‬
‫نملئ ‪ token bucket‬بمعدل ‪ Bc and Be tokens‬كل فترة ‪ Tc‬وستكون ‪ tokens‬الغير مستخدمة في حالة ‪ discarded‬كما يبدو في الشكل‪.‬‬

‫كل ‪ Tc‬سوف يتم تجديد كل من ‪.Bc and Be tokens‬‬


‫لكن قد تتسألك لماذا نستخدم ‪shape peak‬؟‬
‫الجواب وهذا على حسب ‪ .traffic contract‬حيث ان ‪ ISP‬قد تعطيك ‪ .CIR and PIR‬حيث انها تضمن لك معدل ‪bandwidth‬‬
‫معين‪ .‬لكن في حالة ‪ PIR‬لن يكون هناك اي ضمان الي معدل من ‪ .bandwidth‬اي في حالة زاد فإن ‪ traffic‬سوف تكون معرضة الى‬
‫حالة ‪.dropped‬‬
‫اي انه في حالة انك ارسلت ‪ traffic‬بمعدل عالي‪ .‬فإنك سوف تستهلك ‪ Bc and Be tokens‬كل ‪ Tc‬وهذا سوف يجعلك تصل الى‬
‫‪.PIR‬‬
‫لكن في حالة كان المعدل اقل فإن هذا سوف يعني اننا سوف نستهلك ‪ Bc tokens‬فقط اي سوف نصل الى ‪ shaping up‬الى مرحلة‬
‫‪ .CIR‬ولن نصل الى ‪.PIR‬‬
‫للتوضيح سوف نأخذ المثال من خالل الشكل ادناه‪.‬‬
‫ سوف يكون لدينا معدل‬R1 ‫ في‬.iperf ‫ عن طريق‬traffic ‫ تلك‬computers ‫ حيث سوف تولد‬.two routers ‫ وكذلك‬two computers ‫لدينا‬
.iperf ‫ مع الزمن سوف نختبر‬.PIR
SERVER# iperf ‐s
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
CLIENT# iperf ‐c 192.168.2.2
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
Client connecting to 192.168.2.2, TCP port 5001
TCP window size: 85.0 KByte (default)
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
[ 3] local 192.168.1.1 port 42646 connected with 192.168.2.2 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0‐10.0 sec 113 MBytes 94.9 Mbits/sec
.100 Mbps ‫تقريبا في حدود‬
R1(config)#ip access‐list extended IPERF_TRAFFIC
R1(config‐ext‐nacl)#permit tcp any any eq 5001
R1(config‐ext‐nacl)#exit
!
R1(config)#class‐map IPERF
R1(config‐cmap)#match access‐group name IPERF_TRAFFIC
R1(config)#policy‐map SHAPE_PEAK
R1(config‐pmap)#class IPERF
R1(config‐pmap‐c)#shape peak 128000
!
R1(config)#interface FastEthernet 0/0
R1(config‐if)#service‐policy output SHAPE_PEAK
:clients ‫مرة اخرى لنالحظ ما يحصل في‬
CLIENT# iperf ‐c 192.168.2.2
SERVER#
[ 5] 0.0‐21.4 sec 640 KBytes 245 Kbits/sec
245 kbps ‫المعدل فقط‬
R1#show policy‐map interface FastEthernet 0/0
FastEthernet0/0
Service‐policy output: SHAPE_PEAK
Class‐map: IPERF (match‐all)
466 packets, 699180 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name IPERF_TRAFFIC
Queueing
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/9/0
(pkts output/bytes output) 457/685554
shape (peak) cir 128000, bc 512, be 512
target shape rate 256000
Class‐map: class‐default (match‐any)
32 packets, 3447 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
queue limit 64 packets
(queue depth/total drops/no‐buffer drops) 0/0/0
(pkts output/bytes output) 32/3447
‫ واكبر معدل من الممكن ارساله وهو‬.512 bits ‫ كالهما القمية‬Bc and Be ‫ لدينا‬.‫ وهو الذي تم اعداده‬.CIR=128 kbps ‫اي ان المعدل‬
PIR=256 Kpbs
Shaping with Burst up to interface speed
.PVC=512 kbps ‫ في األعلى‬.physical AR (Access Rate)=1536 kbps ‫ يعتبر‬.two PVCs ‫ ولديه‬router ‫في الشكل المقابل لدينا‬
:‫ سيكون لدينا المعطيات التالية‬.PVC=64 kbps ‫بينما في األسفل‬
.CIR rate ‫ له الى‬shape ‫ سوف يكون‬PVC ‫كل‬ -
‫ سوف يكون قاد‬PVCs ‫ كال من‬inactivity ‫بعد مدة زمنية‬ -
.physical access rate ‫ الى‬burst up ‫ر على‬
.Tc=50 ms -
.CIR=512 kbps ‫ حيث ان‬.‫ األعلى‬PVC ‫ في‬Bc ‫في البداية سوف نحسب قيمة‬
.50 ms ‫ كل‬25.600 bit ‫سوف نستطيع ارسال‬
‫؟‬Be ‫لكن نحسب قيمة‬
.76.800 bits ‫ سوف نرسل‬Tc=50 ms ‫ لذلك مع‬.AR rate=1536 kbps ‫اوال قيمة‬
.Be and Bc=76.800 bits ‫اي ان مجموع‬
:‫ اذن سيكون ناتج المعادلة بكل بساطة‬.Bc=25.600 bits ‫ فإن‬link = 64kbps ‫في حالة كان‬
76.800 bits – 25.600 bits (Bc) = 51.200 bits
How to configure QoS trust boundary on Cisco Switches
.marking ‫بالطبع للشبكة حدود فمن سيقوم بعملية الـ‬
trust boundary ‫ فإن‬.‫دعني اوضح من خالل الشكل المقابل‬
remark ‫ هذا يعني اننا لن نقوم بعملية‬.cisco IP phone ‫في‬
‫ على مستوى‬Ethernet frames ‫ او الي‬packets ‫الي‬
.access layer switch
.traffic ‫ لكل‬mark ‫ سوف تقوم بعملية‬IP phone ‫اي ان‬
.QoS trunst boundary ‫ تعتبر خارج حدود‬computer ‫مع مالحظة ان‬

.trust ‫ خارج حدود‬IP phone ‫ اي ان‬trust ‫في الشكل المقابل لن يكون لدينا‬
‫ وكذلك‬classification ‫ عملية‬access layer switch ‫بمعني اخر سوف تتولى‬
.access layer switches ‫ على مستوى‬marking ‫عملية‬
‫ حيث اننا سوف نستخدم من اجل‬.trust boundary ‫لنبدأ في معرفة كيفية إعداد‬
.‫ في هذا المثال‬Catalyst 3560 ‫ذلك‬
:‫في البداية كما يلي التفعيل‬

3560Switch(config)#mls qos
.‫ التي تم استقبالها‬packets ‫ من كل‬marking ‫ سوف يتجه الى مسح كل‬switch ‫ فإن‬QoS ‫يجب ان تنتبه الى شئ مهم وهو انك عندما تفعيل‬
:‫في حالة لم ترد ان يحدث ذلك كل ما عليك هو ان تتجه الى كتابة األمر التالي‬
3560Switch(config)#no mls qos rewrite ip dscp
:‫في البداية سوف نقوم بالبحث بعملية ادخال األمرمن اجل استعراض ما حدث‬
3560Switch#show mls qos interface fastEthernet 0/1
FastEthernet0/1
trust state: not trusted
trust mode: not trusted
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
.IP phone ‫ او‬CoS ‫ في‬frames ‫ ايضا‬،DSCP ‫ فقط حسب قيم‬trust ‫ بعملية‬cisco switches ‫افتراضيا يقوم‬
3560Switch(config‐if)#mls qos trust cos
.‫ الداخلة الى المنفذ‬frames ‫ لكل‬CoS ‫ حسب قيم‬trust ‫من اجل التأكد من عملية‬
3560Switch#show mls qos interface fastEthernet 0/1
FastEthernet0/1
trust state: trust cos
trust mode: trust cos
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
.cos-to-dscp map ‫ طبقا لـ‬frame ‫ داخل‬packet ‫ في الـ‬DSCP ‫ لقيم‬overwrite ‫ بعملية‬switches ‫بشكل افتراضي سوف تقوم كل‬
:‫في حالة لم ترد ذلك فعليك بما يلي‬
3560Switch(config‐if)#mls qos trust cos pass‐through
‫ سنقوم‬DSCP ‫ لقيمة‬trust ‫ فمن اجل‬،CoS ‫ الى جانب قيمة‬DSCP ‫ لن يتجاوز قيم‬switch ‫ سوف تضمن ان‬pass-through ‫الكلمة‬
:‫بإدخال األمر التالي‬
3560Switch(config‐if)#mls qos trust dscp
3560Switch#show mls qos interface fastEthernet 0/1
FastEthernet0/1
trust state: trust dscp
trust mode: trust dscp
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
‫؟‬Cisco IP phone ‫ على‬trust boundary ‫األن ماذا لو ادرنا ان نضع عملية‬
3560Switch(config‐if)#mls qos trust device cisco‐phone
‫ التي تصل‬CoS values ‫ على كل‬trust ‫ من ان يقوم بعملية‬switch ‫ سوف نخبر‬mls qos trust ‫بإستخدام‬
.Cisco IP phone ‫من‬
3560Switch#show mls qos interface FastEthernet0/1
FastEthernet0/1
trust state: not trusted
trust mode: not trusted
COS override: dis
default COS: 0
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: cisco‐phone
‫؟‬another vendor ‫ وبين‬Cisco IP phone ‫ الفرق بين‬switch ‫قد تتسأل كيف سيعرف‬
.CDP (Cisco Discovery Protocol) ‫بالطبع سوف نستخدم‬
.Cisco IP phone ‫االمر تم لكن ماذا عن الكمبيوتر خلف‬
3560Switch(config‐if)#switchport priority extend cos
IP phone ‫ خلف‬computer ‫ التي تم استقبالها من‬Ethernet frames ‫ لكل‬CoS ‫االمر اعاله سوف يقوم بتجاهل كل قيم‬
3560Switch(config‐if)#switchport priority extend trust
.computer ‫ التي تم استقبالها من‬CoS values ‫ لكل قيم‬trust ‫االمر اعاله سوف يقوم بعملية‬
.4 ‫ سوف يتم وضع التصنيف‬untagged frames ‫ سوف يمر ويكون في حالة‬frame ‫من اجل وضع قيم معينة بنفسك فإن اي‬
3560Switch(config‐if)#mls qos cos 4
.‫ عليها‬remarked ‫ لن يتم وضع اي‬tagged ‫بقية‬
:‫من اجل روية التأثير علي ذلك كما يلي‬
3560Switch#show mls qos interface FastEthernet0/1
FastEthernet0/1
trust state: not trusted
trust mode: not trusted
COS override: dis
default COS: 4
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
:‫ بشكل اجباري سيكون كما يلي‬remarking ‫وفي حالة اردنا عملية‬
3560Switch(config‐if)#mls qos cos override
.traffic ‫ لكل‬remark ‫ من اجل ان يقوم بعملية‬switch ‫اي نخبر‬
:‫دعنا نستخدم نرى التأثير‬
3560Switch#show mls qos interface FastEthernet 0/1
FastEthernet0/1
trust state: not trusted
trust mode: not trusted
COS override: ena
default COS: 4
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
.4 ‫) سوف تضع لها القيمة‬tagged and untagged Ethernet frames( ‫اي ان كل‬

Classification and Marking on Cisco Switch


.‫ التي تم شرحها سابقا‬.trust boundaries ‫ فيجب ان يكون لديك علم بـ‬Cisco switches ‫ في‬QoS ‫عندما نقوم بعملية إعداد‬
QoS ‫ وهذان االمر لديهما بعض القصور من ناحية سوف يتم تطبيق‬mls qos cos‫ وايضا األمر‬mls qos trust ‫استخدمنا من اجل ذلك العرض‬
.‫ معين‬traffic ‫ فماذا لو اردنا انتقاء‬.traffic ‫على كل‬
‫ يعمل‬server ‫ تخيل معي اآلن ان‬.WAN ‫ متصالن بشبكة‬switch and router ‫ ايضا يوجد لدينا‬server ‫ مع‬small network ‫في الشكل لدينا‬
:‫ التالية‬applications ‫بطريقة‬
1. SSH server.
2. Mail server.
3. MySQL server.

‫؟‬serial 0/0 interface ‫ لدينا لها األولوية عندما تغادر‬SSH traffic ‫ماذا لو اردنا ان نجعل‬
.MQC ‫ مع‬standard, extended or MAC access-list in ‫سوف نستخدم‬
Switch(config)#class‐map match‐all SERVER
Switch(config‐cmap)#match access‐group 1
.access-list ‫ سوف نصله بـ‬،‫ معين‬traffic ‫ من اجل اختيار‬class-map ‫لقد قمنا بإستخدام‬
Switch(config)#access‐list 1 permit 192.168.1.1
:policy-map ‫االن لنطبق‬
Switch(config)#policy‐map SET‐DSCP‐SERVER
Switch(config‐pmap)#class SERVER
Switch(config‐pmap‐c)#set ip dscp 40
:‫ على المنفذ‬policy map ‫ لنقوم بعملية تفعيل‬.DSCP=40 ‫تم وضع قيمة‬
Switch(config)#interface FastEthernet 0/1
Switch(config‐if)#service‐policy input SET‐DSCP‐SERVER
:‫ كما يلي‬traffic ‫ لما نريد من‬mark ‫لنرى هل تم عمل‬
Switch#show policy‐map interface FastEthernet 0/1
FastEthernet0/1
Service‐policy input: SET‐DSCP‐SERVER
Class‐map: SERVER (match‐all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group 1
Class‐map: class‐default (match‐any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
0 packets, 0 bytes
5 minute rate 0 bps
.0 packets ‫ الى االن‬.f0/1 ‫ على المنفذ‬policy-map ‫لقد تم تطبيق‬
:‫ كما يلي‬extended access-list ‫ ولكن بأستخدام‬SSH ‫ على‬QoS ‫دعنا نقوم بعملية تطبيق‬
Switch(config)#class‐map SSH
Switch(config‐cmap)#match access‐group 100
.access-list 100 ‫ وتطابق‬SSH ‫ تسمى بـ‬class-map ‫تم انشاء‬
Switch(config)#access-list 100 permit tcp host 192.168.1.1 eq 22 any
Switch(config)#policy‐map SET‐DSCP‐SSH
Switch(config‐pmap)#class SSH
Switch(config‐pmap‐c)#set ip dscp cs6
:‫ االن الربط مع المنفذ كما يلي‬.DSCP=CS6 ‫تم وضع قيمة‬
Switch(config)#interface FastEthernet 0/1
Switch(config‐if)#no service‐policy input SET‐DSCP‐SERVER
Switch(config‐if)#service‐policy input SET‐DSCP‐SSH
:‫لنتطلع على النتائج كما يلي‬
Switch#show policy‐map interface fastEthernet 0/1
FastEthernet0/1
Service‐policy input: SET‐DSCP‐SSH
Class‐map: SSH (match‐all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group 100
Class‐map: class‐default (match‐any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
0 packets, 0 bytes
5 minute rate 0 bps
.packets=0 ‫اليزال عدد‬
Switch(config)#class‐map SERVER‐MAC
Switch(config‐cmap)#match access‐group name MAC
:‫ كما يلي‬MAC ‫ ومتصلة بـ‬extended access-list ‫انشاءنا‬
Switch(config)#mac access‐list extended MAC
Switch(config‐ext‐macl)#permit host 1234.1234.1234 any
:‫ وتفعيلها‬policy-map ‫لنقوم اآلن بإنشاء‬
Switch(config)#policy‐map SET‐DSCP‐FOR‐MAC
Switch(config‐pmap)#class SERVER‐MAC
Switch(config‐pmap‐c)#set ip dscp cs1
Switch(config)#interface FastEthernet 0/1
Switch(config‐if)#no service‐policy input SET‐DSCP‐SSH
Switch(config‐if)#service‐policy input SET‐DSCP‐FOR‐MAC
:‫االن لنقوم بعملية استعراض ما حدث‬
Switch#show policy‐map interface fastEthernet 0/1
FastEthernet0/1
Service‐policy input: SET‐DSCP‐FOR‐MAC
Class‐map: SERVER‐MAC (match‐all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: access‐group name MAC
Class‐map: class‐default (match‐any)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
0 packets, 0 bytes
5 minute rate 0 bps

How to configure Queuing on Cisco 3560 and 3750 switch


‫ فإن‬routers ‫ حيث ان األختالف في‬.routers ‫ ليست سهلة اإلعداد كما في‬Cisco Catalyst switches ‫ في‬QoS (Quality of Service)
.ASICs ‫ او بمعنى ادق‬hardware ‫ فإنها تعمل كـ‬switches ‫ بينما في‬software ‫ تعمل في‬QoS
Priority Queue
‫ في حالة‬.‫ بشكل افتراضي‬priority ‫ اي انها تعتبر‬ingress queue 2 ‫( فإنها تدعم‬Cisco Catalyst 3560 and 3750) ‫فيما يخص‬
‫ كما يلي‬bandwidth ‫ فإن ذلك سوف يعني اننا من الممكن ان نغير في‬queue 1 ‫اردنا التغيير الى‬
Switch(config)#mls qos srr‐queue input priority‐queue 1 bandwidth 20
:‫ من الممكن تفعيله كما يلي‬egress ‫فيما يخص‬
Switch(config)#interface fa0/1
Switch(config‐if)#priority‐queue out

Queue-set
queue-set 2 ‫ او من الممكن‬queue-set 1 ‫ حيث من الممكن وضع‬.switches ‫ في‬QoS ‫ في‬template ‫ وهو مثل‬queue-set
Switch(config)#interface fa0/2
Switch(config‐if)#queue‐set 2

Buffer Allocation
:‫ األمر العام‬.‫ مختلفة‬queues ‫ حيث اننا سوف نقسمه الى‬interface ‫ فهو مثل المخزن في‬buffer ‫فيما يخص‬
mls qos queue‐set output <queue set> buffers Q1 Q2 Q3 Q4
.queue 1,2,3 and 4 ‫ بين‬buffers ‫ ومن ثم تقسيم‬queue-set ‫سوف يتم اختيار‬
.queuw 1,4 and 4 ‫ لـ‬99 ‫ الى‬0 ‫حيث اننا من الممكن اختيار القيمة من‬
:‫ كما في المثال التالي‬.CPU buffer ‫ فإنه يستخدم كـ‬queue 2 ‫ فيما يخص‬.diable the queue ‫ فإنها تعني‬0 ‫في حالة كتبت الرقم‬
Switch(config)#mls qos queue‐set output 2 buffers 33 17 25 25
:‫ كما يلي‬buffer space ‫هذا سوف يقسم‬
33% for queue 1.
17% for queue 2.
25% for queue 3.
25% for queue 4.
:‫ من الممكن التقسيم بالشكل التالي‬queues ‫ بين‬buffer space ‫الى جانب تقسيم‬
Threshold 1 value
Threshold 2 value
Reserved value
Maximum value
:‫كمثال على ذلك‬
Switch(config)#mls qos queue‐set output 2 threshold 3 33 66 100 300
.queue-set 2 ‫هذا سوف يقوم بإعداد‬
Threshold 1 = 33%
Threshold 2 = 66%
Reserved = 100%
Maximum = 300%
.queue ‫ من‬threshold 1=33% ‫ما قمنا به يعني اننا سوف يكون قيمة‬
‫ فمن الممكن‬full ‫ في حالة‬queue ‫ ففي حالة كان‬،buffer space ‫ على انه‬100% ‫ وسوف نحتفظ بـ‬.queue ‫ من قيمة‬threshold 2=66% ‫اما‬
.common pool ‫ من‬300% ‫استالف‬
Assign marked packets/frames to correct queue
.DSCP and CoS ‫ قيم‬swich ‫ لكن البد من اعطاء‬buffer and thresholds ‫من الممكن اعداد‬
mls qos srr-queue <direction> <marking> <queue> <threshold> <values>
:‫هذا يعني ان‬

 Direction: input or output.


 Marking: CoS or DSCP.
 Queue: The queue number.
 Threshold: this can be threshold 1,2 or 3.
 Values: The CoS or DSCP values you want to put here.
:‫كمثال على ذلك‬
Switch(config)#mls qos srr‐queue output cos‐map queue 1 threshold 1 0 1
Switch(config)#mls qos srr‐queue output cos‐map queue 1 threshold 2 2 3
Switch(config)#mls qos srr‐queue output cos‐map queue 4 threshold 2 6 7

Bandwidth Allocation
.‫ او بمعنى اخر كم حجم المخزن الذي لدينا‬.‫ او طوله‬queue ‫لكن كيف نحدد حجم‬
Switch(config)#mls qos srr‐queue input bandwidth 30 70
.70% ‫ سيكون‬queue 2 ‫ بينما في‬bandwidth ‫ من‬30% ‫ حيث ان تم حجز‬queue 1 ‫في المثال تم على‬
Switch(config)#interface fa0/1
Switch(config‐if)#srr‐queue bandwidth share 30 20 25 25
:‫ كما يلي‬bandwidth ‫المثال اعاله يعني تقسيم‬
Queue 1: 30%
Queue 2: 20%
Queue 3: 25%
Queue 4: 25%
‫ بينما‬25% ‫ فسيكون‬queue 3 ‫ اما‬.20% ‫ سيكون‬queue 2 ‫ بينما‬.queue 1 ‫ ستكون من اجل‬30% ‫ فإن هذا يعني ان‬100Mbit ‫لدينا‬
.25% ‫ سيكون‬Queue 4
.sharing ‫ فإن هذا سوف يعني‬congestion ‫في حالة عدم وجود اي‬
Switch(config)#interface fa0/1
Switch(config‐if)#srr‐queue bandwidth limit 85
.85Mbit ‫ فقط او بمعني‬85% ‫ معدل‬interface ‫ من‬100 Mbit ‫األمر اعاله سوف يعني اننا سوف نحدد من‬
Verification and troubleshooting
.‫االن كيف سنعرف انه تم اعداد كل شئ بشكل تام‬
Switch#show interfaces fa0/23 capabilities
FastEthernet0/23
Model: WS‐C3560‐24PS
Type: 10/100BaseTX
Speed: 10,100,auto
Duplex: half,full,auto
Trunk encap. type: 802.1Q,ISL
Trunk mode: on,off,desirable,nonegotiate
Channel: yes
Broadcast suppression: percentage(0‐100)
Flowcontrol: rx‐(off,on,desired),tx‐(none)
Fast Start: yes
QoS scheduling: rx‐(not configurable on per port basis),
tx‐(4q3t) (3t: Two configurable values and one fixed.)
CoS rewrite: yes
ToS rewrite: yes
UDLD: yes
Inline power: yes
SPAN: source/destination
PortSecure: yes
Dot1x: yes
.threshold ‫ وايضا ثالثة مستويات من‬4 queues ‫ تقريبا‬switch ‫كما نالحظ انه لدى‬
:‫ مفعلة على المنفذ اوال‬QoS ‫ولنتأكد هل‬
Switch#show mls qos
QoS is enabled
QoS ip packet dscp rewrite is enabled
:‫ سوف نرى التالي‬QoS parameters ‫ومن اجل التدقيق اكثر على‬
Switch#show mls qos interface fa0/1
FastEthernet0/1
trust state: trust cos
trust mode: trust cos
trust enabled flag: ena
COS override: dis
default COS: 1
DSCP Mutation Map: Default DSCP Mutation Map
Trust device: none
qos mode: port‐based
:‫ سوف نالحظ التالي‬queue-sets ‫ وذلك لحالة‬verify ‫اما من اجل عمل‬
Switch#show mls qos queue‐set
Queueset: 1
Queue : 1 2 3 4
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
buffers : 25 25 25 25
threshold1: 100 200 100 100
threshold2: 100 200 100 100
reserved : 50 50 50 50
maximum : 400 400 400 400
Queueset: 2
Queue : 1 2 3 4
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
buffers : 33 17 25 25
threshold1: 100 33 33 100
threshold2: 100 66 66 100
reserved : 50 100 100 50
maximum : 400 200 200 400
:‫ تحت المنافذ فستكون كما يلي‬queuing ‫اما اعدادات‬
Switch#show mls qos interface fastEthernet 0/24 queuing
FastEthernet0/24
Egress Priority Queue : disabled
Shaped queue weights (absolute) : 25 0 0 0
Shared queue weights : 25 25 25 25
The port bandwidth limit : 100 (Operational Bandwidth:100.0)
The port is mapped to qset : 1
:‫ فسيكون لدينا التالي‬queues ‫ وذلك في‬drops ‫ومن اجل التأكد من حدوث اي‬
Switch#show platform port‐asic stats drop FastEthernet 0/1
Interface Fa0/1 TxQueue Drop Statistics
Queue 0
Weight 0 Frames 0
Weight 1 Frames 0
Weight 2 Frames 0
Queue 1
Weight 0 Frames 0
Weight 1 Frames 0
Weight 2 Frames 0
Queue 2
Weight 0 Frames 0
Weight 1 Frames 0
Weight 2 Frames 0
Queue 3
Weight 0 Frames 0
Weight 1 Frames 0
Weight 2 Frames 0
:‫اما األحصائية فستكون كما يلي‬
Switch#show mls qos interface fastEthernet 0/1 statistics
FastEthernet0/1 (All statistics are in packets)
dscp: incoming
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
0 ‐ 4 : 0 0 0 0 0
5 ‐ 9 : 0 0 0 0 0
10 ‐ 14 : 0 0 0 0 0
15 ‐ 19 : 0 0 0 0 0
20 ‐ 24 : 0 0 0 0 0
25 ‐ 29 : 0 0 0 0 0
30 ‐ 34 : 0 0 0 0 0
35 ‐ 39 : 0 0 0 0 0
40 ‐ 44 : 0 0 0 0 0
45 ‐ 49 : 0 0 0 0 0
50 ‐ 54 : 0 0 0 0 0
55 ‐ 59 : 0 0 0 0 0
60 ‐ 64 : 0 0 0 0
dscp: outgoing
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
0 ‐ 4 : 0 0 0 0 0
5 ‐ 9 : 0 0 0 0 0
10 ‐ 14 : 0 0 0 0 0
15 ‐ 19 : 0 0 0 0 0
20 ‐ 24 : 0 0 0 0 0
25 ‐ 29 : 0 0 0 0 0
30 ‐ 34 : 0 0 0 0 0
35 ‐ 39 : 0 0 0 0 0
40 ‐ 44 : 0 0 0 0 0
45 ‐ 49 : 0 0 0 0 0
50 ‐ 54 : 0 0 0 0 0
55 ‐ 59 : 0 0 0 0 0
60 ‐ 64 : 0 0 0 0
cos: incoming
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
0 ‐ 4 : 2 0 0 0 0
5 ‐ 7 : 0 0 0
cos: outgoing
‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
0 ‐ 4 : 0 0 0 0 0
5 ‐ 7 : 0 0 0
Policer: Inprofile: 0 OutofProfile: 0

CBWFQ not supported on Sub-Interfaces


.‫ بشكل مباشر‬sub-interface ‫ وما بين‬policy-map ‫ليس من الممكن عمل اي ربط ما بين‬
frame-relay ‫ متصلة مع بعضها البعض بشكل مباشر باستخدام‬two routers ‫ومن اجل اصالح ذلك سوف نالحظ في الشكل ادناه لدينا‬
:‫لنبدأ‬

R1(config)#class‐map TELNET
R1(config‐cmap)#match protocol telnet
R1(config)#class‐map HTTP
R1(config‐cmap)#match protocol http
R1(config)#policy‐map CBWFQ
R1(config‐pmap)#class TELNET
R1(config‐pmap‐c)#bandwidth percent 10
R1(config‐pmap‐c)#exit
R1(config‐pmap)#class HTTP
R1(config‐pmap‐c)#bandwidth percent 20
R1(config‐pmap‐c)#exit
‫ ولنقم بعملية تطبيقها على المنفذ كما‬HTTP ‫ من اجل‬20% ‫ وايضا‬telnet ‫ من اجل‬bandwidth ‫ من‬10% ‫ واعطاءه‬CBWFQ ‫فقط تم تفعيل‬
:‫يلي‬
R1(config)#interface serial 0/0.1
R1(config‐subif)#service‐policy output CBWFQ
CBWFQ : Not supported on subinterfaces
.‫لم تطبق بشكل مباشر‬
R1(config)#policy‐map PARENT
R1(config‐pmap)#class class‐default
R1(config‐pmap‐c)#service‐policy CBWFQ
:‫ لنقم اآلن بربطها مع المنفذ‬class-default ‫ وربطها مع‬PARENT ‫ تسمى‬policy-map ‫لقد قمنا بعمل‬
R1(config)#interface serial 0/0.1
R1(config‐subif)#service‐policy output PARENT
CBWFQ : Hierarchy supported only if shaping is configured in this class

R1(config)#policy‐map PARENT
R1(config‐pmap)#class class‐default
R1(config‐pmap‐c)#shape average percent 100
.100% ‫ بنسبة‬shape ‫لقد قمنا بعمل‬
R1(config)#interface serial 0/0.1
R1(config‐subif)#service‐policy output PARENT
:‫ومن التجربة‬
R1#telnet 192.168.12.2
Trying 192.168.12.2 ... Open
Password required, but none set
[Connection to 192.168.12.2 closed by foreign host]
:‫اآلن لنجرب نعرض ما تم اعداده‬
R1#show policy‐map interface serial 0/0.1
Serial0/0.1
Service‐policy output: PARENT
Class‐map: class‐default (match‐any)
39 packets, 4086 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
Traffic Shaping
Target/Average Byte Sustain Excess Interval Increment
Rate Limit bits/int bits/int (ms) (bytes)
100 (%) 0 (ms) 0 (ms)
1544000/1544000 9650 38600 38600 25 4825
Adapt Queue Packets Bytes Packets Bytes Shaping
Active Depth Delayed Delayed Active
‐ 0 39 4086 0 0 no
Service‐policy : CBWFQ
Class‐map: TELNET (match‐all)
11 packets, 514 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol telnet
Queueing
Output Queue: Conversation 73
Bandwidth 10 (%)
Bandwidth 154 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 0/0
(depth/total drops/no‐buffer drops) 0/0/0
Class‐map: HTTP (match‐all)
0 packets, 0 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http
Queueing
Output Queue: Conversation 74
Bandwidth 20 (%)
Bandwidth 308 (kbps)Max Threshold 64 (packets)
(pkts matched/bytes matched) 0/0
(depth/total drops/no‐buffer drops) 0/0/0
Class‐map: class‐default (match‐any)
28 packets, 3572 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
policy-map ‫ مع‬telnet ‫نعم لقد تطابقت‬
PPP Multilink Link Fragmentation and Interleaving
load ‫ من خالل‬.single logical interface ‫ تم تحويلها الى‬physical interfaces ‫ماذا لو كان لدينا اكثر من‬
‫ مع بعض‬router ‫ تم ربط اكثر من‬.‫ خذ معي الشكل المقابل‬.balance
.serial interfaces ‫من خالل‬
bundle ‫ فإننا نستطيع من خاللها عمل‬PPP multilink ‫عندما نستخدم‬
serial links ‫لتكوين‬
.logical layer 3 interface ‫وتكوين‬

R1(config)#interface virtual‐template 1
R1(config‐if)#bandwidth 128
R1(config‐if)#ip address 192.168.12.1 255.255.255.0
R1(config‐if)#fair‐queue
R1(config‐if)#ppp multilink fragment delay 10
R1(config‐if)#ppp multilink interleave

R2(config)#interface virtual‐template 1
R2(config‐if)#bandwidth 128
R2(config‐if)#ip address 192.168.12.2 255.255.255.0
R2(config‐if)#fair‐queue
R2(config‐if)#ppp multilink fragment delay 10
R2(config‐if)#ppp multilink interleave
.PPP multilink ‫ وذلك من اجل اعداد‬IP addresses ‫ وإعداد‬virtual-template ‫لقد استخدمنا‬
.VoIP ‫ بالنسبة لـ‬10 ms ‫ والذي هو‬maximum delay ‫ ليكون مساوي‬delay ‫تم اعداد‬
R1(config)#multilink virtual‐template 1
R2(config)#multilink virtual‐template 1
:‫االن اعداد المنافذ كما يلي‬
R1(config)#interface serial 0/0
R1(config‐if)#bandwidth 128
R1(config‐if)#encapsulation ppp
R1(config‐if)#ppp multilink

R2(config)#interface serial 0/0


R2(config‐if)#bandwidth 128
R2(config‐if)#encapsulation ppp
R2(config‐if)#ppp multilink
:‫لنرى اآلن كيف يعمل‬
R1#show ppp multilink
Virtual‐Access2
Bundle name: R2
Remote Endpoint Discriminator: [1] R2
Local Endpoint Discriminator: [1] R1
Bundle up for 00:00:25, total bandwidth 128, load 1/255
Receive buffer limit 12192 bytes, frag timeout 1000 ms
Interleaving enabled
0/0 fragments/bytes in reassembly list
0 lost fragments, 0 reordered
0/0 discarded fragments/bytes, 0 lost received
0x2 received sequence, 0x2 sent sequence
Member links: 1 (max not set, min not set)
Se0/0, since 00:00:25, 160 weight, 152 frag size
No inactive multilink interfaces

R1#show interfaces virtual‐access 2


Virtual‐Access2 is up, line protocol is up
Hardware is Virtual Access interface
Internet address is 192.168.12.1/24
MTU 1500 bytes, BW 128 Kbit/sec, DLY 100000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, LCP Open, multilink Open
Open: IPCP
MLP Bundle vaccess, cloned from Virtual‐Template1
Vaccess status 0x40, loopback not set
Keepalive set (10 sec)
DTR is pulsed for 5 seconds on reset
Last input 00:01:05, output never, output hang never
Last clearing of "show interface" counters 00:01:05
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/32 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 96 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
2 packets input, 28 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
2 packets output, 40 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
.interleaving ‫ تم تفعيله وتم استخدام‬PPP multilink ‫كما الحظنا ان‬
Introduction to RSVP
IntServ and RSVP
:‫ وهي‬QoS ‫ في‬two models ‫في البداية قلنا ان لدينا‬

 DiffServ (Differentiated Services)


 IntServ (Integrated Services)
‫ الموجود‬ToS byte ‫ حيث ان نستخدم‬.hop by hop ‫ لكن بشكل‬QoS ‫ فإننا نقوم بعملية تنفيذ‬DiffServ ‫بإختصار عندما نستخدم‬
.classification ‫ من اجل عملية‬IP packets ‫في‬
.flow data ‫ معين من اجل‬bandwidth and delay ‫ حيث يتم طلب‬signaling ‫ تماما مختلفة حيث انها تقوم من خالل عملية‬IntServ
:‫ وهما‬IntServ ‫يوجد مكونان اساسيان في‬

 Resource reservation
.flow ‫ معين من اجل‬bandwidth and delay ‫ للشبكة و تطلب‬Resource reservation signals
‫ وكذلك‬bandwidth ‫ فسوف يكون لدينا‬routers ‫ بشكل كامل لكل مكونات الشبكة او بشكل ادق على‬reservation ‫عندما تتم عملية‬
.‫ المطلوب‬delay

 Admission control
.‫ معينة‬reservation ‫ لعملية‬permit or deny ‫ تستخدم من اجل‬Admission control

‫ بعد ان يوافق‬.destination ‫ الى‬route ‫ حيث انها تمر عبر‬.RSVP ‫ معينة فسوف نرسل طلب بذلك باستخدام رسائل‬reservation ‫عندما نريد‬
‫ فإنه سوف يرد برسالة‬destination ‫ عندما تصل الى‬،‫ المطلوبة فإنه يمررها الى التالي حسب المسار‬bandwidth/delay ‫ على‬router
.‫ وتتم المعالجة بالمثل في األتجاه العكسي‬.RSVP resv
:‫لنأخذ الشكل المقابل كمثال على ذلك‬
:interface ‫ على كل‬RSVP ‫في البداية تفعيل‬
R2(config)#interface fa0/0
R1(config‐if)#ip rsvp bandwidth 128 64
-----------------------------------------
R2(config)#interface fa0/0
R2(config‐if)#ip rsvp bandwidth 128 64
R2(config)#interface fa0/1
R2(config‐if)#ip rsvp bandwidth 128 64
-----------------------------------------
R3(config)#interface fa0/0
R3(config‐if)#ip rsvp bandwidth 128 64
R3(config)#interface fa0/1
R3(config‐if)#ip rsvp bandwidth 128 64
-----------------------------------------
R4(config)#interface fa0/0
R4(config‐if)#ip rsvp bandwidth 128 64
.reservation ‫) من اجل عملية‬interface bandwidth( ‫ من‬75% ‫ فسوف يتم استقطاع تقريبا‬bandwidth ‫في حالة لم نحدد اي‬
:‫ عبر المسار‬RSVP ‫ وبالتالي سوف يرسل‬RSVP host ‫ من اجل ان يكون هو‬R1 ‫سوف نقوم بإعداد‬
R1(config)#ip rsvp sender‐host 192.168.34.4 192.168.12.1 tcp 23 0 64 32
‫ بينما في‬.telnet ‫ وهذا يعني‬port=23 ‫ حيث ان‬TCP ‫ باستخدام‬192.168.34.4 ‫ والمستقبل‬192.168.12.1 ‫ما بين المرسل‬
.maximum burst=32kbps ‫ مع وجود‬.bitrate=64 kbps ‫ ومعدل‬.anything ‫ وهذا يعني‬source port=0
R1#show ip rsvp sender
To From Pro DPort Sport Prev Hop I/F BPS
192.168.34.4 192.168.12.1 TCP 23 0 192.168.12.1 64K
:‫بعد المرسل األن دور المستقبل‬
R4(config)#ip rsvp reservation‐host 192.168.34.4 192.168.12.1 tcp 23 0 ff ?
load Controlled Load Service
rate Guaranteed Bit Rate Service
‫ بينما يعتبر‬.bandwidth and delay ‫ والذي يعني ضمان حجز‬guaranteed bit rate ‫ او الخيار‬controlled load ‫سوف يكون لدينا خيار‬
.delay ‫ لكن لن يضمن اي‬bandwidth ‫ يضمن ايضا‬controlled load
R4(config)#ip rsvp reservation‐host 192.168.34.4 192.168.12.1 tcp 23 0 ff rate
64 32
:R4 ‫ في‬verify ‫من اجل‬

R4#show ip rsvp reservation


To From Pro DPort Sport Next Hop I/F Fi Serv BPS
192.168.34.4 192.168.12.1 TCP 23 0 192.168.34.4 FF RATE 64K
‫؟‬R2 and R3 ‫ماذا عن‬
R2#show ip rsvp reservation
To From Pro DPort Sport Next Hop I/F Fi Serv BPS
192.168.34.4 192.168.12.1 TCP 23 0 192.168.23.3 Fa0/1 FF RATE 64K

R3#show ip rsvp reservation


To From Pro DPort Sport Next Hop I/F Fi Serv BPS
192.168.34.4 192.168.12.1 TCP 23 0 192.168.34.4 Fa0/1 FF RATE 64K
:interface ‫ على مستوى‬RSVP ‫ وذلك لـ‬check ‫ لنقوم األن بعملية‬.routers ‫ في كل‬reservation ‫لقد رأينا كيف تم عمل‬
R2#show ip rsvp interface detail | begin Fa0/1
Fa0/1:
Interface State: Up
Bandwidth:
Curr allocated: 64K bits/sec
Max. allowed (total): 128K bits/sec
Max. allowed (per flow): 64K bits/sec
Max. allowed for LSP tunnels using sub‐pools: 0 bits/sec
Set aside by policy (total): 0 bits/sec
Admission Control:
Header Compression methods supported:
rtp (36 bytes‐saved), udp (20 bytes‐saved)
Traffic Control:
RSVP Data Packet Classification is ON via CEF callbacks
Signalling:
DSCP value used in RSVP msgs: 0x3F
Number of refresh intervals to enforce blockade state: 4
Number of missed refresh messages: 4
Refresh interval: 30
Authentication: disabled
:‫ كما يلي‬debug ‫من اجل رؤيتة ما يحدث بشكل اكبر سوف نقوم بتفعيل‬
R1,R2,R3,R4#debug ip rsvp
RSVP signalling debugging is on
:R1 ‫ من‬conversation ‫االن لنقوم بعملية انشاء‬
R1(config)#ip rsvp sender‐host 192.168.34.4 192.168.12.1 tcp 80 0 32 16

:‫سوف نالحظ التالي‬


R1#
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Received Path message from
192.168.12.1 (on sender host)
RSVP: new path message passed parsing, continue...
RSVP: Triggering outgoing Path refresh
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh Path psb = 66C8D7CC
refresh interval = 0mSec
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Path message to
192.168.12.2
:R2 ‫ لنالحظ ذلك في‬192.168.12.2 ‫ الى‬forward ‫ المسار من نفسه ومن ثم قام بعملية‬R1 ‫لقد استقبل‬
R2#
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Received Path message from
192.168.12.1 (on FastEthernet0/0)
RSVP: new path message passed parsing, continue...
RSVP: Triggering outgoing Path refresh
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh Path psb = 650988D4
refresh interval = 0mSec
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Path message to
192.168.23.3

R3#
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Received Path message from
192.168.23.2 (on FastEthernet0/0)
RSVP: new path message passed parsing, continue...
RSVP: Triggering outgoing Path refresh
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh Path psb = 6508EB64
refresh interval = 0mSec
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Path message to
192.168.34.4

R4#
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Received Path message from
192.168.34.3 (on FastEthernet0/0)
R4#
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh Path psb = 6618082C
refresh interval = 30000mSec
RSVP: can't forward Path out received interface
.R4 ‫ واخيرا الى‬R3 ‫ ومنه الى‬R2 ‫ الى‬R1 ‫ ابتدا من‬forwarding ‫استمرت عملية‬
:R4 ‫لنضع الرد في‬
R4(config)#$reservation‐host 192.168.34.4 192.168.12.1 tcp 80 0 ff rate 64 3
:‫هذا ما سنالحظه‬
R4#
RSVP session 192.168.34.4_80[0.0.0.0]: Received RESV for 192.168.34.4
(receiver host) from 192.168.34.4
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: this RESV has a confirm object
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: reservation not found‐‐new one
RSVP‐RESV: Admitting new reservation: 674BE740
RSVP‐RESV: Locally created reservation. No admission/traffic control needed
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: start requesting 64 kbps FF
reservation for 192.168.12.1(0) TCP‐> 192.168.34.4(80) on FastEthernet0/0
neighbor 192.168.34.3
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh RESV, req=674C39E8,
refresh interval=0mSec [cleanup timer is not awake]
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Resv message to
192.168.34.3
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: RESV CONFIRM Message for
192.168.34.4 (FastEthernet0/0) from 192.168.34.3

R3#
RSVP session 192.168.34.4_80[0.0.0.0]: Received RESV for 192.168.34.4
(FastEthernet0/1) from 192.168.34.4
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: this RESV has a confirm object
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: reservation not found‐‐new one
RSVP‐RESV: Admitting new reservation: 66171920
RSVP‐RESV: reservation was installed: 66171920
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: start requesting 64 kbps FF
reservation for 192.168.12.1(0) TCP‐> 192.168.34.4(80) on FastEthernet0/0
neighbor 192.168.23.2
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh RESV, req=661769B4,
refresh interval=0mSec [cleanup timer is not awake]
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Resv message to
192.168.23.2
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: RESV CONFIRM Message for
192.168.34.4 (FastEthernet0/0) from 192.168.23.2
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending RESV CONFIRM message to
192.168.34.4

R2#
RSVP session 192.168.34.4_80[0.0.0.0]: Received RESV for 192.168.34.4
(FastEthernet0/1) from 192.168.23.3
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: this RESV has a confirm object
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: reservation not found‐‐new one
RSVP‐RESV: Admitting new reservation: 674B8E00
RSVP‐RESV: reservation was installed: 674B8E00
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: start requesting 64 kbps FF
reservation for 192.168.12.1(0) TCP‐> 192.168.34.4(80) on FastEthernet0/0
neighbor 192.168.12.1
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Refresh RESV, req=674BDE94,
refresh interval=0mSec [cleanup timer is not awake]
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending Resv message to
192.168.12.1
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: RESV CONFIRM Message for
192.168.34.4 (FastEthernet0/0) from 192.168.12.1
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending RESV CONFIRM message to
192.168.23.3

R1#
RSVP session 192.168.34.4_80[0.0.0.0]: Received RESV for 192.168.34.4
(FastEthernet0/0) from 192.168.12.2
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: this RESV has a confirm object
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: reservation not found‐‐new one
RSVP‐RESV: Admitting new reservation: 66C95AF4
RSVP‐RESV: reservation was installed: 66C95AF4
RSVP 192.168.12.1_0‐>192.168.34.4_80[0.0.0.0]: Sending RESV CONFIRM message to
192.168.12.2
.‫ معين‬flow ‫ من اجل‬reservation ‫ لتلك الرسالة وقام بعمل‬forward ‫ بعملية‬router ‫كل‬
RSVP DSBM (Designated Subnetwork Bandwidth Manager)
two routers ‫ بين‬link ‫ سوف يعمل بشكل جيد عندما نقوم بعمل ذلك عبر‬RSVP
‫؟‬shared segment ‫لكن ماذا عن‬
.half-duplex Ethernet network ‫ متصلة بـ‬routers ‫في الشكل لدينا اكثر من‬
.bandwidth ‫اي لديها تشارك لـ‬
‫؟‬bandwidth ‫ معين استقطع جزء معين من‬router ‫ ان‬routers ‫كيف ستعلم بقية‬
.DSBM ‫الجواب بالضبط من خالل‬
‫ سوف يتم تمرير كل‬routers ‫ وكل‬DSBM ‫سوف يتم انتخاب‬
.‫ من خالله‬RSVP PATH and RESV messages

.‫ مركزية‬admission control ‫اي هناك‬


:‫عملية األنتخابات ستتم وفق للقواعد التالية‬

 The router with the highest priority becomes the DSBM.


 In case the priority is the same, the highest IP address is the tie-breaker.
.‫ اخر ليكون األعلى‬router ‫ في‬priority ‫ حتى لو تم تغيير‬DSBM ‫ اين لن يتم تغيير اي‬non-preemptive ‫ ما نطلق عليه‬DSBM ‫يعتبر‬
:‫لنباشر عملية األعداد كما يلي‬
R1(config)#interface FastEthernet 0/0
R1(config‐if)#ip rsvp bandwidth

R2(config)#interface FastEthernet 0/0


R2(config‐if)#ip rsvp bandwidth

R3(config)#interface FastEthernet 0/0


R3(config‐if)#ip rsvp bandwidth
:‫ كما يلي‬DSBM ‫ ليكون هو‬R3 ‫االن دور‬
R3(config)#interface FastEthernet 0/0
R3(config‐if)#ip rsvp dsbm candidate
:‫ معين كما يلي‬bandwidth ‫ الى‬reservations ‫ من اجل تحديد‬routers ‫ بقية‬R3 ‫من اجل ان يخبر‬
R3(config‐if)#ip rsvp bandwidth 2048
.maximum bandwidth=2048 kbit ‫اي ان‬
R1#show ip rsvp sbm detail
Interface: FastEthernet0/0
Local Configuration Current DSBM
IP Address: 192.168.123.1 IP Address: 192.168.123.3
DSBM candidate: no I Am DSBM: no
Priority: 64 Priority: 64
Non Resv Send Limit Non Resv Send Limit
Rate: unlimited Rate: 2147483 Kbytes/sec
Burst: unlimited Burst: 536870 Kbytes
Peak: unlimited Peak: unlimited
Min Unit: unlimited Min Unit: unlimited
Max Unit: unlimited Max Unit: unlimited

R2#show ip rsvp sbm detail


Interface: FastEthernet0/0
Local Configuration Current DSBM
IP Address: 192.168.123.2 IP Address: 192.168.123.3
DSBM candidate: no I Am DSBM: no
Priority: 64 Priority: 64
Non Resv Send Limit Non Resv Send Limit
Rate: unlimited Rate: 2147483 Kbytes/sec
Burst: unlimited Burst: 536870 Kbytes
Peak: unlimited Peak: unlimited
Min Unit: unlimited Min Unit: unlimited
Max Unit: unlimited Max Unit: unlimited

R3#show ip rsvp sbm detail


Interface: FastEthernet0/0
Local Configuration Current DSBM
IP Address: 192.168.123.3 IP Address: 192.168.123.3
DSBM candidate: yes I Am DSBM: yes
Priority: 64 Priority: 64
Non Resv Send Limit Non Resv Send Limit
Rate: unlimited Rate: 2147483 Kbytes/sec
Burst: unlimited Burst: 536870 Kbytes
Peak: unlimited Peak: unlimited
Min Unit: unlimited Min Unit: unlimited
Max Unit: unlimited Max Unit: unlimited
:‫االن لنختبر عملية األرسال واألستقبال من خالل التالي‬
R1(config)#ip rsvp sender‐host 192.168.123.2 192.168.123.1 tcp 23 0 128 64
R2(config)#reservation‐host 192.168.123.2 192.168.123.1 tcp 23 0 ff rate 128
64
:‫ سيكون لدينا التالي‬R3 ‫عندما نقوم بعملية التأكد من‬
R3#show ip rsvp installed
RSVP: FastEthernet0/0
BPS To From Protoc DPort Sport
128K 192.168.123.2 192.168.123.1 TCP 23 0

Block website with NBAR on Cisco Router


‫)من اجل‬layer 1,2,3 and 4( ‫ فإننا نستخدم معلومات‬QoS (Quality of Service) policies ‫ او انشاء‬access-lists ‫عندما نقوم بإنشاء‬
‫ إضافة ذكية من اجل الوصول الى الطبقة السابعة‬NBAR (Network Based Application Recognition) ‫ تعتبر‬.criteria ‫مطابقة‬
.‫ بناء على تطبيقات معينة‬match and fliter ‫ والذي يعني سوف نقوم بعملية‬Cisco ISO router ‫ووضعها من ضمن المعايير في‬
‫ ومن ثم‬youtube ‫ للموقع‬IP addresses ‫ بشكل طبيعي سوف نبحث عن‬.Youtube.com ‫على سبيل المثال سوف نقوم بعملية حجب موقع‬
.QoS ‫ في‬police/shape ‫ او من خالل‬access-list ‫سوف نقوم بعملية حجبه بناء على ذلك من خالل‬
.IP addresses ‫ بدال عن‬website addresses ‫ بناء على‬match ‫ سوف تتم عملية‬NBAR ‫بإستخدام‬
.‫هذا سوف يعطينا سهولة في التنفيذ‬
:‫لنأخذ المثال التالي‬
R1(config)#class‐map match‐any BLOCKED
R1(config‐cmap)#match protocol http host "*youtube.com*"
R1(config‐cmap)#exit
‫ حيث يعني‬.NBAR ‫ من اجل استخدام‬match protocol ‫ ومن ثم استخدام‬BLOCKED ‫ وتسميتها باسم‬class-map ‫في البداية تم انشاء‬
.sub-domains ‫ وهذا سوف يقوم بعملية منع اي‬.‫*" وبالنسبة * اي حرف‬youtube.com*"
:‫لنطبقها كما يلي‬
R1(config)#policy‐map DROP
R1(config‐pmap)#class BLOCKED
R1(config‐pmap‐c)#drop
R1(config‐pmap‐c)#exit
.dropped ‫ ومن ثم تطبيق‬.class-map ‫تم ربطها مع‬
R1(config)#interface fastEthernet 0/1
R1(config‐if)#service‐policy output DROP
.‫وعلى المنفذ تم تطبيقها الواصل الى االنترنت‬

R1#show policy‐map interface fastEthernet 0/1


FastEthernet0/1
Service‐policy output: DROP
Class‐map: BLOCKED (match‐any)
1 packets, 500 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: protocol http host "*youtube.com*"
1 packets, 500 bytes
5 minute rate 0 bps
drop
Class‐map: class‐default (match‐any)
6101 packets, 340841 bytes
5 minute offered rate 10000 bps, drop rate 0 bps
Match: any
.traffic ‫ لتلك‬block ‫ سوف يقوم بعمل‬.youtube.com ‫ الى‬HTTP GET ‫ فعندما يصل‬youtube.com ‫االن في حالة لن حد الى‬

You might also like