Ns Simulator For Beginners In Persian

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ns Simulator For Beginners In Persian as PDF for free.

More details

  • Words: 20,878
  • Pages: 102
‫ﺩﺍﻧﺸﻜﺪﻩ ﻣﻬﻨﺪﺳﻲ ﻛﺎﻣﭙﻴﻮﺗﺮ ﻭ ﻓﻨﺎﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ‬ ‫ﺩﺍﻧﺸﮕﺎﻩ ﺻﻨﻌﺘﻲ ﺍﻣﻴﺮﻛﺒﻴﺮ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬ ‫ﻣﻬﺪﯼ ﺁﺫﺭﻣﯽ ‪۸۳۲۳۱۱۰۲‬‬

‫ﺍﺳﻔﻨﺪ‬ ‫‪۱۳۸۳‬‬

‫ﻓﻬﺮﺳﺖ ﻣﻄﺎﻟﺐ‬

‫‪ .١‬ﻣﻘﺪﻣﻪ ‪١‐١..................................................................................................................................‬‬

‫‪ .٢‬ﺁﺷﻨﺎﻳﻲ ﻣﻘﺪﻣﺎﺗﻲ ﺑﺎ ‪٢‐٢..............................................................................NS-2‬‬ ‫‪ ١‐٢‬ﺑﺨﺶ ‪ : ١‬ﻃﺮﻳﻘﻪ ‪ download‬ﻛﺮﺩﻥ ﻭ ﻧﺼﺐ ‪٣‐٢ ...................................................... ns‬‬

‫‪ Download ١‐١‐٢‬ﻛﺮﺩﻥ ‪٣‐٢ ............................................................................... ns‬‬ ‫‪ ٢‐١‐٢‬ﻧﺼﺐ ‪٣‐٢ ................................................................................................................. ns‬‬ ‫‪ ٢‐٢‬ﺑﺨﺶ ‪ : ٢‬ﺷﺮﻭﻉ ﻛﺎﺭ ﺑﺎ ‪٥‐٢ .......................................................................................... ns‬‬

‫‪ ١‐٢‐٢‬ﺍﺟﺮﺍﻱ ‪٥‐٢ ............................................................................................................... ns‬‬ ‫‪ ٢‐٢‐٢‬ﻣﻌﻤﺎﺭﻱ ‪٥‐٢ ............................................................................................................ ns‬‬ ‫‪ ٣‐٢‐٢‬ﺯﺑﺎﻥ ﻛﺎﺭﺑﺮﻱ ‪٧‐٢ ............................................................................................... OTcl‬‬ ‫‪ ٣‐٢‬ﺑﺨﺶ ‪ : ٣‬ﻧﺮﻡ ﺍﻓﺰﺍﺭ ‪١٠‐٢ .........................................................................................Nam‬‬

‫‪ ١‐٣‐٢‬ﭘﻴﻜﺮﺑﻨﺪﻱ ‪ nam‬ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﺗﻮﭘﻮﻟﻮﮊﻱ ‪١٠‐٢.....................................................‬‬ ‫‪ ٢‐٣‐٢‬ﻭﺍﺳﻂ ﻛﺎﺭﺑﺮﻱ ‪١١‐٢.....................................................................................................‬‬ ‫‪ ٤‐٢‬ﺑﺨﺶ ‪ : ٤‬ﻣﺜﺎﻟﻬﺎﻱ ﻋﻤﻠﻲ ‪١٢‐٢ ........................................................................................‬‬

‫‪ ١‐٤‐٢‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﺍﻭﻟﻴﻪ ‪١٢‐٢........................................................................................... ns-2‬‬ ‫‪ ٢‐٤‐٢‬ﻣﺪﻝ ﻛﺮﺩﻥ ﻳﻚ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺳﺎﺩﻩ ‪ :‬ﺩﻭ ﮔﺮﻩ ﺑﺎ ﻳﻚ ﻟﻴﻨﻚ ‪١٣‐٢...........................‬‬ ‫‪ ٣‐٤‐٢‬ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻭ ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﻟﻴﻨﻚ ﻫﺎ ‪١٥‐٢....................‬‬ ‫‪ ٤‐٤‐٢‬ﺗﻌﺮﻳﻒ ﺗﻮﭘﻮﻟﻮﮊﻱ ‪١٥‐٢................................................................................................‬‬ ‫‪ ٥‐٤‐٢‬ﺗﻌﺮﻳﻒ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ﻭ ﮔﻴﺮﻧﺪﻩ ﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ‪١٦‐٢ ................................................‬‬ ‫‪ ٦‐٤‐٢‬ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ‪١٨‐٢..................................................................‬‬ ‫‪ ٧‐٤‐٢‬ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﻳﻚ ﻟﻴﻨﻚ ‪١٩‐٢.................................................................................‬‬ ‫‪ ٨‐٤‐٢‬ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ﺗﻌﺪﺍﺩ ﮔﺮﻩ ﻫﺎﻱ ﺑﺎﻻ ﻭ ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ ﻟﻴﻨﻚ ﻫﺎ ‪٢٠‐٢.....‬‬ ‫‪i‬‬

‫‪ ١‐٨‐٤‐٢‬ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ﺗﻌﺪﺍﺩ ﮔﺮﻩ ﻫﺎﻱ ﺑﺎﻻ ‪٢٠‐٢ ........................................................................‬‬ ‫‪ ٢‐٨‐٤‐٢‬ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ ﻟﻴﻨﻚ ﻫﺎ ‪٢١‐٢ .........................................................................................‬‬

‫‪ ٩‐٤‐٢‬ﺍﻳﺠﺎﺩ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﺔ ‪٢٣‐٢.......................................................XGraph‬‬ ‫‪ ١‐٩‐٤‐٢‬ﺗﻮﭘﻮﻟﻮﮊﻱ ﻭ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ‪٢٣‐٢ .............................................................................................‬‬ ‫‪ ٢‐٩‐٤‐٢‬ﺛﺒﺖ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ‪٢٦‐٢......................................................................................‬‬ ‫‪ ٣‐٩‐٤‐٢‬ﺍﺟﺮﺍﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ‪٢٧‐٢ ........................................................................................................‬‬ ‫‪ Trace .٣‬ﻭ ‪ Monitoring‬ﺩﺭ ‪٣٠‐٣......................................................................................NS-2‬‬ ‫‪ ١‐٣‬ﺭﻭﺷﻬﺎﻱ ﺟﻤﻊﺁﻭﺭﻱ ﺩﺍﺩﻩ ﺩﺭ ‪٣٠‐٣............................................................................. NS‬‬ ‫‪ ٢‐٣‬ﺍﺷﻴﺎﺀ ‪٣١‐٣........................................................................................................... Trace‬‬

‫‪ ١‐٢‐٣‬ﻣﻌﻤﺎﺭﻱ ﺳﺮﺁﻳﻨﺪ ﺑﺴﺘﻪﻫﺎ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪٣١‐٣......................................... trace‬‬ ‫‪ ٢‐٢‐٣‬ﻣﻌﻤﺎﺭﻱ ﻟﻴﻨﻜﻬﺎ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪٣١‐٣...................................................... Trace‬‬ ‫‪ ٣‐٢‐٣‬ﻓﺮﻣﺖ ﻓﺎﻳﻞ ‪٣٣‐٣................................................................................................ trace‬‬ ‫‪ ٤‐٢‐٣‬ﺗﻮﺍﺑﻊ ﻛﻤﻜﻲ ﺑﺮﺍﻱ ﺩﺳﺘﺮﺳﻲ ﺑﻪ ﺍﺷﻴﺎﺀ ‪٣٣‐٣................................................tracing‬‬ ‫‪ ٥‐٢‐٣‬ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﺷﻴﺎﺀ ‪٣٤‐٣.................................. trace‬‬ ‫‪ ١‐٥‐٢‐٣‬ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﻓﻌﺎﻝ ﻧﻤﻮﺩﻥ ‪ trace‬ﺩﺭ ﻟﻴﻨﻜﻬﺎ ‪٣٤‐٣ ..................................‬‬ ‫‪ ٢‐٥‐٢‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ‪ trace‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺻﻔﻬﺎ‪٣٥‐٣ ...................................................................................‬‬ ‫‪ ٣‐٣‬ﺍﺷﻴﺎﺀ ‪٣٥‐٣.............................................................................................. Monitoring‬‬

‫‪٣٥‐٣.............................................................................................. Queue Monitoring ١‐٣‐٣‬‬ ‫‪ ٢‐٣‐٣‬ﺷﺊ ‪٣٧‐٣..................................................................................... QueueMonitor/ED‬‬ ‫‪٣٧‐٣........................................................................................... PerFlow Monitoring ٣‐٣‐٣‬‬ ‫‪ ١‐٣‐٣‐٣‬ﺷﺊ ‪٣٧‐٣ ......................................................................... QueueMonitor/ED/FlowMon‬‬ ‫‪ ٢‐٣‐٣‐٣‬ﺷﺊ ‪٣٨‐٣ ................................................................... QUEUEMONITOR/ED/FLOW‬‬ ‫‪ ٣‐٣‐٣‐٣‬ﻓﺮﻣﺖ ‪٣٨‐٣ ....................................................................................................Flow Monitor‬‬ ‫‪ii‬‬

‫‪ ٤‐٣‐٣‬ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ‪٣٩‐٣..................................................... Monitoring‬‬ ‫‪ ١‐٤‐٣‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﻓﻌﺎﻝ ﻧﻤﻮﺩﻥ ‪ Monitoring‬ﺭﻭﻱ ﻟﻴﻨﻜﻬﺎ‪٣٩‐٣ ......................................................‬‬ ‫‪ ٢‐٤‐٣‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﺷﺊ ‪٣٩‐٣ .................................................................................. QueueMonitor‬‬ ‫‪ ٣‐٤‐٣‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﺷﺊ ‪٤٠‐٣ ..................................................................................... Flow Monitor‬‬ ‫‪٤١‐٣ .................................................................................................... Loss Monitor ٤‐٣‬‬ ‫‪ ۵‐۳‬ﻣﺜﺎﻟﻬﺎﻳﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ Trace‬ﻭ ‪ Monitoring‬ﺩﺭ ‪٤١‐٣ .............................. NS-2‬‬

‫‪٤١‐٣..................................................................................................................... trace ١‐٥‐٣‬‬ ‫‪ all‐trace ١‐١‐٥‐٣‬ﻭ ‪٤١‐٣ .............................................................................................numtrace-all‬‬ ‫‪٤٢‐٣ .................................................................................................................. Trace-queue ٢‐١‐٥‐٣‬‬

‫‪٤٢‐٣.......................................................................................................... Monitoring ٢‐٥‐٣‬‬ ‫‪٤٣‐٣ .......................................................................................................Queue Monitoring ١‐٢‐٥‐٣‬‬ ‫‪٤٥‐٣ ........................................................................................................ Monitor per Flow ٢‐٢‐٥‐٣‬‬

‫‪٤٦‐٣ ...................................................................................................... Loss Monitor ٣‐٥‐٣‬‬ ‫‪ .٤‬ﺷﺒﻴﻪﺳﺎﺯ ‪ MPLS‬ﺩﺭ ‪٤٨‐٤.............................................................................................NS-2‬‬ ‫‪ ١‐٤‬ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪٤٨‐٤ ............................................... MPLS Network Simulator-V2‬‬

‫‪ MNS-v2 ١‐١‐٤‬ﺍﻋﻤﺎﻝ ﺗﻮﺯﻳﻊ ﺑﺮﭼﺴﺐ ﻛﻪ ﺷﺎﻣﻞ ﺍﺟﺰﺍﺀ ﺯﻳﺮ ﺍﺳﺖ ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪:‬‬ ‫‪٤٨‐٤‬‬ ‫‪ MNS-V2 ٢‐١‐٤‬ﺍﺯ ﺭﻭﺷﻬﺎﻱ ﺯﻳﺮ ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ‪ LSP‬ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪٤٩‐٤.................... :‬‬ ‫‪ ۳‐۱‐۴‬ﻗﺎﺑﻠﻴﺖ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٤٩‐٤...................................................................................‬‬ ‫‪ ٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪٥٠‐٤ ...............................................................Mpls Network Simulator‬‬

‫‪ ١‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ‪٥٠‐٤....................................................‬‬ ‫‪ ٢‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ‪٥٢‐٤.........................................................‬‬ ‫‪ ٣‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ﺑﻲﺩﺭﻧﮓ ‪٥٣‐٤............................................‬‬ ‫‪iii‬‬

‫‪ ٤‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ ‪٥٤‐٤.......................................................................‬‬ ‫‪ ٥‐٢‐٤‬ﺳﻄﻮﺡ ﺳﺮﻭﻳﺲ ﺩﺭ ‪٥٥‐٤................................................................................. MNS‬‬ ‫‪ ٦‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٥٦‐٤ ............................................................‬‬ ‫‪ ٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺷﺒﻴﻪﺳﺎﺯ ‪٦١‐٤ ................................... MNS‬‬

‫‪ ١‐٣‐٤‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﻭﺍﺳﻂ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺩﺭ ‪٦١‐٤ ........................................ NS-2‬‬ ‫‪ ٢‐٣‐٤‬ﻭﺍﺳﻂﻫﺎ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ‪٦٢‐٤ ................................................................‬‬ ‫‪ ٣‐٣‐٤‬ﻭﺍﺳﻄﻬﺎ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻛﻼﺱﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ ‪٦٣‐٤ .................................................‬‬ ‫‪ ٤‐٣‐٤‬ﻭﺍﺳﻂﻫﺎ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﻣﻘﻴﺪ ))‪ CR-LSP‬ﻭ ‪٦٥‐٤ ........................... CR-LDP‬‬ ‫‪ ٥‐٣‐٤‬ﻭﺍﺳﻄﻬﺎ ﺑﺮﺍﻱ ﻓﺮﺍﺧﻮﺍﻧﻲ ﺭﻭﺍﻟﻬﺎ ‪٦٦‐٤ ..........................................................................‬‬ ‫‪ ۶‐۳‐۴‬ﻭﺍﺳﻄﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﻘﻴﺪ ‪٦٦‐٤ ...............................................................................‬‬ ‫‪ ٧‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٦٧‐٤ .............................................................................‬‬ ‫‪ ٨‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ‪ trace‬ﻛﺮﺩﻥ ‪٦٨‐٤ .....................................................‬‬ ‫‪ ٩‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ‪٦٩‐٤ ................................... namulator‬‬ ‫‪ ٤‐٤‬ﻣﺜﺎﻟﻬﺎﻱ ﺍﺯ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺩﺭ ﺷﺒﻴﻪﺳﺎﺯ ‪٦٩‐٤........................................................ :‬‬

‫‪ ١‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ‪٧٤‐٤.......................................................‬‬ ‫‪ ٢‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ‪٧٦‐٤ ...............................................‬‬ ‫‪ ١‐٢‐٤‐٤‬ﻣﺴﻴﺮﻫﺎﻱ ‪٧٦‐٤........................................................................................................ CR-LSP‬‬ ‫‪٢‐٢‐٤‐٤‬‬

‫‪ CR-LSP‬ﺑﺎ ﺧﺼﻮﺻﻴﺖ ﺑﻪ ﺯﻭﺭ ﮔﺮﻓﺘﻦ ﻣﻨﺎﺑﻊ ‪٨٠‐٤ ............................................................‬‬

‫‪٨١‐٤ .........................................................................................Constraint Based Routing ٣‐٢‐٤‐٤‬‬

‫‪ ٣‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٢‐٤.......................................................‬‬ ‫‪ ۱‐۳‐۴‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺭﻭﺵ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٤‐٤ ........................... Hashkin‬‬ ‫‪ ۲‐۳‐۴‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺭﻭﺵ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٥‐٤ ................................................ Makam‬‬ ‫‪ ۳‐۳‐۴‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٥‐٤ ........................................ Simple-Dynamic‬‬ ‫‪iv‬‬

‫‪ ٤‐٣‐٤‐٤‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٥‐٤ ........................................ shortest-dynamic‬‬ ‫‪ ۵‐۳‐۴‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪٨٥‐٤ .................................................................... L3‬‬ ‫‪ .٥‬ﻣﻜﺎﻧﻴﺰﻡ ‪ Diffrentiated Service‬ﺩﺭ ‪٨٧‐٥............................................................NS-2‬‬ ‫‪ ۱‐۵‬ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺩﺭ ‪٨٦‐٥ ................................................................................. NS-2‬‬ ‫‪ ۲‐۵‬ﻣﻌﻤﺎﺭﻱ ﻣﺎﺟﻮﻝ ‪٨٦‐٥ .....................................................................................DiffServ‬‬

‫‪ ۱‐۲‐۵‬ﻣﻌﻤﺎﺭﻱ ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﻭ ﻣﺮﻛﺰﻱ ‪٨٧‐٥......................................................................‬‬ ‫‪ ۲‐۲‐۵‬ﺳﻴﺎﺳﺖﻫﺎ ‪٨٨‐٥...........................................................................................................‬‬ ‫‪ ۳‐۲‐۵‬ﺍﻧﻮﺍﻉ ‪policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﻣﺎﺟﻮﻝ ‪٨٩‐٥........................................ DiffServ‬‬ ‫‪ ۴‐۲‐۵‬ﺳﺎﺧﺘﺎﺭ ‪ Policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ‪٩٠‐٥.....................................................................‬‬ ‫‪ ۳‐۵‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﺎﺟﻮﻝ ‪٩١‐٥ .............................................................. DiffServ‬‬

‫‪ ۱‐۳‐۵‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺻﻒ ‪٩١‐٥.............................................................................‬‬ ‫‪ ١‐١‐٣‐٥‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﺷﻤﺎﻱ ﺯﻣﺎﻥﺑﻨﺪﻱ ﺑﻴﻦ ﺻﻒﻫﺎﻱ ﻓﻴﺰﻳﻜﻲ ‪٩٣‐٥ ...............................................‬‬

‫‪ ٢‐٣‐٥‬ﭘﻴﻜﺮﺑﻨﺪﻱ ‪٩٤‐٥............................................................................................... Policy‬‬ ‫‪ ٤‐٥‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻣﺎﺟﻮﻝ ‪٩٥‐٥ ................................ Diffserv‬‬

‫‪v‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪.١‬‬

‫‪١‐٢‬‬

‫ﻣﻘﺪﻣﻪ‬ ‫ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﭘﻴﭽﻴﺪﮔﻲ ﺷﺒﻜﻪ‪ ،‬ﺷﺒﻴﻪﺳﺎﺯﻱ ﻧﻘﺶ ﺑﺴﻴﺎﺭ ﻣﻬﻤﻲ ﻫﻢ ﺩﺭ ﺗﻌﻴﻴﻦ ﺧﺼﻮﺻﻴﺎﺕ ﺭﻓﺘﺎﺭ ﻓﻌﻠـﻲ‬

‫ﺷﺒﻜﻪ‪ ،‬ﻭ ﻫـﻢ ﺩﺭ ﺗﻌﻴـﻴﻦ ﺍﺛـﺮﺍﺕ ﺍﺣﺘﻤـﺎﻟﻲ ﻧﺎﺷـﻲ ﺍﺯ ﺗﻐﻴﻴـﺮﺍﺕ ﭘﻴـﺸﻨﻬﺎﺩ ﺷـﺪﻩ ﺭﻭﻱ ﻋﻤﻠﻜـﺮﺩ ﺷـﺒﻜﻪ ﺩﺍﺭﺩ‪.‬‬ ‫ﺷﺒﻴﻪﺳﺎﺯﻫﺎﻱ ﺯﻳﺎﺩﻱ ﺑﺮﺍﻱ ﺍﻳﻦ ﺍﻣﺮ ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪.‬ﺍﺯ ﻣﺰﺍﻳﺎﯼ ﺍﻳﻦ ﺷﺒﻴﻪ ﺳﺎﺯ ﺍﻳﻦ ﺍﺳﺖ ﮐﻪ‪:‬‬ ‫ﺍﻟﻒ‐ ﻣﻮﺭﺩ ﺗﺎﻳﻴﺪ ﻣﺠﺎﻣﻊ ﻋﻠﻤﻲ ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫ﺏ‐ ﺑﻪ ﺻﻮﺭﺕ ﺭﺍﻳﮕﺎﻥ ﺩﺭ ﺩﺳﺘﺮﺱ ﺍﺳﺖ‪.‬‬ ‫ﺝ‐ ﮐﺪ ﺁﻥ ﻧﻴﺰ ﺩﺭ ﺩﺳﺘﺮﺱ ﺍﺳﺖ ﻭ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﺍﻳﻦ ﺷﺒﻴﻪﺳﺎﺯ ﮐﺪﻫﺎﻳﻲ ﺍﺿﺎﻓﻪ ﻳﺎ ﮐﻢ ﻧﻤﻮﺩ‪.‬‬ ‫ﺩ‐ ﺍﻛﺜﺮ ﭘﺮﻭﺗﻜﻠﻬﺎﻱ ﺷﺒﻜﻪ ﺩﺭ ﺁﻥ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬

‫ﺩﺭ ﻓﺼﻞ ﺍﻭﻝ ﺍﻳﻦ ﮔﺰﺍﺭﺵ ﭼﮕﻮﻧﮕﻲ ﻧـﺼﺐ ﻭ ﺭﺍﻩﺍﻧـﺪﺍﺯﻱ ‪ NS-2‬ﻭ ﻧﺤـﻮﻩ ﺷـﺮﻭﻉ ﻛـﺎﺭ ﺑـﺎ ﺁﻥ ﺗـﺸﺮﻳﺢ‬ ‫ﻣﻲﺷﻮﺩ‪ ،‬ﺩﺭ ﻓﺼﻞ ﺩﻭﻡ ﻧﺤﻮﻩ ﺍﺳـﺘﻔﺎﺩﻩ ﺍﺯ ﻗﺎﺑﻠﻴـﺖ ‪ Monitoring‬ﻭ ‪ trace‬ﺩﺭ ‪ NS-2‬ﺷـﺮﺡ ﺩﺍﺩﻩ ﻣـﻲﺷـﻮﺩ‪ ،‬ﺩﺭ‬ ‫ﻓﺼﻞ ﺳﻮﻡ ﭼﮕﻮﻧﮕﻲ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺩﺭ ‪ NS-2‬ﺗﺸﺮﻳﺢ ﻣﻲﺷﻮﺩ ﻭ ﺩﺭ ﻓﺼﻞ ﭼﻬﺎﺭﻡ ﺑﻪ ﺷﺮﺡ ﻧﺤﻮﻩ ﺍﺳـﺘﻔﺎﺩﻩ‬ ‫ﺍﺯ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺩﺭ ‪ NS-2‬ﭘﺮﺩﺍﺧﺘﻪ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫‪.٢‬‬

‫ﺁﺷﻨﺎﻳﻲ ﻣﻘﺪﻣﺎﺗﻲ ﺑﺎ ‪NS-2‬‬ ‫ﺩﺭ ﺍﻳﻦ ﮔﺰﺍﺭﺵ ﺑﻪ ﺗﻮﺿﻴﺢ ﭼﮕﻮﻧﮕﻲ ﻧﺼﺐ ﻭ ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ‪ ns‬ﻭ ﻧﺤﻮﺓ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻥ ﭘﺮﺩﺍﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ns‬ﻳﻚ ﺷﺒﻴﻪﺳﺎﺯ ﺷﻲﮔﺮﺍ ﻭ ‪ discrete event driven‬ﺍﺳﺖ ﻛﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺯﺑﺎﻧﻬﺎﻱ ‪ C++‬ﻭ ‪ OTcl‬ﺩﺭ‬ ‫ﺩﺍﻧﺸﮕﺎﻩ ﺑﺮﻛﻠﻲ ﻃﺮﺍﺣﻲ ﻭ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﺍﺯ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﻋﻤﻮﻣﺎ ﺑﻪ ﻣﻨﻈﻮﺭ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺷﺒﻜﻪﻫﺎﻱ‬ ‫ﻛﺎﻣﭙﻴﻮﺗﺮﻱ ﻣﺤﻠﻲ ﻭ ﺷﺒﻜﻪﻫﺎﻱ ﮔﺴﺘﺮﺩﻩ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ ns .‬ﻣﻲﺗﻮﺍﻧﺪ ﺷﺒﻜﻪﻫﺎﻱ ‪ IP‬ﮔﻮﻧﺎﮔﻮﻧﻲ ﺭﺍ ﺷﺒﻴﻪ‪-‬‬ ‫ﺳﺎﺯﻱ ﻧﻤﺎﻳﺪ‪ .‬ﭘﺮﻭﺗﻜﻠﻬﺎﻱ ﺷﺒﻜﻪ ﻣﺎﻧﻨﺪ ‪ TCP‬ﻭ ‪ ،UDP‬ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ﻫﻤﭽﻮﻥ ‪ CBR ،Web ،Telnet ،FTP‬ﻭ‬ ‫‪ ،VBR‬ﻣﻜﺎﻧﻴﺰﻣﻬﺎﻱ ﻣﺪﻳﺮﻳﺖ ﺻﻔﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺏ ﻣﺜﻞ ‪ RED ،DropTail‬ﻭ ‪ ،CBQ‬ﺍﻟﮕﻮﺭﻳﺘﻤﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ‬ ‫ﻣﺜﻞ ‪ Dijkstra‬ﻭ ‪ ...‬ﺩﺭ ‪ ns‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩﺍﻧﺪ‪ .‬ﻫﻤﭽﻨﻴﻦ ‪ multicasting‬ﻭ ﺑﺮﺧﻲ ﺍﺯ ﭘﺮﻭﺗﻜﻠﻬﺎﻱ ﻻﻳﺔ ‪MAC‬‬

‫ﺑﺮﺍﻱ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺷﺒﻜﻪﻫﺎﻱ ﻣﺤﻠﻲ ﺩﺭ ‪ ns‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩﺍﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢‐ ٢‬‬

‫ﻫﺮ ﭼﻨﺪ ﭘﺲ ﺍﺯ ﺁﺷﻨﺎﻳﻲ ﺑﺎ ﻧﺤﻮﺓ ﻋﻤﻠﻜﺮﺩ ﺷﺒﻴﻪﺳﺎﺯ‪ ،‬ﻛﺎﺭ ﺑﺎ ‪ ns‬ﺑﺴﻴﺎﺭ ﺳﺎﺩﻩ ﻣﻲﮔﺮﺩﺩ ﺑﺎ ﺍﻳﻦ ﺣﺎﻝ ﺑﺮﺍﻱ‬ ‫ﻛﺎﺭﺑﺮﺍﻧﻲ ﻛﻪ ﺑﺎﺭ ﺍﻭﻝ ﺑﺎ ‪ ns‬ﺭﻭﺑﺮﻭ ﻣﻲﺷﻮﻧﺪ ﻛﺎﺭﻛﺮﺩﻥ ﺑﺎ ﺁﻥ ﺑﺴﻴﺎﺭ ﻣﺸﻜﻞ ﻣﻲﺑﺎﺷﺪ ﭼﺮﺍ ﻛﻪ ﺭﺍﻫﻨﻤﺎﻫﺎﻱ ﺧﻮﺑﻲ‬ ‫ﺑﺮﺍﻱ ﺍﻳﻨﮕﻮﻧﻪ ﻛﺎﺭﺑﺮﺍﻥ ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ‪ .‬ﺍﻛﺜﺮ ﺭﺍﻫﻨﻤﺎﻫﺎﻳﻲ ﻛﻪ ﺑﺮﺍﻱ ‪ ns‬ﻧﻮﺷﺘﻪ ﺷﺪﻩﺍﻧﺪ ﺑﻪ ﺗﻮﺿﻴﺢ ﻋﻤﻴﻖ ﺷﺒﻴﻪﺳﺎﺯ‬ ‫ﻣﻲﭘﺮﺩﺍﺯﻧﺪ ﻭ ﻛﺎﺭﺑﺮﺍﻥ ﺗﺎﺯﻩﻛﺎﺭ ﻧﻤﻲﺗﻮﺍﻧﻨﺪ ﺍﺯ ﺍﻳﻦ ﺭﺍﻫﻨﻤﺎﻫﺎ ﺑﻬﺮﻩ ﺑﺒﺮﻧﺪ‪.‬‬ ‫ﻫﺪﻑ ﺍﺯ ﺍﻳﻦ ﻓﺼﻞ‪ ،‬ﺁﺷﻨﺎ ﻧﻤﻮﺩﻥ ﻛﺎﺭﺑﺮﺍﻥ ﺗﺎﺯﻩﻛﺎﺭ ﺑﺎ ﻧﺤﻮﺓ ‪ download‬ﻛﺮﺩﻥ‪ ،‬ﻧﺼﺐ ﻭ ﻛﺎﺭ ﺑﺎ ﺷﺒﻴﻪﺳﺎﺯ‬ ‫ﻣﻲﺑﺎﺷﺪ‪ .‬ﺁﺷﻨﺎ ﻧﻤﻮﺩﻥ ﻛﺎﺭﺑﺮﺍﻥ ﺑﺎ ﺍﻳﺪﻩﻫﺎﻱ ﺍﺻﻠﻲ ﺍﻳﻨﻜﻪ ﺷﺒﻴﻪﺳﺎﺯ ﭼﮕﻮﻧﻪ ﻛﺎﺭ ﻣﻲﻛﻨﺪ‪ ،‬ﭼﮕﻮﻧﻪ ﻣﻲﺗﻮﺍﻥ ﺷﺒﻜﻪﻫﺎ‬ ‫ﺭﺍ ﺑﺮﺍﻱ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺁﻣﺎﺩﻩ ﻛﺮﺩ‪ ،‬ﺩﺭ ﻛﺠﺎ ﺑﺎﻳﺴﺘﻲ ﺍﻃﻼﻋﺎﺕ ﺑﻴﺸﺘﺮﻱ ﺭﺍ ﺭﺍﺟﻊ ﺑﻪ ﻗﻄﻌﺎﺕ ﺷﺒﻜﻪ ﺩﺭ ﻛﺪﻫﺎﻱ‬ ‫ﺷﺒﻴﻪﺳﺎﺯ ﺟﺴﺘﺠﻮ ﻛﺮﺩ ﻭ ‪ ...‬ﺍﺯ ﻭﻳﮋﮔﻴﻬﺎﻱ ﺍﻳﻦ ﮔﺰﺍﺭﺵ ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١-٢‬‬

‫‪٣‐٢‬‬

‫ﺑﺨﺶ ‪ : ١‬ﻃﺮﻳﻘﻪ ‪ download‬آﺮدن و ﻧﺼﺐ ‪ns‬‬

‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺑﻪ ﺗﻮﺿﻴﺢ ﻧﺤﻮﺓ ‪ download‬ﻛﺮﺩﻥ ﻭ ﻧﺼﺐ ‪ ns‬ﻣﻲﭘﺮﺩﺍﺯﻳﻢ‪ .‬ﺍﺑﺘﺪﺍ ﻃﺮﻳﻘﺔ ‪ download‬ﻛﺮﺩﻥ‬ ‫‪ ns‬ﺗﻮﺿﻴﺢ ﺩﺍﺩﻩ ﺧﻮﺍﻫﺪ ﺷﺪ ﻭ ﺳﭙﺲ ﭼﮕﻮﻧﮕﻲ ﻧﺼﺐ ﺁﻥ ﺍﺭﺍﺋﻪ ﻣﻲﮔﺮﺩﺩ‪.‬‬

‫‪ Download ١‐١‐٢‬ﻛﺮﺩﻥ ‪ns‬‬ ‫ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ ﺑﻪ ﺩﻭ ﺻﻮﺭﺕ ﻣﻲﺗﻮﺍﻥ ﻧﺼﺐ ﻛﺮﺩ‪ .‬ﺭﻭﺵ ﺍﻭﻝ ﻧﺼﺐ ﺑﺴﺘﻪﻫﺎﻱ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ ﻣﺨﺘﻠﻒ ﻣﻮﺭﺩ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ‪) ns‬ﻣﺜﻞ ‪ OTcl ، Tcl/Tk‬ﻭ ‪ (...‬ﺑﻪ ﺻﻮﺭﺕ ﺟﺪﺍﮔﺎﻧﻪ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺩﺭ ﺭﻭﺵ ﺩﻭﻡ ﺍﺯ ﺑﺴﺘﺔ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ‬ ‫‪ all-in-one‬ﻛﻪ ﺷﺎﻣﻞ ﻛﻠﻴﺔ ﺑﺴﺘﻪﻫﺎﻱ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ ﻻﺯﻡ ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ‪ ns‬ﻣﻲﺑﺎﺷﺪ‪ ،‬ﺑﺮﺍﻱ ﻧﺼﺐ ‪ ns‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ‪-‬‬ ‫ﺷﻮﺩ‪ .‬ﺍﮔﺮ ﺷﻤﺎ ﺍﺯ ﺁﻥ ﺩﺳﺘﻪ ﺍﻓﺮﺍﺩﻱ ﻫﺴﺘﻴﺪ ﻛﻪ ﻣﻲﺧﻮﺍﻫﻴﺪ ﺑﻪ ﺗﺎﺯﮔﻲ ﻛﺎﺭ ﺑﺎ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ ﺷﺮﻭﻉ ﻛﻨﻴﺪ ﻭ‬ ‫ﺁﺷﻨﺎﻳﻲ ﻗﺒﻠﻲ ﺑﺎ ﻧﺤﻮﺓ ﻛﺎﺭﻛﺮﺩ ﺁﻥ ﻧﺪﺍﺭﻳﺪ‪ ،‬ﭘﻴﺸﻨﻬﺎﺩ ﻣﻲﺷﻮﺩ ﺑﺮﺍﻱ ﺷﺮﻭﻉ ﻛﺎﺭ ﺍﺯ ﺭﻭﺵ ﺩﻭﻡ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪ .‬ﺗﻨﻬﺎ‬ ‫ﻋﻴﺒﻲ ﻛﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺭﻭﺵ ﺩﻭﻡ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﺑﺮﺧﻲ ﺍﺯ ﻗﺴﻤﺘﻬﺎﻱ ﺑﺴﺘﺔ ‪ all-in-one‬ﻛﻪ ﻣﻮﺭﺩ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻲﺑﺎﺷﻨﺪ ﺑﺨﺸﻲ ﺍﺯ ﻓﻀﺎﻱ ﺩﻳﺴﻜﺘﺎﻥ ﺭﺍ ﺍﺷﻐﺎﻝ ﺧﻮﺍﻫﻨﺪ ﻛﺮﺩ‪ .‬ﻧﻜﺘﻪﺍﻱ ﻛﻪ ﺑﺎﻳﺪ ﺑﻪ ﺁﻥ ﺗﻮﺟﻪ ﻛﻨﻴﺪ ﺍﻳﻦ‬ ‫ﺍﺳﺖ ﻛﻪ ﺑﺴﺘﻪ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ ‪ all-in-one‬ﻓﻘﻂ ﺩﺭ ﺳﻴﺴﺘﻤﻬﺎﻱ ﻣﺒﻨﻲ ﺑﺮ ﻳﻮﻧﻴﻜﺲ ﻛﺎﺭ ﻣﻲﻛﻨﺪ‪ .‬ﺑﺴﺘﻪ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ‬ ‫‪ all-in-one‬ﺭﺍ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺁﺩﺭﺱ ﺍﻳﻨﺘﺮﻧﺘﻲ ﺯﻳﺮ ‪ download‬ﻛﻨﻴﺪ ‪:‬‬ ‫‪. http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz‬‬ ‫ﺁﺧﺮﻳﻦ ﻧﺴﺨﺔ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺁﺩﺭﺱ ﺍﻳﻨﺘﺮﻧﺘﻲ‬

‫‪http://www.isi.edu/nsnam/dist/‬‬

‫ﻭ ﻳﺎ ﺁﺩﺭﺱ‬

‫‪ download ftp://ftp.isi.edu/nsnam‬ﻛﻨﻴﺪ‪.‬‬ ‫ﻧﻜﺘﻪ ‪ :‬ﺍﮔﺮ ﺍﺯ ﺳﻴﺴﺘﻢﻋﺎﻣﻞ ﻭﻳﻨﺪﻭﺯ ‪ ٢٠٠٠/٩٨/٩٥‬ﻭ ﻳﺎ ‪ NT‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻴﺪ‪ ،‬ﻣﻲﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺁﺩﺭﺱ ﺯﻳﺮ ﻓﺎﻳﻞ‬ ‫ﻗﺎﺑﻞ ﻧﺼﺐ ‪ ns‬ﺭﺍ ‪ download‬ﻛﻨﻴﺪ ‪. http://www.isi.edu/nsnam/dist/binary :‬‬

‫‪ ٢‐١‐٢‬ﻧﺼﺐ‬

‫‪ns‬‬

‫ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ ﻗﺒﻼ ﮔﻔﺘﻪ ﺷﺪ ﺑﺮﺍﻱ ﻧﺼﺐ ﻭ ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ‪ ns‬ﺩﻭ ﺭﻭﺵ ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪ .‬ﺑﻪ ﺩﻟﻴﻞ ﭘﻴﭽﻴﺪﮔﻲ ﺭﻭﺵ‬ ‫ﺍﻭﻝ ﺑﺮﺍﻱ ﻛﺎﺭﺑﺮﺍﻥ ﺗﺎﺯﻩﻛﺎﺭ‪ ،‬ﺩﺭ ﺍﻳﻨﺠﺎ ﻓﻘﻂ ﺑﻪ ﺗﻮﺿﻴﺢ ﺭﻭﺵ ﺩﻭﻡ ﻣﻲﭘﺮﺩﺍﺯﻳﻢ‪.‬‬ ‫‪ ns-allinone‬ﻳﻚ ﺑﺴﺘﺔ ﻧﺮﻡﺍﻓﺰﺍﺭﻳﺴﺖ ﻛﻪ ﺷﺎﻣﻞ ﻗﻄﻌﺎﺕ ﻻﺯﻡ ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ‪ ns‬ﻭ ﺑﺮﺧﻲ ﻗﻄﻌﺎﺕ ﺍﺧﺘﻴﺎﺭﻱ ﻣﻲ‪-‬‬ ‫ﺑﺎﺷﺪ‪ .‬ﺑﺴﺘﻪ ﺷﺎﻣﻞ ﻳﻚ ﺍﺳﻜﺮﻳﭙﺖ "‪ "install‬ﻣﻲﺑﺎﺷﺪ ﻛﻪ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ‪ ،‬ﻛﺎﻣﭙﺎﻳﻞ ﻭ ﻧﺼﺐ ﺧﻮﺩﻛﺎﺭ ﻗﻄﻌﺎﺕ‬ ‫ﺫﻛﺮ ﺷﺪﻩ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤‐٢‬‬

‫ﭘﺲ ﺍﺯ ﺁﻧﻜﻪ ﻓﺎﻳﻞ ‪ ns-allinone-2.27.tar.gz‬ﺭﺍ ‪ download‬ﻛﺮﺩﻳﺪ‪ ،‬ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﺁﻧﺮﺍ ﺍﺯ ﺣﺎﻟﺖ ﻓﺸﺮﺩﻩ‬ ‫ﺷﺪﻩ ﺧﺎﺭﺝ ﻛﻨﻴﺪ‪ .‬ﺍﮔﺮ ﺩﺭ ﻣﺤﻴﻂ ﮔﺮﺍﻓﻴﻜﻲ ﻫﺴﺘﻴﺪ‪ ،‬ﺑﺮ ﺭﻭﻱ ﻓﺎﻳﻞ ﻛﻠﻴﻚ ﺭﺍﺳﺖ ﻧﻤﺎﻳﻴﺪ ﻭ ﺍﺯ ﻣﻨﻮﻱ ﻧﺸﺎﻥ ﺩﺍﺩﻩ‬ ‫ﺷﺪﻩ ﮔﺰﻳﻨﺔ "‪ "Extracte here‬ﺭﺍ ﺍﻧﺘﺨﺎﺏ ﻧﻤﺎﻳﻴﺪ‪ .‬ﺑﺮﺍﻱ ﺷﻤﺎ ﺩﺍﻳﺮﻛﺘﻮﺭﻳﻲ ﺑﺎ ﻫﻤﺎﻥ ﻧﺎﻡ ﻓﺎﻳﻞ ﺍﻳﺠﺎﺩ ﺧﻮﺍﻫﺪ ﺷﺪ‬ ‫ﻛﻪ ﺣﺎﻭﻱ ﻣﺤﺘﻮﻳﺎﺕ ﻓﺎﻳﻞ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺍﮔﺮ ﺩﺭ ﺩﺍﺧﻞ ﻣﺤﻴﻂ ﻣﺘﻨﻲ ﻫﺴﺘﻴﺪ ﻣﻲﺗﻮﺍﻧﻴﺪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺑﺮﻧﺎﻣﻪ ‪tar‬‬

‫ﻓﺎﻳﻞ ﺭﺍ ﺍﺯ ﺣﺎﻟﺖ ﻓﺸﺮﺩﻩ ﺧﺎﺭﺝ ﻭ ﻳﺎ ﺑﻪ ﺍﺻﻄﻼﺡ ‪ untar‬ﻧﻤﺎﻳﻴﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻳﻦ ﻛﺎﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺭﺍ ﺩﺭ ﺷﻞ ﺍﺟﺮﺍ‬ ‫ﻛﻨﻴﺪ ‪:‬‬ ‫‪tar -xzvf ns-allinone-2.27.tar.gz‬‬

‫ﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺩﺍﻳﺮﻛﺘﻮﺭﻳﻲ ﺑﻪ ﻧﺎﻡ ‪ ns-allinone-2.27.tar‬ﺑﺮﺍﻱ ﺷﻤﺎ ﺍﻳﺠﺎﺩ ﺧﻮﺍﻫﺪ ﺷﺪ ﻛﻪ ﺣﺎﻭﻱ‬ ‫ﻣﺤﺘﻮﻳﺎﺕ ﻓﺎﻳﻞ ﻓﺸﺮﺩﻩ ﺷﺪﻩ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺣﺎﻝ ﺑﺮﺍﻱ ﻧﺼﺐ ﺑﺎﻳﺴﺘﻲ ﺍﺳﻜﺮﻳﭙﺖ ‪ install‬ﺭﺍ ﺍﺟﺮﺍ ﻧﻤﺎﻳﻴﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ‬ ‫ﺍﻳﻦ ﻛﺎﺭ ﻣﺴﻴﺮ ﺩﺍﻳﺮﻛﺘﻮﺭﻱ ﺧﻮﺩ ﺭﺍ ﺑﻪ ﺩﺍﻳﺮﻛﺘﻮﺭﻱ ‪ ns-allinone-2.27‬ﺗﻐﻴﻴﺮ ﺩﻫﻴﺪ ‪:‬‬ ‫‪# cd ns-allinone-2.27‬‬

‫ﺩﺳﺘﻮﺭ‪ ./install‬ﺭﺍ ﺑﻪ ﻣﻨﻈﻮﺭ ﻧﺼﺐ ﺧﻮﺩﻛﺎﺭ ‪ ns‬ﺍﺟﺮﺍ ﻧﻤﺎﻳﻴﺪ‪ .‬ﭘﺲ ﺍﺯ ﺍﺗﻤﺎﻡ ﻛﺎﺭ ﺍﺳﻜﺮﻳﭙﺖ ‪ ،install‬ﺑﺎﻳﺴﺘﻲ‬ ‫ﻣﺴﻴﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺤﻞ ﻧﺼﺐ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ‪ ،‬ﺑﻪ ﻣﻨﻈﻮﺭ ﺩﺳﺘﺮﺳﻲ ﻣﺴﺘﻘﻴﻢ ﺑﻪ ﺁﻥ‪ ،‬ﺩﺭ ﻓﺎﻳﻞ ﭘﺮﻭﻓﺎﻳﻞ ﺷﻠﻲ‬ ‫ﻛﻪ ﺍﺯ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻴﺪ‪ ،‬ﻣﺜﻼ ‪ ،bash‬ﻗﺮﺍﺭ ﺩﻫﻴﺪ‪ .‬ﻓﺮﺽ ﻣﺎ ﺑﺮ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﺷﻞ ﭘﻴﺶﻓﺮﺽ ﻳﻌﻨﻲ ‪bash‬‬

‫ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻧﻤﺎﻳﻴﺪ‪ .‬ﺑﺮﺍﻱ ﺗﻨﻈﻴﻢﻛﺮﺩﻥ ﻣﺴﻴﺮﻫﺎ ﺩﺭ ﻓﺎﻳﻞ ﭘﺮﻭﻓﺎﻳﻞ ﺷﻞ ‪ ،bash‬ﻓﺎﻳﻞ ‪ .bashrc‬ﺭﺍ ﻭﻳﺮﺍﻳﺶ ﻧﻤﺎﻳﻴﺪ‬ ‫ﻭ ﻣﺴﻴﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺤﻞ ﻧﺼﺐ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ ﺑﻪ ﺁﻥ ﺍﺿﺎﻓﻪ ﻛﻨﻴﺪ‪ .‬ﺗﻐﻴﻴﺮﺍﺕ ﺍﻋﻤﺎﻝ ﺷﺪﻩ ﺭﺍ ﺫﺧﻴﺮﻩ ﻧﻤﺎﻳﻴﺪ ﻭ‬ ‫ﻳﻚ ﺷﻞ ﺟﺪﻳﺪ ﺑﺎﺯ ﻛﻨﻴﺪ‪ ns .‬ﻗﺎﺑﻞ ﺍﺟﺮﺍ ﺷﺪﻥ ﺧﻮﺍﻫﺪ ﺑﻮﺩ‪ .‬ﺍﮔﺮ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﻣﺴﻴﺮ ﻧﺼﺐ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺩﺭ‬ ‫‪ root/ns-allinone-2.27‬ﺑﺎﺷﺪ‪ ،‬ﺷﻤﺎ ﺑﺎﻳﺴﺘﻲ ﻋﺒﺎﺭﺕ ﺯﻳﺮ ﺭﺍ ﺩﺭ ﻓﺎﻳﻞ ‪ bashrc‬ﺍﺿﺎﻓﻪ ﻧﻤﺎﻳﻴﺪ ‪:‬‬ ‫… ‪export PATH=$PATH:/root/ns-allinone-2.27/bin:‬‬ ‫… =‪export TCL_LIBRARY‬‬

‫ﻧﻜﺘﻪ ‪ :‬ﭘﺲ ﺍﺯ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ ‪ ./install‬ﻭ ﻛﺎﻣﻞ ﺷﺪﻥ ﻣﺮﺍﺣﻞ ﻧﺼﺐ‪ ،‬ﺩﺭ ﺍﻧﺘﻬﺎ ﭘﻴﻐﺎﻣﻬﺎﻳﻲ ﺑﻪ ﻣﻨﻈﻮﺭ ﺗﻨﻈﻴﻢ‬ ‫ﺑﺮﺧﻲ ﺍﺯ ﻣﺴﻴﺮﻫﺎﻱ ﻻﺯﻡ ﺑﺮﺍﻱ ﻋﻤﻠﻜﺮﺩ ﺻﺤﻴﺢ ‪ ns‬ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﭘﻴﻐﺎﻣﻬﺎﻱ ﺩﺍﺩﻩ ﺷﺪﻩ ﺭﺍ ﺑﻪ ﺩﻗﺖ ﺑﺨﻮﺍﻧﻴﺪ ﻭ‬ ‫ﻣﺴﻴﺮﻫﺎﻱ ﮔﻔﺘﻪ ﺷﺪﻩ ﺭﺍ ﻫﻤﺎﻧﻨﺪ ﺁﻧﭽﻪ ﻛﻪ ﺑﺮﺍﻱ ‪ PATH‬ﺍﻋﻤﺎﻝ ﺷﺪ‪ ،‬ﺗﻨﻈﻴﻢ ﻛﻨﻴﺪ‪.‬ﺿﻤﻨﺎ ﺑﺠﺎﯼ ‪ ...‬ﺩﺭ ﺩﻭ ﺩﺳﺘﻮﺭ‬ ‫ﺑﺎﻻ ﺍﺯ ﻣﺴﻴﺮ ﻫﺎﯼ ﺩﺍﺩﻩ ﺷﺪﻩ ﺩﺭ ﺍﻧﺘﻬﺎﯼ ﻧﺼﺐ ﺍﺳﺘﻔﺎﺩﻩ ﮐﻨﻴﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢-٢‬‬

‫‪٥‐٢‬‬

‫ﺑﺨﺶ ‪ : ٢‬ﺷﺮوع آﺎر ﺑﺎ ‪ns‬‬

‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺍﺑﺘﺪﺍ ﺑﻪ ﺗﻮﺿﻴﺤﻲ ﻛﻮﺗﺎﻩ ﺭﺍﺟﻊ ﺑﻪ ﻧﺤﻮﺓ ﺍﺟﺮﺍﻱ ﻓﺎﻳﻠﻬﺎﻱ ﺍﺳﻜﺮﻳﭙﺖ ﺩﺭ ‪ ns‬ﻭ ﻣﻌﻤﺎﺭﻱ ﻛﻠﻲ‬ ‫ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺧﻮﺍﻫﻴﻢ ﭘﺮﺩﺍﺧﺖ‪ .‬ﺳﭙﺲ ﺯﺑﺎﻥ ‪ OTcl‬ﺑﻪ ﺻﻮﺭﺕ ﻣﺨﺘﺼﺮ ﻣﻌﺮﻓﻲ ﺧﻮﺍﻫﺪ ﺷﺪ ﻭ ﻣﺜﺎﻟﻬﺎﻳﻲ ﺩﺭ ﺍﻳﻦ‬ ‫ﺯﻣﻴﻨﻪ ﺍﺭﺍﺋﻪ ﻣﻲﮔﺮﺩﺩ‪.‬‬

‫‪ ١‐٢‐٢‬ﺍﺟﺮﺍﻱ‬

‫‪ns‬‬

‫ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ‪ ns‬ﺑﻪ ﺩﻭ ﺻﻮﺭﺕ ﻣﻲﺗﻮﺍﻥ ﻋﻤﻞ ﻛﺮﺩ ‪:‬‬ ‫‪ .١‬ﺍﮔﺮ ﻣﺴﻴﺮ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺤﻞ ﻧﺼﺐ ‪ ns‬ﺭﺍ ﺩﺭ ‪ PATH‬ﺳﺖ ﻛﺮﺩﻩ ﺑﺎﺷﻴﺪ‪ ،‬ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ‪ ns‬ﻛﺎﻓﻴﺴﺖ ﻛﻪ‬ ‫ﻧﺎﻡ ‪ ns‬ﺭﺍ ﺗﺎﻳﭗ ﻧﻤﺎﻳﻴﺪ‪.‬‬ ‫‪ .٢‬ﺍﮔﺮ ﻣﺴﻴﺮ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺤﻞ ﻧﺼﺐ ‪ ns‬ﺭﺍ ﺩﺭ ‪ PATH‬ﺳﺖ ﻧﻜﺮﺩﻩ ﺑﺎﺷﻴﺪ‪ ،‬ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ‪ ns‬ﺑﺎﻳﺴﺘﻲ ﺍﺑﺘﺪﺍ‬ ‫ﺑﻪ ﺩﺍﻳﺮﻛﺘﻮﺭﻱ ‪ bin‬ﺩﺭ ﺩﺍﺧﻞ ﺩﺍﻳﺮﻛﺘﻮﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺤﻞ ﻧﺼﺐ ‪ ns‬ﺗﻐﻴﻴﺮ ﻣﺴﻴﺮ ﺩﻫﻴﺪ ﻭ ﺳﭙﺲ ﺩﺭ‬ ‫ﺁﻧﺠﺎ ‪ ns‬ﺭﺍ ﺍﺟﺮﺍ ﻧﻤﺎﻳﻴﺪ‪.‬‬ ‫ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ ns‬ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﻫﻢ ﺑﻪ ﺻﻮﺭﺕ ﺑﺪﻭﻥ ﺁﺭﮔﻮﻣﺎﻥ ﻭ ﻫﻢ ﺑﺎ ﺁﺭﮔﻮﻣﺎﻥ ﺍﺟﺮﺍ ﻛﺮﺩ‪ .‬ﺁﺭﮔﻮﻣﺎﻧﻲ ﻛﻪ ﻧﺮﻡ‪-‬‬ ‫ﺍﻓﺰﺍﺭ ‪ ns‬ﻣﻲﮔﻴﺮﺩ ﻳﻚ ﻓﺎﻳﻞ ﺍﺯ ﻧﻮﻉ "‪ "tclscript‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﻓﺎﻳﻞ ﺳﻨﺎﺭﻳﻮﻱ ﺷﺒﻴﻪﺳﺎﺯﻱ ﻛﻪ ﺷﺎﻣﻞ‬ ‫ﺗﻮﭘﻮﻟﻮﮊﻱ ﻭ ﺭﻭﻳﺪﺍﺩﻫﺎ ﻣﻲﺑﺎﺷﺪ‪ ،‬ﺗﻌﺮﻳﻒ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺑﺮﺍﻱ ﺷﺮﻭﻉ ﻛﺎﺭ ﺑﺎ ‪ ns‬ﻛﺎﻓﻴﺴﺖ ﺁﻧﭽﻪ ﺭﺍ ﻛﻪ ﻣﻮﺭﺩ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺍﺳﺖ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻳﻚ ﻭﻳﺮﺍﻳﺸﮕﺮ ﻣﺜﻞ‬ ‫‪ emacs‬ﺩﺭ ﻳﻚ ﻓﺎﻳﻞ ﺑﺎ ﭘﺴﻮﻧﺪ ‪ tcl‬ﺫﺧﻴﺮﻩ ﻛﻨﻴﺪ ﻭ ﺳﭙﺲ ﺁﻥ ﻓﺎﻳﻞ ﺭﺍ ﺑﻪ ﻋﻨﻮﺍﻥ ﺁﺭﮔﻮﻣﺎﻥ ﺑﻪ ‪ ns‬ﭘﺎﺱ ﻛﻨﻴﺪ‪ .‬ﺑﻪ‬ ‫ﻋﻨﻮﺍﻥ ﻧﻤﻮﻧﻪ ﺍﮔﺮ ﺍﺳﻢ ﻓﺎﻳﻞ ‪ test.tcl‬ﺑﺎﺷﺪ‪ ،‬ﺑﺮﺍﻱ ﺍﺟﺮﺍﻱ ﺁﻥ ﻋﺒﺎﺭﺕ ﺯﻳﺮ ﺭﺍﺗﺎﻳﭗ ﻛﻨﻴﺪ ‪:‬‬ ‫‪# ns test.tcl‬‬

‫ﻧﻜﺘﻪ ‪ :‬ﻣﻲﺗﻮﺍﻥ ﺧﺮﻭﺟﻲ ﺍﻳﻦ ﺑﺮﻧﺎﻣﻪ ﺭﺍ ﺑﻪ ﺑﺮﻧﺎﻣﺔ ‪ (Network Animator) nam‬ﺩﺍﺩ ﺗﺎ ﻧﺘﺎﻳﺞ ﺭﺍ ﺑﻪ ﺻﻮﺭﺕ‬ ‫ﺗﺼﻮﻳﺮﻱ ﻧﻤﺎﻳﺶ ﺩﻫﺪ‪ .‬ﺑﺮﻧﺎﻣﺔ ‪ nam‬ﻣﺮﺍﺣﻞ ﻣﺨﺘﻠﻒ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺭﺍ ﺩﺭ ﻓﻮﺍﺻﻞ ﺯﻣﺎﻧﻲ ﻣﺨﺘﻠﻒ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪.‬‬

‫‪ ٢‐٢‐٢‬ﻣﻌﻤﺎﺭﻱ‬

‫‪ns‬‬

‫ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ ﺩﺭ ﺷﻜﻞ ‪ ١‬ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪ ns ،‬ﻳﻚ ﻣﻔﺴﺮ ﺍﺳﻜﺮﻳﭙﺖ ‪ OTcl‬ﻣﻲﺑﺎﺷﺪ ﻛﻪ ﺩﺍﺭﺍﻱ ﻳﻚ‬ ‫ﺯﻣﺎﻥﺑﻨﺪ ﺭﻭﻳﺪﺍﺩ‪ ،‬ﻛﺘﺎﺑﺨﺎﻧﻪﻫﺎﻱ ﺍﺷﻴﺎ ﻗﻄﻌﺎﺕ ﺷﺒﻜﻪ ﻭ ﻛﺘﺎﺑﺨﺎﻧﻪﻫﺎﻱ ﻣﺎﺟﻮﻝ ﺍﻳﺠﺎﺩ ﺷﺒﻜﻪ )ﻟﻮﻟﻪﻛﺸﻲ( ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫ﺑﻪ ﺑﻴﺎﻥ ﺩﻳﮕﺮ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ ns‬ﺍﺯ ﺯﺑﺎﻥ ﺍﺳﻜﺮﻳﭙﺘﻲ ‪ otcl‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﻳﺠﺎﺩ ﻭ ﺍﺟﺮﺍﻱ ﻳﻚ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦‐٢‬‬

‫ﺷﺒﻜﻪ ﻛﺎﺭﺑﺮ ﺑﺎﻳﺴﺘﻲ ﻳﻚ ﺍﺳﻜﺮﻳﭙﺖ ‪ otcl‬ﺑﻨﻮﻳﺴﺪ ﻛﻪ ﻳﻚ ﺯﻣﺎﻥﺑﻨﺪ ﺭﻭﻳﺪﺍﺩ ﺭﺍ ﻣﻘﺪﺍﺭﺩﻫﻲ ﺍﻭﻟﻴﻪ ﻛﻨﺪ ﻭ ﺳﭙﺲ‬ ‫ﺁﻧﺮﺍ ﻓﻌﺎﻝ ﻧﻤﺎﻳﺪ‪ ،‬ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﺒﻜﻪ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﺷﻴﺎ ﺷﺒﻜﻪ ﻭ ﺗﻮﺍﺑﻊ ﻟﻮﻟﻪﻛﺸﻲ ﻛﻪ ﺩﺭ ﻛﺘﺎﺑﺨﺎﻧﻪ ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ‬ ‫ﺍﻳﺠﺎﺩ ﻧﻤﺎﻳﺪ ﻭ ﺑﺎﻻﺧﺮﻩ ﺍﻳﻨﻜﻪ ﺍﺯ ﻃﺮﻳﻖ ﺯﻣﺎﻥﺑﻨﺪ ﺭﻭﻳﺪﺍﺩ ﺑﻪ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ﺑﮕﻮﻳﺪ ﻛﻪ ﭼﻪ ﺯﻣﺎﻧﻲ ﺍﻧﺘﻘﺎﻝ ﺑﺴﺘﻪﻫﺎ ﺭﺍ‬ ‫ﺷﺮﻭﻉ ﻛﻨﻨﺪ ﻭ ﭼﻪ ﺯﻣﺎﻧﻲ ﺑﻪ ﺁﻥ ﺧﺎﺗﻤﻪ ﺩﻫﻨﺪ‪ .‬ﻭﺍﮊﻩ "ﻟﻮﻟﻪﻛﺸﻲ" ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﺷﺒﻜﻪ ﺑﻪ ﻛﺎﺭ ﻣﻲﺭﻭﺩ ﭼﺮﺍﻛﻪ ﺍﻳﺠﺎﺩ‬ ‫ﻳﻚ ﺷﺒﻜﻪ‪ ،‬ﻟﻮﻟﻪﻛﺸﻲ ﻣﺴﻴﺮﻫﺎﻱ ﺩﺍﺩﻩﺍﻱ ﻣﺨﺘﻠﻒ ﺑﻴﻦ ﺍﺷﻴﺎ ﺷﺒﻜﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻣﻘﺪﺍﺭﺩﻫﻲ ﺍﺷﺎﺭﻩﮔﺮ‬ ‫"‪ "neighbor‬ﻳﻚ ﺷﻲ ﺑﻪ ﺁﺩﺭﺱ ﻳﻚ ﺷﻲ ﻣﻨﺎﺳﺐ ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫ﺷﻜﻞ ‪ : ١‬ﺷﻤﺎﻱ ﻛﻠﻲ ‪ ns‬ﺍﺯ ﺩﻳﺪ ﻛﺎﺭﺑﺮ‬

‫ﻭﻗﺘﻲ ﻛﻪ ﻛﺎﺭﺑﺮ ﺑﺨﻮﺍﻫﺪ ﻳﻚ ﺷﻲ ﺷﺒﻜﻪﺍﻱ ﺟﺪﻳﺪ ﺍﻳﺠﺎﺩ ﻛﻨﺪ ﺍﺯ ﺩﻭ ﻃﺮﻳﻖ ﻣﻲﺗﻮﺍﻧﺪ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﺪ ‪:‬‬ ‫‪ .١‬ﻧﻮﺷﺘﻦ ﻳﻚ ﺷﻲ ﺟﺪﻳﺪ‬ ‫‪ .٢‬ﺍﻳﺠﺎﺩ ﻳﻚ ﺷﻲ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺘﺎﺑﺨﺎﻧﺔ ﺍﺷﻴﺎ ﻭ ﻟﻮﻟﻪﻛﺸﻲ ﻣﺴﻴﺮ ﺩﺍﺩﻩ ﺍﺯ ﻃﺮﻳﻖ ﺷﻲ‬ ‫ﺍﻳﻦ ﻛﺎﺭ ﻣﻤﻜﻦ ﺍﺳﺖ ﭘﻴﭽﻴﺪﻩ ﺑﻪ ﻧﻈﺮ ﺁﻳﺪ ﺍﻣﺎ ﻟﻮﻟﻪﻛﺸﻲ ﻣﺎﺟﻮﻟﻬﺎﻱ ‪ otcl‬ﻋﻤﻼ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺑﺴﻴﺎﺭ ﺳﺎﺩﻩ ﻣﻲﻧﻤﺎﻳﺪ‬ ‫ﻭ ﻗﺪﺭﺕ ‪ ns‬ﻫﻢ ﺍﺯ ﻫﻤﻴﻦ ﺧﺎﺻﻴﺖ ﻟﻮﻟﻪﻛﺸﻲ ﻣﻲﺁﻳﺪ‪.‬‬ ‫ﻳﻜﻲ ﺩﻳﮕﺮ ﺍﺯ ﻗﻄﻌﺎﺕ ﺍﺻﻠﻲ ‪ ،ns‬ﺩﺭ ﻛﻨﺎﺭ ﺍﺷﻴﺎ ﺷﺒﻜﻪ‪ ،‬ﺯﻣﺎﻥﺑﻨﺪ ﺭﻭﻳﺪﺍﺩ ﻣﻲﺑﺎﺷﺪ‪ .‬ﻳﻚ ﺭﻭﻳﺪﺍﺩ ﺩﺭ ‪ns‬‬

‫ﺗﻮﺳﻂ ﻳﻚ ﺷﻨﺎﺳﺔ )‪ (ID‬ﺑﺴﺘﻪ‪ ،‬ﻛﻪ ﺩﺭ ﻃﻮﻝ ﻣﺪﺕ ﺯﻣﺎﻥﺑﻨﺪﻱ ﺷﺪﻩ ﺑﺮﺍﻱ ﺑﺴﺘﻪ ﻳﻜﺘﺎ ﻣﻲﺑﺎﺷﺪ‪ ،‬ﻭ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ‬ ‫ﺷﻲﺍﻱ ﻛﻪ ﺭﻭﻳﺪﺍﺩ ﺭﺍ ﭘﺮﺩﺍﺯﺵ ﻣﻲﻛﻨﺪ‪ ،‬ﻣﺸﺨﺺ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺩﺭ ‪ ns‬ﺯﻣﺎﻥﺑﻨﺪ ﺭﻭﻳﺪﺍﺩ ﺯﻣﺎﻥ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺭﺍ ﺩﻧﺒﺎﻝ ﻣﻲﻛﻨﺪ ﻭ ﻛﻠﻴﺔ ﺭﻭﻳﺪﺍﺩﻫﺎﻳﻲ ﺭﺍ ﻛﻪ ﺩﺭ ﺻﻒ ﺭﻭﻳﺪﺍﺩ‬ ‫ﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ ﻭ ﺑﺮﺍﻱ ﺯﻣﺎﻥ ﺟﺎﺭﻱ ﺯﻣﺎﻥﺑﻨﺪﻱ ﺷﺪﻩﺍﻧﺪ‪ ،‬ﺍﺯ ﻃﺮﻳﻖ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻗﻄﻌﺎﺕ ﺷﺒﻜﻪﺍﻱ ﻣﻨﺎﺳﺐ ﻓﻌﺎﻝ ﻣﻲ‪-‬‬ ‫ﻧﻤﺎﻳﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧‐ ٢‬‬

‫ﻭﻗﺘﻲ ﻛﻪ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺑﻪ ﭘﺎﻳﺎﻥ ﻣﻲﺭﺳﺪ‪ ns ،‬ﭼﻨﺪﻳﻦ ﻓﺎﻳﻞ ﻣﺘﻨﻲ ﺭﺍ ﻛﻪ ﺷﺎﻣﻞ ﺩﺍﺩﻩﻫﺎﻱ ﺷﺒﻴﻪﺳﺎﺯﻱ ﻣﻲ‪-‬‬ ‫ﺑﺎﺷﻨﺪ ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ )ﺍﻟﺒﺘﻪ ﺍﮔﺮ ﺍﻳﻦ ﻣﻮﺿﻮﻉ ﺩﺭ ﻓﺎﻳﻞ ﺍﺳﻜﺮﻳﭙﺖ ‪ .tcl‬ﺫﻛﺮ ﺷﺪﻩ ﺑﺎﺷﺪ(‪ .‬ﺍﺯ ﺍﻳﻦ ﺩﺍﺩﻩﻫﺎ ﻣﻲﺗﻮﺍﻥ‬ ‫ﺑﺮﺍﻱ ﺗﺤﻠﻴﻞ ﺷﺒﻴﻪﺳﺎﺯﻱ ﻭ ﻳﺎ ﺑﻪ ﻋﻨﻮﺍﻥ ﻭﺭﻭﺩﻱ ﺑﻪ ﺑﺮﻧﺎﻣﻪ ‪ nam‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ‪ nam .‬ﺩﺍﺭﺍﻱ ﻳﻚ ﺭﺍﺑﻂ ﮔﺮﺍﻓﻴﻜﻲ‬ ‫ﺧﻮﺏ ﺷﺒﻴﻪ ﺑﻪ ﺁﻧﭽﻪ ﻛﻪ ﺩﺭ ﻧﺮﻡﺍﻓﺰﺍﺭﻫﺎﻱ ‪ CD Player‬ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪ ،‬ﻣﻲﺑﺎﺷﺪ ﻭ ﻫﻤﭽﻨﻴﻦ ﺩﺍﺭﺍﻱ ﻛﻨﺘﺮﻝ ﻛﻨﻨﺪﺓ‬ ‫ﺳﺮﻋﺖ ﻧﻤﺎﻳﺶ ﺍﺳﺖ‪ .‬ﻋﻼﻭﻩ ﺑﺮ ﺍﻳﻨﻬﺎ‪ nam ،‬ﻗﺎﺑﻠﻴﺖ ﻧﻤﺎﻳﺶ ﮔﺮﺍﻓﻴﻜﻲ ﺍﻃﻼﻋﺎﺗﻲ ﻣﺜﻞ ﻣﻴﺰﺍﻥ ﺑﺎﺯﺩﻫﻲ‪ ،‬ﺗﻌﺪﺍﺩ‬ ‫ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﻫﺮ ﻟﻴﻨﻚ ﻭ ‪ ...‬ﺭﺍ ﺩﺍﺭﺍﺳﺖ‪.‬‬

‫‪ ٣‐٢‐٢‬ﺯﺑﺎﻥ ﻛﺎﺭﺑﺮﻱ‬

‫‪OTcl‬‬

‫ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ ﻗﺒﻼ ﮔﻔﺘﻪ ﺷﺪ‪ ns ،‬ﺍﺳﺎﺳﺎ ﻳﻚ ﻣﻔﺴﺮ ‪ otcl‬ﺍﺳﺖ ﻭ ﺑﻨﺎﺑﺮﺍﻳﻦ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ ns‬ﺑﺴﻴﺎﺭ ﻣﻔﻴﺪ‬ ‫ﺧﻮﺍﻫﺪ ﺑﻮﺩ ﻛﻪ ﻧﺤﻮﺓ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﻪ ﺯﺑﺎﻥ ‪ otcl‬ﺭﺍ ﺑﺪﺍﻧﻴﻢ‪ .‬ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﻳﻚ ﻣﺜﺎﻝ ﺍﺯ ﺍﺳﻜﺮﻳﭙﺖ ‪ tcl‬ﻭ ﻳﻚ‬ ‫ﻣﺜﺎﻝ ﺍﺯ ﺍﺳﻜﺮﻳﭙﺖ ‪ otcl‬ﺁﻭﺭﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﻣﺜﺎﻝ ‪ ١‬ﻳﻚ ﺍﺳﻜﺮﻳﭙﺖ ‪ tcl‬ﺍﺳﺖ ﻛﻪ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ ﭼﮕﻮﻧﻪ ﻣﻲﺗﻮﺍﻥ ﻳﻚ ﺭﻭﺍﻝ ﺍﻳﺠﺎﺩ ﻛﺮﺩ ﻭ ﺁﻧﺮﺍ ﻓﺮﺍﺧﻮﺍﻧﻲ‬ ‫ﻧﻤﻮﺩ‪ ،‬ﭼﮕﻮﻧﻪ ﻣﻲﺗﻮﺍﻥ ﻣﺘﻐﻴﺮﻫﺎ ﺭﺍ ﻣﻘﺪﺍﺭﺩﻫﻲ ﻛﺮﺩ ﻭ ﺑﺎﻻﺧﺮﻩ ﭼﮕﻮﻧﻪ ﻣﻲﺗﻮﺍﻥ ﺣﻠﻘﻪ ﺍﻳﺠﺎﺩ ﻛﺮﺩ‪.‬‬

‫ﻣﺜﺎﻝ ‪ : ١‬ﺍﻳﺠﺎﺩ ﻭ ﻓﺮﺍﺧﻮﺍﻧﻲ ﺭﻭﺍﻝ ﺩﺭ ‪tcl‬‬

‫ﺩﺭ ‪ tcl‬ﺍﺯ ﻛﻠﻤﺔ ﻛﻠﻴﺪﻱ ‪ proc‬ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻳﻚ ﺭﻭﺍﻝ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺑﻪ ﺩﻧﺒﺎﻝ ﻭﺍﮊﺓ ‪ proc‬ﺑﻪ ﺗﺮﺗﻴﺐ‬ ‫ﻧﺎﻡ ﺭﻭﺍﻝ ﻭ ﺳﭙﺲ ﺁﺭﮔﻮﻣﺎﻧﻬﺎﻱ ﺁﻥ‪ ،‬ﻛﻪ ﺩﺭ ﺩﺍﺧﻞ ﮔﻴﻮﻣﻪ ﻗﺮﺍﺭ ﮔﺮﻓﺘﻪﺍﻧﺪ‪ ،‬ﻣﻲﺁﻳﻨﺪ‪ .‬ﺍﺯ ﻭﺍﮊﺓ ﻛﻠﻴﺪﻱ ‪ set‬ﺑﺮﺍﻱ‬ ‫ﺗﺨﺼﻴﺺ ﻳﻚ ﻣﻘﺪﺍﺭ ﺑﻪ ﻳﻚ ﻣﺘﻐﻴﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﻋﺒﺎﺭﺕ ]‪ [expr ...‬ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻛﻪ ﻣﻔﺴﺮ ﻋﺒﺎﺭﺗﻲ ﺭﺍ ﻛﻪ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨‐٢‬‬

‫ﺑﻌﺪ ﺍﺯ ﻭﺍﮊﺓ ‪ expr‬ﺁﻣﺪﻩ ﺍﺳﺖ‪ ،‬ﺍﺭﺯﻳﺎﺑﻲ ﻧﻤﺎﻳﺪ‪ .‬ﺗﻮﺟﻪ ﻛﻨﻴﺪ ﻛﻪ ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻣﺤﺘﻮﻱ ﻳﻚ ﻣﺘﻐﻴﺮ ﺍﺯ‬ ‫ﻛﺎﺭﺍﻛﺘﺮ ‪ $‬ﺑﻪ ﻫﻤﺮﺍﻩ ﻧﺎﻡ ﻣﺘﻐﻴﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﻭﺍﮊﺓ ﻛﻠﻴﺪﻱ ‪ puts‬ﺭﺷﺘﻪﺍﻱ ﺭﺍ ﻛﻪ ﻣﺎﺑﻴﻦ ﻛﺎﺭﺍﻛﺘﺮﻫﺎﻱ "" ﻗﺮﺍﺭ‬ ‫ﮔﺮﻓﺘﻪ ﺍﺳﺖ‪ ،‬ﺩﺭ ﺧﺮﻭﺟﻲ ﭼﺎﭖ ﻣﻲﻛﻨﺪ‪ .‬ﺩﺭ ﺯﻳﺮ ﻧﺘﻴﺠﺔ ﺣﺎﺻﻞ ﺍﺯ ﺍﺟﺮﺍﻱ ﻣﺜﺎﻝ ‪ ١‬ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ‪:‬‬

‫ﻣﺜﺎﻝ ﺑﻌﺪ ﻳﻚ ﻣﺜﺎﻝ ﺷﻲﮔﺮﺍ ﺑﻪ ﺯﺑﺎﻥ ‪ otcl‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﺍﻳﻦ ﻣﺜﺎﻝ ﺑﺴﻴﺎﺭ ﺳﺎﺩﻩ ﻣﻲﺑﺎﺷﺪ ﻭ ﺻﺮﻓﺎ ﻧﺸﺎﻥ‬ ‫ﺩﻫﻨﺪﺓ ﻧﺤﻮﺓ ﺍﻳﺠﺎﺩ ﻭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻳﻚ ﺷﻲ ﺩﺭ ‪ otcl‬ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫ﻣﺜﺎﻝ‪ : ٢‬ﺍﻳﺠﺎﺩ ﺷﻲ ﻭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﺭﺙﺑﺮﻱ ﺩﺭ ‪otcl‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩‐ ٢‬‬

‫ﺩﺭ ﻣﺜﺎﻝ ‪ ٢‬ﺩﻭ ﻛﻼﺱ ﺑﻪ ﻧﺎﻣﻬﺎﻱ ‪ mom‬ﻭ ‪ kid‬ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ‪ .‬ﻛﻼﺱ ‪ kid‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻓﺮﺯﻧﺪ ﻛﻼﺱ‬ ‫‪ mom‬ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﻭﻟﻲ ﺗﺎﺑﻊ ‪ greet‬ﺩﺭ ﻛﻼﺱ ‪ kid‬ﺩﻭﺑﺎﺭﻩﻧﻮﻳﺴﻲ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﺍﺯ ﻭﺍﮊﻩ ﻛﻠﻴﺪﻱ ‪Class‬‬

‫ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻭ ﺍﻳﺠﺎﺩ ﻛﻼﺱ ﻭ ﺍﺯ ﻭﺍﮊﻩ ﻛﻠﻴﺪﻱ ‪ instproc‬ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﺗﻮﺍﺑﻊ ﻋﻀﻮ ﻳﻚ ﻛﻼﺱ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‬ ‫ﻭ ﺑﺮﺍﻱ ﺍﺭﺙﺑﺮﻱ ﺍﺯ ﻭﺍﮊﺓ ﻛﻠﻴﺪﻱ ‪ -superclass‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﮔﺮﺩﺩ‪ .‬ﺩﺭ ﺗﻌﺮﻳﻒ ﺗﺎﺑﻊ‪ ،‬ﻭﺍﮊﺓ ‪ $self‬ﻫﻤﺎﻧﻨﺪ ﺍﺷﺎﺭﻩﮔﺮ‬ ‫‪ this‬ﺩﺭ ‪ C++‬ﻋﻤﻞ ﻣﻲﻛﻨﺪ ﻭ ‪ instvar‬ﺑﺮﺭﺳﻲ ﻣﻲﻛﻨﺪ ﻛﻪ ﺁﻳﺎ ﻧﺎﻡ ﻣﺘﻐﻴﺮﻱ ﻛﻪ ﺑﻌﺪ ﺍﺯ ﺁﻥ ﻣﻲﺁﻳﺪ ﺩﺭ ﺧﻮﺩ‬ ‫ﻛﻼﺱ ﻭ ﻳﺎ ﺩﺭ ﻛﻼﺱ ﭘﺪﺭ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ ﻳﺎ ﻧﻪ‪ .‬ﺍﮔﺮ ﻣﺘﻐﻴﺮ ﺍﺯ ﻗﺒﻞ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺎﺷﺪ ﺑﻪ ﺁﻥ ﺍﺭﺟﺎﻉ ﻣﻲﺷﻮﺩ‬ ‫ﻭﮔﺮﻧﻪ ﻳﻚ ﻣﺘﻐﻴﺮ ﺟﺪﻳﺪ ﺗﻌﺮﻳﻒ ﻣﻲﺷﻮﺩ‪ .‬ﻭ ﺑﺎﻻﺧﺮﻩ ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﻳﻚ ﻧﻤﻮﻧﻪ ﺍﺯ ﺷﻲ ﺍﺯ ﻭﺍﮊﺓ ‪ ،new‬ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ‬ ‫ﺩﺭ ﻣﺜﺎﻝ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪ ،‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺧﺮﻭﺟﻲ ﺑﺮﻧﺎﻣﻪ ﺑﻪ ﺷﻜﻞ ﺯﻳﺮ ﻣﻲﺑﺎﺷﺪ ‪:‬‬

‫ﺩﺭ ﺑﺨﺶ ﺑﻌﺪ ﺑﻪ ﺗﻮﺿﻴﺢ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ nam‬ﻛﻪ ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﮔﺮﺍﻓﻴﻜﻲ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺑﻪ ﻛﺎﺭ ﻣﻲﺭﻭﺩ‪ ،‬ﻣﻲﭘﺮﺩﺍﺯﻳﻢ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣-٢‬‬

‫‪١٠‐٢‬‬

‫ﺑﺨﺶ ‪ : ٣‬ﻧﺮم اﻓﺰار ‪Nam‬‬

‫‪ nam‬ﺍﺑﺰﺍﺭﻱ ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﮔﺮﺍﻓﻴﻜﻲ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺷﺒﻜﻪ ﻣﻲﺑﺎﺷﺪ ﻭ ﻣﺤﻴﻄﻲ ﺩﺭ ﺍﺧﺘﻴﺎﺭ ﻣﻲﮔﺬﺍﺭﺩ ﻛﻪ‬ ‫ﺑﺘﻮﺍﻥ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻥ ﺣﺮﻛﺖ ﻭﺍﻗﻌﻲ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺍﺩﻩﺍﻱ ﺭﺍ ﻣﺸﺎﻫﺪﻩ ﻛﺮﺩ‪.‬‬ ‫ﻗﺪﻡ ﺍﻭﻝ ﺩﺭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺑﺮﻧﺎﻣﻪ ‪ nam‬ﺍﻳﺠﺎﺩ ﻓﺎﻳﻞ ‪ trace‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﻓﺎﻳﻞ ‪ trace‬ﺑﺎﻳﺪ ﺷﺎﻣﻞ ﺍﻃﻼﻋﺎﺕ ﺗﻮﭘﻮﻟﻮﮊﻱ‬ ‫ﮔﺮﻩﻫﺎ‪ ،‬ﻟﻴﻨﻚﻫﺎ ﻭ ‪ trace‬ﺑﺴﺘﻪﻫﺎ ﺑﺎﺷﺪ‪ .‬ﻣﻌﻤﻮﻻ ﻓﺎﻳﻞ ‪ trace‬ﺑﻮﺳﻴﻠﺔ ‪ ns‬ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﺩ‪ .‬ﺩﺭ ﻃﻮﻝ ﺷﺒﻴﻪﺳﺎﺯﻱ‬ ‫‪ ، ns‬ﻛﺎﺭﺑﺮﺍﻥ ﻣﻲﺗﻮﺍﻧﻨﺪ ﺷﻜﻞ ﺗﻮﭘﻮﻟﻮﮊﻱ‪ ،‬ﺍﻃﻼﻋﺎﺕ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻭ ‪ trace‬ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻭﻗﺎﻳﻊ ﻣﻮﺟﻮﺩ‬ ‫ﺩﺭ ﻓﺎﻳﻞ ‪ trace‬ﺩﺭ ‪ ns‬ﺗﻮﻟﻴﺪ ﻧﻤﺎﻳﻨﺪ‪.‬‬ ‫ﭘﺲ ﺍﺯ ﺁﻧﻜﻪ ﻓﺎﻳﻞ ‪ trace‬ﺍﻳﺠﺎﺩ ﺷﺪ‪ ،‬ﺁﻣﺎﺩﺓ ﻧﻤﺎﻳﺶ ﺍﺯ ﻃﺮﻳﻖ ‪ nam‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﺑﻪ ﻣﺤﺾ ﺍﺟﺮﺍ ‪ nam ،‬ﻓﺎﻳﻞ ﺭﺍ‬ ‫ﻣﻲﺧﻮﺍﻧﺪ‪ ،‬ﺗﻮﭘﻮﻟﻮﮊﻱ ﺭﺍ ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ‪ ،‬ﻣﺤﻴﻂ ﮔﺮﺍﻓﻴﻜﻲ ﺭﺍ ﺑﻪ ﻧﻤﺎﻳﺶ ﺩﺭ ﻣﻲﺁﻭﺭﺩ‪ ،‬ﺍﮔﺮ ﻻﺯﻡ ﺑﺎﺷﺪ ﭘﻴﻜﺮﺑﻨﺪﻱ‬ ‫ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ ﻭ ﺳﭙﺲ ﺗﺎ ﺭﺳﻴﺪﻥ ﺯﻣﺎﻥ ﺍﻭﻟﻴﻦ ﺑﺴﺘﻪ ﺩﺭ ﻓﺎﻳﻞ ‪ trace‬ﻣﻨﺘﻈﺮ ﻣﻲﻣﺎﻧﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ﻛﻨﺘﺮﻝ‬ ‫ﺑﻴﺸﺘﺮ ﺑﺮ ﺭﻭﻱ ﺟﻨﺒﻪﻫﺎﻱ ﻣﺨﺘﻠﻒ ﻣﺘﺤﺮﻙﺳﺎﺯﻱ‪ ،‬ﻣﻲﺗﻮﺍﻥ ﺍﺯ ﻭﺍﺳﻂ ﻛﺎﺭﺑﺮﻱ ‪ nam‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ‪.‬‬

‫‪ ١‐٣‐٢‬ﭘﻴﻜﺮﺑﻨﺪﻱ ‪ nam‬ﺑﺮﺍﻱ ﻧﻤﺎﻳﺶ ﺗﻮﭘﻮﻟﻮﮊﻱ‬ ‫ﺩﺭ ﻧﺮﻡﺍﻓﺰﺍﺭ ‪ nam‬ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﻪ ﻭﺳﻴﻠﺔ ﮔﺮﻩﻫﺎ ﻭ ﻟﻴﻨﻚﻫﺎ ﻣﺸﺨﺺ ﻣﻲﺷﻮﺩ ﺍﻣﺎ ﺑﻪ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﻛﻪ ﻧﻤﺎﻳﺶ‬ ‫ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﻪ ﺷﻜﻠﻲ ﻗﺎﺑﻞ ﺩﺭﻙ ﺑﺎﺷﺪ‪ ،‬ﻣﻜﺎﻧﻴﺰﻡ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻻﺯﻡ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺩﺭ ‪ nam‬ﺩﻭ ﻣﻜﺎﻧﻴﺰﻡ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ‬ ‫ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪ .‬ﺩﺭ ﺭﻭﺵ ﺍﻭﻝ‪ ،‬ﺧﻮﺩ ﻛﺎﺭﺑﺮﺍﻥ ﺑﺎﻳﺴﺘﻲ ﺟﻬﺖ ﻳﺎﻟﻬﺎ ﺭﺍ ﻣﺸﺨﺺ ﻧﻤﺎﻳﻨﺪ‪ .‬ﺟﻬﺖ ﻳﺎﻝ‪ ،‬ﺯﺍﻭﻳﺔ ﺑﻴﻦ ﻳﺎﻝ ﻭ‬ ‫ﺧﻂ ﺍﻓﻖ ﻣﻲﺑﺎﺷﺪ ﻭ ﺩﺭ ﺑﺎﺯﺓ ]‪ [0 , 2Pi‬ﻗﺮﺍﺭ ﺩﺍﺭﺩ‪ .‬ﻣﻌﻤﻮﻻ ﺑﺪﻳﻦ ﮔﻮﻧﻪ ﻣﻲﺑﺎﺷﺪ ﻛﻪ ﺍﺑﺘﺪﺍ ﮔﺮﺓ ﻣﺮﺟﻊ ﺍﻧﺘﺨﺎﺏ‬ ‫ﻣﻲﺷﻮﺩ ﻭ ﺳﭙﺲ ﺩﻳﮕﺮ ﮔﺮﻩﻫﺎ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺟﻬﺖ ﻳﺎﻝ ﻭ ﻃﻮﻝ ﺁﻥ‪ ،‬ﻛﻪ ﻣﺘﻨﺎﺳﺐ ﺑﺎ ﺗﺎﺧﻴﺮ ﺍﺳﺖ‪ ،‬ﺩﺭ ﺟﺎﻳﺸﺎﻥ‬ ‫ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ‪ .‬ﺍﻳﻦ ﮔﻮﻧﻪ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺑﺮﺍﻱ ﺗﻮﻟﻴﺪ ﺗﻮﭘﻮﻟﻮﮊﻳﻬﺎﻱ ﺩﺳﺘﻲ ﻭ ﻛﻮﭼﻚ ﻣﻨﺎﺳﺐ ﻣﻲﺑﺎﺷﺪ ﻭﻟﻲ ﺑﺮﺍﻱ‬ ‫ﺗﻮﭘﻮﻟﻮﮊﻳﻬﺎﻱ ﺑﺰﺭﮒ ﺍﺻﻼ ﺭﻭﺵ ﻣﻨﺎﺳﺒﻲ ﻧﻤﻲﺑﺎﺷﺪ‪.‬‬ ‫ﺩﺭ ﺭﻭﺵ ﺩﻭﻡ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺑﻪ ﺻﻮﺭﺕ ﺧﻮﺩﻛﺎﺭ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ ﻭ ﻣﻌﻤﻮﻻ ﻫﻨﮕﺎﻣﻴﻜﻪ ﻣﺎ ﺑﺎ ﺗﻮﭘﻮﻟﻮﮊﻳﻬﺎﻱ ﺑﺰﺭﮒ‬ ‫ﺳﺮﻭﻛﺎﺭ ﺩﺍﺭﻳﻢ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪ .‬ﺑﻪ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺍﻟﮕﻮﺭﻳﺘﻢ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺧﻮﺩﻛﺎﺭ ﮔﺮﺍﻑ ﺩﺭ ‪ nam‬ﭘﻴﺎﺩﻩ‪-‬‬ ‫ﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﺍﻳﺪﺓ ﺍﺻﻠﻲ ﺍﻟﮕﻮﺭﻳﺘﻢ ﻣﺪﻟﺴﺎﺯﻱ ﮔﺮﺍﻓﻲ ﺍﺯ ﮔﺮﻩﻫﺎﻱ ﻣﺘﺼﻞ ﺷﺪﻩ ﺍﺯ ﻃﺮﻳﻖ ﻳﺎﻟﻬﺎ ﻣﻲﺑﺎﺷﺪ‪ .‬ﮔﺮﻩ‪-‬‬ ‫ﻫﺎ ﻧﺴﺒﺖ ﺑﻪ ﻳﻜﺪﻳﮕﺮ ﺣﺎﻟﺖ ﺩﺍﻓﻌﻪ ﺩﺍﺭﻧﺪ ﺩﺭﺣﺎﻟﻴﻜﻪ ﻳﺎﻟﻬﺎ ﺁﻧﻬﺎ ﺭﺍ ﺑﻪ ﺳﻤﺖ ﻫﻢ ﻣﻲﻛﺸﻨﺪ‪ .‬ﺍﻳﻦ ﺳﻴﺴﺘﻢ ﭘﺲ ﺍﺯ‬ ‫ﭼﻨﺪﻳﻦ ﻣﺮﺣﻠﻪ ﺗﻜﺮﺍﺭ ﻫﻤﮕﺮﺍ ﻣﻲﺷﻮﺩ‪ .‬ﺷﺒﻴﻪﺳﺎﺯﻳﻬﺎ ﻧﺸﺎﻥ ﻣﻲﺩﻫﻨﺪ ﻛﻪ ﭘﺲ ﺍﺯ ‪ ١٠‬ﺗﺎ ‪ ١٠٠‬ﺗﻜﺮﺍﺭ‪ ،‬ﺍﻏﻠﺐ ﮔﺮﺍﻓﻬﺎ‬ ‫ﺑﻪ ﺳﺎﺧﺘﺎﺭﻱ ﻗﺎﺑﻞ ﺩﺭﻙ ﻫﻤﮕﺮﺍ ﻣﻲﺷﻮﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١١‐٢‬‬

‫ﺳﻪ ﭘﺎﺭﺍﻣﺘﺮ ﺩﺭ ﺗﻨﻈﻴﻢﻛﺮﺩﻥ ﭘﺮﻭﺳﺔ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺧﻮﺩﻛﺎﺭ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ ‪:‬‬ ‫‪ : Ca .١‬ﻧﻴﺮﻭﻱ ﺟﺎﺫﺑﺔ ﺩﺍﺋﻤﻲ ﻛﻪ ﻧﻴﺮﻭﻱ ﻳﺎﻟﻬﺎ ﺭﺍ ﻛﻨﺘﺮﻝ ﻣﻲﻛﻨﺪ ﻭ ﻣﻘﺪﺍﺭ ﭘﻴﺶﻓﺮﺽ ﺁﻥ ‪ ٠/١٥‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫‪ : Cr .٢‬ﻧﻴﺮﻭﻱ ﺩﺍﻓﻌﺔ ﺩﺍﺋﻤﻲ ﻛﻪ ﻧﻴﺮﻭﻱ ﺩﺍﻓﻌﺔ ﺑﻴﻦ ﮔﺮﻩﻫﺎ ﺭﺍ ﻛﻨﺘﺮﻝ ﻣﻲﻛﻨﺪ ﻭ ﻣﻘﺪﺍﺭ ﻗﺮﺍﺭﺩﺍﺩﻱ ﺁﻥ ‪٠/١٥‬‬ ‫ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫‪ .٣‬ﺗﻌﺪﺍﺩ ﺗﻜﺮﺍﺭﻫﺎ ‪ :‬ﻣﻘﺪﺍﺭ ﭘﻴﺶﻓﺮﺽ ﺍﻳﻦ ﭘﺎﺭﺍﻣﺘﺮ ‪ ١٠‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫ﻧﻜﺘﻪ ‪ :‬ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻳﻬﺎﻱ ﺑﺰﺭﮒ‪ ،‬ﺑﺎﻳﺴﺘﻲ ﭘﺎﺭﺍﻣﺘﺮﻫﺎ ﺭﺍ ﺑﻪ ﺷﻜﻠﻲ ﺩﻗﻴﻖ ﺗﻨﻈﻴﻢ ﻛﺮﺩ‪.‬‬

‫‪ ٢‐٣‐٢‬ﻭﺍﺳﻂ ﻛﺎﺭﺑﺮﻱ‬ ‫ﻭﻗﺘﻲ ﻛﻪ ﺑﺮﻧﺎﻣﺔ ‪ nam‬ﺍﺟﺮﺍ ﻣﻲﺷﻮﺩ‪ ،‬ﭘﻨﺠﺮﻩﺍﻱ ﺑﺎﺯ ﻣﻲﺷﻮﺩ ﻛﻪ ﺩﺍﺭﺍﻱ ﺑﺨﺸﻬﺎﻱ ﮔﻮﻧﺎﮔﻮﻧﻲ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺑﺎﻻﻱ‬ ‫ﭘﻨﺠﺮﻩ‪ menubar ،‬ﻗﺮﺍﺭ ﺩﺍﺭﺩ ﻛﻪ ﺩﺍﺭﺍﻱ ﺳﻪ ﻓﻴﻠﺪ ‪ file‬ﻭ ‪ View‬ﻭ ‪ help‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﻣﻨﻮﻱ ‪ file‬ﺩﺍﺭﺍﻱ ﺩﺍﺭﺍﻱ‬ ‫ﺁﻳﺘﻤﻬﺎﻱ ﻣﺨﺘﻠﻔﻲ ﺍﺯ ﺟﻤﻠﻪ ‪ Open‬ﻭ ‪ Quit‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﻣﻨﻮﻱ ‪ view‬ﺩﺍﺭﺍﻱ ﭼﻬﺎﺭ ﺁﻳﺘﻢ ﺯﻳﺮ ﻣﻲﺑﺎﺷﺪ ‪:‬‬ ‫•‬

‫‪ : new view‬ﺍﻳﻦ ﺁﻳﺘﻢ ‪ view‬ﺟﺪﻳﺪﻱ ﺑﺎ ﻫﻤﺎﻥ ‪ animation‬ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ‪ .‬ﻛﺎﺭﺑﺮ ﻣﻲﺗﻮﺍﻧﺪ ‪view‬‬

‫ﺟﺪﻳﺪ ﺭﺍ ﺑﺰﺭﮒ ﻭ ﻛﻮﭼﻚ ﻧﻤﺎﻳﺪ‪ .‬ﻫﻤﭽﻨﻴﻦ ﻗﺎﺑﻠﻴﺖ ﺛﺒﺖ ﺁﻥ ﻧﻴﺰ ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪.‬‬ ‫• ‪ : show monitors checkbox‬ﺍﮔﺮ ﻋﻼﻣﺖ ﺧﻮﺭﺩﻩ ﺑﺎﺷﺪ‪ monitor ،‬ﻫﺎ ﺩﺭ ﻧﻴﻤﺔ ﭘﺎﻳﻴﻦ ﭘﻨﺠﺮﻩ ﻧﻤﺎﻳﺶ‬ ‫ﺩﺍﺩﻩ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫•‬

‫‪ : show autolayout checkbox‬ﺍﮔﺮ ﻋﻼﻣﺖ ﺧﻮﺭﺩﻩ ﺑﺎﺷﺪ‪ ،‬ﺩﺭ ﻧﻴﻤﺔ ﭘﺎﻳﻴﻦ ﭘﻨﺠﺮﻩ ﻛﻪ ﺷﺎﻣﻞ ‪box‬‬ ‫ﻫﺎﻱ ﻭﺭﻭﺩﻱ ﻭ ﻛﻠﻴﺪ ﺗﻨﻈﻴﻢ ﺧﻮﺩﻛﺎﺭ ﻃﺮﺡ ﻣﻲﺑﺎﺷﺪ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪ .‬ﺗﻮﺟﻪ ﻛﻨﻴﺪ ﻛﻪ ﺍﮔﺮ ﻓﺎﻳﻞ ‪trace‬‬

‫ﻣﺸﺨﺼﻪﻫﺎﻱ ﻃﺮﺡ ﺧﻮﺩﺵ ﺭﺍ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺍﻳﻦ ‪ box‬ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻧﻤﻲﺷﻮﺩ ﺍﻣﺎ ﺍﮔﺮ ﻣﺸﺨﺼﺎﺕ ﻃﺮﺡ‬ ‫ﻛﺎﻣﻞ ﻧﺒﺎﺷﺪ‪ ،‬ﺍﻳﻦ ‪ box‬ﺑﻪ ﻧﻤﺎﻳﺶ ﺩﺭ ﺧﻮﺍﻫﺪ ﺁﻣﺪ‪.‬‬ ‫• ‪ : show animation checkbox‬ﺍﮔﺮ ﻋﻼﻣﺖ ﺧﻮﺭﺩﻩ ﺑﺎﺷﺪ‪ listbox ،‬ﺍﻱ ﺩﺭ ﻧﻴﻤﺔ ﭘﺎﻳﻴﻨﻲ ﭘﻨﺠﺮﻩ‬ ‫ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫ﻣﻨﻮﻱ ‪ help‬ﺩﺭ ﺳﻤﺖ ﺭﺍﺳﺖ ‪ menubar‬ﻗﺮﺍﺭ ﺩﺍﺭﺩ ﻭ ﺷﺎﻣﻞ ﺩﻭ ﺁﻳﺘﻢ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺑﺎ ﺍﻧﺘﺨﺎﺏ ﺁﻳﺘﻢ ‪، help‬‬ ‫ﭘﻨﺠﺮﺓ ﺟﺪﻳﺪﻱ ﻛﻪ ﺣﺎﻭﻱ ﺍﻃﻼﻋﺎﺗﻲ ﺩﺭ ﻣﻮﺭﺩ ﻧﺤﻮﺓ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ nam‬ﻣﻲﺑﺎﺷﺪ ﻧﻤﺎﻳﺶ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺑﺎ‬ ‫ﺍﻧﺘﺨﺎﺏ ﺁﻳﺘﻢ ‪ about‬ﭘﻨﺠﺮﺓ ﺟﺪﻳﺪﻱ ﻛﻪ ﺷﺎﻣﻞ ﺗﺎﺭﻳﺨﭽﻪ ﻭ ﻣﻮﻗﻌﻴﺖ ‪ nam‬ﻣﻲﺑﺎﺷﺪ ﺑﻪ ﻧﻤﺎﻳﺶ ﺩﺭﺧﻮﺍﻫﺪ ﺁﻣﺪ‪.‬‬ ‫ﺩﺭ ﺑﺨﺶ ﺑﻌﺪ ﺑﻪ ﺗﻮﺿﻴﺢ ﻧﺤﻮﺓ ﺍﻧﺠﺎﻡ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺍﺯ ﻃﺮﻳﻖ ﻣﺜﺎﻟﻬﺎﻱ ﻋﻤﻠﻲ ﺧﻮﺍﻫﻴﻢ ﭘﺮﺩﺍﺧﺖ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤-٢‬‬

‫‪١٢‐٢‬‬

‫ﺑﺨﺶ ‪ : ٤‬ﻣﺜﺎﻟﻬﺎي ﻋﻤﻠﻲ‬

‫ﺩﺭ ‪ ns‬ﺑﺮﺍﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺷﺒﻜﻪﻫﺎ ﺍﺯ ﺯﺑﺎﻥ ‪ Tcl Script‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪ Tcl Script .‬ﻳﻚ ﺯﺑﺎﻥ‬ ‫ﺍﺳﻜﺮﻳﭙﺘﻲ ﺍﺳﺖ ﻛﻪ ﺍﺯ ﺁﻥ ﺑﺮﺍﻱ ﻣﻌﺮﻓﻲ ﮔﺮﻩ ﻫﺎﻱ ﺷﺒﻜﻪ ‪ ،‬ﻟﻴﻨﻚ ﻫﺎﻱ ﺑﻴﻦ ﮔﺮﻩ ﻫﺎ ‪ ،‬ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻟﻴﻨﻚ ﻫﺎ ﻭ‬ ‫ﺳﺎﻳﺮ ﻣﺸﺨﺼﺎﺕ ﺷﺒﻜﻪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪.‬‬ ‫ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺷﺒﻴﻪ ﺳﺎﺯ ‪ ،‬ﺩﺭ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﺒﻜﻪ ﺩﻟﺨﻮﺍﻩ ﺧﻮﺩ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ Tcl Script‬ﺩﺭ ﻳﻚ‬ ‫ﻓﺎﻳﻞ ﻣﻌﺮﻓﻲ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﺍﻧﺘﻬﺎ ﻓﺎﻳﻞ ﺭﺍ ﺑﺎ ﭘﺴﻮﻧﺪ ‪ .tcl‬ﺫﺧﻴﺮﻩ ﻛﻨﻴﺪ‪ .‬ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺑﺎ ﻭﻳﺮﺍﻳﺸﮕﺮﻫﺎﻱ‬ ‫ﻣﻮﺟﻮﺩ ﺩﺭ ﻟﻴﻨﻮﻛﺲ ﻣﺜﻞ ‪ emacs‬ﺍﻧﺠﺎﻡ ﺩﻫﻴﺪ‪ .‬ﺩﺭ ﺍﻧﺘﻬﺎ ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ ‪ ns filename.tcl‬ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺷﺒﻴﻪ‬ ‫ﺳﺎﺯﻱ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﻴﺪ‪.‬‬ ‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ‪ ،‬ﺩﺭ ﺍﺑﺘﺪﺍ ﺑﺎ ﺍﺻﻮﻝ ‪ Tcl Script‬ﺁﺷﻨﺎ ﺧﻮﺍﻫﻴﺪ ﺷﺪ‪ .‬ﺳﭙﺲ ﺑﺎ ﺍﺭﺍﻳﻪ ﻣﺜﺎﻟﻬﺎﻳﻲ ‪ ،‬ﻗﺎﺑﻠﻴﺖ ﻫﺎﻱ ﺁﻥ‬ ‫ﻋﻨﻮﺍﻥ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫‪ ١‐٤‐٢‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﺍﻭﻟﻴﻪ ‪ns-2‬‬ ‫ﺩﺳﺘﻮﺭﺍﺗﻲ ﻛﻪ ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﻣﻲ ﺁﻳﺪ ‪ ،‬ﺑﺎﻳﺪ ﺗﻮﺳﻂ ﻳﻚ ﻭﻳﺮﺍﻳﺸﮕﺮ ﺩﺭ ﻳﻚ ﻓﺎﻳﻞ ﻭﺍﺭﺩ ﺷﺪﻩ ﻭ ﺩﺭ ﺍﻧﺘﻬﺎ ﺑﺎ ﭘﺴﻮﻧﺪ ‪ tcl‬ﺫﺧﻴﺮﻩ ﮔﺮﺩﺩ‪.‬‬

‫ﺑﺮﺍﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ‪ ،‬ﺩﺭ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﻳﻚ ﻧﻤﻮﻧﻪ ﺍﺯ ﺷﺊ ‪ Simulator‬ﺍﻳﺠﺎﺩ ﮔﺮﺩﺩ‪ .‬ﺍﻳﻦ ﻛﺎﺭ ﺑﺎ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲ‬ ‫ﮔﻴﺮﺩ ‪:‬‬ ‫]‪set ns [new Simulator‬‬

‫ﺑﺮﺍﻱ ﺫﺧﻴﺮﻩ ﺍﻃﻼﻋﺎﺕ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ‪ nam trace‬ﺑﺎﻳﺪ ﻓﺎﻳﻠﻲ ﺑﺎﺯ ﺷﻮﺩ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻦ ﻛﺎﺭ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ‬ ‫ﻛﻨﻴﻢ ‪:‬‬ ‫]‪set nf [open out.nam w‬‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ‪ ،‬ﻓﺎﻳﻞ ‪ out.nam‬ﺭﺍ ﺑﺮﺍﻱ ﻧﻮﺷﺘﻦ ﺑﺎﺯ ﻣﻲ ﻛﻨﺪ ﻭ ‪ handler ، nf‬ﺁﻥ ﻣﻲ ﺑﺎﺷﺪ‪ .‬ﻳﻌﻨﻲ ﺑﺮﺍﻱ ﺍﺷﺎﺭﻩ ﺑﻪ‬ ‫ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ﺍﺯ ‪ nf‬ﺍﺳﺘﻔﺎﺩﻩ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫ﺑﺮﺍﻱ ﺍﻳﻨﻜﻪ ﺗﻤﺎﻡ ﺧﺮﻭﺟﻲ ﻫﺎﻱ ﻣﺮﺗﺒﻂ ﺑﺎ ‪ nam‬ﺑﻪ ﻓﺎﻳﻞ ‪ nf‬ﻣﻨﺘﻘﻞ ﺷﻮﻧﺪ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ‪:‬‬ ‫‪$ns namtrace-all $nf‬‬

‫ﺩﺭ ﺧﺎﺗﻤﻪ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺍﺯ ﺗﺎﺑﻊ ‪ finish‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪ .‬ﻛﻪ ﻓﺎﻳﻞ ﻫﺎﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺭﺍ ﺑﺴﺘﻪ ‪ ،‬ﺑﺎﻓﺮﻫﺎ ﺭﺍ ﺁﺯﺍﺩ‬ ‫ﻛﺮﺩﻩ ﻭ ﺳﺎﻳﺮ ﻛﺎﺭﻫﺎﻱ ﻻﺯﻡ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ‪.‬‬ ‫{}{ ‪proc finish‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٣‐٢‬‬ ‫‪global nf ns‬‬ ‫‪$ns flush-trace‬‬ ‫‪close $nf‬‬ ‫‪exec nam out.nam‬‬ ‫‪exit 0‬‬ ‫}‬

‫ﺩﺭ ﺍﻳﻦ ﺗﺎﺑﻊ ‪ ،‬ﭘﺲ ﺍﺯ ﺧﺎﺗﻤﻪ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﻭ ﺑﺴﺘﻦ ﻓﺎﻳﻞ ‪ ، out.nam‬ﺑﺮﻧﺎﻣﻪ ‪ nam‬ﺑﺎ ﻭﺭﻭﺩﻱ ‪ out.nam‬ﺻﺪﺍ‬ ‫ﺯﺩﻩ ﻣﻲ ﺷﻮﺩ‪.‬‬ ‫ﺑﺮﺍﻱ ﺧﺎﺗﻤﻪ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺑﺎﻳﺪ ﺗﺎﺑﻊ ‪ finish‬ﺻﺪﺍ ﺷﻮﺩ ‪:‬‬ ‫”‪$ns at 5.0 “finish‬‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﻪ ﺷﺒﻴﻪ ﺳﺎﺯ ﻣﻲ ﮔﻮﻳﺪ ‪ ٥‬ﺛﺎﻧﻴﻪ ﭘﺲ ﺍﺯ ﺷﺮﻭﻉ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺗﺎﺑﻊ ‪ finish‬ﺭﺍ ﺍﺟﺮﺍ ﻛﻨﺪ‪.‬‬ ‫ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﻳﺪﻩ ﻣﻲ ﺷﻮﺩ ﺑﺮﺍﻱ ﺯﻣﺎﻥ ﺑﻨﺪﻱ ﺭﻭﻳﺪﺍﺩﻫﺎ ﺍﺯ ﻛﻠﻤﻪ ﻛﻠﻴﺪﻱ ‪ at‬ﻣﻲ ﺗﻮﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ‪.‬‬ ‫ﺩﺭ ﺍﻧﺘﻬﺎ ﺑﺮﺍﻱ ﺷﺮﻭﻉ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ‪:‬‬ ‫‪$ns run‬‬

‫‪ ٢‐٤‐٢‬ﻣﺪﻝ ﻛﺮﺩﻥ ﻳﻚ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺳﺎﺩﻩ ‪ :‬ﺩﻭ ﮔﺮﻩ ﺑﺎ ﻳﻚ ﻟﻴﻨﻚ‬ ‫ﺑﺮﺍﻱ ﺷﺮﻭﻉ‪ ،‬ﺍﺯ ﻳﻚ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺳﺎﺩﻩ ﻛﻪ ﺩﺭ ﺁﻥ ﺩﻭ ﮔﺮﻩ ﺑﺎ ﻳﻚ ﻟﻴﻨﻚ ﺑﻪ ﻫﻢ ﻣﺘﺼﻞ ﺷﺪﻩ ﺍﻧﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ‬ ‫ﻛﻨﻴﻢ‪.‬‬ ‫ﻛﺪ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺑﺎﻳﺪ ﻗﺒﻞ ﺍﺯ ‪ $ns run‬ﻳﺎ ﺣﺘﻲ ﺑﻬﺘﺮ ﺍﺳﺖ ﻗﺒﻞ ﺍﺯ ”‪ $ns at 5.0 “finsh‬ﺍﺿﺎﻓﻪ ﺷﻮﻧﺪ‪.‬‬ ‫ﺩﺭ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﮔﺮﻩ ﻫﺎ ﺭﺍ ﺗﻌﺮﻳﻒ ﻛﺮﺩ ‪:‬‬ ‫]‪set n0 [$ns node‬‬ ‫]‪set n1 [$ns node‬‬

‫ﺍﻳﻦ ﺩﻭ ﺩﺳﺘﻮﺭ ‪ ،‬ﮔﺮﻩ ﻫﺎ ﺭﺍ ﺍﻳﺠﺎﺩ ﻛﺮﺩﻩ ﻭ ﺁﻧﻬﺎ ﺭﺍ ﺑﻪ ‪ n0‬ﻭ ‪ n1‬ﻧﺴﺒﺖ ﻣﻲ ﺩﻫﺪ‪.‬‬ ‫ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻟﻴﻨﻚ ﺑﻴﻦ ﺩﻭ ﮔﺮﻩ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ ‪:‬‬ ‫‪$ns duplex-link $n0 $n1 1mb 10ms DropTail‬‬ ‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻳﻚ ﻟﻴﻨﻚ ﺑﻴﻦ ﺩﻭ ﮔﺮﻩ ‪ n0‬ﻭ ‪ n1‬ﺍﻳﺠﺎﺩ ﻣﻲ ﻛﻨﺪ ﻛﻪ ﺍﺯ ﻧﻮﻉ ﺩﻭ ﻃﺮﻓﻪ ﺍﺳﺖ‪ .‬ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ‪1 mbit/s‬‬

‫ﻭ ﺗﺎﺧﻴﺮ ‪ 10 ms‬ﺩﺍﺷﺘﻪ ﻭ ﺩﺍﺭﺍﻱ ﺻﻔﻲ ﺍﺯ ﻧﻮﻉ ‪ DropTail‬ﺍﺳﺖ‪ .‬ﺩﺭ ﺻﻒ ‪ ، DropTail‬ﺩﺭ ﺻﻮﺭﺕ ﺍﺭﺳﺎﻝ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٤‐٢‬‬

‫ﺗﺮﺍﻓﻴﻚ ﺑﻴﺶ ﺍﺯ ﻇﺮﻓﻴﺖ ﺧﻂ ‪ ،‬ﺑﺴﺘﻪﻫﺎ ﺍﺯ ﺍﻧﺘﻬﺎﻱ ﺻﻒ ﺣﺬﻑ ﺧﻮﺍﻫﻨﺪ ﺷﺪ‪ .‬ﺑﺎ ﺍﻧﻮﺍﻉ ﺩﻳﮕﺮ ﺻﻒ ﺑﻌﺪﺍ ﺁﺷﻨﺎ‬ ‫ﺧﻮﺍﻫﻴﻢ ﺷﺪ‪.‬‬ ‫ﺣﺎﻝ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺭﺍ ﺫﺧﻴﺮﻩ ﻛﺮﺩﻩ ﻭ ﺑﺮﻧﺎﻣﻪ ﺭﺍ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ .‬ﺧﺮﻭﺟﻲ ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﻣﺸﺎﻫﺪﻩ ﻣﻲ ﺷﻮﺩ ‪:‬‬

‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﻣﻲﺧﻮﺍﻫﻴﻢ ﺗﺮﺍﻓﻴﻜﻲ ﺭﺍ ﺍﺯ ‪ n0‬ﺑﻪ ‪ n1‬ﺍﺭﺳﺎﻝ ﻛﻨﻴﻢ‪.‬‬ ‫ﺩﺭ ‪ ns‬ﺑﺮﺍﻱ ﺍﺭﺳﺎﻝ ﻭ ﺩﺭﻳﺎﻓﺖ ﺩﺍﺩﻩ ﻫﺎ ﺍﺯ ﻋﺎﻣﻠﻬﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪ .‬ﺑﺮﺍﻱ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ‪(Traffic‬‬

‫)‪ Source‬ﻭ ﻣﻘﺼﺪ ﺗﺮﺍﻓﻴﻚ )‪ (Traffic Sink‬ﻋﺎﻣﻠﻬﺎﻱ ﺟﺪﺍﮔﺎﻧﻪﺍﻱ ﺗﻌﺮﻳﻒ ﻣﻲ ﺷﻮﺩ‪.‬‬ ‫‪#Create a UDP agent and attach it to node n0‬‬ ‫]‪set udp0 [new Agent/UDP‬‬ ‫‪$ns attach-agent $n0 $udp0‬‬ ‫‪#Create a CBR traffic source and attach it to udp0‬‬ ‫]‪set cbr0 [new Aplication/Traffic/CBR‬‬ ‫‪$cbr0 set packetsize_500‬‬ ‫‪$cbr0 set interval_0.005‬‬ ‫‪$cbr0 attach-agent $udp0‬‬

‫ﺳﻪ ﺧﻂ ﺍﻭﻝ ﺳﺒﺐ ﺍﻳﺠﺎﺩ ﻳﻚ ‪ UDP agent‬ﻭ ﻧﺴﺒﺖ ﺩﺍﺩﻥ ﺁﻥ ﺑﻪ ‪ n0‬ﻣﻲ ﺷﻮﺩ‪ .‬ﺧﻄﻮﻁ ﺑﻌﺪ ﻳﻚ ﻣﻨﺒﻊ‬ ‫ﺗﺮﺍﻓﻴﻚ ‪ CBR‬ﺍﻳﺠﺎﺩ ﻛﺮﺩﻩ ﻭ ﺑﻪ ‪ udp0‬ﻧﺴﺒﺖ ﻣﻲ ﺩﻫﺪ‪ .‬ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﻫﺎ ‪ ٥٠٠‬ﺑﺎﻳﺖ ﺑﻮﺩﻩ ﻭ ﻫﺮ ‪ ٠/٠٠٥‬ﺛﺎﻧﻴﻪ‬ ‫ﻳﻚ ﺑﺴﺘﻪ ﺍﺭﺳﺎﻝ ﻣﻲ ﺷﻮﺩ‪.‬‬ ‫ﺩﻭ ﺩﺳﺘﻮﺭ ﺑﻌﺪ ﻳﻚ ﻋﺎﻣﻞ ‪ null‬ﻛﻪ ﺑﻪ ﻋﻨﻮﺍﻥ ﮔﻴﺮﻧﺪﺓ ﺗﺮﺍﻓﻴﻚ ﻋﻤﻞ ﻣﻲ ﻛﻨﺪ‪ ،‬ﺍﻳﺠﺎﺩ ﻛﺮﺩﻩ ﻭ ﺁﻧﺮﺍ ﺑﻪ ‪ n1‬ﻧﺴﺒﺖ‬ ‫ﻣﻲ ﺩﻫﻨﺪ‪.‬‬ ‫]‪set null0 [new Agent/Null‬‬ ‫‪$ns attach-agent $n1 $null0‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٥‐٢‬‬

‫ﺣﺎﻝ ﺩﻭ ﻋﺎﻣﻞ ﺑﻪ ﻫﻢ ﻣﺘﺼﻞ ﻣﻲ ﺷﻮﻧﺪ ﺗﺎ ﺗﺮﺍﻓﻴﻚ ﺍﺭﺳﺎﻟﻲ ﺗﻮﺳﻂ ‪ n0‬ﺩﺭ ‪ n1‬ﺩﺭﻳﺎﻓﺖ ﺷﻮﺩ ‪:‬‬ ‫‪$ns connect $udp0 $null0‬‬

‫ﺷﺎﻳﺪ ﺍﻳﻦ ﺳﺌﻮﺍﻝ ﻣﻄﺮﺡ ﺷﻮﺩ ﻛﻪ ﺗﺮﺍﻓﻴﻚ ﭼﻪ ﺯﻣﺎﻧﻲ ﺷﺮﻭﻉ ﺑﻪ ﺍﺭﺳﺎﻝ ﺷﺪﻩ ﻭ ﭼﻪ ﺯﻣﺎﻧﻲ ﻣﺘﻮﻗﻒ ﺷﻮﺩ ؟‬ ‫ﭘﺎﺳﺦ ﺍﻳﻦ ﺳﺌﻮﺍﻝ ﺩﺭ ﺯﻳﺮ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﺑﺮﺍﻱ ﻛﻨﺘﺮﻝ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﻛﻨﻴﻢ )ﻗﺒﻞ ﺍﺯ ‪: ( $ns at 5.0 finish‬‬ ‫"‪$ns at 0.5 "$cbr0 start‬‬ ‫"‪$ns at 4.5 "$cbr0 stop‬‬ ‫ﺣﺎﻝ ﻣﻲ ﺗﻮﺍﻧﻴﻢ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﻴﻢ‪ .‬ﻭﻗﺘﻲ ﺩﺭ ﭘﻨﺠﺮﺓ ﺑﺎﺯ ﺷﺪﻩ ﺗﻮﺳﻂ ‪ nam‬ﺑﺮ ﺭﻭﻱ ﺩﻛﻤﺔ ‪play‬‬

‫ﻛﻠﻴﻚ ﻛﻨﻴﻢ ﻣﺸﺎﻫﺪﻩ ﻣﻲ ﺷﻮﺩ ﺩﺭ ﺛﺎﻧﻴﻪ ‪ ٠/٥‬ﮔﺮﻩ ‪ n0‬ﺷﺮﻭﻉ ﺑﻪ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﺑﺮﺍﻱ ﮔﺮﻩ ‪ n1‬ﻣﻲ ﻛﻨﺪ‪ .‬ﻭ ﺩﺭ‬ ‫ﺛﺎﻧﻴﻪ ‪ ٤/٥‬ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﻣﻮﻗﻒ ﻣﻲ ﺷﻮﺩ‪ .‬ﺷﻜﻞ ﺯﻳﺮ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﮔﺮﻩ ‪ n0‬ﺑﻪ ﮔﺮﻩ ‪ n1‬ﺭﺍ ﻧﺸﺎﻥ ﻣﻲ ﺩﻫﺪ‪.‬‬

‫ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺑﺎ ﻛﻠﻴﻚ ﺭﻭﻱ ﻟﻴﻨﻚ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﻳﺪ‪ .‬ﻫﻤﻴﻦ ﻃﻮﺭ ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺍﻧﺪﺍﺯﺓ ﺑﺴﺘﻪ ﻫﺎ ﻭ‬ ‫ﺯﻣﺎﻥ ﺑﻴﻦ ﺍﺭﺳﺎﻝ ﺑﺴﺘﻪ ﻫﺎ )‪ (Interval Time‬ﺭﺍ ﺗﻐﻴﻴﺮ ﺩﺍﺩﻩ ﻭ ﺣﺎﺻﻞ ﺗﻐﻴﻴﺮﺍﺕ ﺭﺍ ﻣﺸﺎﻫﺪﻩ ﻛﻨﻴﺪ‪.‬‬

‫‪ ٣‐٤‐٢‬ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻭ ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﻟﻴﻨﻚ ﻫﺎ‬ ‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺍﺯ ﻳﻚ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ‪ ٤‬ﮔﺮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﺧﻮﺍﻫﻴﻢ ﻛﺮﺩ‪ .‬ﺩﻭ ﮔﺮﻩ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﻋﻤﻞ ﻣﻲ‬ ‫ﻛﻨﻨﺪ‪ .‬ﻳﻚ ﮔﺮﻩ ﺩﺭﻳﺎﻓﺖ ﻛﻨﻨﺪﻩ ﺗﺮﺍﻓﻴﻚ ﻣﻲ ﺑﺎﺷﺪ‪ .‬ﻭ ﻳﻚ ﮔﺮﻩ ﻓﻘﻂ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺑﻪ ﻣﻘﺼﺪ ﻣﻲ ﻓﺮﺳﺘﺪ‪.‬‬ ‫ﺑﺮﺍﻱ ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻭ ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﺻﻒ ﻣﺮﺑﻮﻁ ﺑﻪ ﻟﻴﻨﻚ ﺭﻭﺷﻬﺎﻳﻲ ﺍﺭﺍﻳﻪ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫‪ ٤‐٤‐٢‬ﺗﻌﺮﻳﻒ ﺗﻮﭘﻮﻟﻮﮊﻱ‬ ‫ﺣﺎﻝ ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﮔﺮﻩ ﻫﺎ ﺧﻄﻮﻁ ﺯﻳﺮ ﺭﺍ ﺍﺿﺎﻓﻪ ﻛﻨﻴﺪ ‪:‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٦‐٢‬‬ ‫]‪set n0 [$ns node‬‬ ‫]‪set n1 [$ns node‬‬ ‫]‪set n2 [$ns node‬‬ ‫]‪set n3 [$ns node‬‬

‫ﺑﺮﺍﻱ ﺗﻌﺮﻳﻒ ﻟﻴﻨﻚ ﺑﻴﻦ ﮔﺮﻩ ﻫﺎ ﻛﺪﻫﺎﻱ ﺯﻳﺮ ﺭﺍ ﺑﻴﻔﺰﺍﻳﻴﺪ ‪:‬‬ ‫‪$ns duplex-link $n0 $n2 1mb 10ms DropTail‬‬ ‫‪$ns duplex-link $n1 $n2 1mb 10ms DropTail‬‬ ‫‪$ns duplex-link $n3 $n2 1mb 10ms DropTail‬‬ ‫ﺍﻛﻨﻮﻥ ﻓﺎﻳﻞ ﺭﺍ ﺫﺧﻴﺮﻩ ﻭ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ .‬ﺍﻟﺒﺘﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺷﻜﻞ ﺁﻥ ﺩﻟﺨﻮﺍﻩ ﻧﺒﺎﺷﺪ‪ .‬ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺩﻛﻤﻪ ‪re-layout‬‬

‫ﺭﺍ ﺑﺰﻧﻴﺪ ﺗﺎ ﺷﻜﻞ ﺁﻥ ﺑﻬﺘﺮ ﺷﻮﺩ‪ .‬ﺍﻣﺎ ﺑﻬﺘﺮ ﺍﺳﺖ ﻛﻨﺘﺮﻝ ﺑﻴﺸﺘﺮﻱ ﺭﻭﻱ ﺁﻥ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺍﺯ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﺴﺘﻘﻴﻢ ﻫﺎ ﻣﻲ ﺗﻮﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ ‪:‬‬ ‫‪$ns duplex-link-op $n0 $n2 orient right-down‬‬ ‫‪$ns duplex-link-op $n1 $n2 orient right-up‬‬ ‫‪$ns duplex-link-op $n2 $n3 orient right‬‬

‫ﺑﺎ ﺍﻓﺰﻭﺩﻥ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﻫﺎ ﺷﻜﻞ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺩﺭ ‪ nam‬ﺑﺼﻮﺭﺕ ﺯﻳﺮ ﺧﻮﺍﻫﺪ ﺷﺪ ‪:‬‬

‫ﺩﺭ ﺩﺳﺘﻮﺭﻫﺎﻱ ﺑﺎﻻﺟﻬﺖ ﻟﻴﻨﻚ ﻫﺎ ﺭﺍ ﺑﺎ ‪ right,left,up,down‬ﻭﻳﺎ ﺗﺮﻛﻴﺒﻲ ﺍﺯ ﺍﻳﻨﻬﺎ ﻣﻲ ﺗﻮﺍﻥ ﻣﺸﺨﺺ ﻛﺮﺩ‪.‬‬

‫‪ ٥‐٤‐٢‬ﺗﻌﺮﻳﻒ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ﻭ ﮔﻴﺮﻧﺪﻩ ﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ‬ ‫ﮔﺮﻩ ﻫﺎﻱ ‪ n0‬ﻭ ‪ n1‬ﺭﺍ ﺑﻌﻨﻮﺍﻥ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ ‪ CBR‬ﻭ ﮔﺮﻩ ‪ n3‬ﺭﺍ ﺑﻌﻨﻮﺍﻥ ﮔﻴﺮﻧﺪﻩ ﺗﺮﺍﻓﻴﻚ ﺗﻌﺮﻳﻒ ﻣﻲ ﻛﻨﻴﻢ‪.‬‬ ‫ﮔﺮﻩ ‪ n2‬ﺗﻨﻬﺎ ﻛﺎﺭ ‪ forwarding‬ﺭﺍ ﺑﺮﺍﻱ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ‪.‬‬ ‫‪#create a UDP agent and attach it to node n0‬‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

١٧‐٢ set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 #create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetsize_500 $cbr0 set interval _0.005 $cbr0 attach-gent $udp0 #create a UDP agent and attach it to noder n1 set udp1 [new Agent/UDP] $ns attach-agent $n1 $udp1 #create a CBR traffic source and attach it to udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetsize_500 $cbr1 set interval _0.005 $cbr1 attach-gent $udp1 #create a null aget for traffic sink n3 set null0 [new Agent/Null] $ns attach-agent $n3 $null0

: ‫ﺣﺎﻝ ﺑﺎﻳﺪ ﺍﺗﺼﺎﻝ ﻋﺎﻣﻞﻫﺎ ﺑﺮﻗﺮﺍﺭ ﮔﺮﺩﺩ‬ $ns connect $udp0 $null0 $ns connect $udp1 $null0

‫ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﺭﺍ‬٤ ‫ ﺷﺮﻭﻉ ﺑﻪ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﺛﺎﻧﻴﻪ‬٠/٥ ‫ ﺩﺭ ﺛﺎﻧﻴﻪ‬cbr0 ‫ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ‬ ‫ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ‬٤/٥ ‫ ﺷﺮﻭﻉ ﺑﻪ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﺛﺎﻧﻴﻪ‬١ ‫ ﺩﺭ ﺛﺎﻧﻴﻪ‬cbr1 ‫ﻣﺘﻮﻗﻒ ﻛﻨﺪ ﻭ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ‬ : ‫ ﺑﻨﺎﺑﺮﺍﻳﻦ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﻋﻤﻞ ﻣﻲﻛﻨﻴﻢ‬.‫ﺭﺍ ﻣﺘﻮﻗﻒ ﻛﻨﺪ‬ $ns at 0.5 $cbr0 start $ns at 1.0 $cbr1 start $ns at 4.0 $cbr0 stop $ns at 4.5 $cbr1 stop

‫ ﻭ‬n2 ‫ ﺑﻴﺶ ﺍﺯ ﻇﺮﻓﻴﺖ ﺧﻂ ﺑﻴﻦ‬، ‫ ﻣﺘﻮﺟﻪ ﻣﻲ ﺷﻮﻳﺪ ﻛﻪ ﻣﺠﻤﻮﻉ ﺩﻭ ﺟﺮﻳﺎﻥ ﺗﺮﺍﻓﻴﻚ‬، ‫ﺑﺎ ﺍﺟﺮﺍﻱ ﺍﻳﻦ ﺍﺳﻜﺮﻳﭙﺖ‬ .‫ ﻳﻚ ﻣﺤﺎﺳﺒﻪ ﺳﺎﺩﻩ ﺍﻳﻦ ﻣﻄﻠﺐ ﺭﺍ ﺗﺎﻳﻴﺪ ﻣﻲ ﻛﻨﺪ‬.‫ ﺑﻮﺩﻩ ﻭ ﺳﺒﺐ ﺣﺬﻑ ﺷﺪﻥ ﺑﺮﺧﻲ ﺍﺯ ﺑﺴﺘﻪ ﻫﺎ ﻣﻲ ﺷﻮﺩ‬n3

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٨‐٢‬‬

‫ﺍﻧﺪﺍﺯﻩ ﻫﺮ ﺑﺴﺘﻪ ‪ ٥٠٠‬ﺑﺎﻳﺖ ﺑﻮﺩﻩ ﻭ ﺩﺭ ﻫﺮ ﺛﺎﻧﻴﻪ ‪ ٢٠٠‬ﺑﺴﺘﻪ ﺍﺭﺳﺎﻝ ﻣﻲ ﺷﻮﺩ‪ .‬ﭘﺲ ﻫﺮ ﺟﺮﻳﺎﻥ ﺗﺮﺍﻓﻴﻚ ﭘﻬﻨﺎﻱ‬ ‫ﺑﺎﻧﺪ ‪ ٠/٨‬ﻣﮕﺎﺑﻴﺖ ﺩﺭ ﺛﺎﻧﻴﻪ ﻧﻴﺎﺯ ﺩﺍﺭﺩ‪ .‬ﻭ ﺧﻂ ‪ ١‬ﻣﮕﺎﺑﻴﺖ ﺩﺭ ﺛﺎﻧﻴﻪ ﺑﻴﻦ ‪ n2‬ﻭ ‪ n3‬ﺟﻮﺍﺑﮕﻮﻱ ﺗﺮﺍﻓﻴﻚ ‪ ١/٦‬ﻣﮕﺎﺑﻴﺖ‬ ‫ﺩﺭ ﺛﺎﻧﻴﺔ ﺍﺭﺳﺎﻟﻲ ﺑﺮﺍﻱ ﺁﻥ ﻧﻴﺴﺖ‪.‬‬ ‫ﭘﺲ ﺑﺨﺸﻲ ﺍﺯ ﺑﺴﺘﻪﻫﺎ ﺣﺬﻑ ﻣﻲ ﺷﻮﻧﺪ‪ .‬ﺍﻣﺎ ﻛﺪﺍﻡ ﺑﺴﺘﻪ ﻫﺎ ؟ ﭼﻮﻥ ﺭﻧﮓ ﺗﻤﺎﻡ ﺑﺴﺘﻪ ﻫﺎ ﻣﺸﻜﻲ ﺍﺳﺖ ﺗﻤﺎﻳﺰ‬ ‫ﺑﻴﻦ ﺁﻧﻬﺎ ﺍﻣﻜﺎﻥﭘﺬﻳﺮ ﻧﻤﻲﺑﺎﺷﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ﺗﻤﺎﻳﺰ ﺑﻴﻦ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺩﺭ ‪ ، nam‬ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ﭘﻴﻜﺮﺑﻨﺪﻱ‬ ‫ﺧﺎﺻﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪ .‬ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺩﺭ ﺑﺨﺶ ﺑﻌﺪ ﺗﻮﺿﻴﺢ ﺩﺍﺩﻩ ﺷﺪﻩﺍﻧﺪ‪.‬‬

‫‪ ٦‐٤‐٢‬ﻣﺸﺨﺺ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ‬ ‫ﺩﻭ ﺧﻂ ﺯﻳﺮ ﺭﺍ ﺑﻪ ﺍﺳﻜﺮﻳﭙﺖ ﺧﻮﺩ ﺍﺿﺎﻓﻪ ﻛﻨﻴﺪ ‪:‬‬ ‫‪$udp0 set class_ 1‬‬ ‫‪$udp1 set class_ 2‬‬

‫ﭘﺎﺭﺍﻣﺘﺮ ﺍﻧﺘﻬﺎﻳﻲ ﺷﻤﺎﺭﻩ ﻣﺸﺨﺼﻪ ﺟﺮﻳﺎﻥ )‪ (Flow ID‬ﻣﻲ ﺑﺎﺷﺪ‪.‬‬ ‫ﺩﻭ ﺧﻂ ﺯﻳﺮ ﺭﺍ ﭘﺲ ﺍﺯ ﺩﺳﺘﻮﺭ ﺍﻳﺠﺎﺩ ‪ simulator object‬ﻗﺮﺍﺭ ﺩﻫﻴﺪ ‪:‬‬ ‫‪$ns color 1 blue‬‬ ‫‪$ns color 2 red‬‬ ‫ﺍﮔﺮ ﺍﺳﻜﺮﻳﭙﺖ ﺭﺍ ﺩﻭﺑﺎﺭﻩ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ ،‬ﻣﺘﻮﺟﻪ ﻣﻲ ﺷﻮﻳﺪ ﻛﻪ ﺟﺮﻳﺎﻥ ﺗﺮﺍﻓﻴﻚ ‪ n0‬ﺁﺑﻲ ﺭﻧﮓ ﻭ ﺟﺮﻳﺎﻥ ﺗﺮﺍﻓﻴﻚ ‪n1‬‬

‫ﻗﺮﻣﺰ ﺭﻧﮓ ﻣﻲ ﺑﺎﺷﺪ‪ .‬ﺍﮔﺮ ﻟﻴﻨﻚ ﺑﻴﻦ ﮔﺮﻩ ﻫﺎﻱ ‪ n2‬ﻭ ‪ n3‬ﺭﺍ ﻣﺸﺎﻫﺪﻩ ﻛﻨﻴﺪ ﺧﻮﺍﻫﻴﺪ ﺩﻳﺪ ﻛﻪ ﺑﻌﺪ ﺍﺯ ﻣﺪﺗﻲ ﻧﺤﻮﺓ‬ ‫ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺯﻳﺎﺩ ﻋﺎﺩﻻﻧﻪ ﻧﻴﺴﺖ )ﺣﺪﺍﻗﻞ ﺭﻭﻱ ﺳﻴﺴﺘﻢ ﻣﺎ ﺍﻳﻨﮕﻮﻧﻪ ﺍﺳﺖ(‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١٩‐٢‬‬

‫‪ ٧‐٤‐٢‬ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﻳﻚ ﻟﻴﻨﻚ‬ ‫ﺑﺮﺍﻱ ﻣﻮﻧﻴﺘﻮﺭ ﻛﺮﺩﻥ ﺻﻒ ﻣﺮﺑﻮﻁ ﺑﻪ ﻟﻴﻨﻚ ﺑﻴﻦ ‪ n2‬ﻭ‪ n3‬ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺭﺍ ﺑﻪ ﺍﺳﻜﺮﻳﭙﺖ ﺧﻮﺩ ﺑﻴﻔﺰﺍﻳﻴﺪ ‪:‬‬ ‫‪$ns duplex-link-op $n2 $n3 queuePos 0.5‬‬

‫‪ ns‬ﺭﺍ ﺩﻭﺑﺎﺭﻩ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ .‬ﭘﺲ ﺍﺯ ﭼﻨﺪ ﻟﺤﻈﻪ ﺗﺼﻮﻳﺮﻱ ﻣﺸﺎﺑﻪ ﺗﺼﻮﻳﺮ ﺯﻳﺮ ﻣﺸﺎﻫﺪﻩ ﺧﻮﺍﻫﻴﺪ ﻛﺮﺩ ‪:‬‬

‫ﺍﻛﻨﻮﻥ ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﻗﺮﺍﺭ ﮔﺮﻓﺘﻦ ﺑﺴﺘﻪ ﻫﺎ ﺭﺍ ﺩﺭ ﺻﻒ ﺑﺒﻴﻨﻴﺪ ﻭ ﺑﺴﺘﻪ ﻫﺎﻳﻲ ﻛﻪ ﺣﺬﻑ ﻣﻲ ﺷﻮﻧﺪ ﺭﺍ ﻣﺸﺎﻫﺪﻩ ﻛﻨﻴﺪ‪.‬‬ ‫ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ ﻗﺒﻼ ﮔﻔﺘﻴﻢ ﻧﺤﻮﺓ ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﻋﺎﺩﻻﻧﻪ ﻧﻴﺴﺖ‪.‬‬ ‫ﭼﻮﻥ ﺻﻒ ﺍﺯ ﻧﻮﻉ ‪ DropTail‬ﺍﺳﺖ ﺑﻨﺎﺑﺮﺍﻳﻦ ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﻧﺘﻈﺎﺭ ﺩﺍﺷﺖ ﻛﻪ ﻋﺪﺍﻟﺖ ﺭﺍ ﺩﺭ ﺣﺬﻑ ﺑﺴﺘﻪ ﻫﺎ‬ ‫ﺭﻋﺎﻳﺖ ﻛﻨﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻨﻜﻪ ﺑﺎ ﻫﺮ ﺩﻭ ﻧﻮﻉ ﺑﺴﺘﻪ ﺑﻪ ﺻﻮﺭﺗﻲ ﻳﻜﺴﺎﻥ ﺑﺮﺧﻮﺭﺩ ﺷﻮﺩ ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺍﺯ ﺻﻒ ‪SFQ‬‬

‫)‪ (Stochastic Fair Queuing‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬ ‫ﺑﻪ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺗﻌﺮﻳﻒ ﻟﻴﻨﻚ ﺑﻴﻦ ‪ n2‬ﻭ ‪ n3‬ﺭﺍ ﺑﻪ ﺍﻳﻦ ﺻﻮﺭﺕ ﺗﻐﻴﻴﺮ ﺩﻫﻴﺪ ‪:‬‬ ‫‪$ns duplex-link $n3 $n2 1Mb 10ms SFQ‬‬

‫ﺻﻒ ﺑﻨﺪﻱ ﺑﺎﻳﺪ ﺍﻛﻨﻮﻥ ﻋﺎﺩﻻﻧﻪ ﺑﺎﺷﺪ‪ .‬ﺑﺴﺘﻪ ﻫﺎﻱ ﺁﺑﻲ ﻭ ﻗﺮﻣﺰ ﺑﻪ ﻳﻚ ﻣﻴﺰﺍﻥ ﺣﺬﻑ ﻣﻲﺷﻮﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٠‐٢‬‬

‫‪ ٨‐٤‐٢‬ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ﺗﻌﺪﺍﺩ ﮔﺮﻩ ﻫﺎﻱ ﺑﺎﻻ ﻭ ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ‬ ‫ﻟﻴﻨﻚ ﻫﺎ‬ ‫ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ﺗﻌﺪﺍﺩ ﮔﺮﻩ ﻫﺎﻱ ﺯﻳﺎﺩ ﻣﻲﺗﻮﺍﻧﺪ ﻛﺎﺭﻱ ﺳﻨﮕﻴﻦ ﺑﺎﺷﺪ‪ .‬ﺑﺮﺍﻱ ﺭﺍﺣﺖ ﻛﺮﺩﻥ ﺍﻳﻦ ﻛﺎﺭ ‪ ،‬ﺩﺭ ‪ns‬‬

‫ﺍﺯ ﻣﻜﺎﻧﻴﺰﻣﻬﺎﻱ ﺧﺎﺻﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﺷﻮﺩ‪ .‬ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺑﺎ ﺍﺭﺍﻳﻪ ﻳﻚ ﻣﺜﺎﻝ‪ ،‬ﺍﻳﻦ ﻗﺎﺑﻠﻴﺖ ﺗﺸﺮﻳﺢ ﻣﻲ ﮔﺮﺩﺩ‪ .‬ﺩﺭ‬ ‫ﺍﺩﺍﻣﻪ ﺑﻪ ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ ﻟﻴﻨﻚ ﻫﺎ ﭘﺮﺩﺍﺧﺘﻪ ﻣﻲ ﺷﻮﺩ‪.‬‬

‫‪١‐٨‐٤‐٢‬‬

‫ﺍﻳﺠﺎﺩ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ﺗﻌﺪﺍﺩ ﮔﺮﻩ ﻫﺎﻱ ﺑﺎﻻ‬

‫ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﻳﻚ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺑﺎ ‪ ٧‬ﮔﺮﻩ ﺍﻳﺠﺎﺩ ﻛﻨﻴﻢ‪ .‬ﺑﺮﺍﻱ ﭘﺮﻫﻴﺰ ﺍﺯ ﻧﻮﺷﺘﻦ ﻛﺪﻫﺎﻱ ﺷﺒﻴﻪ‬ ‫ﺑﻪ ﻫﻢ‪ ،‬ﺍﺯ ﺣﻠﻘﺔ ‪ for‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﻛﻨﻴﻢ ‪:‬‬ ‫{ }‪for {set i 0} {$i < 7} {incr i‬‬ ‫]‪set n($i) [$ns node‬‬ ‫}‬

‫ﺍﻳﻦ ﻛﺪ ‪ ٧‬ﮔﺮﻩ ﺍﻳﺠﺎﺩ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﻳﻚ ﺁﺭﺍﻳﻪ ﺑﻪ ﻧﺎﻡ )(‪ n‬ﺫﺧﻴﺮﻩ ﻣﻲ ﻛﻨﺪ‪.‬‬ ‫ﺣﺎﻝ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﺍﻳﻦ ﮔﺮﻩ ﻫﺎ ﺭﺍ ﺑﺼﻮﺭﺕ ﺩﺍﻳﺮﻭﻱ ﺑﻪ ﻫﻢ ﻣﺘﺼﻞ ﻛﻨﻴﻢ‪ .‬ﻛﺪ ﺯﻳﺮ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪.‬‬ ‫{ }‪for {set i 0} {$i < 7} {incr i‬‬ ‫‪$ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail‬‬ ‫}‬

‫ﺍﻳﻦ ﻛﺪ ‪ ،‬ﻫﺮ ﮔﺮﻩ ﺭﺍ ﺑﻪ ﮔﺮﻩ ﺑﻌﺪﻱ ﻣﺘﺼﻞ ﻣﻲ ﻛﻨﺪ )ﺑﻪ ﺍﺳﺘﺜﻨﺎﺀ ﮔﺮﻩ ﺁﺧﺮ ﻛﻪ ﺑﻪ ﮔﺮﻩ ﺍﻭﻝ ﻣﺘﺼﻞ ﻣﻲ ﺷﻮﺩ(‪.‬‬ ‫ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺍﺯ ‪ ١%‬ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﺍﻛﻨﻮﻥ ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺍﺳﻜﺮﻳﭙﺖ ﺭﺍ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ .‬ﺩﺭ ‪ nam‬ﻣﻤﻜﻦ ﺍﺳﺖ ﺷﻜﻞ ﺩﺍﺩﻩ ﺷﺪﻩ ﻋﺠﻴﺐ ﺑﺎﺷﺪ‪ .‬ﺑﺎ ﺯﺩﻥ ﺩﻛﻤﻪ‬ ‫‪ re-layout‬ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺷﻜﻞ ﺯﻳﺮ ﺭﺍ ﺑﺒﻴﻨﻴﺪ ‪:‬‬

‫ﻋﻼﻣﺖ ﺑﺎﻗﻴﻤﺎﻧﺪﻩ‬

‫‪1‬‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٢١‐٢

‫ ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ ﻟﻴﻨﻚ ﻫﺎ‬٢‐٨‐٤‐٢ : ‫ ﺍﻳﺠﺎﺩ ﻣﻲ ﻛﻨﻴﻢ‬n3 ‫ ﺑﻪ ﮔﺮﻩ‬n0 ‫ ﻛﺪﻱ ﺑﺮﺍﻱ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﮔﺮﻩ‬،‫ﻗﺒﻞ ﺍﺯ ﻣﺪﻝ ﻛﺮﺩﻥ ﺧﺮﺍﺑﻲ‬ #Create a UDP agent and attach it to node n(0) set udp0 [new Agent/UDP] $ns attach-agent $n(0) $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 set null0 [new Agent/Null] $ns attach-agent $n(3) $null0 $ns connect $udp0 $null0 $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop"

‫ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﺭﺍﻳﻪ ﮔﺮﻩﻫﺎ‬، ‫ ﺗﻨﻬﺎ ﻣﻮﺭﺩ ﺟﺪﻳﺪﻱ ﻛﻪ ﺩﺭ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ‬.‫ﺍﻳﻦ ﻛﺪ ﺑﺎﻳﺪ ﺑﺮﺍﻱ ﺷﻤﺎ ﻗﺎﺑﻞ ﻓﻬﻢ ﺑﺎﺷﺪ‬ .‫ﻣﻲ ﺑﺎﺷﺪ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٢‐٢‬‬

‫ﺍﮔﺮ ﺍﻳﻦ ﺍﺳﻜﺮﻳﭙﺖ ﺭﺍ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ ،‬ﺧﻮﺍﻫﻴﺪ ﺩﻳﺪ ﻛﻪ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﻃﺮﻳﻖ ﮔﺮﻩﻫﺎﻱ )‪ n(1‬ﻭ )‪ n(2‬ﻣﻨﺘﻘﻞ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫ﺣﺎﻝ ﻣﻲ ﺧﻮﺍﻫﻴﻢ ﻟﻴﻨﻚ ﺑﻴﻦ )‪ n(1‬ﻭ )‪ n(2‬ﺑﺮﺍﻱ ﻣﺪﺕ ‪ ١‬ﺛﺎﻧﻴﻪ ﻗﻄﻊ ﺑﺸﻮﺩ‪ .‬ﺑﺮﺍﻱ ﻣﺪﻝ ﻛﺮﺩﻥ ﺍﻳﻦ ﻣﺴﺎﻟﻪ‬ ‫ﺩﺳﺘﻮﺭﺍﺕ ﺯﻳﺮ ﺭﺍ ﺍﺿﺎﻓﻪ ﻣﻲ ﻛﻨﻴﻢ ‪:‬‬ ‫)‪$ns rtmodel-at 1.0 down $n(1) $n(2‬‬ ‫)‪$ns rtmodel-at 2.0 up $n(1) $n(2‬‬

‫ﻓﻬﻤﻴﺪﻥ ﺍﻳﻦ ﺩﻭ ﺧﻂ ﺧﻴﻠﻲ ﺳﺨﺖ ﻧﻴﺴﺖ‪ .‬ﺍﻛﻨﻮﻥ ﻣﺠﺪﺩﺍ ﺍﺳﻜﺮﻳﭙﺖ ﺭﺍ ﺍﺟﺮﺍ ﻛﻨﻴﺪ‪ .‬ﺧﻮﺍﻫﻴﺪ ﺩﻳﺪ ﻛﻪ ﺩﺭ ﺑﻴﻦ‬ ‫ﺛﺎﻧﻴﻪ ﻫﺎﻱ ‪ ١‬ﻭ ‪ ، ٢‬ﻟﻴﻨﻚ ﺑﻴﻦ ﮔﺮﻩ )‪ n(1‬ﻭ )‪ n(2‬ﻗﻄﻊ ﺷﺪﻩ ﻭ ﺍﺭﺗﺒﺎﻁ ﺩﻭ ﮔﺮﻩ ﻗﻄﻊ ﻣﻲ ﺷﻮﺩ‪ .‬ﺑﺎ ﺍﻳﻦ ﺣﺎﻝ‬ ‫ﺍﻣﻜﺎﻥ ﺍﺭﺗﺒﺎﻁ ﺑﻴﻦ ﺁﻥ ﺩﻭ ﻫﻨﻮﺯ ﻭﺟﻮﺩ ﺩﺍﺭﺩ‪.‬‬

‫ﺑﺮﺍﻱ ﺣﻞ ﻣﺴﺎﻟﻪ ﺫﻛﺮ ﺷﺪﻩ ﺑﺎﻳﺪ ﺍﺯ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺩﻳﻨﺎﻣﻴﻚ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩ‪ .‬ﺑﺪﻳﻦ ﻣﻨﻈﻮﺭ ﺧﻂ ﺯﻳﺮ ﺭﺍ ﺑﻪ ﺍﺳﻜﺮﻳﭙﺖ‬ ‫ﺧﻮﺩ‪ ،‬ﭘﺲ ﺍﺯ ﺍﻳﺠﺎﺩ ﺷﻲﺀ ﺷﺒﻴﻪ ﺳﺎﺯ‪ ،‬ﺑﻴﻔﺰﺍﻳﻴﺪ ‪:‬‬ ‫‪$ns rtproto DV‬‬

‫ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﻭﺑﺎﺭﻩ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ‪ ،‬ﺩﺭ ﺍﻭﻝ ﻣﻲ ﺑﻴﻨﻴﺪ ﻛﻪ ﺗﻌﺪﺍﺩﻱ ﺑﺴﺘﻪ ﻛﻮﭼﻚ ﻣﻨﺘﻘﻞ ﻣﻲ ﺷﻮﻧﺪ‪ .‬ﺍﻳﻦ ﺑﺴﺘﻪ ﻫﺎ‬ ‫ﺑﺮﺍﻱ ﺗﺒﺎﺩﻝ ﺍﻃﻼﻋﺎﺕ ﺩﺭ ﻣﻮﺭﺩ ﻭﺿﻌﻴﺖ ﻣﺴﻴﺮﻫﺎ ﺑﻴﻦ ﮔﺮﻩ ﻫﺎ ﻣﻨﺘﻘﻞ ﻣﻲ ﺷﻮﻧﺪ‪ .‬ﻭﻗﺘﻲ ﺩﺭ ﺛﺎﻧﻴﻪ ‪ ١‬ﻟﻴﻨﻚ ﻣﻮﺭﺩ‬ ‫ﻧﻈﺮ ﺧﺮﺍﺏ ﻣﻲ ﺷﻮﺩ ‪ ،‬ﻣﺴﻴﺮ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﺗﻐﻴﻴﺮ ﻛﺮﺩﻩ ﻭ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﻃﺮﻳﻖ ﮔﺮﻩ ﻫﺎﻱ )‪ n(5) ، n(4‬ﻭ )‪n(6‬‬

‫ﺍﺭﺳﺎﻝ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٣‐٢‬‬

‫‪ ٩‐٤‐٢‬ﺍﻳﺠﺎﺩ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﺔ ‪XGraph‬‬ ‫ﻳﻚ ﻗﺴﻤﺖ ﺍﺯ ﺑﺴﺘﺔ ﻧﺮﻡﺍﻓﺰﺍﺭﻱ ‪ ns-allinone‬ﺑﺮﻧﺎﻣﺔ ‪ Xgraph‬ﻣﻲﺑﺎﺷﺪ ﻛﻪ ﻣﻲﺗﻮﺍﻧﺪ ﻧﻤﺎﻳﺶ ﮔﺮﺍﻓﻴﻜﻲ ﺍﺯ‬ ‫ﻧﺘﺎﻳﺞ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺭﺍ ﻧﺸﺎﻥ ﺑﺪﻫﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﻧﺸﺎﻥ ﻣﻲﺩﻫﻴﻢ ﻛﻪ ﭼﮕﻮﻧﻪ ﺩﺭﻭﻥ ﺍﺳﻜﺮﻳﭙﺖ ‪ tcl‬ﻳﻚ ﻓﺎﻳﻞ‬ ‫ﺗﻮﻟﻴﺪ ﻛﻨﻴﻢ ﻛﻪ ﺑﻪ ﻋﻨﻮﺍﻥ ﻭﺭﻭﺩﻱ ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﺔ ‪ Xgraph‬ﺑﻪ ﻛﺎﺭ ﺭﻭﺩ‪ .‬ﻫﻤﭽﻨﻴﻦ ﻧﺸﺎﻥ ﺧﻮﺍﻫﻴﻢ ﺩﺍﺩ ﻛﻪ ﭼﮕﻮﻧﻪ ﺍﺯ‬ ‫ﺗﻮﻟﻴﺪ ﻛﻨﻨﺪﺓ ﺗﺮﺍﻓﻴﻚ)‪ (Traffic Generator‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﺪ‪.‬‬

‫‪ ١‐٩‐٤‐٢‬ﺗﻮﭘﻮﻟﻮﮊﻱ ﻭ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻚ‬ ‫ﺩﺭ ﻭﻫﻠﻪ ﺍﻭﻝ ﻗﺼﺪ ﺩﺍﺭﻳﻢ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺯﻳﺮ ﺭﺍ ﺍﻳﺠﺎﺩ ﻛﻨﻴﻢ‪.‬‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٢٤‐٢

.‫ﺍﺑﺘﺪﺍ ﮔﺮﻩﻫﺎ ﻭ ﻟﻴﻨﻚﻫﺎﻱ ﺑﻴﻦ ﺁﻧﻬﺎ ﺭﺍ ﺗﻌﺮﻳﻒ ﻣﻲ ﻛﻨﻴﻢ‬ : ‫ﺗﻌﺮﻳﻒ ﮔﺮﻩﻫﺎ‬ set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node]

: ‫ﺗﻌﺮﻳﻒ ﻟﻴﻨﻜﻬﺎ‬ $ns duplex-link $n0 $n3 1Mb 100ms DropTail $ns duplex-link $n1 $n3 1Mb 100ms DropTail $ns duplex-link $n2 $n3 1Mb 100ms DropTail $ns duplex-link $n3 $n3 1Mb 100ms DropTail

‫ ﻣﺎ ﻳﻚ ﺗﺎﺑﻊ ﺑﻪ ﻧﺎﻡ‬.‫ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﺗﺨﺼﻴﺺ ﺑﺪﻫﻴﻢ‬n2 ‫ ﻭ‬n1،n0 ‫ﺣﺎﻝ ﻣﻲﺧﻮﺍﻫﻴﻢ ﺑﻪ ﮔﺮﻩﻫﺎﻱ‬ .‫ ﻣﻲ ﻧﻮﻳﺴﻴﻢ ﻛﻪ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺳﺎﺩﻩ ﻣﻲ ﻛﻨﺪ‬traffic‐expoo‐attach proc attach-expoo-traffic { node sink size burst idle rate } { set ns [Simulator instance] set source [new Agent/UDP] $ns attach-agent $node $source set traffic [new Application/Traffic/Exponential] $traffic set packet-size $size $traffic set burst-time $burst $traffic set idle-time $idle $traffic set rate $rate

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٥‐٢‬‬ ‫‪$traffic attach-agent $source‬‬ ‫‪$ns connect $source $sink‬‬ ‫‪return $traffic‬‬ ‫}‬

‫ﺍﻳﻦ ﺗﺎﺑﻊ ‪ ٦‬ﺁﺭﮔﻮﻣﺎﻥ ﻣﻲ ﮔﻴﺮﺩ‪ .‬ﺁﺭﮔﻮﻣﺎﻥ ﺍﻭﻝ ﻳﻚ ﮔﺮﻩ‪ ،‬ﺁﺭﮔﻮﻣﺎﻥ ﺩﻭﻡ ﻳﻚ ‪ ،sink‬ﺁﺭﮔﻮﻣﺎﻥ ﺳﻮﻡ ﺍﻧﺪﺍﺯﺓ ﺑﺴﺘﻪ‬ ‫ﺑﺮﺍﻱ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ‪ ،‬ﺁﺭﮔﻮﻣﺎﻥ ﭼﻬﺎﺭﻡ ﻣﺪﺕﺯﻣﺎﻥ ‪ ،brust‬ﺁﺭﮔﻮﻣﺎﻥ ﭘﻨﺠﻢ ﻣﺪﺕﺯﻣﺎﻥ ﺑﻴﻜﺎﺭﻱ)ﺑﺮﺍﻱ ﺗﻮﺻﻴﻒ‬ ‫ﺗﻮﺯﻳﻊ ﻧﻤﺎﻳﻲ( ﻭ ﺑﺎﻻﺧﺮﻩ ﺁﺭﮔﻮﻣﺎﻥ ﺷﺸﻢ ﻧﺮﺥ ﺣﺪﺍﻛﺜﺮ)‪ (peak rate‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﺍﻳﻦ ﺗﺎﺑﻊ ﺩﺭ ﭘﺎﻳﺎﻥ ﻳﻚ ‪handle‬‬

‫ﺑﺮﺍﻱ ﺷﻲ ﺗﺮﺍﻓﻴﻚ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ‪.‬‬ ‫ﺍﺑﺘﺪﺍ ﺭﻭﺍﻝ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ ﻭ ﺁﻧﺮﺍ ﺑﻪ ﮔﺮﻩ ﻧﺴﺒﺖ ﻣﻲ ﺩﻫﺪ‪ .‬ﺳﭙﺲ ﻳﻚ ﺷﻲ ﺑﻪ ﻧﺎﻡ‬ ‫‪ traffic‬ﻣﻲﺳﺎﺯﺩ‪ ،‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻥ ﺭﺍ ﺗﻨﻈﻴﻢ ﻣﻲﻛﻨﺪ ﻭ ﻗﺒﻞ ﺍﺯ ﺁﻧﻜﻪ ‪ source‬ﻭ ‪ sink‬ﺑﻪ ﻫﻢ ﻣﺘﺼﻞ ﺷﻮﻧﺪ ﺁﻧﺮﺍ ﺑﻪ‬ ‫ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﻧﺴﺒﺖ ﻣﻲ ﺩﻫﺪ‪ .‬ﺍﻳﻦ ﺭﻭﺍﻝ ﻣﺜﺎﻝ ﺧﻮﺑﻲ ﺍﺳﺖ ﻛﻪ ﻧﺸﺎﻥ ﻣﻲ ﺩﻫﺪ ﻛﻪ ﭼﮕﻮﻧﻪ ﻛﺎﺭﻫﺎﻱ ﺗﻜﺮﺍﺭﻱ‬ ‫ﻣﺜﻞ ﻧﺴﺒﺖ ﺩﺍﺩﻥ ﻳﻚ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﺑﻪ ﭼﻨﺪﻳﻦ ﮔﺮﻩ ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﺻﻮﺭﺕ ﺭﺍﺣﺘﺘﺮﻱ ﺍﻧﺠﺎﻡ ﺩﺍﺩ‪ .‬ﺣﺎﻝ ﻣﺎ ﺍﺯ ﺍﻳﻦ‬ ‫ﺭﻭﺍﻝ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲ ﻛﻨﻴﻢ ﺗﺎ ﻣﻨﺎﺑﻊ ﺗﺮﺍﻓﻴﻜﻲ ﺑﺎ ﻧﺮﺥﻫﺎﻱ ﺣﺪﺍﻛﺜﺮ ﻣﺘﻔﺎﻭﺕ ﺭﺍ ﺑﻪ ﮔﺮﻫﻬﺎﻱ ‪ n1،n0‬ﻭ ‪ n2‬ﻧﺴﺒﺖ‬ ‫ﺩﻫﻴﻢ ﻭ ﺁﻧﻬﺎ ﺭﺍ ﺑﻪ ﮔﺮﻩ ‪ n4‬ﻣﺘﺼﻞ ﻛﻨﻴﻢ‪.‬‬ ‫]‪set sink0 [new Agent/LossMonitor‬‬ ‫]‪set sink1 [new Agent/LossMonitor‬‬ ‫]‪set sink2 [new Agent/LossMonitor‬‬ ‫‪$ns attach-agent $n4 $sink0‬‬ ‫‪$ns attach-agent $n4 $sink1‬‬ ‫‪$ns attach-agent $n4 $sink2‬‬ ‫]‪set source0 [attach-expoo-traffic $n0 $sink0 200 2s 1s 100k‬‬ ‫]‪set source1 [attach-expoo-traffic $n1 $sink1 200 2s 1s 200k‬‬ ‫]‪set source2 [attach-expoo-traffic $n2 $sink2 200 2s 1s 300k‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٦‐٢‬‬

‫ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻣﺎ ﺍﺯ ﺍﺷﻴﺎ ‪ Agent/LossMonitor‬ﺑﻪ ﻋﻨﻮﺍﻥ ‪Sink‬ﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮﺩﻩﺍﻳﻢ‪ .‬ﺍﻳﻦ‬ ‫ﺍﺷﻴﺎ ﺍﻳﻦ ﻗﺎﺑﻠﻴﺖ ﺭﺍ ﺩﺍﺭﻧﺪ ﻛﻪ ﺑﺘﻮﺍﻧﻨﺪ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺭﺍ ﻧﮕﻪﺩﺍﺭﻱ ﻛﻨﻨﺪ‪ .‬ﺍﻳﻦ ﻛﻤﻴﺖ ﺩﺭ ﻣﺤﺎﺳﺒﺔ‬ ‫ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪ .‬ﺩﺭ ﻓﺼﻞ ﺑﻌﺪ ﺍﻳﻦ ﺷﺊ ﺑﻪ ﺗﻔﺼﻴﻞ ﺗﺸﺮﻳﺢ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫‪٢‐٩‐٤‐٢‬‬

‫ﺛﺒﺖ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ‬

‫ﺣﺎﻝ ﺳﻪ ﻓﺎﻳﻞ ﺑﺎﺯ ﻣﻲ ﻛﻨﻴﻢ ﻛﻪ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺗﺒﻂ ﺑﻪ ‪Sink‬ﻫﺎ ﺭﺍ ﺩﺭ ﺁﻥ ﺫﺧﻴﺮﻩ ﻛﻨﻴﻢ ﻭ ﺳﭙﺲ ﺍﺯ ﺍﻳﻦ‬ ‫ﻓﺎﻳﻠﻬﺎ ﺑﻪ ﻋﻨﻮﺍﻥ ﻭﺭﻭﺩﻱ ﺑﺮﺍﻱ ﺑﺮﻧﺎﻣﺔ ‪ Xgraph‬ﺍﺳﺘﻔﺎﺩﻩ ﺧﻮﺍﻫﻴﻢ ﻛﺮﺩ‪ .‬ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺭﺍ ﺩﺭ ﺍﺑﺘﺪﺍﻱ ﺍﺳﻜﺮﻳﭙﺖ‬ ‫ﻗﺮﺍﺭ ﺩﻫﻴﺪ‪.‬‬ ‫]‪set f0 [open out0.tr w‬‬ ‫]‪set f1 [open out1.tr w‬‬ ‫]‪set f2 [open out2.tr w‬‬

‫ﺍﻳﻦ ﻓﺎﻳﻠﻬﺎ ﺑﺎﻳﺪ ﺩﺭ ﻳﻚ ﻧﻘﻄﻪ ﺑﺴﺘﻪ ﺷﻮﻧﺪ‪ .‬ﻣﺎ ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺩﺭ ﺭﻭﺍﻝ ‪ finish‬ﺍ ﻧﺠﺎﻡ ﻣﻲﺩﻫﻴﻢ‪.‬‬ ‫{ }{ ‪proc finish‬‬ ‫‪global f0 f1 f2‬‬ ‫‪#Close the output files‬‬ ‫‪close $f0‬‬ ‫‪close $f1‬‬ ‫‪close $f2‬‬ ‫‪#Call xgraph to display the results‬‬ ‫& ‪exec xgraph out0.tr out1.tr out2.tr -geometry 800x400‬‬ ‫‪exit 0‬‬ ‫}‬

‫ﺩﺭ ﺍﻳﻦ ﺗﺎﺑﻊ ﻧﻪ ﺗﻨﻬﺎ ﻓﺎﻳﻠﻬﺎﻱ ‪ f1،f0‬ﻭ ‪ f2‬ﺭﺍ ﻣﻲﺑﻨﺪﻳﻢ ﺑﻠﻜﻪ ﺑﺮﻧﺎﻣﺔ ‪ Xgraph‬ﺭﺍ ﺑﺎ ﺳﻪ ﻓﺎﻳﻞ ﻭﺭﻭﺩﻱ ‪، out1.tr‬‬ ‫‪ out2.tr‬ﻭ ‪ out3.tr‬ﻭ ﺑﺎ ﺩﻗﺖ ﻧﻤﺎﻳﺶ ‪ ٨٠٠*٤٠٠‬ﺍﺟﺮﺍ ﻣﻲﻛﻨﻴﻢ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٧‐٢‬‬

‫ﺩﺭ ﺍﻳﻨﺠﺎ ﻣﺎ ﺗﺎﺑﻌﻲ ﻣﻲ ﻧﻮﻳﺴﻴﻢ ﻛﻪ ﺑﻪ ﻃﻮﺭ ﻭﺍﻗﻌﻲ ﺩﺍﺩﻩ ﻫﺎ ﺭﺍ ﺑﺮﺭﻭﻱ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ﺑﻨﻮﻳﺴﺪ‪.‬‬ ‫{ }{ ‪proc record‬‬ ‫‪global sink0 sink1 sink2 f0 f1 f2‬‬ ‫]‪set ns [Simulator instance‬‬ ‫‪set time 0.5‬‬ ‫]_‪set bw0 [$sink0 set bytes‬‬ ‫]_‪set bw1 [$sink1 set bytes‬‬ ‫]_‪set bw2 [$sink2 set bytes‬‬ ‫]‪set now [$ns now‬‬ ‫"]‪puts $f0 "$now [expr $bw0/$time*8/1000000‬‬ ‫"]‪puts $f1 "$now [expr $bw1/$time*8/1000000‬‬ ‫"]‪puts $f2 "$now [expr $bw2/$time*8/1000000‬‬ ‫‪$sink0 set bytes_ 0‬‬ ‫‪$sink1 set bytes_ 0‬‬ ‫‪$sink2 set bytes_ 0‬‬ ‫"‪$ns at [expr $now+$time] "record‬‬ ‫}‬

‫ﺍﻳﻦ ﺭﻭﺍﻝ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺘﻲ ﺍﺯ ‪ Traffic Sink‬ﺭﺍ ﺩﺭﻳﺎﻓﺖ ﻣﻲﻛﻨﺪ‪ .‬ﺳﭙﺲ ﭘﻬﻨﺎﻱﺑﺎﻧﺪ ﺭﺍ ﻣﺤﺎﺳﺒﻪ ﻣﻲﻛﻨﺪ ﻭ‬ ‫ﺁﻥ ﺭﺍ ﺑﺎ ﺯﻣﺎﻥ ﺍﻧﺘﻘﺎﻝ ﻗﺒﻞ ﺍﺯ ﺍﻳﻦ ﻛﻪ ﻣﻘﺪﺍﺭ _‪ byte‬ﺭﺍ ﺑﻪ ﺻﻔﺮ ﻣﻘﺪﺍﺭﺩﻫﻲ ﻛﻨﺪ ﺩﺭ ﺳﻪ ﻓﺎﻳﻞ ﺧﺮﻭﺟﻲ ﻣﻲ ﻧﻮﻳﺴﺪ‬ ‫ﻭ ﺩﺭ ﺍﻧﺘﻬﺎ ﻫﻢ ﺧﻮﺩﺵ ﺭﺍ ﺩﻭﺑﺎﺭﻩ ﺯﻣﺎﻧﺒﻨﺪﻱ ﻣﻲ ﻧﻤﺎﻳﺪ‪.‬‬

‫‪ ٣‐٩‐٤‐٢‬ﺍﺟﺮﺍﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ‬ ‫ﺣﺎﻝ ﻣﻲﺗﻮﺍﻧﻴﻢ ﺭﻭﻳﺪﺍﺩﻫﺎﻱ ﻣﻮﺟﻮﺩ ﺩﺭ ﺑﺮﻧﺎﻣﻪ ﺭﺍ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺯﻣﺎﻥ ﺑﻨﺪﻱ ﻛﻨﻴﻢ ‪:‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٨‐٢‬‬ ‫"‪$ns at 0.0 "record‬‬ ‫"‪$ns at 10.0 "$source0 start‬‬ ‫"‪$ns at 10.0 "$source1 start‬‬ ‫"‪$ns at 10.0 "$source2 start‬‬ ‫"‪$ns at 50.0 "$source0 stop‬‬ ‫"‪$ns at 50.0 "$source1 stop‬‬ ‫"‪$ns at 50.0 "$source2 stop‬‬ ‫"‪$ns at 60.0 "finish‬‬ ‫‪$ns run‬‬

‫ﻧﺨﺴﺖ ﺗﺎﺑﻊ ‪ record‬ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲ ﺷﻮﺩ‪ .‬ﺗﺎﺑﻊ ‪ record‬ﺧﻮﺩ ﺭﺍ ﻫﺮ ‪ ٠/٥‬ﺛﺎﻧﻴﻪ ﺑﻪ ﻃﻮﺭ ﻣﺘﻨﺎﻭﺏ ﺯﻣﺎﻧﺒﻨﺪﻱ ﻣﻲ‬ ‫ﻛﻨﺪ‪.‬‬ ‫ﺳﭙﺲ ﺳﻪ ﻣﻨﺒﻊ ﺗﺮﺍﻓﻴﻚ ﺩﺭ ﺛﺎﻧﻴﻪ ﺩﻫﻢ ﺷﺮﻭﻉ ﺑﻪ ﺍﺭﺳﺎﻝ ﺗﺮﺍﻓﻴﻚ ﻛﺮﺩﻩ ﻭ ﺩﺭ ﺛﺎﻧﻴﻪ ﭘﻨﺠﺎﻫﻢ ﺍﺭﺳﺎﻝ ﺭﺍ ﻣﺘﻮﻗﻒ‬ ‫ﻣﻲﻛﻨﻨﺪ‪ .‬ﺩﺭ ﺛﺎﻧﻴﻪ ﺷﺼﺖ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺗﺎﺑﻊ ‪ finish‬ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ‪ .‬ﺗﺎﺑﻊ ‪ finish‬ﺗﻤﺎﻡ ﻓﺎﻳﻠﻬﺎ ﺭﺍ ﻣﻲﺑﻨﺪﺩ ﻭ‬ ‫ﺑﺮﻧﺎﻣﺔ ‪ Xgraph‬ﺭﺍ ﺍﺟﺮﺍ ﻣﻲ ﻧﻤﺎﻳﺪ‪.‬‬ ‫ﻫﻨﮕﺎﻣﻲ ﻛﻪ ﺷﻤﺎ ﺑﺮﻧﺎﻣﻪ ﺭﺍ ﺍﺟﺮﺍ ﻣﻲ ﻛﻨﻴﺪ‪،‬ﭘﻨﺠﺮﻩ ‪ Xgraph‬ﺭﺍ ﻣﺎﻧﻨﺪ ﺷﻜﻞ ﺯﻳﺮ ﻣﻲ ﺑﻴﻨﻴﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢٩‐٢‬‬

‫ﻫﻤﺎﻧﮕﻮﻧﻪ ﻛﻪ ﺩﺭ ﺷﻜﻞ ﻣﺸﺎﻫﺪﻩ ﻣﻲﺷﻮﺩ ﺣﺪﺍﻛﺜﺮ ‪ burst‬ﻫﺎ ﺑﺮﺍﻱ ﺟﺮﻳﺎﻥ ﺍﻭﻝ ﺩﺭ‪ ،٠/١ Mbit/s‬ﺑﺮﺍﻱ ﺟﺮﻳﺎﻥ‬ ‫ﺩﻭﻡ ﺩﺭ‪ ٠/٢ Mbit/s‬ﻭ ﺑﺮﺍﻱ ﺟﺮﻳﺎﻥ ﺳﻮﻡ ﺩﺭ‪ ٠/٣ Mbit/s‬ﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪.٣‬‬

‫‪٣٠‐٣‬‬

‫‪ Trace‬و ‪ Monitoring‬در ‪NS-2‬‬ ‫ﺍﺯ ﻣﻬﻤﺘﺮﻳﻦ ﻗﺎﺑﻠﻴﺘﻬﺎﻳﻲ ﻛﻪ ﻳﻚ ﺷﺒﻴﻪﺳﺎﺯ ﺑﺎﻳﺪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﺟﻤﻊﺁﻭﺭﻱ ﺩﺍﺩﻩﻫﺎﻱ ﺧﺮﻭﺟﻲ ﺑﻪ ﻣﻨﻈﻮﺭ‬

‫ﭘﺮﺩﺍﺯﺵ ﺷﺒﻜﻪ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺷﺪﻩ ﻣﻲﺑﺎﺷﺪ‪.‬ﺭﻭﺷﻬﺎﻱ ﻣﺨﺘﻠﻔﻲ ﺑﺮﺍﻱ ﺟﻤﻊ ﺁﻭﺭﻱ ﺧﺮﻭﺟﻴﻬﺎ ﻳﺎ ‪ trace‬ﻛﺮﺩﻥ ﺩﺭ‬ ‫ﺷﺒﻴﻪ ﺳﺎﺯ ‪ NS-2‬ﻣﻮﺟﻮﺩ ﻣﻲﺑﺎﺷﺪ‪ .‬ﻣﻲﺗﻮﺍﻥ ﺩﺍﺩﻩﻫﺎﻱ ‪ trace‬ﺭﺍ ﺩﺭ ﺣﻴﻦ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﻧﻤﺎﻳﺶ ﺩﺍﺩ‪ .‬ﻭ ﻳﺎ ﺍﻳﻨﻜﻪ‬ ‫ﺩﺍﺩﻩﻫﺎ ﺭﺍ ﺩﺭ ﻓﺎﻳﻠﻲ ﺫﺧﻴﺮﻩ ﻧﻤﻮﺩ ﺗﺎ ﺑﻌﺪ ﺍﺯ ﭘﺎﻳﺎﻥ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﻣﻮﺭﺩ ﭘﺮﺩﺍﺯﺵ ﻗﺮﺍﺭ ﺑﮕﻴﺮﻧﺪ )ﺍﻳﻦ ﺭﻭﺵ ﺍﺳﺘﻔﺎﺩﻩ‬ ‫ﺑﻴﺸﺘﺮﻱ ﺩﺍﺭﺩ(‪.‬‬ ‫ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺑﻪ ﭼﮕﻮﻧﮕﻲ ﭘﺸﺘﻴﺒﺎﻧﻲ ‪ NS-2‬ﺍﺯ ﺍﻧﺠﺎﻡ ﺍﻋﻤﺎﻝ ‪ Trace‬ﻣﻲﭘﺮﺩﺍﺯﻳﻢ‪.‬‬

‫‪١‐٣‬‬

‫ﺭﻭﺷﻬﺎﻱ ﺟﻤﻊﺁﻭﺭﻱ ﺩﺍﺩﻩ ﺩﺭ ‪NS‬‬

‫‪ Ns‬ﺑﻪ ﺩﻭ ﺭﻭﺵ ‪ tracing‬ﺭﺍ ﭘﺸﺘﻴﺒﺎﻥ ﻣﻲﻛﻨﺪ‪:‬‬ ‫‪ – ١‬ﺑﻮﺳﻴﻠﻪ ﺍﺷﻴﺎﺀ ‪ :trace‬ﺗﻮﺳﻂ ﺍﻳﻦ ﺍﺷﻴﺎﺀ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻫﺮ ﺑﺴﺘﻪ ﺑﻪ ﺻﻮﺭﺕ ﺍﻧﻔﺮﺍﺩﻱ )ﻭﺍﺭﺩ ﺷﺪﻥ ﺑﻪ‬ ‫ﺻﻒ‪ ،‬ﺭﺳﻴﺪﻥ ﺑﺴﺘﻪ ﻫﺎ‪ ،‬ﺧﺎﺭﺝ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ‪ ،‬ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﻟﻴﻨﻚ ﻳﺎ ﺻﻒ(ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﺟﻤﻊﺁﻭﺭﻱ‬ ‫ﻧﻤﻮﺩ‪ ..‬ﺍﺷﻴﺎﺀ ‪ trace‬ﻣﺎﻧﻨﺪ ﮔﺮﻩﻫﺎ ﺩﺭ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﻧﺪ‪ .‬ﺍﺷﻴﺎﺀ ‪ trace‬ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :Trace/Hop‬ﺍﻳﻦ ﺷﺊ ‪Hop‬ﻫﺎ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :Trace/Enque‬ﺍﻳﻦ ﺷﺊ ﻭﺭﻭﺩ ﺑﺴﺘﻪﻫﺎ )ﻣﻌﻤﻮﻻ ﺑﻪ ﺻﻒ( ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :Trace/Deque‬ﺍﻳﻦ ﺷﺊ ﺧﺮﻭﺝ ﺑﺴﺘﻪﻫﺎ )ﻣﻌﻤﻮﻻ ﺍﺯ ﺻﻒ( ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :Trace/Drop‬ﺍﻳﻦ ﺷﺊ ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :Trace/Recv‬ﺍﻳﻦ ﺷﺊ ﺩﺭﻳﺎﻓﺖ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﮔﺮﻩ ﺑﻌﺪﻱ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :SnoopQueue/In‬ﺍﻳﻦ ﺷﺊ ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﻭ ﺯﻣﺎﻥ ﻭﺭﻭﺩ ﺭﺍ ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‬ ‫‪ :SnoopQueue/Out‬ﺍﻳﻦ ﺷﺊ ﺯﻣﺎﻥ ﺧﺮﻭﺝ ﺑﺴﺘﻪ ﻭ ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﺭﺍ ﻳﺎﺩﺩﺷﺖ ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :SnoopQueue/Drop‬ﺍﻳﻦ ﺷﺊ ﺯﻣﺎﻥ ﺣﺬﻑ ﺑﺴﺘﻪ ﻭ ﺍﻧﺪﺍﺯﻩ ﺍﻥ ﺭﺍ ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ :SnoopQueue/EDrop‬ﺍﻳﻦ ﺷﺊ ﺩﺭ ﺯﻣﺎﻥ ﺣﺬﻑ ﺑﺴﺘﻪ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ RED‬ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﺣﺬﻑ ﺷﺪﻩ ﻭ‬ ‫ﺯﻣﺎﻥ ﺣﺬﻑ ﺭﺍ ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣١‐٣‬‬

‫‪ – ٢‬ﺑﻮﺳﻴﻠﻪ ﺍﺷﻴﺎﺀ ‪ :Monitoring‬ﺍﻳﻦ ﺍﺷﻴﺎﺀ ﻛﻤﻴﺘﻬﺎﻱ ﻣﺨﺘﻠﻔﻲ ﻣﺎﻧﻨﺪ ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ‪ ،‬ﺑﻴﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺘﻲ ﻳﺎ‬ ‫ﻓﺮﺳﺘﺎﺩﻩ ﺷﺪﻩ ﻭ ﻏﻴﺮﻩ ﺭﺍ ﻳﺎﺩﺩﺍﺷﺖ ﻣﻲﻛﻨﻨﺪ‪ .‬ﻣﺎﻧﺘﻴﻮﺭﻫﺎ ﻣﻲﺗﻮﺍﻧﻨﺪ ﻫﻢ ﺭﻭﻱ ﺑﺴﺘﻪﻫﺎ ﻭ ﻫﻢ ﺭﻭﻱ ﻓﻠﻮﻫﺎ ﻋﻤﻞ‬ ‫ﺷﻤﺎﺭﺵ ﺭﺍ ﺍﻧﺠﺎﻡ ﺩﻫﻨﺪ‪ .‬ﺍﺷﻴﺎﺀ ‪ Monitoring‬ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :QueueMonitor‬ﺍﻳﻦ ﺷﺊ ﻧﻤﻮﻧﻪﻫﺎﻱ ﺑﺪﺳﺖﺁﻣﺪﻩ ﺗﻮﺳﻂ ‪Snooper‬ﻫﺎ) ﻛﻪ ﺩﺭ ﻗﺴﻤﺖ ﺍﺷﻴﺎﺀ ‪ trace‬ﺑﻪ ﺁﻧﻬﺎ‬ ‫ﺍﺷﺎﺭﻩ ﺷﺪ( ﺭﺍ ﺩﺭﻳﺎﻓﺖ ﻭ ﮔﺮﻭﻩﺑﻨﺪﻱ ﻣﻲﻛﻨﻨﺪ‪.‬‬ ‫‪ :QueueMonitor/ED‬ﺍﻳﻦ ﺷﺊ ﻋﻼﻭﻩ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﺷﺊ ‪ QueueMonitor‬ﻗﺎﺑﻠﻴﺖ ﺗﺸﺨﻴﺺ ﺣﺬﻑ ﺑﺴﺘﻪ‬ ‫ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ Red‬ﺭﺍ ﻧﻴﺰ ﺩﺍﺭﺩ‪.‬‬ ‫‪ :QueueMonitor/ED/Flowmon‬ﺍﻳﻦ ﺷﺊ ﻋﻼﻭﻩ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﺷﺊ ‪ QueueMonitor/ED‬ﻣﻲﺗﻮﺍﻧﺪ‬ ‫ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺑﺮ ﺍﺳﺎﺱ ﻫﺮ ﺟﺮﻳﺎﻥ‪ ،‬ﺑﻪ ﻃﻮﺭ ﺟﺪﺍﮔﺎﻧﻪ ﮔﺮﻭﻩﺑﻨﺪﻱ ﻛﻨﺪ‪.‬‬ ‫‪ :QueueMonitor/ED/Flow‬ﺍﻳﻦ ﺷﺊ ﻣﺤﺘﻮﻱ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺟﺮﻳﺎﻥﻫﺎ ﺍﺳﺖ ﻭ ﺗﻮﺳﻂ ﺷﺊ‬ ‫‪ QueueMonitor/ED/Flowmon‬ﻣﺪﻳﺮﻳﺖ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪٢‐٣‬‬

‫ﺍﺷﻴﺎﺀ ‪Trace‬‬

‫‪ ١‐٢‐٣‬ﻣﻌﻤﺎﺭﻱ ﺳﺮﺁﻳﻨﺪ ﺑﺴﺘﻪﻫﺎ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪trace‬‬ ‫ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪ trace‬ﻳﻚ ﺳﺮﺁﻳﻨﺪ ﻣﺸﺘﺮﻙ ﺩﺭ ﻫﺮ ﺑﺴﺘﻪ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺧﺼﻮﺻﻴﺎﺕ ﺯﻳﺮ ﺭﺍ ﺩﺍﺭﺍﺳﺖ ‪.‬‬ ‫‪ – ١‬ﻳﻚ ﻣﺸﺨﺼﻪ ﻳﻜﺘﺎ ﺑﻪ ﺑﺴﺘﻪ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪ – ٢‬ﻧﻮﻉ ﺑﺴﺘﻪ ﺭﺍ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ؛ ﺍﻳﻦ ﺧﺼﻮﺻﻴﺖ ﺗﻮﺳﻂ ﻋﺎﻣﻞﻫﺎﻳﻲ‪ ١‬ﻛﻪ ﺑﺴﺘﻪ ﺭﺍ ﺗﻮﻟﻴﺪ ﻣﻲﻛﻨﻨﺪ ﺗﻌﻴﻴﻦ‬ ‫ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ – ٣‬ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﺭﺍ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻳﻦ ﻛﻤﻴﺖ ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﺯﻣﺎﻥ ﺍﻧﺘﻘﺎﻝ ﺑﺴﺘﻪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺍﺳﺖ‪.‬‬ ‫‪ – ٤‬ﺑﺮﭼﺴﺐ ﻭﺍﺳﻂ‪ :‬ﺑﺮﺍﻱ ﻣﺤﺎﺳﺒﻪ ﺗﻮﺯﻳﻊ ﺩﺭﺧﺘﻲ ‪ Multicast‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ٢‐٢‐٣‬ﻣﻌﻤﺎﺭﻱ ﻟﻴﻨﻜﻬﺎ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪Trace‬‬ ‫ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﻧﺠﺎﻡ ‪ Trace‬ﺍﺷﺎﺭﻩﮔﺮﻫﺎﻳﻲ ﺩﺭ ﻟﻴﻨﻜﻬﺎ ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ‪ .‬ﻟﻴﻨﻚ ﺍﺯ ﺗﻌﺪﺍﺩﻱ ‪ Connetor‬ﺗﺸﻜﻴﻞ ﺷـﺪﻩ‬ ‫ﺍﺳﺖ‪ .‬ﭘﻨﺞ ﻣﺘﻐﻴﺮ ﺭﻭﺑﺮﻭ ﻟﻴﻨﻚ ﺭﺍ ﺗﻌﺮﻳﻒ ﻣﻲﻛﻨﻨﺪ‪ Ttl ،Link ،Queue ،Head :‬ﻭ ‪.DropHead‬‬

‫‪Agents‬‬

‫‪1‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٢‐٣‬‬

‫ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﻧﺠﺎﻡ ‪ trace‬ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ‪ trace‬ﺭﻭﻱ ﻟﻴﻨﻜﻬﺎ ﻓﻌﺎﻝ ﺷﻮﺩ‪ .‬ﻛﻼﺱ ﺍﺻﻠﻲ ﻟﻴﻨـﻚ ‪Simple-Link‬‬

‫ﻣــﻲﺑﺎﺷــﺪ‪ .‬ﺍﻳــﻦ ﻛــﻼﺱ ﺩﺍﺭﺍﻱ ﺩﻭ ﺭﻭﺍﻝ ‪ trace‬ﻭ‪ init-monitor‬ﺍﺳــﺖ ﻛــﻪ ﺩﺭ ﺯﻣــﺎﻥ ﻓﻌــﺎﻝ ﺷــﺪﻥ ‪ Trace‬ﻭ‬ ‫‪ Monitoring‬ﺍﺯ ﺁﻧﻬﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺭﻭﺍﻝ ‪ trace‬ﺍﺷﻴﺎﺀ ‪ trace‬ﺍﺯ ﻧﻮﻉ ‪ Dequeue ، Enqueue ،Drop‬ﻭ ‪ Recieve‬ﻣﻲﺳﺎﺯﺩ ﻭ ﺧﺮﻭﺟﻲ‬ ‫ﺁﻧﻬﺎ ﺭﺍ ﺑﻪ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻣﻲﻓﺮﺳﺘﺪ‪ .‬ﻧﻮﻉ ‪ Enqueue‬ﺗﻨﻬﺎ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻭﺍﺭﺩ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺫﺧﻴﺮ‬ ‫ﻣﻲﻛﻨﺪ‪ Dequeue ،‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﺧﺎﺭﺝ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲﻛﻨﺪ‪ Drop ،‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪ .‬ﻭ ‪ Recieve‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﺩﺭﻳﺎﻓﺖ ﺑﺴﺘﻪﻫﺎ ﺗﻮﺳﻂ ﮔﺮﻩ ﺑﻌﺪﻱ ﺭﺍ‬ ‫ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪.‬‬ ‫ﻫﻤﭽﻨﻴﻦ ﺭﻭﺍﻝ ‪ Trace‬ﻓﺮﺽ ﻣﻲﻛﻨﺪ ﻳﻚ ﺻﻒ ﺑﻪ ﺍﻳﻦ ﻟﻴﻨﻚ ﻣﺮﺑﻮﻁ ﺷﺪﻩ ﺍﺳﺖ ﺑﻌﺪ ﺍﺯ ﺍﻳﺠﺎﺩ ﺍﺷﻴﺎﺀ‬ ‫‪ trace‬ﮔﻔﺘﻪ ﺷﺪﻩ‪ ،‬ﺷﻲ ‪ Enqueue‬ﺭﺍ ﻗﺒﻞ ﺍﺯ ﺷﻲ ‪ queue‬ﺩﺭ ﻟﻴﻨﻚ ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ ﻭ ﺷﻲ ‪ Dequeue‬ﺭﺍ ﭘﺲ ﺍﺯ‬ ‫‪ queue‬ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ ﻭ ﺷﻲ ‪ Drop‬ﺭﺍ ﺑﻴﻦ ﺻﻒ ﻭ ‪ drop target‬ﻣﺮﺑﻮﻁ ﺑﻪ ﻟﻴﻨﻚ ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ‪.‬ﺷﻜﻞ ‪١‐١‬‬ ‫ﺍﻳﻦ ﻣﺴﺌﻠﻪ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪.‬‬

‫ﺷﻜﻞ ‪١‐١‬‬

‫ﻣﻌﻤﺎﺭﻱ ﻟﻴﻨﻚ‬

‫ﻋﻨﺎﺻﺮ ﺯﻳﺮ ﺩﺭ ﻟﻴﻨﻚ ﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ‪ trace‬ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ‪:‬‬ ‫_‪ Enqt‬ﺑﻪ ﻋﻨﺼﺮﻱ ﻛﻪ ﺑﺴﺘﻪﻫﺎﻱ ﻭﺭﻭﺩﻱ ﺑﻪ ﺻﻒ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪ ،‬ﺍﺷﺎﺭﻩ ﻣﻲﻛﻨﺪ‪.‬‬ ‫_‪ :Dept‬ﺑﻪ ﻋﻨﺼﺮﻱ ﻛﻪ ﺑﺴﺘﻪﻫﺎﻱ ﺧﺮﻭﺟﻲ ﺍﺯ ﺻﻒ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪ ،‬ﺍﺷﺎﺭﻩ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٣‐٣‬‬

‫_‪ :Drpt‬ﺍﺷﺎﺭﻩ ﻣﻲﻛﻨﺪ ﺑﻪ ﻋﻨﺼﺮﻱ ﻛﻪ ﺑﺴﺘﻪﻫﺎﻱ ﮔﻢ ﺷﺪﻩ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ _Rcvt‬ﺍﺷﺎﺭﻩ ﻣﻲﻛﻨﺪ ﺑﻪ ﻋﻨﺼﺮﻱ ﻛﻪ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺗﻮﺳﻂ ﮔﺮﺓ ﺑﻌﺪﻱ ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫ﺍﮔﺮ ﻛﺎﺭﺑﺮ ‪ tracing‬ﺭﺍ ﭼﻨﺪ ﺑﺎﺭ ﺭﻭﻱ ﻟﻴﻨﻚ ﻓﻌﺎﻝ ﻛﻨﺪ‪ .‬ﺍﻳﻦ ﻣﺘﻐﻴﺮﻫﺎ ﺑﻪ ﺁﺧﺮﻳﻦ ﻋﻨﺼﺮ ﺍﺷﺎﺭﻩ ﻣﻲﻛﻨﻨﺪ‪.‬‬

‫‪ ٣‐٢‐٣‬ﻓﺮﻣﺖ ﻓﺎﻳﻞ ‪trace‬‬ ‫ﺩﻭ ﺟﺪﻭﻝ ﺯﻳﺮ ﻓﺮﻣﺖ ﻓﺎﻳﻞ ‪ trace‬ﻛﻪ ﺑﻮﺳﻴﻠﻪ ﺩﺳﺘﻮﺭ ‪ trace-all‬ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﺩ‪ ،‬ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﻨﺪ‪.‬‬ ‫‪7) Pkt-Size‬‬

‫‪5) Pkt-Type‬‬

‫‪6) flag‬‬

‫ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪ ﺭﺍ ﺷﺎﻣﻞ ‪ ٤‬ﻓﻴﻠﺪ ﻧﻮﻉ ﺑﺴﺘﻪ ﺭﺍ ﻧﺸﺎﻥ‬ ‫ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‬

‫ﺍﺳﺖ‪.‬‬

‫ﻣﻲﺩﻫﺪ‬

‫‪ECN :E‬‬

‫‪4) Node2‬‬

‫‪3) Node1‬‬

‫‪1) Type‬‬

‫‪2) time‬‬

‫ﺍﻳﻦ ﺩﻭ ﻓﻴﻠﺪ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﻨﺪ ﺯﻣﺎﻥ ﻭﻗﻮﻉ ﺍﻳﻦ ﻓﻴﻠﺪ ﻧﻮﻉ ﺍﺗﻔﺎﻕ ﺭﺍ ﻧﺸﺎﻥ‬ ‫ﺑﻴﻦ ﭼﻪ ﮔﺮﻩﻫﺎﻳﻲ ﺍﻳﻦ ﺍﺗﻔﺎﻕ‬

‫ﺍﺗﻔﺎﻕ‬

‫ﺍﻓﺘﺎﺩﻩ ﺍﺳﺖ‪.‬‬

‫ﺛﺎﻧﻴﻪ(‬

‫)ﺑﻪ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪-: Dequeue +: Enqueue‬‬

‫‪:CE‬‬

‫‪d: Drop‬‬

‫‪12) Uniqe-id‬‬

‫ﻣﺸﺨﺼﻪ ﻳﻜﺘﺎﻱ ﺑﺴﺘﻪ‬

‫‪11) SeqNO‬‬

‫‪10) Dst‬‬

‫ﺷﻤﺎﺭﻩ ﺗﺮﺗﻴﺐ ﻣﺮﺑﻮﻁ ﺑﻪ ﺑﺴﺘﻪ‬

‫ﻣﻘﺼﺪ ﺑﺴﺘﻪ‬

‫‪r: recieve‬‬

‫‪9) Src‬‬

‫‪8)Flow-Id‬‬

‫ﻣﺒﺪﺍ ﺑﺴﺘﻪ‬

‫ﻣﺸﺨﺼﻪ ﻓﻠﻮ‪) .‬ﺩﺭ ‪(IPV6‬‬

‫‪ ٤‐٢‐٣‬ﺗﻮﺍﺑﻊ ﻛﻤﻜﻲ ﺑﺮﺍﻱ ﺩﺳﺘﺮﺳﻲ ﺑﻪ ﺍﺷﻴﺎﺀ ‪tracing‬‬ ‫ﺍﺷﻴﺎﺀ ‪ trace‬ﻛﻪ ﺩﺭ ﺑﺎﻻ ﺑﻪ ﺁﻧﻬﺎ ﺍﺷﺎﺭﻩ ﺷﺪ ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﺑﺪﻭﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﺳﺘﻮﺭﻫﺎﻱ ﻭﺍﺳﻂ ﻭ ﺑﺎ ﺑﻜﺎﺭﺑﺮﺩﻥ‬ ‫ﺗﻮﺍﺑﻊ ﻛﻤﻜﻲ ﺯﻳﺮ ﺑﻜﺎﺭ ﺑﺮﺩ‪.‬‬

‫‪١‬‬

‫}{‪™ flush – trace‬‬

‫ﺍﻳﻦ ﺗﺎﺑﻊ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻫﻤﻪ ﺍﺷﻴﺎﺀ ‪ trace‬ﺭﺍ ﺍﺯ ﺑﺎﻓﺮ ﻭﺍﺭﺩ ﻓﺎﻳﻞ ﻣﻲﻛﻨﺪ‪.‬‬ ‫}‪™ Create – trace {type file src dst‬‬

‫ﻳﻚ ﺷﻲ ‪ trace‬ﺍﺯ ﻧﻮﻉ )‪ (type‬ﺑﻴﻦ ‪ src‬ﻭ ‪ dst‬ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ ﻭ ﻳﻚ ﺩﺳﺘﮕﻴﺮﻩ ﺑﻪ ﺍﻳﻦ ﺷﻲ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ‪type .‬‬

‫ﻣﻲﺗﻮﺍﻧﺪ ﻣﻘﺎﺩﻳﺮ ‪ Drop ،Dequeue ،Enqueue‬ﻭ ‪ Recv‬ﺭﺍ ﺩﺍﺭﺍ ﺑﺎﺷﺪ ﻛﻪ ﺗﻮﺳﻂ ﺭﻭﺍﻝ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٤‐٣‬‬

‫}‪trace – callback {ns command‬‬

‫ﺯﻣﺎﻧﻴﻜﻪ ﻟﻴﻨﻜﻲ ﻗﺮﺍﺭ ﺍﺳﺖ ‪ trace‬ﺷﻮﺩ ﺩﺳﺘﻮﺭ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺍﺭﺯﻳﺎﺑﻲ‬

‫ﻣﻲﺷﻮﺩ‪.‬‬ ‫}‪™ Drop-trace {n1 n2 traceobject‬‬

‫ﺷﻲ ‪ trace‬ﻛﻪ ﻗﺒﻼ ﺗﻮﺳﻂ ﺗﺎﺑﻊ ‪ create-trace‬ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺍﺳﺖ ﻣﻘﺼﺪ ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺑﻴﻦ‬ ‫ﮔﺮﻩ ‪ n1‬ﻭ ‪ n2‬ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ٥‐٢‐٣‬ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﺷﻴﺎﺀ ‪trace‬‬ ‫ﺍﻳﻦ ﺩﺳﺘﻮﺭﻫﺎ ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﺩﺭ ﺍﺳﻜﺮﻳﭙﺖﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﻜﺎﺭ ﺑﺮﺩ‪.‬‬

‫‪١‐٥‐٢‐٣‬‬

‫ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﻓﻌﺎﻝ ﻧﻤﻮﺩﻥ ‪ trace‬ﺩﺭ ﻟﻴﻨﻜﻬﺎ‬ ‫>‪™ $Simple-link trace <ns>
‫ﺍﻳﻦ ﺩﺳﺘﻮﺭﺷﻲ ‪ trace‬ﺭﺍ ﺑﺮﺍﻱ ﺍﻳﻦ ﻟﻴﻨﻚ ﻣﻲﺳﺎﺯﺩ )ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ( ﻭ ﺍﺗـﺼﺎﻝ ﺭﺍ ﺑـﻪ ﺭﻭﺯ ﺩﺭ ﻣـﻲﺁﻭﺭﺩ‪ .‬ﺧﺮﻭﺟـﻲ‬ ‫‪ trace‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﻳﻦ ﻟﻴﻨﻚ ﺩﺭ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﺍﮔـﺮ ‪ op‬ﻣﻘـﺪﺍﺭ ‪ nam‬ﺭﺍ ﺑﮕﻴـﺮﺩ ﻳـﻚ ﻓﺎﻳـﻞ‬ ‫‪ trace‬ﺍﺯ ﻧﻮﻉ ‪ nam‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯﻓﺎﻳﻞ ‪ nam‬ﻣﻲﺗﻮﺍﻥ ﺍﺗﻔﺎﻗﺎﺕ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺷﺪﻩ ﺩﺭ ﻟﻴﻨﻚ ﺭﺍ ﺑﻪ‬ ‫ﺻﻮﺭﺕ ﮔﺮﺍﻓﻴﻜﻲ ﺩﺭ ‪ nam animator‬ﻧﺸﺎﻥ ﺩﺍﺩ‪.‬‬ ‫>‪™ $simple-link nam – trace <ns>
‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ‪ nam tracing‬ﺭﺍ ﺩﺭ ﻟﻴﻨﻚ ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﻲﻛﻨﺪ‪ .‬ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﺩﺭ ﻓﺎﻳﻞ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫>‪™ $simple-link trace – dyndmic <ns>
‫‪ tracing‬ﺭﺍ ﻣﺨﺼﻮﺹ ﺍﺗﻔﺎﻗﺎﺕ ﺩﻳﻨﺎﻣﻴﻜﻲ ﻟﻴﻨﻚ )ﺧﺮﺍﺏ ﺷﺪﻥ ﻟﻴﻨﻚ( ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﻲﻛﻨﺪ ﻭ ﻧﻴﺰ ﺑﺎ ﺗﻌﻴﻴﻦ ﻣﻘﺪﺍﺭ‬ ‫‪ nam‬ﺑﺮﺍﻱ“‪ ”op‬ﺍﻳﻦ ﻧﻮﻉ ‪ trace‬ﺭﺍ ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﻲﻛﻨﺪ‪ .‬ﻓﺮﻣﺖ ‪ trace‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﺗﻔﺎﻗﺎﺕ ﺩﻳﻨﺎﻣﻜﻲ ﺑﻪ ﺷﺮﺡ ﺯﻳـﺮ‬ ‫ﺍﺳﺖ‪:‬‬ ‫>‪
‫>‪<src‬‬

‫>‪<state‬‬

‫>‪
‫ﻣﻘﺼﺪ‬

‫ﻣﺒﺪﺍ‬

‫ﻭﺿﻌﻴﺖ ﻟﻴﻨﻚ‪:‬‬

‫ﺯﻣﺎﻥ ﺍﺗﻔﺎﻕ‬

‫‪ :Up‬ﺳﺎﻟﻢ‬

‫‪1‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻳﻦ ﺗﻮﺍﺑﻊ ﺑﺮﺍﻱ ﺍﻓﺮﺍﺩ ﻣﺒﺘﺪﻱ ﺗﻮﺻﻴﻪ ﻧﻤﻲﺷﻮﺩ‪.‬‬

‫>‪
‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٥‐٣‬‬ ‫‪ :Down‬ﺧﺮﺍﺏ‬

‫‪ ٢‐٥‐٢‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ‪ trace‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺻﻔﻬﺎ‬ ‫>‪™ $ns trace-all
‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ‪ trace‬ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﻟﻴﻨﻜﻬﺎ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﺩﺭ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫>‪™ $ns namtrace-all
‫‪ trace‬ﺍﺯ ﻧﻮﻉ ‪ nam‬ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﻟﻴﻨﻜﻬﺎ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﺩﺭ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻧﻮﺳﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫>‪™ $ ns trace – queue
‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﻳﻚ ﺷﺊ ‪ trace‬ﺑﻪ ﻣﻨﻈﻮﺭ ‪ log‬ﮔﺮﻓﺘﻦ ﺍﺯ ﺍﺗﻔﺎﻗﺎﺕ ﺻﻒ ﺑﻴﻦ ‪ n1‬ﻭ ‪ n2‬ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ‬ ‫>‪™ $ns namtrace – queue
‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﻣﺎﻧﻨﺪ ﻓﺮﻣﺎﻥ ﻗﺒﻞ ﺍﺳﺖ ﺑﻪ ﺟﺰ ﺍﻳﻨﻜﻪ ‪ nam tracing‬ﺭﺍ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪٣-٣‬‬

‫اﺷﻴﺎء ‪Monitoring‬‬

‫ﻣﺎﻧﺘﻴﻮﺭﻫﺎ ﻣﺠﻤﻮﻋﻪ ﺩﻳﮕﺮﻱ ﺍﺯ ﺍﺷﻴﺎﺀ ﻫﺴﺘﻨﺪ ﻛﻪ ﺑﻪ ﻣﻨﻈﻮﺭ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﺍﺯ ﺧﺮﻭﺟﻲ ﺷﺒﻴﻪﺳﺎﺯﻱ‬ ‫ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ ﺍﻳﻦ ﺍﺷﻴﺎﺀ ﻧﻴﺰ ﺑﻌﺪ ﺍﺯ ﺍﻳﺠﺎﺩ ﺑﻪ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﺒﻜﻪ ﺍﺿﺎﻓﻪ ﻣﻲﺷﻮﻧﺪ‪ .‬ﺍﻳﻦ ﺍﺷﻴﺎﺀ‬ ‫ﻗﺎﺑﻠﻴﺖ ﺭﺩﮔﻴﺮﻱ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‪ ،‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ‬ ‫ﺷﺪﻩ‪ ،‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﻓﺮﺳﺘﺎﺩﻩ ﺷﺪﻩ ﻭ ﺑﺮﺣﺴﺐ ﻧﻴﺎﺯ ﻣﻴﺎﻧﮕﻴﻦ ﺍﻳﻦ ﭘﺎﺭﺍﻣﺘﺮﻫﺎ ﺭﺍ ﺩﺍﺭﻧﺪ‪ .‬ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﮔﻔﺘﻪ‬ ‫ﺷﺪ‪ Monitorig،‬ﻣﻤﻜﻦ ﺍﺳﺖ ﺭﻭﻱ ﺗﻤﺎﻡ ﺑﺴﺘﻪﻫﺎ ﺍﻋﻤﺎﻝ ﺷﻮﺩ ﻳﺎ ﺭﻭﻱ ﻓﻠﻮﻫﺎﻱ ﺧﺎﺹ‪.‬‬ ‫ﻋﻼﻭﻩ ﺑﺮ ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ ﻭ ﻳﺎ ﺑﺎﻳﺘﻬﺎ ﻳﻚ ﻣﺎﻧﻴﺘﻮﺭ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺷﻲ‪ Integrator‬ﻣﻲﺗﻮﺍﻧﺪ ﺩﺭ ﻳﻚ ﻓﺎﺻـﻠﻪ ﺯﻣـﺎﻧﻲ‬ ‫]‪ [t0,t1‬ﺍﻃﻼﻋﺎﺕ ﻭ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺭﺍ ﻣﺤﺎﺳﺒﻪ ﻛﻨﺪ‪.‬‬

‫‪Queue Monitoring ١‐٣‐٣‬‬ ‫ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻋﻤﺎﻝ ‪ Monitoring‬ﻛﻼﺱ ‪) Simple-Link‬ﻛﻼﺱ ﺍﺻﻠﻲ ﻟﻴﻨﻚ( ﺭﻭﺍﻟﻲ ﺑﻪ ﻧﺎﻡ ‪Init-‬‬

‫‪ monitor‬ﺩﺍﺭﺩ‪ .‬ﺍﻳﻦ ﺭﻭﺍﻝ ﻣﺎﻧﻴﺘﻮﺭﻳﻨﮓ ﺻﻒ ﺭﺍ ﺭﻭﻱ ﻟﻴﻨﻚ ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٦‐٣‬‬

‫‪ Queue Monitoring‬ﺍﺯ ﺍﺷﻴﺎﺀ ‪ Snoop‬ﻭ ‪ monitor‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ snoop queue .‬ﻣﺎﻧﻨﺪ ﺍﺷﻴﺎﺀ ‪trace‬‬

‫ﺑﻪ ﻳﻚ ﺻﻒ ﻣﺘﺼﻞ ﻣﻲﺷﻮﺩ ﻭ ﻭﺭﻭﺩ ﻭ ﺧﺮﻭﺝ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﻣﺎﻧﺘﻴﻮﺭ ﻣﻲ ﻛﻨﺪ ﻭ ﺑﻪ ‪ Queue Monitor‬ﮔﺰﺍﺭﺵ‬ ‫ﻣﻲﺩﻫﺪ‪ Queue Monitor .‬ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺩﺭ ﻣﺘﻐﻴﺮﻫﺎﻳﻲ ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻳﻦ ﺍﻃﻼﻋﺎﺕ ﺩﺭ ﻫﺮ ﺯﻣﺎﻥ ﺷﺒﻴﻪﺳﺎﺯﻱ‬ ‫ﻗﺎﺑﻞ ﺩﺳﺘﺮﺳﻲ ﻫﺴﺘﻨﺪ ﻭ ﺍﺯ ﺁﻧﻬﺎ ﻣﻲﺗﻮﺍﻥ ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺧﺮﻭﺟﻲ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪.‬‬ ‫ﻣﺘﻐﻴﺮﻫﺎﻳﻲ ﻛﻪ ‪ Queue Momitor‬ﺁﻧﻬﺎ ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﺍﮔﺮ ﺑﺎ ‪ P‬ﺷﺮﻭﻉ ﺷﻮﻧﺪ ﻣﺮﺑﻮﻁ ﻫﺴﺘﻨﺪ ﺑﻪ ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ‬ ‫ﻭ ﺍﮔﺮ ﺑﺎ ‪ b‬ﺷﺮﻭﻉ ﺷﻮﻧﺪ ﻣﺮﺑﻮﻁ ﺑﻪ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎ ﻫﺴﺘﻨﺪ‪.‬‬ ‫ﻣﻤﻜﻦ ﺍﺳﺖ ﭼﻨﺪ ‪ snoop Queue‬ﺑﻪ ﻳﻚ ‪ Queue monitor‬ﺍﺷﺎﺭﻩ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻨﺪ‪.‬ﻣﺘﻐﻴﺮﻫﺎﻳﻲ ﻛﻪ ﺗﻮﺳﻂ ﺷﺊ‬ ‫‪ queue Monitor‬ﻣﻘﺪﺍﺭ ﺩﻫﻲ ﻭ ﺑﺮﮔﺮﺩﺍﻧﺪﻩ ﻣﻲﺷﻮﻧﺪ ﺑﻪ ﺷﺮﺡ ﺯﻳﺮ ﻫﺴﺘﻨﺪ‪:‬‬ ‫‪ :Size‬ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺎﻳﺖ‬ ‫_‪ :Pkts‬ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺴﺘﻪ‬ ‫_‪ :parrival‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺘﻲ ﺻﻒ‬ ‫_‪ :barrival‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺘﻲ ﺻﻒ‬ ‫_‪ :pdeparture‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺧﺎﺭﺝ ﺷﺪﻩ ﺍﺯ ﺻﻒ‬ ‫_‪ :bdeparture‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺧﺎﺭﺝ ﺷﺪﻩ ﺍﺯ ﺻﻒ‬ ‫_‪ :pdrops‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺍﺯ ﺻﻒ‬ ‫_‪ :bdrops‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺍﺯ ﺻﻒ‬ ‫_‪ :bytesInt‬ﺗﻮﺳﻂ ﺍﻳﻦ ﺷﺊ ﺍﻧﺘﮕﺮﺍﻝ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺎﻳﺖ ﻣﺤﺎﺳﺒﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫_‪ : PktsInt‬ﺗﻮﺳﻂ ﺍﻳﻦ ﺷﺊ ﺍﻧﺘﮕﺮﺍﻝ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺴﺘﻪ ﻣﺤﺎﺳﺒﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻣﻘﺪﺍﺭ ﺑﺮﮔﺮﺩﺍﻧﺪﻩ ﺷﺪﻩ ﺗﻮﺳﻂ ﺍﻳﻦ ﻣﺘﻐﻴﺮﻫﺎ ﺍﺯ ﺯﻣﺎﻥ ﻓﻌﺎﻝ ﺷﺪﻥ ‪ Monitoring‬ﺩﺭ ﺻﻒ ﺗﺎ ﺯﻣﺎﻥ ﻓﺮﺍﺧﻮﺍﻧﻲ ﺍﻳﻦ‬ ‫ﻣﺘﻐﻴﺮﻫﺎ ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٧‐٣‬‬

‫‪ ٢‐٣‐٣‬ﺷﺊ ‪QueueMonitor/ED‬‬ ‫ﺍﻳﻦ ﺷﺊ ﻣﺎﻧﻨﺪ ‪ QueueMonitor‬ﺍﺳﺖ ﺑﻪ ﺟﺰ ﺍﻳﻨﻜﻪ ﻗﺎﺩﺭ ﺍﺳﺖ ﺑﻴﻦ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﺧﺎﻃﺮ ﭘﺮ‬ ‫ﺷﺪﻥ ﺑﺎﻓﺮ ﻭ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ Red‬ﺗﻤﺎﻳﺰ ﻗﺎﺋﻞ ﺷﻮﺩ‪ .‬ﻣﺘﻐﻴﺮﻫﺎﻱ ﺍﺧﺘﺼﺎﺻﻲ ﺍﻳﻦ ﺷﺊ‬ ‫ﻋﺒﺎﺭﺗﺴﺖ ﺍﺯ‪:‬‬ ‫_‪ :Epdrops‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪RED‬‬ ‫_‪ :Ebdrops‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪RED‬‬

‫‪PerFlow Monitoring ٣‐٣‐٣‬‬ ‫ﻛﻼﺳﻬﺎﻱ ﺧﺎﺹ ﺑﺮﺍﻱ ﺟﻤﻊ ﺁﻭﺭﻱ ﺩﺍﺩﻩﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻓﻠﻮﻫﺎ ﭘﻴﺎﺩﻩ ﺳﺎﺯﻱ ﺷـﺪﻩﺍﻧـﺪ ﺍﻳـﻦ ﻛﻼﺳـﻬﺎ ﺍﺑﺘـﺪﺍ‬ ‫ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﻨﺪ ﻛﻪ ﺑﺴﺘﻪ ﻣﺘﻌﻠﻖ ﺑﻪ ﭼﻪ ﺟﺮﻳﺎﻧﻲ ﺍﺳﺖ ﻭ ﺑﻌﺪ ﺍﺯ ﺁﻥ ﺑﺴﺘﻪ ﺑﻪ ﺷﺊ ﻣﺎﻧﻴﺘﻮﺭ ﻛﻨﻨﺪﻩ ﺟﺮﻳﺎﻧﻬـﺎ ﺍﺭﺳـﺎﻝ‬ ‫ﻣﻲﺷﻮﺩ ﻛﻪ ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺑﺮﺣﺴﺐ ﻓﻠﻮ ﺟﻤﻊ ﺁﻭﺭﻱ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪١‐٣‐٣‐٣‬‬

‫ﺷﺊ ‪QueueMonitor/ED/FlowMon‬‬

‫ﺍﻳﻦ ﺷﺊ ﺑﻪ ﻣﻨﻈﻮﺭ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﺑﺮ ﺣﺴﺐ ﺟﺮﻳﺎﻥﻫﺎ ﺑﻪ ﺟﺎﻱ ﺷﺊ ‪ QueueMonitor‬ﻣﻮﺭﺩ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪ .‬ﻭ ﻋﻼﻭﻩ ﺑﺮ ﺟﻤﻊﺁﻭﺭﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﺩﺭ ﺷﺊ ‪QueueMonitor‬‬

‫ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻓﻠﻮﻫﺎ ﺭﺍ ﻧﻴﺰ ﺟﻤﻊﺁﻭﺭﻱ ﻣﻲﻧﻤﺎﻳﺪ‪.‬‬ ‫ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺷﺊ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫_‪ :enable_in‬ﺑﻪ ﺻﻮﺭﺕ ﭘﻴﺶﻓﺮﺽ ﻣﻘﺪﺍﺭ ‪ true‬ﺩﺍﺭﺩ ﻭ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﻛﻪ ﻣﺘﻐﻴﺮﻫﺎﻱ ﺣﺎﻟﺖ ﻣﺮﺑﻮﻁ ﺑﻪ ﺟﺮﻳﺎﻥ‬ ‫ﺩﺭﻳﺎﻓﺘﻲ‪،‬ﺑﺎﻳﺪ ﺗﻮﺳﻂ ‪ Flow Monitor‬ﻧﮕﻬﺪﺍﺭﻱ ﺷﻮﺩ‪ .‬ﻭ ﺍﮔﺮ ﺍﻳﻦ ﻣﺘﻐﻴﺮ ﻣﻘﺪﺍﺭ ‪ False‬ﺑﮕﻴﺮﺩ ﺗﻨﻬﺎ ﺍﻃﻼﻋﺎﺕ‬ ‫ﻣﺮﺑﻮﻁ ﺑﻪ ﺩﺭﻳﺎﻓﺖ ﻛﻞ ﺑﺴﺘﻪﻫﺎ ﻧﮕﻬﺪﺍﺭﻱ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫_‪ :enable_out‬ﺑﻪ ﺻﻮﺭﺕ ﭘﻴﺶﻓﺮﺽ ﻣﻘﺪﺍﺭ ‪ true‬ﺩﺍﺭﺩ ﻭ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﻛﻪ ﺁﻳﺎ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺟﺮﻳﺎﻥ ﺧﺮﻭﺟﻲ ﺍﺯ ﺑﺎﻳﺪ ﺗﻮﺳﻂ ‪ Flow Monitor‬ﻧﮕﻬﺪﺍﺭﻱ ﺷﻮﻧﺪ ﻳﺎ ﺧﻴﺮ‪ .‬ﺍﮔﺮ ﻣﻘﺪﺍﺭ ‪ false‬ﺑﮕﻴﺮﺩ ﺗﻨﻬﺎ ﺗﻌﺪﺍﺩ‬ ‫ﻛﻞ ﺑﺴﺘﻪﻫﺎﻱ ﺧﺎﺭﺝ ﺷﺪﻩ ﺍﺯ ﺻﻒ ﻧﮕﻬﺪﺍﺭﻱ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣٨‐٣‬‬

‫_‪ :enable_drop‬ﭘﻴﺶﻓﺮﺽ ﻣﻘﺪﺍﺭ ‪ true‬ﺩﺍﺭﺩ ﻭ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﻛﻪ ﺁﻳﺎ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺩﻭﺭﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺑﺮ ﺣﺴﺐ ﻫﺮ ﺟﺮﻳﺎﻥ ﺑﺎﻳﺪ ﻧﮕﻪ ﺩﺍﺷﺘﻪ ﺷﻮﺩ ﻳﺎ ﺧﻴﺮ‪ .‬ﺍﮔﺮ ﻣﻘﺪﺍﺭ ‪ false‬ﺑﮕﻴﺮﺩ ﺗﻨﻬﺎ ﺗﻌﺪﺍﺩ ﻛﻞ‬ ‫ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﻧﮕﻬﺪﺍﺭﻱ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫‪ :enable_edrops‬ﭘﻴﺶﻓﺮﺽ ﻣﻘﺪﺍﺭ ‪ true‬ﺩﺍﺭﺩ ﻭ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﻛﻪ ﺁﻳﺎ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺩﻭﺭﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ RED‬ﺑﺮ ﺣﺴﺐ ﻫﺮ ﺟﺮﻳﺎﻥ ﺑﺎﻳﺪ ﻧﮕﻪﺩﺍﺷﺘﻪ ﺷﻮﺩ ﻳﺎ ﺧﻴﺮ‪ .‬ﺍﮔﺮ ﻣﻘﺪﺍﺭ‬ ‫‪ false‬ﺑﮕﻴﺮﺩ ﺗﻨﻬﺎ ﺗﻌﺪﺍﺩ ﻛﻞ ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺗﻮﺳﻂ ﺍﻟﮕﻮﺭﻳﺘﻢ ‪ RED‬ﻧﮕﻬﺪﺍﺭﻱ ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫‪ ٢‐٣‐٣‐٣‬ﺷﺊ ‪QUEUEMONITOR/ED/FLOW‬‬ ‫ﺍﻳﻦ ﺷﺊ ﺷﺎﻣﻞ ﺷﻤﺎﺭﻧﺪﻩﻫﺎﻱ ﺑﺮ ﺣﺴﺐ ﻓﻠﻮ ﻭ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﺍﺳﺖ ﻛﻪ ﺗﻮﺳﻂ ﺷﺊ‬ ‫‪ QUEUEMONITOR/ED/FLOWmon‬ﻣﺪﻳﺮﻳﺖ ﻣﻲﺷﻮﺩ‪ .‬ﺍﻳﻦ ﺷﺊ ﺩﺭ ﺯﻣﺎﻥ ﺍﻳﺠﺎﺩ ﺷﺊ ‪Flowmon‬‬

‫ﺗﻮﺳﻂ ﺭﻭﺍﻝ ‪ oTcl callback‬ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﺩ ﻭ ﺑﺮﺍﻱ ﻧﮕﺎﺷﺖ ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﻓﻠﻮﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺗﻮﺟﻪ ﺷﻮﺩ ﻛﻪ‬ ‫‪ classifier‬ﻣﺴﺌﻮﻝ ﻧﮕﺎﺷﺖ ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﻓﻠﻮﻫﺎ ﺑﻪ ﺭﻭﺵ ﺍﺧﺘﻴﺎﺭﻱ)ﻛﻪ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮ ﺗﻌﻴﻴﻦ ﻣﻲﺷﻮﺩ( ﺍﺳﺖ‪.‬‬ ‫ﻣﺘﻐﻴﺮﻫﺎﻱ ﺣﺎﻟﺖ ﺍﻳﻦ ﺷﺊ ﻋﺒﺎﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :Src‬ﺁﺩﺭﺱ ﻣﺒﺪﺍ ﺟﺮﻳﺎﻥ‬‫‪ :Dst‬ﺁﺩﺭﺱ ﻣﻘﺼﺪ ﺟﺮﻳﺎﻥ‬‫‪ :Flowid‬ﻣﺸﺨﺼﻪ ﺟﺮﻳﺎﻥ‬‫‪ ٣‐٣‐٣‐٣‬ﻓﺮﻣﺖ ‪Flow Monitor‬‬ ‫ﻓﺮﻣﺖ ﻓﺎﻳﻠﻲ ﻛﻪ ﺗﻮﺳﻂ ‪ Flow Monitoring‬ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﺩ ﺩﺭ ﺩﻭ ﺟﺪﻭﻝ ﺯﻳﺮ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫_‪parrival‬‬

‫‪Dst‬‬

‫‪src‬‬

‫ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ ﻱ‬

‫ﻣﻘﺼﺪ‬

‫ﻣﺒﺪﺍ‬

‫ﺩﺭﻳﺎﻓﺘﻲ ﻣﺮﺑﻮﻁ ﺑﻪ‬

‫‪flowid‬‬

‫ﻣﺸﺨﺼﻪ‬ ‫ﻓﻠﻮ‬

‫‪pkt-type‬‬

‫ﻧﻮﻉ ﺑﺴﺘﻪ‬

‫‪Flowid‬‬

‫‪time‬‬

‫‪0‬‬

‫ﺭﺩﻩ ﺑﺴﺘﻪ ﺭﺍ‬

‫ﻣﺸﺨﺼﻪ‬

‫ﺯﻣﺎﻥ ﻓﺮﺍﺧﻮﺍﻧﻲ‬

‫ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪.‬‬

‫ﻓﻠﻮ‬

‫‪FlowMonit‬‬ ‫‪or‬‬

‫ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ‬

‫ﻓﻌﻼ ﺗﻨﻬﺎ ﻣﻘﺪﺍﺭ‬

‫‪flowid‬‬

‫‪ 0‬ﺩﺍﺭﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬ ‫‪Bdrops‬‬

‫‪pdrops‬‬

‫‪Tbdrops‬‬

‫‪Tpdrops‬‬

‫ﺗﻌﺪﺍﺩ ﻛﻞ ﺗﻌﺪﺍﺩ‬

‫ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺗﻌﺪﺍﺩ‬ ‫ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺑﺴﺘﻪﻫﺎﻱ‬ ‫ﺷﺪﻩ ﻣﺮﺑﻮﻁ ﺑﻪ ﺩﻭﺭ‬

‫‪٣٩‐٣‬‬

‫ﺑﻪ ﺑﺴﺘﻪﻫﺎﻱ‬

‫ﺍﻧﺪﺍﺧﺘﻪ ﺑﻪ‬

‫ﺑﺎﻳﺘﻬﺎﻱ‬

‫ﺩﻭﺭ ﺩﺭﻳﺎﻓﺘﻲ‬

‫‪Tparrival‬‬

‫ﻛﻞ ﺗﻌﺪﺍﺩ‬

‫‪ebdrops‬‬

‫ﻛﻞ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺗﻌﺪﺍﺩ‬

‫ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎ ﻱ‬

‫ﺑﺴﺘﻪﻫﺎﻱ‬

‫ﺑﻪ‬

‫ﺩﺭﻳﺎﻓﺘﻲ‬

‫ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺩﻭﺭ‬

‫ﺍﻧﺪﺍﺧﺘﻪ ﺑﻪ ﻓﻠﻮ ﺑﺎ‬

‫ﺗﻮﺳﻂ‬

‫ﺷﺪﻩ‬

‫ﺗﻮﺳﻂ ﻣﺸﺨﺼﻪ‬

‫‪RED‬‬

‫‪RED‬‬

‫ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ﺷﺪﻩ ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﻧﺪﺍﺧﺘﻪ‬ ‫‪Flowid‬‬

‫‪epdrops‬‬

‫‪Barrival‬‬

‫ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ﺷﺪﻩ‬

‫ﺩﻭﺭ ﺑﺴﺘﻪﻫﺎﻱ‬

‫ﺑﻪ ﺩﺭﻳﺎﻓﺘﻲ ﻣﺮﺑﻮﻁ‬

‫‪flowid‬‬

‫‪Flowid‬‬

‫‪ ٤‐٣‐٣‬ﻭﺍﺳﻄﻬﺎﻱ ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ‪Monitoring‬‬ ‫‪١‐٤‐٣‐٣‬‬

‫ﻓﺮﻣﺎﻧﻬﺎﻱ ﻓﻌﺎﻝ ﻧﻤﻮﺩﻥ ‪ Monitoring‬ﺭﻭﻱ ﻟﻴﻨﻜﻬﺎ‬ ‫>‪$ simple-link init – monitor <ns> <sample Interval‬‬

‫ﻳﻚ ﺷﻲ ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ ﻛﻪ ﻣﺎ ﺭﺍ ﻗﺎﺩﺭ ﻣﻲﻛﻨﺪ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺍﻳﻦ ﻟﻴﻨﻚ ﺭﺍ ﻣﺎﻧﻴﺘﻮﺭ ﻛﻨﻴﻢ ﻭ ﺍﺳﻢ ﺷﻴﺌﻲ ﺭﺍ ﺑﺮ‬ ‫ﻣﻲﮔﺮﺩﺍﻧﺪ ﻛﻪ ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﺍﻧﺪﺍﺯﻩ ﻣﺘﻮﺳﻂ ﺻﻒ ﻻﺯﻡ ﻣﻲﺷﻮﺩ‪.‬‬ ‫>‪$ simple-link attach – monitors
‫ﺍﻳﻦ ﺷﺒﻴﻪ ﺩﺳﺘﻮﺭ ‪ init–monitor‬ﺍﺳﺖ ﺑﻪ ﻋﻼﻭﻩ ﺍﻳﻨﻜﻪ ﻣﻮﺍﺭﺩ ﺍﺧﺘﺼﺎﺻﻲ ﺑﻴﺸﺘﺮﻱ ﺭﺍ ﺩﺭ ﺍﺧﺘﻴﺎﺭ ﻣﺎ ﻗﺮﺍﺭ‬ ‫ﻣﻲﺩﻫﺪ‪..‬‬ ‫>‪$ns monitor – queve
‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﺷﻴﺌﻲ ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ ﻛﻪ ﺑﻪ ﻣﺎ ﺍﺟﺎﺯﻩ ﻣﻲﺩﻫﺪ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻴﻦ ﮔﺮﻩ ‪ n1‬ﻭ ‪ n2‬ﻣﺎﻧﻴﺘﻮﺭ ﺷﻮﺩ‪ .‬ﻭ ﻳﻚ‬ ‫ﺩﺳﺘﮕﻴﺮﻩ ﺑﻪ ﺷﻴﺌﻲ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﻛﻪ ﻣﻴﺎﻧﮕﻴﻦ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺗﻮﺳﻂ ﺁﻥ ﺗﻌﻴﻴﻦ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪٢‐٤‐٣‐٣‬‬

‫ﻓﺮﻣﺎﻧﻬﺎﻱ ﺷﺊ ‪QueueMonitor‬‬

‫ﭘﺲ ﺍﺯ ﺍﻳﻨﻜﻪ ‪ Monitoring‬ﺩﺭ ﻳﻚ ﺻﻒ ﻓﻌﺎﻝ ﺷﺪ ﺑﻮﺳﻴﻠﻪ ﻓﺮﻣﺎﻧﻬﺎﻱ ﺯﻳﺮ ﻣﻲﺗﻮﺍﻥ ﺷﺊ ‪QueueMonitor‬‬

‫ﻣﺮﺑﻮﻃﻪ ﺭﺍ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻧﻤﻮﺩ‪.‬‬ ‫‪™ $queuemonitor‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٠‐٣‬‬

‫ﻫﻤﻪ ﺷﻤﺎﺭﻧﺪﻩﻫﺎﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺷﺊ ‪)queuemonitor‬ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ‪ deparure ،arrival‬ﻭ ‪ (drops‬ﺭﺍ‬ ‫ﻣﻘﺪﺍﺭ ﺻﻔﺮ ﻣﻲﺩﻫﺪ‪ .‬ﻭ ﻧﻴﺰ ‪ integrator‬ﻭ ‪ delay sampler‬ﺭﺍ ﺍﮔﺮ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺑﺎﺷﻨﺪ ﺩﻭﺑﺎﺭﻩ ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ﻣﻲ‬ ‫ﻛﻨﺪ‪.‬‬ ‫>_‪™ $queuemonitor set-delay-samples <delaySamp‬‬

‫ﺷﺊ _‪ delaysamp‬ﺭﺍ ﺑﻪ ﻣﻨﻈﻮﺭ ﻳﺎﺩﺍﺷﺖ ﻛﺮﺩﻥ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺩﺭﺑﺎﺭﻩ ﺗﺎﺧﻴﺮ ﺻﻒ ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ﻣﻲﻛﻨﺪ‪ .‬ﻗﺒﻼ‬ ‫ﺑﺎﻳﺪ _‪ delaySamp‬ﺍﻳﺠﺎﺩ ﺷﻮﺩ‪.‬‬ ‫‪™ $queuemonitor get-bytes-integrator‬‬

‫ﺷﺊ ‪ Integrator‬ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﻛﻪ ﺍﻳﻦ ﺷﺊ ﻣﻲﺗﻮﺍﻧﺪ ﺑﺮﺍﻱ ﻣﺤﺎﺳﺒﻪ ﺍﻧﺘﮕﺮﺍﻝ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺎﻳﺖ ﺍﺳﺘﻔﺎﺩﻩ‬ ‫ﺷﻮﺩ‪.‬‬ ‫‪™ $queuemonitor get-pkts-integrator‬‬

‫ﺷﺊ ‪ Integrator‬ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﻛﻪ ﺍﻳﻦ ﺷﺊ ﻣﻲﺗﻮﺍﻧﺪ ﺑﺮﺍﻱ ﻣﺤﺎﺳﺒﻪ ﺍﻧﺘﮕﺮﺍﻝ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﺑﻪ ﺑﺴﺘﻪ ﺍﺳﺘﻔﺎﺩﻩ‬ ‫ﺷﻮﺩ‪.‬‬ ‫‪™ $queuemonitor get-delay-samples‬‬

‫ﺷﺊ _‪ delaySamp‬ﺭﺍ ﺑﻪ ﻣﻨﻈﻮﺭ ﻳﺎﺩﺩﺍﺷﺖ ﻛﺮﺩﻥ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‬ ‫‪ ٣‐٤‐٣‐٣‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﺷﺊ ‪Flow Monitor‬‬ ‫>‪$fmon classifier
‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﻳﻚ ‪ classiffier‬ﺑﻪ ﺷﺊ ‪ FlowMonitor‬ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ ﻛﻪ ﺑﺮﺍﻱ ﻧﮕﺎﺷﺖ ﺑﺴﺘﻪﻫﺎ ﺑﻪ‬ ‫ﻓﻠﻮﻫﺎ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫‪$fmon dump‬‬

‫ﺷﻤﺎﺭﻧﺪﻩﻫﺎ ﻭ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺭﺍ ﺩﺭ ﺧﺮﻭﺟﻲ ﻣﻲﻧﻮﻳﺴﺪ‪.‬‬ ‫‪$fmon flows‬‬

‫ﻳﻚ ﺭﺷﺘﻪ ﺣﺮﻓﻲ ﻛﻪ ﺷﺎﻣﻞ ﺍﺳﻢ ﺍﺷﻴﺎﺀ ﺟﺮﺍﻧﻬﺎﻳﻲ ﻛﻪ ﺗﻮﺳﻂ ﺍﻳﻦ ‪ Flow Monitor‬ﺷﻨﺎﺧﺘﻪ ﻣﻲﺷﻮﻧﺪ ﺭﺍ‬ ‫ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‪ .‬ﻫﻤﻪ ﺍﻳﻦ ﺍﺷﻴﺎﺀ ﺍﺯ ﻧﻮﻉ ‪ QueueMonitor/ED/Flow‬ﻫﺴﺘﻨﺪ‪.‬‬ ‫>‪$fmon attach
‫ﻳﻚ ﻛﺎﻧﺎﻝ ﺧﺮﻭﺟﻲ ﺭﺍ ﺑﻪ ‪ Flow Monitor‬ﭘﻴﻮﺳﺖ ﻣﻲﻛﻨﺪ‪ .‬ﭘﺲ ﺍﺯ ﻓﺮﻣﺎﻥ ‪ dump‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺍﻳﻦ ﺷﺊ‬ ‫ﺩﺍﺧﻞ ﺍﻳﻦ ﺧﺮﻭﺟﻲ ﻧﻮﺷﺘﻪ ﺧﻮﺍﻫﺪ ﺷﺪ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺧﺮﻭﺟﻲ ﻣﻲﺗﻮﺍﻧﺪ ﻳﻚ ﻓﺎﻳﻞ ﺑﺎﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤-٣‬‬

‫‪٤١‐٣‬‬

‫‪Loss Monitor‬‬

‫‪ Loss Moniter‬ﺍﺯ ﻛﻼﺱ ‪ agent‬ﻣﺸﺘﻖ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﺗﺮﺍﻓﻴﻚ ‪ sink‬ﺭﺍ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﻣﻲﻛﻨﺪ ﻭ ﻋﻼﻭﻩ ﺑﺮ‬ ‫ﺁﻥ ﻣﻲﺗﻮﺍﻧﺪ ﮔﻢ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﭼﻚ ﻛﻨﺪ ﻭ ﻫﻤﭽﻨﻴﻦ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺩﺍﺩﻩﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺭﺍ‬ ‫ﻧﮕﻬﺪﺍﺭﻱ ﻣﻲﻛﻨﺪ ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪ :‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﻳﺎ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‪ ،‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﮔﻢ ﺷﺪﻩ‪،‬‬ ‫ﻣﺘﻐﻴﺮﻫﺎﻱ ﺍﻳﻦ ﺷﺊ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫_‪ :nlost‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﮔﻢ ﺷﺪﻩ‬ ‫_‪ :nPkts‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‬ ‫_‪ :bytes‬ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‬ ‫_‪ : lastPktTime‬ﺯﻣﺎﻥ ﺁﺧﺮﻳﻦ ﺑﺴﺘﻪ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‬ ‫‪ Seqno :Expected‬ﻣﻮﺭﺩ ﺍﻧﺘﻈﺎﺭ ﺑﺴﺘﻪ ﺑﻌﺪﻱ‬ ‫ﺍﺯ ﺍﻳﻦ ‪ agent‬ﻧﻴﺰ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﻣﻨﻈﻮﺭ ﺟﻤﻊﺁﻭﺭﻱ ﺩﺍﺩﻩ ﺩﺭ ﺷﺒﻴﻪﺳﺎﺯ ‪ ns‬ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪.‬‬

‫‪٥-٣‬‬

‫ﻣﺜﺎﻟﻬﺎﻳﻲ ﺑﺮاي اﺳﺘﻔﺎدﻩ از ‪ Trace‬و ‪ Monitoring‬در ‪NS-2‬‬

‫ﻓﺮﺽ ﻛﻨﻴﺪ ﺗﻮﭘﻮﻟﻮﮊﻱ ﺯﻳﺮ ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺍﺳﺖ‪ ،‬ﻭ ﺗﺮﺍﻓﻴﻜﻲ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ TCP‬ﺍﺯ ﮔﺮﻩ ‪ n0‬ﺑﻪ ﮔﺮﻩ ‪ n3‬ﻭ‬ ‫ﻧﻴﺰ ﺗﺮﺍﻓﻴﻚ ﺩﻳﮕﺮﻱ ﺍﺯ ﮔﺮﻩ ‪ n1‬ﺑﻪ ﮔﺮﻩ ‪ n3‬ﺩﺭ ﺣﺎﻝ ﺍﺭﺳﺎﻝ ﻣﻲﺑﺎﺷﺪ‪ .‬ﻣﻲﺧﻮﺍﻫﻴﻢ ﺗﺮﺍﻓﻴﻚ ﺑﻴﻦ ﺩﻭ ﮔﺮﻩ ‪ n2‬ﻭ ‪n3‬‬

‫ﺭﺍ ‪ trace‬ﻛﻨﻴﻢ‪.‬‬ ‫‪n1‬‬ ‫‪n3‬‬

‫‪n2‬‬

‫‪n0‬‬

‫‪trace ١‐٥‐٣‬‬ ‫‪ trace-all ۱‐۱‐۵‐۳‬ﻭ ‪numtrace-all‬‬ ‫‪ #‬ﺩﺭ ﺩﺳﺘﻮﺭﺍﺕ ﺯﻳﺮ ﺩﻭ ﻓﺎﻳﻞ ﺑﻪ ﻣﻨﻈﻮﺭ ﻧﻮﺷﺘﻦ ﺩﺭ ﺁﻥ )ﺑﺮﺍﻱ ﺍﻳﻨﻜﺎﺭ ﺑﺎ ﺧﺼﻮﺻﻴﺖ ‪ w‬ﻓﺎﻳﻞ ﺑﺎﺯ ﻣﻲﺷﻮﺩ( ﺑﺎﺯ‬ ‫ﻣﻲﺷﻮﻧﺪ ﻭ ﺍﺷﺎﺭﻩﮔﺮﻱ ﺑﻪ ﺁﻧﻬﺎ ﻧﺴﺒﺖ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٢‐٣‬‬ ‫]‪set tf [open out.tr w‬‬ ‫]‪set nf [open out.nam w‬‬

‫‪ #‬ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ‪ trace‬ﺭﺍﻩﻧﺪﺍﺯﻱ ﻣﻲﺷﻮﺩ ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﻛﻪ ﺷﺎﻣﻞ ﺗﻤﺎﻡ ﺭﻭﻳﺪﺍﺩﻫﺎ ﺩﺭ ﻫﻤﻪ ﻟﻴﻨﻜﻬﺎ ﺍﺳﺖ ﺩﺭ‬ ‫ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺑﻪ ﻓﺮﻣﺖ ﮔﻔﺘﻪ ﺷﺪﻩ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$ns trace-all $tf‬‬

‫‪ #‬ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ‪ namtrace‬ﺭﻩﺍﻧﺪﺍﺯﻱ ﻣﻲﺷﻮﺩ ﻭ ﺧﺮﻭﺟﻲ ﺁﻥ ﺩﺭ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$ns namtrace-all $nf‬‬

‫‪#‬ﺩﺭ ﺍﻳﻦ ﺭﻭﺍﻝ ﺍﺑﺘﺪﺍ ﺑﻮﺳﻴﻠﻪ ﻓﺮﻣﺎﻥ ‪ flush-trace‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ‪trace‬ﻫﺎ ﺩﺍﺧﻞ ﻓﺎﻳﻠﻬﺎ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ ﻭ‬ ‫ﺳﭙﺲ ﻓﺎﻳﻠﻬﺎ ﺑﺴﺘﻪ ﻣﻲﺷﻮﻧﺪ‪ .‬ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﺑﺮﻧﺎﻣﻪ ‪ nam‬ﺑﺎ ﻭﺭﻭﺩﻱ ﻓﺎﻳﻞ ‪ out.nam‬ﺍﺟﺮﺍ ﻣﻲﺷﻮﺩ‪.‬‬ ‫{ }{ ‪proc finish‬‬ ‫‪global ns nf tf‬‬ ‫‪$ns flush-trace‬‬ ‫‪close $nf‬‬ ‫‪close $tf‬‬ ‫&‪exec nam out.nam‬‬ ‫‪exit 0‬‬ ‫}‬

‫‪٢‐١‐٥‐٣‬‬

‫‪Trace-queue‬‬

‫‪ Trace-all‬ﺗﻤﺎﻡ ﺭﻭﻳﺪﺍﺩﻫﺎ ﺩﺭ ﻫﻤﻪ ﻟﻴﻨﻜﻬﺎ ﺭﺍ ﻣﺎﻧﻴﺘﻮﺭ ﻣﻲﻛﻨﺪ ﺍﮔﺮ ﺑﺨﻮﺍﻫﻴﻢ ﺗﻨﻬﺎ ﺭﻭﻳﺪﺍﺩﻫﺎﻱ ﻳﻚ‬ ‫ﻟﻴﻨﻚ ﻣﺜﻼ ﻟﻴﻨﻚ ﺑﻴﻦ دو ﮔﺮﻩ ‪ n1‬ﻭ ‪ n2‬ﺭﺍ ﻣﺎﻧﻴﺘﻮﺭ ﻛﻨﻴﻢ ﻣﻲ ﺗﻮﺍﻥ ﺑﺠﺎﻱ ﺩﺳﺘﻮﺭ ‪ trace-all‬ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﻢ‬ ‫‪$ns trace-queue n2 n3 $tf‬‬

‫‪Monitoring ٢‐٥‐٣‬‬ ‫ﺍﮔﺮ ﻧﺨﻮﺍﻫﻴﻢ ﻫﻤﻪ ﺍﺗﻔﺎﻗﺎﺕ ﺭﺍ ﻣﺎﻧﻴﺘﻮﺭ ﻛﻨﻴﻢ ﺍﺯ ‪ Monitoring‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻴﻢ‪ .‬ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﻗﺒﻼ ﺍﺷﺎﺭﻩ‬ ‫ﺷﺪﻩ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ Monitoring‬ﻣﻲﺗﻮﺍﻥ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺑﺴﺘﻪﻫﺎ) ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎ ﮔﻢ ﺷﺪﻩ‪ ،‬ﺗﻌﺪﺍﺩ‬ ‫ﺑﺴﺘﻪﻫﺎﻱ ﺧﺎﺭﺝ ﺷﺪﻩ ﺍﺯ ﺻﻒ ﻭ ‪(..‬ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﺩ ﻛﻪ ﺍﺯ ﺍﻳﻦ ﺍﻃﻼﻋﺎﺕ ﻣﻲﺗﻮﺍﻥ ﺑﺮﺍﻱ ﻣﻨﻈﻮﺭﻫﺎﻱ ﺧﺎﺹ ﺍﺳﺘﻔﺎﺩﻩ‬ ‫ﻧﻤﻮﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫™ ﻧﺮﺥ ﮔﻢ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﻣﻘﻴﺎﺳﻬﺎﻱ ﺯﻣﺎﻧﻲ ﻣﺘﻔﺎﻭﺕ‬ ‫™ ﻧﺮﺥ ﮔﺬﺭﺩﻫﻲ ﺩﺭ ﻣﻘﻴﺎﺳﻬﺎﻱ ﺯﻣﺎﻧﻲ ﻣﺨﺘﻠﻒ‬ ‫™ ﺗﻌﺪﺍﺩ ﻭﺭﻭﺩ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﻣﻘﻴﺎﺳﻬﺎﻱ ﺯﻣﺎﻧﻲ ﻣﺨﺘﻠﻒ‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٤٣‐٣

... ‫™ ﻭ ﻏﻴﺮﻩ‬ Queue Monitoring

١‐٢‐٥‐٣

n3 ‫ ﻭ‬n2 ‫ ﺭﻭﻱ ﻟﻴﻨﻚ ﺑﻴﻦ‬monitoring ‫ﺑﻪ ﻋﻨﻮﺍﻥ ﻧﻤﻮﻧﻪ ﺩﺭ ﻛﺪ ﺯﻳﺮ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻓﻌﺎﻝ ﻧﻤﻮﺩﻥ‬

.‫ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻟﻴﻨﻚ ﻭ ﻧﺮﺥ ﮔﻢ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﭘﺮﻳﻮﺩﻫﺎﻱ ﻣﻨﺎﺳﺐ ﺍﻧﺪﺍﺯﻩ ﮔﺮﻓﺘﻪ ﻣﻲﺷﻮﺩ‬ set aggr_thr_file [open thr_.dat w] set aggr_drops_file [open drops_genC4mt.dat w] set ft “”

.‫ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ ﻭ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﺍﻳﻦ ﺷﻲ ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‬n2-n3 ‫ ﺭﺍ ﺭﻭﻱ ﻟﻴﻨﻚ‬monitor-queeu ‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ‬# set mon_ref [$ns monitor-queue $n2 $n3 $ft] $mon_ref set-delay-samples [new Samples] set link_ref [$ns link $n1 $n2] set throughput_samples_($link_ref) [new Samples] set drops_samples_($link_ref) [new Samples]

$throughput_samples_($link_ref) reset $drops_samples_($link_ref) reset $ns at 0.0 "record" proc record {} { global n1 n2 aggr_thr_file aggr_drops_file global ns t_u_time_ sent_bytes_ throughput_samples_ drops_samples_ global dropped_bytes_ #get an instance of the simulator set ns [Simulator instance] #set time after which this proc should be called again set time 0.1 #byts no go through the queue

‫ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻳﻚ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﻟﻴﻨﻚ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‬# set nbr [$ns link $n1 $n2]

.‫ ﻟﻴﻨﻚ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ‬qMonitor ‫ﺍ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﺷﻲ‬# set qmon [$nbr set qMonitor_]

‫ ﺍﻧﺘﺴﺎﺏ‬transf_byte ‫ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺧﺎﺭﺝ ﺷﺪﻩ ﺍﺯ ﺍﻳﻦ ﻟﻴﻨﻚ ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﻭ ﺑﻪ ﻣﺘﻐﻴﺮ‬# .‫ﻣﻲﻛﻨﺪ‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٤٤‐٣ set transf_bytes [$qmon set bdepartures_]

new_drops ‫ﺩﺳﺘﻮﺭ ﺯﻳﺮﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩ ﺍﺯ ﺍﻳﻦ ﻟﻴﻨﻚ ﺭﺍ ﺑﺮ ﻣﻲﮔﺮﺩﺍﻧﺪ ﻭ ﺑﻪ ﻣﺘﻐﻴﺮ‬#

.‫ﺍﻧﺘﺴﺎﺏ ﻣﻲﻛﻨﺪ‬ set new_drops [$qmon set bdrops_] set simtime [$ns now]

reset ‫ ﻣﻘﺪﺍﺭﻱ ﻧﺪﺍﺭﺩ ﻭ ﻣﺘﻐﻴﺮﻫﺎ‬t_u_time ‫ﺑﺮﺍﻱ ﺍﻭﻟﻴﻦ ﺑﺎﺭ ﻛﻪ ﻭﺍﺭﺩ ﮔﺰﺍﺭﻩ ﺷﺮﻃﻲ ﺯﻳﺮ ﻣﻲﺷﻮﺩ ﻣﺘﻐﻴﺮ‬#

.‫ﻣﻲﺷﻮﻧﺪ‬ if { ![info exists t_u_time_($nbr)]} { set p_simtime 0.0 set used_bw 0.0 set drop_rate 0.0 set sent_bytes_($nbr) $transf_bytes set dropped_bytes_($nbr) $new_drops set t_u_time_($nbr) $simtime } else {

‫ ﻛﻪ ﺯﻣﺎﻥ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﻗﺒﻠﻲ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ؛ ﻣﻘﺪﺍﺭﺩﻫﻲ ﻣﻲﺷﻮﺩ‬p_simtime ‫ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﺘﻐﻴﺮ‬# set p_simtime [set t_u_time_($nbr)]

.‫ ﺫﺧﻴﺮﻩ ﻣﻲﮔﺮﺩﺩ‬t_u_time ‫ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺯﻣﺎﻥ ﺣﺎﺿﺮ ﺩﺭ ﻣﺘﻐﻴﺮ‬# set t_u_time_($nbr) $simtime

.‫ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺑﻴﻦ ﺩﻭ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﻣﺤﺎﺳﺒﻪ ﻱﮔﺮﺩﺩ‬# set used_bw [expr (($transf_bytes-$sent_bytes_($nbr))*8)/($simtime-$p_simtime)] set sent_bytes_($nbr) $transf_bytes

.‫ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻧﺮﺥ ﮔﻢ ﺷﺪﻥ ﺑﺴﺘﻪﻫﺎ ﺑﻴﻦ ﺩﻭ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﻣﺤﺎﺳﺒﻪ ﻣﻲﮔﺮﺩﺩ‬# Set drop_rate [expr (($new_drops-$dropped_bytes_($nbr))*8)/($simtime-$p_simtime)] set dropped_bytes_($nbr) $new_drops set t_u_time_($nbr) $simtime }

.‫ ﺩﺭ ﺁﺭﺍﻳﻪﻫﺎﻱ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺫﺧﻴﺮﻩ ﻣﻲﺷﻮﻧﺪ‬drop_rate ‫ ﻭ‬used_bw ‫ﺩﺭ ﺍﻳﻦ ﺩﻭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ‬# $throughput_samples_($nbr) newpoint $used_bw $drops_samples_($nbr) newpoint $drop_rate

.‫ ﺩﺭ ﻓﺎﻳﻞ ﺫﺧﻴﺮﻩ ﻣﻲﺷﻮﻧﺪ‬drop_rate ‫ و‬used_bw ‫ﺩﺭ ﺩﻭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ‬# puts $aggr_thr_file "$used_bw" puts $aggr_drops_file "$simtime $drop_rate" set now [$ns now]

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٥‐٣‬‬

‫‪ #‬ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺭﻭﺍﻝ ﺑﺎﻻ ﺑﺮﺍﻱ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﺩﺭ ﻓﺎﺻﻠﻪ ﺯﻣﺎﻧﻲ ﺑﻌﺪﻱ ﺩﻭﺑﺎﺭﻩ ﻓﺮﺍﺧﻮﺍﻧﻲ‬ ‫ﻣﻲﺷﻮﺩ‪.‬‬ ‫”‪$ns at [expr $now+$time] "recoord‬‬

‫‪٢‐٢‐٥‐٣‬‬

‫‪Monitor per Flow‬‬

‫ﻣﻲﺗﻮﺍﻥ ﺍﻃﻼﻋﺎﺕ ﺭﺍ ﺑﺮ ﺣﺴﺐ ﻓﻠﻮﻫﺎ ﺑﺪﺳﺖ ﺁﻭﺭﺩ‪ .‬ﻛﺪ ﺯﻳﺮ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻓﻠﻮﻫﺎ ﺭﺍ ﺩﺭ‬ ‫ﻓﺎﻳﻠﻲ ﻣﻲﻧﻮﻳﺴﺪ‬ ‫]‪set flow_stat [open flow_mon.stat w‬‬

‫‪ #‬ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻳﻚ ﺷﺊ ‪ monitor-per-flow‬ﻣﻲﺳﺎﺯﺩ‪.‬‬ ‫]‪set flowmon1 [$ns makeflowmon Fid‬‬

‫‪ #‬ﺩﺳﺘﻮﺭ ﺯﻳﺮ ‪ flowmon1‬ﺭﺍ ﺑﻪ ﻟﻴﻨﻚ ﺑﻴﻦ‪ n2-n3‬ﭘﻴﻮﺳﺖ ﻣﻲﻛﻨﺪ‪.‬ﺑﻪ ﺍﻳﻦ ﺗﺮﺗﻴﺐ ‪ flowmon1‬ﺩﺍﺩﻩﻫﺎﻱ ﺍﻳﻦ‬ ‫ﻟﻴﻨﻚ ﺭﺍ ﺑﺮ ﺣﺴﺐ ﻧﻮﻉ ﻓﻠﻮ ﺟﻤﻊﺁﻭﺭﻱ ﻣﻲﻛﻨﺪ‪.‬‬ ‫]‪$ns attach-fmon [$ns link $n2 $n3] $flowmon1 0‬‬

‫‪ #‬ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺷﺊ ‪ flowmon1‬ﺭﺍﺑﻪ ﻓﺎﻳﻞ ﻣﺘﺼﻞ ﻣﻲﻛﻨﺪ ﺑﻪ ﺍﻳﻦ ﺻﻮﺭﺕ ﺧﺮﻭﺟﻲ ﺍﻳﻦ ﺷﺊ ﺑﻪ ﻓﺮﻣﺘﻲ ﻛﻪ ﻗﺒﻼ‬ ‫ﮔﻔﺘﻪ ﺷﺪ ﺩﺭ ﺍﻳﻦ ﻓﺎﻳﻞ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$flowmon_10 attach $flow_stat‬‬

‫‪#‬ﺑﺎ ﺍﺟﺮﺍﻱ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺩﺭ ﺯﻣﺎﻥ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺧﺮﻭﺟﻲ ﺷﺊ ‪ flowmon1‬ﺑﻪ ﺩﺍﺧﻞ ﻓﺎﻳﻞ ﻧﻮﺷﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﺍﮔﺮ‬ ‫ﺑﺨﻮﺍﻫﻴﻢ ﺩﺭ ﭘﺮﻳﻮﺩﻫﺎﻱ ﺯﻣﺎﻧﻲ ﺧﺎﺹ ﺍﺯ ‪ flowmon1‬ﺍﻃﻼﻋﺎﺕ ﺑﮕﻴﺮﻳﻢ ﻣﻲﺗﻮﺍﻧﻴﻢ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺭﺍ ﺩﺭ ﭘﺮﻳﻮﺩﻫﺎﻱ‬ ‫ﺯﻣﺎﻧﻲ ﻣﻮﺭﺩ ﻧﻈﺮ ﺗﻜﺮﺍﺭ ﻛﻨﻴﻢ‪.‬‬ ‫”‪$ns at $finish-time "$flowmon_10 dump‬‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ Flow Monitoring‬ﺑﺮﺍﻱ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻓﻠﻮ‪:‬‬ ‫ﻫﻤﭽﻨﻴﻦ ﻣﻲﺗﻮﺍﻥ ﺍﺯ ﻣﻘﺎﺩﻳﺮ ﻣﺘﻐﻴﺮﻫﺎﻱ ‪ Flow Monitor‬ﺑﻪ ﻃﻮﺭ ﻣﺴﺘﻘﻴﻢ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ‬ ‫ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﻓﻠﻮ ﺗﻌﻴﻴﻦ ﺷﻮﺩ ﻭ ﺳﭙﺲ ﺍﺯ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ‪:‬‬ ‫ﺩﺭ ﺍﻳﻦ ﺣﻠﻘﻪ ﺑﻪ ﺍﺯﺍﻱ ﻫﺮ ﻓﻠﻮ ﻣﺘﻐﻴﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺁﻥ ﺫﺧﻴﺮﻩ ﻣﻲﺷﻮﻧﺪ ﻭ ﻣﻲﺗﻮﺍﻥ ﺍﺯ ﺁﻧﻬﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪.‬‬ ‫{ ]‪foreach f [$fmon flows‬‬ ‫]_‪set flow_arrs [$f set barrivals‬‬ ‫]_‪set flow_deps [$f set bdepartures‬‬ ‫]_‪set flow_drops [$f set bdrops‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٦‐٣‬‬ ‫}‬

‫ﻫﻤﭽﻨﻴﻴﻦ ﻣﻲﺗﻮﺍﻥ ﻓﻠﻮ ﻣﻮﺭﺩ ﻧﻈﺮ ﺭﺍ ﺗﻮﺳﻂ ‪ classifier‬ﺟﺴﺘﺠﻮ ﻧﻤﻮﺩ ﻭ ﺳﭙﺲ ﺍﺯ ﺍﻃﻼﻋﺎﺕ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‬ ‫ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫]‪set fclassifier [$fmon classifier‬‬ ‫]‪set flow1 [$fclassifier lookup auto 0 0 1‬‬ ‫]_‪set flow_arrs [$flow1 set barrivals‬‬

‫‪Loss Monitor ٣‐٥‐٣‬‬ ‫ﺍﮔﺮ ‪ agent‬ﮔﻴﺮﻧﺪﻩ ﺍﺯ ﻧﻮﻉ ‪ LossMonitor‬ﺗﻌﺮﻳﻒ ﺷﻮﺩ ﻣﻲﺗﻮﺍﻥ ﺍﺯ ﺍﻃﻼﻋﺎﺕ ﺁﻣﺎﺭﻱ ﻛﻪ ﺍﻳﻦ ﺷﺊ‬ ‫ﺟﻤﻊﺁﻭﺭﻱ ﻣﻲﻛﻨﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﻓﺮﺽ ﻛﻨﻴﺪ ﮔﻴﺮﻧﺪﻩﺍﻱ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﻣﻲﺷﻮﺩ‪:‬‬ ‫]‪$ns set sink0 [new agent/LossMonitor‬‬

‫ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﺭﻭﺍﻝ ﺯﻳﺮ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺗﻮﺳﻂ ﮔﻴﺮﻧﺪﻩ ﺭﺍ ﺩﺭ ﺩﻭﺭﻩ ﺗﻨﺎﻭﺏ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺍﻧﺪﺍﺯﻩ‬ ‫ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫{ }{ ‪proc record‬‬ ‫‪global sink0 f1‬‬ ‫‪#Get an instance of the simulator‬‬ ‫]‪set ns [Simulator instance‬‬ ‫‪#Set the time after which the procedure should be called again‬‬ ‫‪set time 0.5‬‬

‫‪#‬ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﺘﻐﻴﺮ ‪ bw0‬ﻣﻘﺪﺍﺭﻱ ﺑﺮﺍﺑﺮ ﺑﺎ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺗﻮﺳﻂ ﮔﻴﺮﻧﺪﻩ ‪ sink0‬ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫]_‪set bw0 [$sink0 set bytes‬‬ ‫‪#Get the current time‬‬ ‫]‪set now [$ns now‬‬

‫‪ #‬ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﺑﻪ ﺻﻮﺭﺕ ‪ Mbs‬ﻣﺤﺎﺳﺒﻪ ﻣﻲﻛﻨﺪ ﻭ ﺩﺭ ﻓﺎﻳﻞ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻣﻲﻧﻮﻳﺴﺪ‪.‬‬ ‫"]‪puts $f0 "$now [expr $bw0/$time*8/1000000‬‬

‫‪ #‬ﺩﺭ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﺘﻐﻴﺮ _‪ byte‬ﻛﻪ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺘﻲ ﮔﻴﺮﻧﺪﻩ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ ﺭﺍ ﺻﻔﺮ ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ‪ .‬ﺗﺎ‬ ‫ﺩﺭ ﺯﻣﺎﻥ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﺑﻌﺪﻱ ﺍﻳﻦ ﻣﺘﻐﻴﺮ ﺗﻌﺪﺍﺩ ﺑﺎﻳﺘﻬﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ ﺍﺯ ﺯﻣﺎﻥ ﻓﻌﻠﻲ ﺗﺎ ﺯﻣﺎﻥ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﺑﻌﺪﻱ‬ ‫ﺭﺍ ﻧﺸﺎﻥ ﺩﻫﺪ‪.‬‬ ‫‪$sink0 set bytes_ 0‬‬ ‫‪#Re-schedule the procedure‬‬

‫‪#‬ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﺑﻌﺪ ﺍﺯ ﻣﺪﺕ ﺯﻣﺎﻥ “‪ ”time‬ﺩﻭﺑﺎﺭﻩ ﺍﻳﻦ ﺭﻭﺍﻝ ﺑﺮﺍﻱ ﻧﻤﻮﻧﻪﮔﻴﺮﻱ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ‪.‬‬ ‫"‪$ns at [expr $now+$time] "record‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٧‐٣‬‬ ‫}‬

‫ﻣﺘﻐﻴﺮﻫﺎﻱ‬

‫ﺩﻳﮕﺮ‬

‫‪LossMonitor‬‬

‫ﺭﺍ‬

‫ﻧﻴﺰ‬

‫ﺑﻪ‬

‫ﻫﻤﻴﻦ‬

‫ﺗﺮﺗﻴﺐ‬

‫ﻣﻲﺗﻮﺍﻥ‬

‫ﺍﺳﺘﻔﺎﺩﻩ‬

‫ﻧﻤﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪.۴‬‬

‫‪٤٨‐٤‬‬

‫ﺷﺒﻴﻪﺳﺎز ‪MPLS Network Simulator-V2.0‬‬ ‫ﻫﺪﻑ ﺍﺯ ﺍﻳﻦ ﻓﺼﻞ ﺗﺸﺮﻳﺢ ﻧﺤﻮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺷﺒﻴﻪﺳﺎﺯ ‪ MPLS‬ﺩﺭ ‪ NS-2‬ﺍﺳﺖ‪ .‬ﻣﺎﺟﻮﻝ ‪ MNS-V2‬ﺍﻛﺜﺮ‬

‫ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﭘﺮﻭﺗﻜﻞ ‪ MPLS‬ﺭﺍ ﺩﺍﺭﺍﺳﺖ ﻭ ﺑﻪ ﻭﺳﻴﻠﻪ ﺁﻥ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﺭﺍﺣﺘﻲ ﺷﺒﻜﻪ ‪ MPLS‬ﺭﺍ ﺩﺭ ﻣﺤﻴﻂ ‪NS-2‬‬

‫ﺷﺒﻴﻪﺳﺎﺯﻱ ﻧﻤﻮﺩ‪ .‬ﺩﺭ ﺣﺎﻝ ﺣﺎﺿﺮ ﺩﺭ ﻣﺪﻝ ‪ MNS-V1 ns-2.1b9a‬ﻧﺼﺐ ﺍﺳﺖ ﻭ ‪ MNS-V2‬ﻛﻪ ﻧﺴﺨﻪ‬ ‫ﺟﺪﻳﺪﺗﺮ ﺷﺒﻴﻪﺳﺎﺯ ‪MPLS‬ﺍﺳﺖ ﺩﺭ ﺁﺧﺮﻳﻦ ﻧﺴﺨﻪ ‪ ns‬ﻳﻌﻨﻲ ‪ ns-2.1b9a‬ﻧﺼﺐ ﻧﻴﺴﺖ ﻭ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺁﻥ‬ ‫ﺑﺎﻳﺪ ﺁﻥ ﺭﺍ ﻧﺼﺐ ﻧﻤﻮﺩ‪.‬‬ ‫ﺩﺭ ﺍﻳﻦ ﺭﺍﻫﻨﻤﺎ ﺍﺑﺘﺪﺍ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪ MNS-V2‬ﺭﺍ ﺑﻪ ﻃﻮﺭ ﺧﻼﺻﻪ ﻣﺮﻭﺭ ﻣﻲﻛﻨﻴﻢ ﻭ ﺳﭙﺲ ﻣﻌﻤﺎﺭﻱ ﺁﻥ ﺭﺍ‬ ‫ﺗﺸﺮﻳﺢ ﻣﻲﻛﻨﻴﻢ ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﺭﻭﺵ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺍﻳﻦ ﺷﺒﻴﻪﺳﺎﺯ ﺭﺍ ﺑﺎ ﻣﺜﺎﻟﻬﺎﻳﻲ ﺗﻮﺿﻴﺢ ﻣﻲﺩﻫﻴﻢ‪.‬‬

‫‪١-٤‬‬

‫ﻗﺎﺑﻠﻴﺘﻬﺎي ‪MPLS Network Simulator-V2‬‬

‫‪ MNS-v2 ١‐١‐٤‬ﺍﻋﻤﺎﻝ ﺗﻮﺯﻳﻊ ﺑﺮﭼﺴﺐ ﻛﻪ ﺷﺎﻣﻞ ﺍﺟﺰﺍﺀ ﺯﻳﺮ ﺍﺳﺖ ﺭﺍ‬ ‫ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪:‬‬ ‫ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ‪ MPLS :‬ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻗﺎﺑﻠﻴﺖ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﻫﺪﺍﻳﺖ ﺑﺴﺘﻪﻫﺎ ﺭﺍ‬ ‫ﺗﺴﺮﻳﻊ ﻣﻲﺑﺨﺸﺪ‪ .‬ﺍﻳﻦ ﻗﺎﺑﻠﻴﺖ ﻛﻪ ﺍﺯ ﺑﺎﺭﺯﺗﺮﻳﻦ ﻭﻳﮋﮔﻲﻫﺎﻱ ‪ MPLS‬ﺍﺳﺖ ﻭ ﺷﺎﻣﻞ ﺍﻋﻤﺎﻟﻲ ﻧﻈﻴﺮ‬ ‫ﺗﺨﺼﻴﺺ ﺑﺮﭼﺴﺐ ﺑﻪ ﺑﺴﺘﻪﻫﺎ‪ ،‬ﺑﺮﺩﺍﺷﺘﻦ ﺑﺮﭼﺴﺐﻫﺎ‪ ،‬ﺗﻌﻮﻳﺾ ﺑﺮﭼﺴﺐﻫﺎ ﻣﻲﺑﺎﺷﺪ‪ ،‬ﺩﺭ ﺷﺒﻴﻪﺳﺎﺯ‬ ‫‪ MPLS‬ﻧﻴﺰ ﻣﻮﺟﻮﺩ ﺍﺳﺖ‪.‬‬ ‫‪ MPLS :LDP .١‬ﺗﻮﺳﻂ ﭘﺮﻭﺗﻜﻞ ‪ LDP‬ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪ .‬ﺍﻳﻦ‬ ‫ﭘﺮﻭﺗﻜﻞ ﺑﺎ ﺍﺭﺳﺎﻝ ﭘﻴﻐﺎﻣﻬﺎﻱ ‪ Mapping ،Withdraw ،Release‬ﻭ ‪ Request‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺍﻧﺘﺴﺎﺏ ﺑﺮﭼﺴﺐﻫﺎ ﺭﺍ ﺑﻴﻦ ‪LSR‬ﻫﺎ ﺭﺩ ﻭ ﺑﺪﻝ ﻣﻲﻛﻨﺪ‪ MNS-V2 .‬ﺍﺯ ﺍﻳﻦ ﭘﺮﻭﺗﻜﻞ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‬ ‫ﻭ ﻗﺎﺑﻠﻴﺖ ﭘﺮﺩﺍﺯﺵ ﭘﻴﻐﺎﻣﻬﺎﻱ ﺁﻥ ﺭﺍ ﺩﺍﺭﺍﺳﺖ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٤٩‐٤‬‬

‫‪ MPLS :CR-LDP .٢‬ﺗﻮﺳﻂ ﭘﺮﻭﺗﻜﻞ ‪ CR-LDP‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ﻭ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺒﺘﻨﻲ ﺑﺮ‬ ‫ﻣﺤﺪﻭﺩﻳﺖ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪ .‬ﺍﻳﻦ ﭘﺮﻭﺗﻜﻞ ﻫﻤﻪ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪ LDP‬ﺭﺍ ﺩﺍﺭﺍﺳﺖ ﻭ ﻋﻼﻭﻩ ﺑﺮ ﺁﻥ ﻗﺎﺑﻠﻴﺖ‬ ‫ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ ﺭﺍ ﻧﻴﺰ ﺩﺍﺭﺍﺳﺖ‪ MNS-2 .‬ﺍﺯ ﺍﻳﻦ ﭘﺮﻭﺗﻜﻞ ﻧﻴﺰ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪ MNS-V2 ٢‐١‐٤‬ﺍﺯ ﺭﻭﺷﻬﺎﻱ ﺯﻳﺮ ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ‪ LSP‬ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪:‬‬ ‫‪ .١‬ﺭﻭﺷﻬﺎﻱ ‪ Control-Driven‬ﻭ ‪ Dtat-Driven‬ﺑﺮﺍﻱ ﺍﻳﺠﺎﺩ ‪.LSP‬‬ ‫‪ .٢‬ﺷﻤﺎﻱ ﺗﻮﺯﻳﻊ ﺍﻃﻼﻋﺎﺕ ﺑﻪ ﺭﻭﺵ ‪ UpStream‬ﺑﺮﺍﻱ ‪ Control-Driven‬ﻭ ﻫﺮ ﺩﻭ ﺷﻤﺎﻱ‬ ‫‪UpStrea‬ﻭ ‪ DownStream‬ﺑﺮﺍﻱ ‪Control-Driven‬‬

‫‪ .٣‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ﺑﺮ ﺍﺳﺎﺱ ﻣﺴﻴﺮ ﺍﺯ ﻗﺒﻞ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺗﻮﺳﻂ ﻛﺎﺭﺑﺮ‪ .‬ﺍﻳﻦ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺗﻮﺳﻂ‬ ‫ﭘﺮﻭﺗﻜﻞ ‪ CR-LDP‬ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ .٤‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺒﺘﻨﻲ ﺑﺮ ﻣﺤﺪﻭﺩﻳﺖ‪ .‬ﺍﻳﻦ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻳﻲ ﻧﻈﻴﺮ ﻣﻴﺰﺍﻥ ﭘﻬﻨﺎﻱ‬ ‫ﺑﺎﻧﺪ‪ ،‬ﺍﻧﺪﺍﺯﻩ ﺑﺎﻓﺮ ﻭ ‪..‬ﻛﻪ ﻗﺒﻼ ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ‪ ،‬ﺗﻮﺳﻂ ﭘﺮﻭﺗﻜﻞ ‪ CR-LDP‬ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ .٥‬ﺍﻭﻟﻮﻳﺖ ﺩﺍﺩﻥ ﺑﻪ ﻛﻼﺳﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺩﺭ ﮔﺮﻓﺘﻦ ﻣﻨﺎﺑﻊ ‪ MNS :‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻭﻳﮋﮔﻲ ﺍﻭﻟﻮﻳﺖ‬ ‫ﺍﻳﺠﺎﺩ‪ ١‬ﻣﺴﻴﺮ ﻭ ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ‪ 2‬ﻫﺮ ﻣﺴﻴﺮ ﻣﺒﺘﻨﻲ ﺑﺮ ﻣﺤﺪﻭﺩﻳﺖ‪ ،‬ﺍﻳﻦ ﺍﻣﻜﺎﻥ ﺭﺍ ﺩﺍﺭﺩ ﻛﻪ ﻣﻨﺎﺑﻌﻲ ﺭﺍ ﺍﺯ‬ ‫ﻳﻚ ﻣﺴﻴﺮ ﻣﻮﺟﻮﺩ ﺑﮕﻴﺮﺩ ﻭ ﺑﻪ ﻣﺴﻴﺮ ﺩﻳﮕﺮﻱ ﺩﻫﺪ‪.‬‬ ‫‪ .٦‬ﺟﻤﻊ ﻛﺮﺩﻥ ﺟﺮﻳﺎﻧﻬﺎﻱ‪ 3‬ﺗﺮﺍﻓﻴﻚ ﺑﻪ ﻳﻚ ﺟﺮﻳﺎﻥ ﺑﺰﺭﮔﺘﺮ‬

‫‪ ۳‐۱‐۴‬ﻗﺎﺑﻠﻴﺖ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ‬ ‫‪ Mns‬ﺍﻧﻮﺍﻉ ﻣﺨﺘﻠﻒ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ )ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ‪Hashkin ،Shortest-dynamic ،Simple-Dynamic‬‬

‫ﻭ ‪ ( Makam‬ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪1‬‬

‫‪Setup Priority‬‬ ‫‪Holding Priority‬‬ ‫‪3‬‬ ‫‪Flow‬‬ ‫‪2‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢-٤‬‬

‫‪٥٠‐٤‬‬

‫ﻣﻌﻤﺎري ‪Mpls Network Simulator‬‬

‫‪ NS-2‬ﺑﺮﺍﻱ ﺷﺒﻴﻪﺳﺎﺯﻱ ﺍﺟﺰﺍﺋﻲ ﻧﻈﻴﺮ ﺭﻭﺗﺮﻫﺎ ﻭ ﺳﺮﻭﺭﻫﺎ ﻭ ‪ ..‬ﺍﺯ ﻣﻔﻬﻮﻣﻲ ﺑﻪ ﻧﺎﻡ ﮔﺮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ ﺍﺯ‬ ‫ﺁﻧﺠﺎﻳﻲ ﻛﻪ ‪ MPLS‬ﺩﺭ ﺭﻭﺗﺮﻫﺎ ﻓﻌﺎﻝ ﻣﻲﺷﻮﺩ‪ ،‬ﺩﺭ ‪ NS‬ﻧﻴﺰ ‪ MPLS‬ﻣﻲﺗﻮﺍﻧﺪ ﺩﺭ ﮔﺮﻫﻲ ﻓﻌﺎﻝ ﺷﻮﺩ؛ ﺩﺭ ﺍﻳﻦ‬ ‫ﺻﻮﺭﺕ ﺑﻪ ﺁﻥ ﮔﺮﻩ ﻣﺎﺟﻮﻟﻬﺎﻳﻲ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ‪ MPLS‬ﺍﺿﺎﻓﻪ ﻣﻲﺷﻮﺩ‪ .‬ﮔﺮﻩ ‪ NS-2‬ﺷﺎﻣﻞ ‪Agent‬ﻫﺎ ﻭ‬ ‫‪Classifier‬ﻫﺎ ﻣﻲﺑﺎﺷﺪ‪Agent .‬ﻫﺎ ﺑﺮﺍﻱ ﺩﺭﻳﺎﻓﺖ ﻭ ﺍﺭﺳﺎﻝ ﭘﺮﻭﺗﻜﻞﻫﺎ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ ﺑﻪ ﻋﻨﻮﺍﻥ‬ ‫ﻣﺜﺎﻝ ﺍﮔﺮ ﮔﺮﻫﻲ ﺑﺨﻮﺍﻫﺪ ﺑﺎ ﭘﺮﻭﺗﻜﻞ ‪ TCP‬ﺑﺴﺘﻪﻫﺎﻳﻲ ﺭﺍ ﺍﺭﺳﺎﻝ ﻛﻨﺪ ﺑﺎﻳﺪ ‪ Agent‬ﻓﺮﺳﺘﻨﺪﻩ ‪ TCP‬ﺩﺭ ﺁﻥ ﻓﻌﺎﻝ‬ ‫ﺷﻮﺩ‪Classifier .‬ﻫﺎ ﻣﺴﺌﻮﻝ ﺩﺳﺘﻪﺑﻨﺪﻱ ﻛﺮﺩﻥ ﺑﺴﺘﻪﻫﺎ ﻫﺴﺘﻨﺪ‪ .‬ﺍﮔﺮ ‪ MPLS‬ﺩﺭ ﮔﺮﻫﻲ ﻓﻌﺎﻝ ﺷﻮﺩ ﺷﺊ‬ ‫‪) MPLS Classifier‬ﻣﺴﺌﻮﻝ ﻛﻼﺳﻪﺑﻨﺪﻱ ﻛﺮﺩﻥ ﺑﺴﺘﻪﻫﺎﻱ ‪ (MPLS‬ﻭ ‪) LDP Agent‬ﻣﺴﺌﻮﻝ ﺍﺭﺳﺎﻝ ﻭ‬ ‫ﺩﺭﻳﺎﻓﺖ ﭘﻴﻐﺎﻡﻫﺎﻱ ‪ (LDP‬ﺩﺭ ﮔﺮﻩ ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻣﺎﺟﻮﻝ ‪ MNS‬ﺩﺍﺭﺍﻱ ﺳﺎﺧﺘﺎﺭﻫﺎﻳﻲ ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﮔﻔﺘﻪ ﺷﺪﻩ ﻣﻲﺑﺎﺷﺪ ﺩﺭ ﺍﻳﻦ ﺑﺨﺶ ﺍﻳﻦ ﺳﺎﺧﺘﺎﺭﻫﺎ‬ ‫ﺭﺍ ﺷﺮﺡ ﻣﻲﺩﻫﻴﻢ‪.‬‬

‫‪ ١‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ‬ ‫ﮔﺮﻩ ‪ MPLS‬ﺩﺭ ‪ MNS-V2‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺩﺍﺭﺍﻱ ﻣﺪﻝ ﻣﻔﻬﻮﻣﻲ ﺑﻪ ﺻﻮﺭﺗﻲ ﻛﻪ ﺩﺭ ﺷﻜﻞ ‪‐۱‬‬ ‫‪ ۲‬ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻣﻲﺑﺎﺷﺪ ‪ .‬ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﺷﻜﻞ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ‪ MNS‬ﺍﺯﻣﺎﺟﻮﻝﻫﺎﻱ ﺯﻳﺮ ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ‬ ‫ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪:‬‬ ‫‪Resource Manager ،Admission Control ،Service Classifier ،MPLS-Classifier ،CR-LDP‬‬

‫ﻭ ‪ . Packet Scheduler‬ﺩﺭ ﺍﺩﺍﻣﻪ ﻛﺎﺭﻫﺎﻳﻲ ﻛﻪ ﺍﻳﻦ ﻣﺎﺟﻮﻝﻫﺎ‪ ،‬ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﻨﺪ ﺭﺍ ﺷﺮﺡ ﻣﻲﺩﻫﻴﻢ‪:‬‬ ‫•‬

‫‪ :CR-LD‬ﺍﻳﻦ ﻣﺎﺟﻮﻝ ﭘﻴﻐﺎﻡﻫﺎﻱ ‪ LDP‬ﻭ ‪ CR-LDP‬ﺭﺍ ﭘﺮﺩﺍﺯﺵ‬

‫ﻣﻲﻛﻨﺪ‪.‬‬ ‫•‬

‫‪ :MPLS Classifier‬ﺍﻳﻦ ﻣﺎﺟﻮﻝ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ‬

‫)ﺗﺨﺼﻴﺺ ﺑﺮﭼﺴﺐ‪ ،‬ﺑﺮﺩﺍﺷﺘﻦ ﺑﺮﭼﺴﺐ ﻭ ﺗﻌﻮﻳﺾ ﺑﺮﭼﺴﺐ( ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫ﺷﻜﻞ ‪٢‐١‬‬ ‫•‬

‫‪٥١‐٤‬‬

‫ﻣﺪﻝ ﻣﻔﻬﻮﻣﻲ ﮔﺮﻩ ‪ MPLS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ‬

‫‪ :Service Classifier‬ﺳﺮﻭﻳﺴﻲ ﻛﻪ ﺑﺎﻳﺪ ﺑﻪ ﺑﺴﺘﻪ ﺍﻋﻤﺎﻝ ﺷﻮﺩ ﺭﺍ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻓﻴﻠﺪ ‪TOS‬‬

‫ﺑﺴﺘﻪ ﻭ ﺑﺮﭼﺴﺐ ‪ MPLS‬ﻣﺸﺨﺺ ﻣﻴـﻜﻨﺪ؛ ﻭ ﺁﻥ ﺭﺍ ﺑﻪ ﺑﺴﺘﻪ ﺍﻋﻤﺎﻝ ﻣﻲﻛﻨﺪ‪.‬‬ ‫• ‪ :Admission Cotrol‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﭘﺎﺭﺍﻣﺘﺮ ﺗﺮﺍﻓﻴﻚ ‪ CR-LDP‬ﺑﺮﺭﺳﻲ ﻣﻲﻛﻨﺪ ﺁﻳﺎ ﻧﻮﺩ‬ ‫‪ ،MPLS‬ﻣﻨﺎﺑﻊ ﻛﺎﻓﻲ ﺑﺮﺍﻱ ﺳﺮﻭﻳﺲ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺭﺍ ﺩﺍﺭﺩ ﻳﺎ ﺧﻴﺮ‪.‬‬ ‫• ‪ :Resource Manager‬ﺩﺭﺧﻮﺍﺳﺘﻬﺎﻱ ﻣﻨﺎﺑﻊ ﺭﺍ ﻣﺪﻳﺮﻳﺖ ﻣﻲﻛﻨﺪ‪.‬‬ ‫• ‪ :Packet Scheduler‬ﺻﻒ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺳﺮﻭﻳﺲ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺁﻧﻬﺎ ﻣﺪﻳﺮﻳﺖ ﻣﻴـﻜﻨﺪ‪.‬‬ ‫ﻧﺤﻮﻩ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺗﻮﺳﻂ ﺍﻳﻦ ﻣﺎﺟﻮﻟﻬﺎ ﺑﻪ ﺍﻳﻦ ﺻﻮﺭﺕ ﺍﺳﺖ ﻛﻪ ﺍﺑﺘﺪﺍ ﺗﻮﺳﻂ ﭘﻴﻐﺎﻣﻬﺎﻱ ‪CR-LDP‬‬ ‫ﭘﻴﻐﺎﻡ ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ ﺑﻪ ﮔﺮﻩ ﻣﻲﺁﻳﺪ ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﻣﺎﺟﻮﻝ ‪ Admssion Control‬ﻭ ‪Resource Manager‬‬

‫ﺑﺮﺭﺳﻲ ﻣﻲﻛﻨﻨﺪ ﺍﮔﺮ ﻣﻨﺒﻊ ﻛﺎﻓﻲ ﺩﺭ ﺩﺳﺘﺮﺱ ﺍﺳﺖ ﺁﻥ ﺭﺍ ﺭﺯﺭﻭ ﻣﻲﻛﻨﻨﺪ ﻭ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ﻭ ﺳﺮﻭﻳﺲ ﺭﺍ ﺩﺭ‬ ‫ﺟﺪﻭﻟﻲ ﺑﻨﺎﻡ ‪ ERB‬ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﻨﺪ‪ .‬ﺯﻣﺎﻧﻴﻜﻪ ﺑﺴﺘﻪﺍﻱ ﻣﺘﻌﻠﻖ ﺑﻪ ﺁﻥ ﻣﺴﻴﺮ ﺑﻪ ﮔﺮﻩ ﻭﺍﺭﺩ ﺷﺪ ﺗﻮﺳﻂ ‪Service‬‬ ‫‪ Classifier‬ﺗﻌﻴﻴﻦ ﻣﻲﺷﻮﺩ ﻛﻪ ﭼﻪ ﺳﺮﻭﻳﺴﻲ ﺑﺎﻳﺪ ﺑﻪ ﺁﻥ ﺍﺭﺍﺋﻪ ﺷﻮﺩ ﻭ ﺳﭙﺲ ﺑﺴﺘﻪ ﺑﻪ ‪Packet Scheduler‬‬

‫ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﺗﺎ ﺳﺮﻭﻳﺲ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺑﻪ ﺁﻥ ﺍﺭﺍﺋﻪ ﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٥٢‐٤‬‬

‫‪ ٢‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ‬ ‫ﮔﺮﻩ ‪ MPLS‬ﺩﺍﺭﺍﻱ ﻣﻌﻤﺎﺭﻱ ﺷﻜﻞ ‪ ۲‐۱‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﺍﺳﺖ‪ .‬ﺯﻣﺎﻧﻲ ﻛﻪ ﺑﺴﺘﻪﺍﻱ‬ ‫ﺑﻪ ﮔﺮﻩ ‪ MPLS‬ﻭﺍﺭﺩ ﻣﻲﺷﻮﺩ ﻛﺎﺭﻫﺎﻱ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪:‬‬

‫ﺷﻜﻞ ‪٣‐١‬‬

‫ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ‬

‫‪ MPLS Classifier .١‬ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﺁﻳﺎ ﺑﺴﺘﻪ ﺩﺍﺭﺍﻱ ﺑﺮﭼﺴﺐ ‪ MPLS‬ﻫﺴﺖ ﻳﺎ ﺧﻴﺮ‪ .‬ﺍﮔﺮ ﺑﺴﺘﻪ ﺩﺍﺭﺍﻱ‬ ‫ﺑﺮﭼﺴﺐ ﺑﺎﺷﺪ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﺭﺍ ﺭﻭﻱ ﺁﻥ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪ .‬ﻭﮔﺮﻧﻪ ﺑﺮﺭﺳﻲ ﻣﻲﻛﻨﺪ ﺍﮔﺮ ﺑﺴﺘﻪ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫‪ LSP‬ﺧﺎﺻﻲ ﺍﺳﺖ ﺑﺎ ﺁﻥ ﻣﺎﻧﻨﺪ ﺑﺴﺘﻪ ﺑﺮﭼﺴﺐ ﺩﺍﺭ ﺭﻓﺘﺎﺭ ﻣﻲﻛﻨﺪ ﻭ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﺭﺍ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﺸﺨﺼﻪ‬ ‫‪ LSP‬ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ؛ ﻭ ﺩﺭ ﻏﻴﺮ ﺍﻳﻦﺻﻮﺭﺕ ﺑﺴﺘﻪ ﺭﺍ ﺑﻪ ‪ Addr Classifier‬ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪ Addr Classifier .٢‬ﺍﺯ ﭘﺮﻭﺗﻜﻞ ﻻﻳﻪ ‪ ۳‬ﺑﺮﺍﻱ ﻫﺪﺍﻳﺖ ﺑﺴﺘﻪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪ .٣‬ﺍﮔﺮ ﻣﻘﺼﺪ ﺑﺴﺘﻪ ﻫﻤﻴﻦ ﮔﺮﻩ ﺑﺎﺷﺪ ﺑﺴﺘﻪ ﺑﻪ ‪ Port Classifier‬ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﺗﺎ ﺑﺮ ﺣﺴﺐ ﭘﺮﻭﺗﻜﻞ ﻻﻳﻪ‬ ‫‪ ۴‬ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺑﺎ ﺁﻥ ﺭﻓﺘﺎﺭ ﮔﺮﺩﺩ‪.‬‬ ‫‪ MNS‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ ﺍﺯ ﺩﻭ ﺟﺪﻭﻝ ‪ LIB١‬ﻭ ‪ PFT2‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻳﻦ ﺟﺪﺍﻭﻝ‬ ‫ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ‪:‬‬

‫‪Lable Information Base‬‬ ‫‪Partial Forwarding Table‬‬

‫‪1‬‬ ‫‪2‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫•‬

‫‪٥٣‐٤‬‬

‫‪ :LIB‬ﺍﻳﻦ ﺟﺪﻭﻝ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ‪LSP‬ﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺍﻋﻤﺎﻝ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺴﺘﻪﻫﺎﻱ ﺑﺮﭼﺴﺐﺩﺍﺭ‬

‫ﺗﻮﺳﻂ ﺍﻳﻦ ﺟﺪﻭﻝ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪ .‬ﻓﻴﻠﺪﻫﺎﻱ ﺍﻳﻦ ﺟﺪﻭﻝ ﺷﺎﻣﻞ ﺑﺮﭼﺴﺐ ﻭﺭﻭﺩﻱ‪ ،‬ﭘﻮﺭﺕ ﻭﺭﻭﺩﻱ‪ ،‬ﺑﺮﭼﺴﺐ‬ ‫ﺧﺮﻭﺟﻲ ﻭ ﭘﻮﺭﺕ ﺧﺮﻭﺟﻲ ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫•‬

‫‪ :PFT‬ﺍﻳﻦ ﺟﺪﻭﻝ ﺩﺭ ‪ LSR‬ﻭﺭﻭﺩﻱ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺗﻮﺳﻂ ﺁﻥ ﺑﺴﺘﻪﻫﺎﻱ ‪ IP‬ﺑﻪ ‪LSP‬ﻫﺎ ﻧﮕﺎﺷﺖ‬

‫ﻣﻲﺷﻮﻧﺪ‪ .‬ﻓﻴﻠﺪﻫﺎﻱ ﺍﻳﻦ ﺟﺪﻭﻝ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪ LIBPtr ،FEC :‬ﻭ ‪ .FlowId‬ﺗﻮﺳﻂ ﻓﻴﻠﺪ ‪ FlowId‬ﻭ ‪FEC‬‬

‫ﻣﺸﺨﺺ ﻣﻲﺷﻮﺩ ﺑﺴﺘﻪ ﺑﺎ ﻓﻴﻠﺪ ‪ FlowId‬ﺑﻪ ﭼﻪ ‪ FEC‬ﺑﺎﻳﺪ ﻧﮕﺎﺷﺖ ﺷﻮﺩ ﻭ ﺩﺭ ﻭﺍﻗﻊ ‪ LSP‬ﻛﻪ ﺑﺴﺘﻪ ﺑﻪ ﺁﻥ‬ ‫ﻣﺘﻌﻠﻖ ﺍﺳﺖ ﺗﻌﻴﻴﻦ ﻣﻲﮔﺮﺩﺩ ﻭ ﺗﻮﺳﻂ ﻓﻴﻠﺪ ‪ LIBPtr‬ﺗﻌﻴﻴﻦ ﻣﻲﺷﻮﺩ ﻛﻪ ﻣﺸﺨﺼﺎﺕ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺍﻳﻦ ‪ LSP‬ﺩﺭ‬ ‫ﻛﺪﺍﻡ ﺭﻛﻮﺭﺩ ﺟﺪﻭﻝ ‪ LIB‬ﻣﻮﺟﻮﺩ ﺍﺳﺖ‪.‬‬

‫‪ ٣‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ﺑﻲﺩﺭﻧﮓ‬ ‫‪ MNS‬ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ﺑﻼﺩﺭﻧﮓ ﺍﺯ ﻣﺎﺟﻮﻝ ‪ Service Classifier‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻳﻦ ﻣﺎﺟﻮﻝ‬ ‫ﺳﺮﻭﻳﺲﻫﺎﻳﻲ ﻛﻪ ﺑﺎﻳﺪ ﺑﻪ ﺑﺴﺘﻪ ﺍﻋﻤﺎﻝ ﺷﻮﺩ ﺭﺍ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ ﻭ ﺳﭙﺲ ﺑﺴﺘﻪ ﺑﻪ ﻣﺎﺟﻮﻝ‬

‫‪Packet‬‬

‫‪ Scheduler‬ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﺗﺎ ﺳﺮﻭﻳﺲ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺑﻪ ﺁﻥ ﺍﻋﻤﺎﻝ ﺷﻮﺩ‪ .‬ﻣﻜﺎﻧﻴﺰﻡ ‪ CBQ‬ﻛﻪ ﺩﺭ ‪ NS-2‬ﻭﺟﻮﺩ‬ ‫ﺩﺍﺭﺩ ﺑﺮﺍﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﻭ ﺳﺮﻭﻳﺲ ﺩﺍﺩﻥ ﺑﺴﺘﻪﻫﺎ ﺍﻧﺘﺨﺎﺏ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﺩﺭ ﺩﻧﻴﺎﻱ ﻭﺍﻗﻌﻲ‪ Packet Scheduler‬ﺩﺭ‬ ‫ﺭﻭﺗﺮﻫﺎ ﺍﺟﺮﺍ ﻣﻲﺷﻮﺩ ﻭﻟﻲ ﺩﺭ ‪ MNS‬ﺍﻳﻦ ﻋﻤﻞ ﺭﻭﻱ ﻟﻴﻨﻜﻬﺎ ﭘﻴﺎﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﻣﺎﺟﻮﻝ ‪ Service Classifier‬ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﺳﺮﻭﻳﺲﻫﺎ ﺍﺯ ﺟﺪﻭﻟﻲ ﺑﻨﺎﻡ ‪ ١ERB‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻳﻦ ﺟﺪﻭﻝ‬ ‫ﺷﺎﻣﻞ ﺍﻃﻼﻋﺎﺗﻲ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ﺻﺮﻳﺢ)‪ (LSPId‬ﻭ ﻣﺸﺨﺼﻪ ﺳﺮﻭﻳﺲ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺴﻴﺮ)‪(ServiceId‬‬ ‫ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫‪Explicit Route Information Base‬‬

‫‪1‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫ﺷﻜﻞ ‪۴‐۱‬‬

‫‪٥٤‐٤‬‬

‫ﺭﻭﻧﺪ ﭘﺮﺩﺍﺯﺵ ‪ MNS‬ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ‬

‫ﺷﻜﻞ ‪ ۴‐۱‬ﺭﻭﻧﺪ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ﺩﺭ ‪ MNS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪ .‬ﺯﻣﺎﻧﻴﻜﻪ‬ ‫ﺑﺴﺘﻪﺍﻱ ﺑﻪ ﮔﺮﻩ ‪ MPLS‬ﻭﺍﺭﺩ ﻣﻲﺷﻮﺩ ﺍﺑﺘﺪﺍ ﺑﻪ ﻗﺴﻤﺖ ‪ MPLS Classifier‬ﻣﻲﺭﻭﺩ ﻭ ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﺑﺮﺟﺴﺐ‬ ‫ﺧﺮﻭﺟﻲ ﻭ ﭘﻮﺭﺗﻲ ﻛﻪ ﺍﺯ ﺁﻥ ﺑﺎﻳﺪ ﺧﺎﺭﺝ ﺷﻮﺩ ﻣﺸﺨﺺ ﻣﻲﮔﺮﺩﺩ‪ .‬ﺳﭙﺲ ﻣﺎﺟﻮﻝ‪ Service Classifier‬ﺳﺮﻭﻳﺲ‬ ‫ﺑﺴﺘﻪ ﺭﺍ ﺍﺯ ﻃﺮﻳﻖ ﺟﺪﻭﻝ ‪ ERB‬ﻣﻌﻴﻦ ﻣﻲﻛﻨﺪ‪ .‬ﺳﭙﺲ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ﺑﺴﺘﻪ ﺑﻪ ﻛﺪﺍﻡ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﻣﺘﻌﻠﻖ‬ ‫ﺍﺳﺖ ﺑﻪ ﻳﻚ ﺻﻒ ﻣﻨﺎﺳﺐ ﺩﺭ ﺑﺎﻓﺮ ‪ CBQ‬ﻭﺍﺭﺩ ﻣﻲﺷﻮﺩ‪ .‬ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﺍﺯ ﻃﺮﻳﻖ ‪ CBQ‬ﺑﻪ ﺁﻥ ﺳﺮﻭﻳﺲ‬ ‫ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ٤‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ‬ ‫ﺷﻜﻞ ‪ ۵‐۱‬ﺭﻭﻧﺪ ﺍﻧﺠﺎﻡ ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ ﺭﺍ ﺩﺭ ‪ MNS‬ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪ .‬ﺯﻣﺎﻧﻴﻜﻪ ﻣﺎﺟﻮﻝ ‪ CR-LDP‬ﭘﻴﻐﺎﻡ ﺩﺭﺧﻮﺍﺳﺖ‬ ‫‪ "CR-LDP‬ﺭﺍ ﺩﺭﻳﺎﻓﺖ ﻣﻲﻛﻨﺪ ﻣﺎﺟﻮﻝ ‪ Admission Control‬ﺭﺍ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﻛﻨﺪ‪ .‬ﻣﺎﺟﻮﻝ ﺑﺮﺭﺳﻲ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٥٥‐٤‬‬

‫ﺷﻜﻞ ‪۵‐۱‬‬

‫ﺭﻭﻧﺪ ﺭﺯﺭﻭ ﻣﻨﺎﺑﻊ ﺩﺭ ‪MNS‬‬

‫ﻣﻲﻛﻨﺪ ﻛﻪ ﺁﻳﺎ ﮔﺮﻩ‪ ،‬ﻣﻨﺎﺑﻊ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺭﺍ ﺩﺭ ﺩﺳﺘﺮﺱ ﺩﺍﺭﺩ ﻳﺎ ﺧﻴﺮ‪ .‬ﺍﮔﺮ ﻣﻨﺎﺑﻊ ﻛﺎﻓﻲ ﺩﺭ ﺩﺳﺘﺮﺱ ﺑﻮﺩﻧﺪ‪.‬‬ ‫ﻣﻨﺎﺑﻊ ﺩﺭﺧﻮﺍﺳﺘﻲ ﺭﺍ ﺭﺯﺭﻭ ﻣﻲﻛﻨﺪ‪ ،‬ﺟﺪﻭﻝ ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﻃﻼﻋﺎﺕ ﻣﻨﺎﺑﻊ ﺭﺍ ﺑﻪ ﺭﻭﺯ ﺩﺭ ﻣﻲﺁﻭﺭﺩ ﻭ ﭘﻴﻐﺎﻡ ‪CR-LDP‬‬

‫ﺭﺍ ﺑﻪ ﮔﺮﻩ ﺑﻌﺪﻱ ﺍﺭﺳﺎﻝ ﻣﻲﻛﻨﺪ‪.‬‬ ‫ﺯﻣﺎﻧﻴﻜﻪ ﻣﺎﺟﻮﻝ ‪ CR-LDP‬ﭘﻴﻐﺎﻡ "‪ "CR-LDP Mapping‬ﺭﺍ ﺩﺭﻳﺎﻓﺖ ﻣﻲﻛﻨﺪ‪ ،‬ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺑﺮﭼﺴﺐ ﻭ ﭘﻮﺭﺕ ﺭﺍ ﺩﺭ ﺟﺪﻭﻝ ‪ LIB‬ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ ﻭ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺭﺍ ﺩﺭ‬ ‫ﺟﺪﻭﻝ ‪ ERB‬ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺳﭙﺲ ﻣﺎﺟﻮﻝ ‪ Resource Manager‬ﺭﺍ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﻛﻨﺪ ﺗﺎ ﺻﻔﻲ ﺑﺮﺍﻱ‬ ‫ﺳﺮﻭﻳﺲ ﺩﺍﺩﻥ ﺑﻪ ﻣﺴﻴﺮ ﺩﺭﺧﻮﺍﺳﺖ ﺷﺪﻩ ﺍﻳﺠﺎﺩ ﻛﻨﺪ ﻭ ﭘﺲ ﺍﺯ ﺍﻧﺠﺎﻡ ﺍﻳﻨﻜﺎﺭ ﻣﺸﺨﺼﻪ ﺳﺮﻭﻳﺲ ﺍﻳﺠﺎﺩ ﺷﺪﻩ ﺭﺍ ﺩﺭ‬ ‫ﺟﺪﻭﻝ ‪ ERB‬ﺫﺧﻴﺮﻩ ﻣﻲﻛﻨﺪ‪ .‬ﻭ ﺩﺭ ﻧﻬﺎﻳﺖ ﭘﻴﻐﺎﻡ “‪ ”CR-LDP‬ﺑﻪ ﮔﺮﺓ ﻗﺒﻠﻲ ﻓﺮﺳﺘﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ٥‐٢‐٤‬ﺳﻄﻮﺡ ﺳﺮﻭﻳﺲ ﺩﺭ ‪MNS‬‬ ‫‪ MNS‬ﭼﻬﺎﺭ ﺳﺮﻭﻳﺲ ‪ HBT3 ،ST2 ،١RT‬ﻭ ‪ SBT4‬ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻭﻟﻮﻳﺖ ﺍﻳﻦ ﺳﺮﻭﻳﺲﻫﺎ ﺍﺯ‬ ‫ﺭﺍﺳﺖ ﺑﻪ ﭼﭗ ﺍﺳﺖ‪ .‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ‪ MNS‬ﺍﺯ ﻣﻜﺎﻧﻴﺰﻡ ﺻﻒ ‪ CBQ‬ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ ،‬ﺍﺯ ﺳﻪ ﺳﻄﺢ ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﺳﺮﻭﻳﺲ ﺑﻪ ﺍﻳﻦ ﻛﻼﺳﻬﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺷﻜﻞ ‪ ۶‐۱‬ﺍﻳﻦ ﻣﺴﺌﻠﻪ ﺭﺍ‬ ‫ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪1‬‬

‫‪Real Traffic‬‬ ‫‪Signaling Traffic‬‬ ‫‪3‬‬ ‫‪High Best Effort Traffic‬‬ ‫‪4‬‬ ‫‪Simple Best Effort Traffic‬‬ ‫‪2‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٥٦‐٤‬‬

‫ﺷﻜﻞ ‪٦‐١‬‬

‫ﻧﻤﺎﻳﺶ ﺳﻄﻮﺡ ﻛﻼﺱ ﺩﺭ ‪MNS‬‬

‫ﻣﻲﺗﻮﺍﻥ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ‪ CBQ‬ﻧﻈﻴﺮ ﻧﺮﺥ ﺗﺮﺍﻓﻴﻚ‪ ،‬ﺍﻧﺪﺍﺯﻩ ﺑﺎﻓﺮ ﻭ ‪ ...‬ﺭﺍ ﺑﺮﺍﻱ ﻫﺮ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻧﻤﻮﺩ‪.‬‬ ‫ﻛﻼﺳﻬﺎﻱ ‪ HBT ،ST‬ﻭ ‪ SBT‬ﺑﻪ ﻃﻮﺭ ﺍﻳﺴﺘﺎ ﺩﺭ ﺯﻣﺎﻥ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﺤﻴﻂ ﺷﺒﻴﻪ ﺳﺎﺯﻱ ﺍﻳﺠﺎﺩ ﻣﻲﺷﻮﻧﺪ‪ .‬ﻭﻟﻲ‬ ‫ﺻﻔﻬﺎﻱ ‪ RT‬ﺑﻪ ﻃﻮﺭ ﭘﻮﻳﺎ ﻭ ﺑﺎ ﺁﻣﺪﻥ ﭘﻴﻐﺎﻣـﻬﺎﻱ ‪ CR-LDP‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫ﺩﺭ ‪ CBQ‬ﻣﻲﺗﻮﺍﻥ ﻣﺸﺨﺺ ﻧﻤﻮﺩ ﻛﻪ ﺑﻪ ﻫﺮ ﻛﺪﺍﻡ ﺍﺯ ﻛﻼﺳﻬﺎ ﭼﻪ ﺩﺭﺻﺪﻱ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺑﺎﻳﺪ‬ ‫ﺍﺧﺘﺼﺎﺹ ﺩﺍﺩﻩ ﺷﻮﺩ‪ .‬ﻭ ﺳﭙﺲ ﺩﺭ ﻫﺮ ﻛﻼﺱ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﺗﺮﺍﻓﻴﻚﻫﺎ ﺍﻭﻟﻮﻳﺖ ﺩﺍﺩ‪ .‬ﻛﻪ ﺩﺭ ﺍﻳﻦ ﻣﻮﺭﺩ ﺩﺭ ﻛﻼﺱ‬ ‫‪ ، BT‬ﺗﺮﺍﻓﻴﻚ ‪ HBT‬ﻧﺴﺒﺖ ﺑﻪ ‪ SBT‬ﺍﻭﻟﻮﻳﺖ ﺩﺍﺭﺩ‪ .‬ﻳﻌﻨﻲ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺑﺮﺍﻱ ﻛﻼﺱ ‪ BT‬ﺍﺑﺘﺪﺍ ﺑﻪ‬ ‫ﺗﺮﺍﻓﻴﻚ ‪ HBT‬ﺳﺮﻭﻳﺲ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺍﺯ ﺑﻘﻴﻪ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺑﻪ ‪ SBT‬ﺳﺮﻭﻳﺲ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺑﺮﺍﻱ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺑﻪ ﺟﺮﻳﺎﻧﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻣﺨﺘﻠﻒ ﺩﺭ ﻛﻼﺱ ‪ RT‬ﺩﻭ ﭘﺎﺭﺍﻣﺘﺮ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ‬ ‫ﺍﻳﻦ ﺩﻭ ﭘﺎﺭﺍﻣﺘﺮﻣﻲﺗﻮﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻚﻫﺎﻱ ﺍﻳﻦ ﻛﻼﺱ ﻣﺪﻳﺮﻳﺖ ﻧﻤﻮﺩ‪ .‬ﺍﻳﻦ ﺩﻭ ﭘﺎﺭﺍﻣﺘﺮ‬ ‫ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ "ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ" ﻭ "ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ" ‪ .‬ﺍﮔﺮ ﻣﻘﺪﺍﺭ ﭘﺎﺭﺍﻣﺘﺮ ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ﺗﺮﺍﻓﻴﻜﻲ ﺍﺯ ﺗﺮﺍﻓﻴﻚ ﻣﻮﺟﻮﺩ‬ ‫ﻛﻤﺘﺮ ﺑﺎﺷﺪ )ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ﺁﻥ ﺑﻴﺸﺘﺮ ﺑﺎﺷﺪ( ﻭ ﺑﺨﻮﺍﻫﺪ ﺳﺮﻭﻳﺲ ﺑﮕﻴﺮﺩ ﺳﺮﻭﻳﺲ ﺍﺯ ﻗﺒﻠﻲ ﮔﺮﻓﺘﻪ‬ ‫ﺷﺪﻩ ﻭ ﺑﻪ ﺗﺮﺍﻓﻴﻚ ﺟﺪﻳﺪ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫‪ ٦‐٢‐٤‬ﻣﻌﻤﺎﺭﻱ ‪ MNS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ‬ ‫‪ MPLS‬ﺑﺎﺯﻳﺎﺑﻲ ﻭ ﻣﺤﺎﻓﻈﺖ ﺍﺯ ﻣﺴﻴﺮ ﺭﺍ ﺑﺮﺍﻱ ﻧﻴﻞ ﺑﻪ ﺍﻫﺪﺍﻑ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪:‬‬ ‫•‬

‫ﺑﻪ ﻣﻨﻈﻮﺭ ﻓﺮﺍﻫﻢ ﻛﺮﺩﻥ ﻳﻚ ﺳﺮﻭﻳﺲ ﻣﻄﻤﺌﻦ ﺑﺮﺍﻱ ﺣﻤﻞ ﺗﺮﺍﻓﻴﻚ ﺭﻭﻱ ﺷﺒﻜﻪ‬

‫‪MPLS‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬ ‫•‬

‫‪٥٧‐٤‬‬

‫ﺑﻪ ﻣﻨﻈﻮﺭ ﺍﻧﺠﺎﻡ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺩﺭ ‪ LSP‬ﻛﻪ ﺧﺮﺍﺑﻲ ﺩﺭ ﺁﻥ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﺍﺳﺖ‪.‬‬

‫ﺩ ﺭﺍﻳﻦ ﻗﺴﻤﺖ ﻗﺎﺑﻠﻴﺖ ‪ MNS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺗﺸﺮﻳﺢ ﻣﻲﺷﻮﺩ‪:‬‬ ‫ﺩﺭ ﺑﺎﺯﻳﺎﺑﻲ ﻭ ﻣﺤﺎﻓﻈﺖ ﻣﺴﻴﺮ ﺑﻪ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﻛﻪ ﺑﺎﻳﺪ ﺍﺯ ﺁﻥ ﻣﺤﺎﻓﻈﺖ ﺷﻮﺩ ﺍﺻﻄﻼﺣﺎ‬ ‫‪path‬‬

‫)‪Working(primary‬‬

‫ﮔﻔﺘﻪ ﻣﻲﺷﻮﺩ ﻭ ﺑﻪ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻛﻪ ﺑﺮﺍﻱ ﻣﺤﺎﻓﻈﺖ ﺍﺯ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‬

‫‪ Backup(alternative) Path‬ﮔﻔﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ MNS‬ﺍﺯ ﺩﻭ ﺗﻜﻨﻴﻚ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﺤﺎﻓﻈﺖ‪ ١‬ﺍﺯ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪:‬‬

‫‹‬

‫‪:Dynamic Protection‬‬ ‫ﺑﺎ ﺍﻳﻦ ﺭﻭﺵ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻳﻚ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ‪ ،‬ﺑﻌﺪ ﺍﺯ ﺍﻳﻨﻜﻪ ﺧﺮﺍﺑﻲ ﺩﺭ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩ‪ ،‬ﺳﺎﺧﺘﻪ‬

‫ﻣﻲﺷﻮﺩ‬

‫‹‬

‫‪:Pre-negotiated‬‬

‫ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﭘﻴﺸﺎﭘﻴﺶ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻫﻤﭽﻨﻴﻦ ﺗﻌﻤﻴﺮ‪ ٢‬ﻣﺴﻴﺮ ﺧﺮﺍﺏ ﺷﺪﻩ ﺑﻪ ﺩﻭ ﺭﻭﺵ ﺍﻣﻜﺎﻥﭘﺬﻳﺮ ﺍﺳﺖ‪:‬‬

‫‹‬

‫‪:Global repair‬‬

‫ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﺍﺻﻼﺡ ﺑﻴﻦ ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ)ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺭﻭﺗﺮ ‪ Ingress‬ﻭ ‪(Egress‬‬

‫‹‬

‫‪:Local repair‬‬

‫ﺩﺭ ﺍﻳﻦ ﺭﻭﺵ ﺗﻌﻤﻴﺮ ﻣﺴﻴﺮ ﺑﻴﻦ ﺩﻭ ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺁﻧﻬﺎ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﺍﺳﺖ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﭼﻨﺪﻳﻦ ﺭﻭﺵ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ ‪،Shortest-Dynamic ،Simple-Dynamic :‬‬ ‫‪ Makam، Hashkin‬ﻭ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻻﻳﻪ ‪. ٣‬ﺟﺪﻭﻝ ﺯﻳﺮ ﺭﻭﺷﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﻭ ﺗﻜﻨﻴﻜﻬﺎﻳﻲ ﻛﻪ ﺑﺮﺍﻱ ﻧﻮﻉ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﻭ ﺗﻌﻤﻴﺮ ﻣﺴﻴﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻨﺪ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪) .‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪ Shortest-dynmic , L3‬ﺍﺯ‬ ‫ﻧﻈﺮ ﺗﻜﻨﻴﻚ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻣﺎﻧﻨﺪ ﺭﻭﺵ ‪ Simple-dynamic‬ﻋﻤﻞ ﻣﻲﻛﻨﻨﺪ(‬ ‫‪Protection configuration‬‬ ‫‪Repair Activation‬‬

‫‪1‬‬ ‫‪2‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٥٨‐٤‬‬

‫ﺷﻜﻞ ‪ ۷‐۱‬ﻣﻌﻤﺎﺭﻱ ﮔﺮﻩ ‪ MPLS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‬

‫ﺷﻜﻞ ‪۷‐۱‬‬

‫ﻣﻌﻤﺎﺭﻱ ﮔﺮﻩ ‪ MPLS‬ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺑﺎﺯﻳﺎﺑﻲ ﻣﺴﻴﺮ‬

‫ﻣﺎﺟﻮﻝ ‪ Link-Failure-Detector‬ﻭﺿﻌﻴﺖ ﻟﻴﻨﻜﻬﺎ ﺭﺍ ﻣﺎﻧﻴﺘﻮﺭ ﻣﻲﻛﻨﺪ ﻭ ﺩﺭ ﺻﻮﺭﺕ ﻣﺸﺎﻫﺪﺓ ﺧﺮﺍﺑﻲ ﻳﺎ ﺑﺮﻃﺮﻑ‬ ‫ﺷﺪﻥ ﺧﺮﺍﺑﻲ ﺁﻥ ﺭﺍ ﺑﻪ ‪ MPLS Classifier‬ﻭ ‪ Reroute Action Trigger‬ﺍﻃﻼﻉ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪ Reroute Action Trigger‬ﺩﺭ ﺭﻭﺷﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺩﻳﻨﺎﻣﻴﻚ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺭﻭﺵ ﻛﺎﺭ ﺁﻥ ﺑﻪ ﺍﻳﻦ‬ ‫ﺻﻮﺭﺕ ﺍﺳﺖ ﻛﻪ ﺍﮔﺮ ﻭﺿﻌﻴﺖ ﻳﻚ ﻟﻴﻨﻚ ﺍﺯ ﺣﺎﻟﺖ ﺳﺎﻟﻢ ﺑﻪ ﺧﺮﺍﺑﻲ ﺗﻐﻴﻴﺮ ﻛﻨﺪ ﻳﻚ ﻣﺴﻴﺮ ﺟﺪﻳﺪ ﭘﺸﺘﻴﺒﺎﻥ‬ ‫ﻣﻲﺳﺎﺯﺩ ﻭ ﺍﮔﺮ ﻭﺿﻌﻴﺖ ﺧﺮﺍﺑﻲ ﻳﻚ ﻟﻴﻨﻚ ﺑﺮﻃﺮﻑ ﺷﻮﺩ‪ ،‬ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺭﺍ ﺣﺬﻑ ﻣﻲﻧﻤﺎﻳﺪ‪.‬‬ ‫ﺩﺭ ﺯﻳﺮ ﺍﻟﮕﻮﻫﺎﻱ ﺭﻭﺷﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺗﺸﺮﻳﺢ ﻣﻲﺷﻮﻧﺪ‪.‬‬

‫‹‬

‫ﺭﻭﺵ ‪Hashkins‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٥٩‐٤‬‬

‫ﺍﻟﮕﻮﻱ ﺍﻳﻦ ﺭﻭﺵ ﺩﺭﺷﻜﻞ ‪ ۸‐۱‬ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪:‬‬

‫‹‬

‫ﺭﺍﻩ ﺍﻧﺪﺍﺯﻱ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺩﺭ ﺭﻭﺗﺮ ‪:PIL‬‬

‫ﻣﺰﺍﻳﺎ‪:‬‬

‫‪ ‐۱‬ﻳﻚ ‪ LSP‬ﺑﻴﻦ ﺭﻭﺗﺮ ‪ PIL‬ﻭ ‪ PML‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ ‐۲‬ﻳﻚ ‪ LSP‬ﺑﻴﻦ ﺭﻭﺗﺮ ‪ PML‬ﻭ ‪ PIL‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‬ ‫)ﺑﺪﻭﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻫﻴﭻ ﻣﺴﻴﺮ ﺍﺻﻠﻲ(‬ ‫‪ ‐۳‬ﺩﻭ ‪ LSP‬ﺑﻪ ﻫﻢ ﻟﻴﻨﻚ ﻣﻲﺷﻮﻧﺪ‪ .‬ﻭ ﺗﻤﺎﻡ ﮔﺮﻩ ﻫﺎ ﺩﺭ ﻃﻮﻝ‬

‫ﻣﺴﻴﺮﻳﺎﺑﻲ ﺭﺍ ﺑﻪ ﻃﻮﺭ ﺳﺮﻳﻊ ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ‪.‬‬ ‫‹‬

‫ﻣﻌﺎﻳﺐ ‪:‬‬

‫ﺑﻌﺪ ﺍﺯ ﺍﻳﻨﻜﻪ ﻣﺸﻜﻞ ﺧﺮﺍﺑﻲ ﺑﺮﻃﺮﻑ ﺷﺪ ﻭ ﺑﺴﺘﻪ ﻫﺎ‬ ‫ﺧﻮﺍﺳﺘﻨﺪ ﺍﺯ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺑﻪ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺳﻮﺋﻴﭻ‬

‫ﻣﺴﻴﺮ ‪ PML → PIL‬ﺑﻪ ﻣﺴﻴﺮ ‪PIL → PML‬‬

‫ﻛﻨﻨﺪ ﻣﺴﺌﻠﻪ ﺩﻭﺑﺎﺭﻩ ﻣﺮﺗﺐ ﻛﺮﺩﻥ ﺑﺴﺘﻪﻫﺎﺑﻮﺟﻮﺩﻣﻲﺁﻳﺪ‬

‫ﻣﺘﺼﻞ ﻣﻲﺷﻮﻧﺪ‬

‫ﺷﻜﻞ ‪۸‐۱‬‬ ‫‹‬

‫ﺍﻟﮕﻮﻱ ‪Hashkin‬‬

‫ﺍﻟﮕﻮﻱ ‪Makam‬‬

‫ﺩﺭ ‪ ۰‬ﺍﻟﮕﻮﻱ‪ Mackam‬ﻧﺸﺎﻥ ﺩﺍﺩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬

‫ﻣﺰﺍﻳﺎ‪ :‬ﺍﻏﻠﺐ ﻣﺴﺌﻠﻪ ﺩﻭﺑﺎﺭﻩ ﻣﺮﺗﺐ ﻛﺮﺩﻥ ﺑﺴﺘﻪ ﻫﺎ‬

‫•‬

‫ﺍﺗﻔﺎﻕ ﻧﻤﻲﺍﻓﺘﺪ‪.‬‬

‫‪ ‐۱‬ﻳﻚ ‪ LSP‬ﺑﻴﻦ ﮔﺮﻩ ‪ PIL‬ﻭ ‪ PML‬ﺳﺎﺧﺘﻪﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﻌﺎﻳﺐ‪ :‬ﺩﺭ ﺯﻣﺎﻥ ﺍﺭﺳﺎﻝ ﭘﻴﻐﺎﻡ ‪ Notification‬ﺑﻪ‬

‫‪ ‐۲‬ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ Notification Message‬ﺑﻪ ‪PIL‬‬

‫‪ PIL‬ﺗﻌﺪﺍﺩﻱ ﺑﺴﺘﻪ ﮔﻢ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﺧﺒﺮ ﺑﺎﺯﻳﺎﺑﻲ ﻭ ﺧﺮﺍﺑﻲ ﻣﺴﻴﺮ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‬

‫ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٠‐٤‬‬

‫ﺷﻜﻞ ‪۹‐۱‬‬ ‫‹‬

‫ﺍﻟﮕﻮﻱ ‪Makam‬‬

‫ﺭﻭﺵ ‪Simple-Dynamic‬‬

‫ﺍﻟﮕﻮﻱ ﺍﻳﻦ ﺭﻭﺵ ﺩﺭ ﺷﻜﻞ ‪ ۱۰‐۱‬ﺁﻣﺪﻩ ﺍﺳﺖ‪.‬‬

‫ﻣﺰﺍﻳﺎ‪ :‬ﺑﻬﺮﻩﻭﺭﻱ ﻣﻨﺎﺑﻊ‬

‫ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ‪ LSP‬ﭘﺸﺘﻴﺒﺎﻥ‬

‫ﻣﻌﺎﻳﺐ‪ :‬ﺯﻣﺎﻥ ﺭﺍﻩﺍﻧﺪﺍﺯﻱ ‪ LSP‬ﺑﺴﻴﺎﺭ ﻃﻮﻻﻧﻲ‬

‫ﺑﻌﺪ ﺍﺯ ﺍﻳﻨﻜﻪ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩ ﻳﻚ ﻣﺴﻴﺮ ﺑﻴﻦ‬ ‫ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺍﻥ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﺍﺳﺖ ﻭ ‪PML‬‬

‫ﺍﺳﺖ‪.‬‬

‫ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺷﻜﻞ ‪ ۱۰‐۱‬ﺍﻟﮕﻮﻱ ﺭﻭﺵ ‪Simple-dynamic‬‬

‫ﺭﻭﺵ ‪ Shortest-dynamic‬ﻭ ‪ L3‬ﻣﺎﻧﻨﺪ ﺭﻭﺵ ‪ Simple-dynamic‬ﺍﺳﺖ ﺑﻪ ﺟﺰ ﺍﻳﻨﻜﻪ ﺩﺭ ﺭﻭﺵ‬ ‫‪ Shortest-dynamic‬ﻳﻚ ﻣﺴﻴﺮ ﺑﻴﻦ ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺁﻥ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﻭ ﮔﺮﻩ ﺑﻌﺪﻱ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ)ﺩﺭ‬ ‫ﺻﻮﺭﺗﻴﻜﻪ ﻟﻴﻨﻚ ﺩﻳﮕﺮﻱ ﺑﻴﻦ ﺁﻧﻬﺎ ﺑﺮﻗﺮﺍﺭ ﻧﺒﺎﺷﺪ( ﻭ ﺩﺭ ﺻﻮﺭﺕ ﺑﺮﻭﺯ ﺧﺮﺍﺑﻲ ﺍﺯ ﺟﺪﻭﻝ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻻﻳﻪ ‪ ٣‬ﺑﺮﺍﻱ‬ ‫ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﺟﺪﻳﺪﻱ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣-٤‬‬

‫‪٦١‐٤‬‬

‫واﺳﻂهﺎي ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﺲ ﺑﺮاي اﺳﺘﻔﺎدﻩ از ﺷﺒﻴﻪﺳﺎز ‪MNS‬‬

‫ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﺍﺑﺘﺪﺍ ﻭﺍﺳﻄﻬﺎﻱ ﻣﻮﺟﻮﺩ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺩﺭ ﺍﺳﻜﺮﻳﭙﺖ ‪ TCL‬ﺑﻴﺎﻥ ﻣﻲﺷﻮﻧﺪ ﻭ‬ ‫ﺳﭙﺲ ﺑﺎ ﻣﺜﺎﻟﻬﺎﻳﻲ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﻣﺨﺘﻠﻒ ‪ MNS‬ﺷﺮﺡ ﺩﺍﺩﻩ ﻣﻲﺷﻮﻧﺪ‪.‬‬

‫‪ ١‐٣‐٤‬ﻓﺮﻣﺎﻧﻬﺎﻱ ﻭﺍﺳﻂ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺩﺭ ‪NS-2‬‬ ‫‪$ns mpls-node‬‬

‫•‬

‫ﻳﻚ ﮔﺮﻩ ﺟﺪﻳﺪ ‪ MPLS‬ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﺪ ﻭ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﺁﻥ ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫]‪set Lsr1 [$ns mpls-node‬‬ ‫‪$ns configure-ldp-on-all-mpls-nodes‬‬

‫•‬

‫‪ ldp agent‬ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﮔﺮﻫﻬﺎﻱ ‪ MPLS‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻧﻜﺘﻪ‪ :‬ﺩﺭ ﺑﻌﻀﻲ ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ﻧﻴﺎﺯ ﺍﺳﺖ ﺭﻭﻱ ﻣﺎﺟﻮﻝ ‪ MPLS‬ﮔﺮﻩ ﻛﺎﺭﺍﻫﺎﻳﻲ ﺻﻮﺭﺕ ﮔﻴﺮﺩ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻦ‬ ‫ﻣﻨﻈﻮﺭ ﻧﻴﺎﺯ ﺍﺳﺖ ﺍﺑﺘﺪﺍ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﻣﺎﺟﻮﻝ ‪ MPLS‬ﮔﺮﻩ ﺑﺪﺳﺖ ﺁﻳﺪ‪ .‬ﺑﻮﺳﻴﻠﻪ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﻲﺗﻮﺍﻥ ﺍﺷﺎﺭﻩﮔﺮ‬ ‫ﺑﻪ ﻣﺎﺟﻮﻝ ‪ MPLS‬ﮔﺮﻩ ‪ LSR1‬ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﺩ‪:‬‬ ‫]”‪Set MPLSnode [$lsr1 get-module “MPLS‬‬

‫ﺑﻨﺎﺑﺮﺍﻳﻦ ﺩﺭ ﺑﻘﻴﻪ ﺩﺳﺘﻮﺭﺍﺕ ﻣﻨﻈﻮﺭ ﺍﺯ ﮔﺮﻩ ‪ MPLSnode‬ﻣﺎﺟﻮﻝ ‪ MPLS‬ﻳﻚ ﮔﺮﻩ ﺍﺯ ﻧﻮﻉ ‪ MPLS‬ﺍﺳﺖ‪.‬‬

‫‪$MPLSnode enable-control-driven‬‬

‫•‬

‫ﮔﺮﻩ ‪ MPLS‬ﺑﻪ ﺭﻭﺵ ‪ control-driven‬ﺑﺮﭼﺴﺐﻫﺎ ﺭﺍ ﺗﻮﺯﻳﻊ ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode enable-data-driven‬‬

‫•‬

‫ﮔﺮﻩ ‪ MPLS‬ﺑﻪ ﺭﻭﺵ ‪ data-driven‬ﺑﺮﭼﺴﺐﻫﺎ ﺭﺍ ﺗﻮﺯﻳﻊ ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode enable-on-demand‬‬

‫•‬

‫ﮔﺮﻩ ‪ MPLS‬ﺩﺭ ﻣﺪ ‪ on-demand‬ﻗﺮﺍﺭ ﻣﻲﻛﻴﺮﺩ‪.‬‬ ‫‪$MPLSnode enable-ordered-control‬‬

‫•‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٢‐٤‬‬

‫ﮔﺮﻩ ‪ MPLS‬ﺩﺭ ﻣﺪ ‪ ordered-control‬ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫‪$ns enable-control-driven‬‬

‫•‬

‫ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺑﻪ ﺭﻭﺵ ‪ control-driven‬ﺑﺮﭼﺴﺐﻫﺎ ﺭﺍ ﺗﻮﺯﻳﻊ ﻣﻲﻛﻨﻨﺪ‪.‬‬ ‫‪$ns enable-data-driven‬‬

‫•‬

‫ﺗﻤﺎ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺑﻪ ﺭﻭﺵ ‪ data-driven‬ﺑﺮﭼﺴﺐﻫﺎ ﺭﺍ ﺗﻮﺯﻳﻊ ﻣﻲﻛﻨﻨﺪ‪.‬‬ ‫‪$ns enable-on-demand‬‬

‫•‬

‫ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺩﺭ ﻣﺪ ‪ on-demand‬ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ‪.‬‬ ‫‪$ns enable-ordered-control‬‬

‫•‬

‫ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺩﺭ ﻣﺪ ‪ ordered-control‬ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫‪$MPLSnode send-ldp-release-msg $fec‬‬

‫•‬

‫ﭘﻴﻐﺎﻡ "‪ "ldp-release‬ﺑﺎ ‪ fec‬ﺩﺍﺩﻩ ﺷﺪﻩ ﺑﻪ ﮔﺮﻩﻫﺎﻱ ‪ DownStream‬ﺍﺭﺳﺎﻝ ﻣﻲﮔﺮﺩﺩ ﺗﺎ ﻣﺴﻴﺮ ‪ LSP‬ﺳﺎﺧﺘﻪ‬ ‫ﺷﺪﻩ ﺑﺎ ‪ $fec ،FEC‬ﺭﺍ ﺣﺬﻑ ﻛﻨﻨﺪ‪.‬‬ ‫‪$MPLSnode send-ldp-withdraw-msg $fec‬‬

‫•‬

‫ﭘﻴﻐﺎﻡ "‪ "ldp-withdraw‬ﺑﺎ ‪ fec‬ﺩﺍﺩﻩ ﺷﺪﻩ ﺑﻪ ﮔﺮﻩﻫﺎﻱ ‪ UpStream‬ﺍﺭﺳﺎﻝ ﻣﻲﮔﺮﺩﺩ ﺗﺎ ﻣﺴﻴﺮ ‪ LSP‬ﺳﺎﺧﺘﻪ‬ ‫ﺷﺪﻩ ﺑﺎ ‪ $fec ،FEC‬ﺭﺍ ﺣﺬﻑ ﻛﻨﻨﺪ‪.‬‬ ‫‪$MPLSnode aggregate-flows $fec1 $fec2‬‬

‫•‬

‫ﻓﻠﻮ ﺑﺎ ‪ $fec1 ،FEC‬ﺭﺍ ﺩﺭ ﻓﻠﻮ ﺑﺰﺭﮔﺘﺮ ﺑﺎ ‪ $fec2 ،FEC‬ﻣﺠﺘﻤﻊ ﻣﻲﻛﻨﺪ‪ .‬ﺩﺭ ﻭﺍﻗﻊ ﻓﻠﻮﻫﺎﻱ ‪ $fec1‬ﻭ ‪ $fec2‬ﺭﺍ‬ ‫ﺗﺮﻛﻴﺐ ﻣﻲﻛﻨﺪ ﺑﺎ ‪$fec2 : FEC‬‬

‫‪ ٢‐٣‐٤‬ﻭﺍﺳﻂﻫﺎ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﺻﺮﻳﺢ‬ ‫‪$MPLSnode setup-erlsp $fec $er $lspid‬‬

‫•‬

‫ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ‪ $er‬ﺑﺎ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪ $lspid‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﻛﻪ ﻣﻘﺪﺍﺭ ‪ FEC‬ﺍﻳﻦ ﻣﺴﻴﺮ ‪ $fec‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫ﺑﻮﺳﻴﻠﻪ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻳﻚ ﭘﻴﻐﺎﻡ ‪ CR-LDP Request‬ﺍﺯ ﮔﺮﻩ ‪ $MPLSnode‬ﺑﻪ ﮔﺮﻩﻫﺎﻱ ﺩﺭ ﻃﻮﻝ ﻣﺴﻴﺮ ‪$er‬‬

‫ﺑﺮﺍﻱ ﻓﻠﻮﻫﺎﻱ ‪ $fec‬ﻓﺮﺳﺘﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٣‐٤‬‬ ‫‪$LSR1 setup-erlsp 7 5_4_8_6_7 3000‬‬

‫ﺑﺎ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ )‪ (۷ ،۶ ،۸ ،۴ ،۵ ،LSR1‬ﺍﺯ ﮔﺮﻩ ‪ $LSR1‬ﺑﻪ ﮔﺮﻩ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ۷‬ﻭ ﺑﺎ ‪FEC‬‬

‫‪ ۷‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﻣﺴﻴﺮ ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺩﺍﺭﺍﻱ ﻣﺸﺨﺼﻪ ‪ ۳۰۰۰‬ﺧﻮﺍﻫﺪ ﺑﻮﺩ‪.‬‬ ‫‪$LSR2 setup-erlsp 9 2-L3000-8 4000‬‬

‫ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺍﺯ ﮔﺮﻩ ‪ $LSR2‬ﺑﻪ ﮔﺮﻩ ‪ ۸‬ﺑﺎ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪ ۴۰۰۰‬ﻭ ‪ ۹ FEC‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﺩﺭ ﺍﻳﻦ‬ ‫ﺩﺳﺘﻮﺭ ﺩﺭ ﻗﺴﻤﺖ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ‪ L3000‬ﺑﻜﺎﺭ ﺑﺮﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻛﻪ ﻣﻨﻈﻮﺭ ﺍﺯ ﺁﻥ ﻣﺴﻴﺮﻱ ﺍﺯ ﭘﻴﺶ ﺗﻌﺮﻳﻒ ﺷﺪﻩ‬ ‫ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ٣٠٠٠‬ﺍﺳﺖ‪ .‬ﺑﻨﺎﺑﺮﺍﻳﻦ ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻣﻲﺗﻮﺍﻥ ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﻛﻪ ﺧﻮﺩ ﺷﺎﻣﻞ ﻳﻚ ﻣﺴﻴﺮ ﺍﺯ‬

‫ﭘﻴﺶ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ‪ ،‬ﺳﺎﺧﺖ‪.‬‬ ‫‪$MPLSnode bind-flow-erlsp $fec $flowid $lspid‬‬

‫•‬

‫ﻓﻠﻮﻫﺎﻱ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $flowid‬ﻭ ‪ $fec FEC‬ﺭﺍ ﺑﻪ ﻣﺴﻴﺮ ﺍﺯ ﭘﻴﺶ ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $lspid‬ﻣﻲﭼﺴﺒﺎﻧﺪ‪.‬‬ ‫ﺑﻌﺪ ﺍﺯ ﺍﺟﺮﺍﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺍﻳﻦ ﻓﻠﻮﻫﺎ ﺍﺯ ﺍﻳﻦ ﻣﺴﻴﺮ ﺍﻧﺘﻘﺎﻝ ﻣﻲﻳﺎﺑﻨﺪ‪.‬‬

‫‪ ٣‐٣‐٤‬ﻭﺍﺳﻄﻬﺎ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻛﻼﺱﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ‬ ‫ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ‪ MNS2‬ﺑﺮﺍﻱ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺑﻪ ﺍﻧﻮﺍﻉ ﻛﻼﺳﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﺻﻒ ‪ CBQ‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‬ ‫ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﻧﺤﻮﻩ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺻﻒ ‪ CBQ‬ﻭ ﺍﻧﻮﺍﻉ ﻛﻼﺳﻬﺎ ﺁﻭﺭﺩﻩ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫‪$ns cfg-cbq-for-SBTS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay‬‬

‫•‬

‫ﺑﻮﺳﻴﻠﻪ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺻﻒ ‪ CBQ‬ﺩﺭ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ‪ SBTS‬ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪ .‬ﻭ‬ ‫ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﺩ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :$qlim‬ﺍﻧﺪﺍﺯﻩ ﺻﻔﻲ ﻛﻪ ﺑﻪ ﺍﻳﻦ ﻛﻼﺱ ﺍﺧﺘﺼﺎﺹ ﻣﻲﺩﻫﺪ)ﺑﺮ ﺣﺴﺐ ﺑﺴﺘﻪ(‪.‬‬ ‫‪ :$cbq_qtype‬ﻧﻮﻉ ﺻﻔﻲ ﻛﻪ ﺑﺮﺍﻱ ﺳﺮﻭﻳﺲ ﺩﻫﻲ ﺑﻪ ﺍﻳﻦ ﻛﻼﺱ ﺍﺯ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﺑﻪﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‬ ‫‪.DropTail‬‬ ‫‪ :$okborrow‬ﻳﻚ ﭘﺎﺭﺍﻣﺘﺮ ﺑﻮﻟﻲ ﻛﻪ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ ﺁﻳﺎ ﻛﻼﺱ ﺍﺟﺎﺯﻩ ﺩﺍﺭﺩ ﺍﺯ ﭘﺪﺭ ﺧﻮﺩ ﻣﻨﺒﻊ ﻗﺮﺽ ﺑﮕﻴﺮﺩ ﻳﺎ‬ ‫ﺧﻴﺮ‪.‬‬ ‫‪ :$bw‬ﺩﺭﺻﺪﻱ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻛﻪ ‪ CBQ‬ﺑﺎﻳﺪ ﺑﺮﺍﻱ ﺍﻳﻦ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﺍﺧﺘﺼﺎﺹ ﺩﻫﺪ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٤‐٤‬‬

‫‪ :$maxidle‬ﻣﺎﻛﺰﻳﻤﻢ ﻣﻘﺪﺍﺭ ﺯﻣﺎﻧﻲ ﻛﻪ ﻛﻼﺱ ﻧﻴﺎﺯ ﺩﺍﺭﺩ ﺗﺎ ﺑﺴﺘﻪﻫﺎﻳﺶ ﺭﺍ ﺩﺭ ﺻﻒ ﻗﺮﺍﺭ ﺩﻫﺪ‪ .‬ﺑﺴﺘﻪﻫﺎ ﻗﺒﻞ ﺍﺯ‬ ‫ﺍﺗﻤﺎﻡ ﺍﻳﻦ ﺯﻣﺎﻥ ﺑﻪ ﺟﻠﻮ ﺍﻧﺘﻘﺎﻝ ﻧﻤﻲﻳﺎﺑﻨﺪ‪.‬‬ ‫‪ :$extradelay‬ﺗﺎﺧﻴﺮ ﻛﻼﺱ ﺑﺎ ﺍﻳﻦ ﺯﻣﺎﻥ ﺟﻤﻊ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$maxidle‬‬

‫‪$bw‬‬

‫‪$okborrow‬‬

‫‪$cbq_qtype‬‬

‫‪$qlim‬‬

‫‪$ns cfg-cbq-for-HBTS‬‬ ‫‪$extradelay‬‬

‫•‬

‫ﺻﻒ ‪ CBQ‬ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ‪ HBTS‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$ns cfg-cbq-for-STS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay‬‬

‫•‬

‫ﺻﻒ ‪ CBQ‬ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ‪ STS‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$ns cfg-cbq-for-RTS $qlim $cbq_qtype $okborrow $bw $maxidle $extradelay‬‬

‫•‬

‫ﺻﻒ ‪ CBQ‬ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ‪ RTS‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﺩ‪.‬‬ ‫]‪$ns bind-flowid-to-SBTS $id1 [$id2‬‬

‫•‬

‫ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $id1‬ﻳﺎ ﻓﻠﻮﻫﺎﻳﻲ ﻛﻪ ﻣﺸﺨﺼﻪ ﺁﻧﻬﺎ ﺑﻴﻦ ‪ $id1‬ﻭ ‪ $id2‬ﺍﺳﺖ ﺑﻪ ﺻﻮﺭﺕ ﺳﺮﻭﻳﺲ‬ ‫‪ SBTS‬ﺳﺮﻭﻳﺲﺩﻫﻲ ﺷﻮﻧﺪ‪.‬‬ ‫]‪$ns bind-flowid-to-HBTS $id1 [$id2‬‬

‫•‬

‫ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $id1‬ﻳﺎ ﻓﻠﻮﻫﺎﻳﻲ ﻛﻪ ﻣﺸﺨﺼﻪ ﺁﻧﻬﺎ ﺑﻴﻦ ‪ $id1‬ﻭ ‪ $id2‬ﺍﺳﺖ ﺑﻪ ﺻﻮﺭﺕ‬ ‫ﺳﺮﻭﻳﺲ ‪ HBTS‬ﺳﺮﻭﻳﺲﺩﻫﻲ ﺷﻮﻧﺪ‪.‬‬ ‫]‪$ns bind-flowid-to-STS $id1 [$id2‬‬

‫•‬

‫ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $id1‬ﻳﺎ ﻓﻠﻮﻫﺎﻳﻲ ﻛﻪ ﻣﺸﺨﺼﻪ ﺁﻧﻬﺎ ﺑﻴﻦ ‪ $id1‬ﻭ ‪ $id2‬ﺍﺳﺖ ﺑﻪ ﺻﻮﺭﺕ‬ ‫ﺳﺮﻭﻳﺲ ‪ SBTS‬ﺳﺮﻭﻳﺲﺩﻫﻲ ﺷﻮﻧﺪ‪.‬‬ ‫‪$ns bind-ldp-to-SBTS‬‬

‫•‬

‫‪$ns bind-ldp-to-HBTS‬‬

‫•‬

‫‪$ns bind-ldp-to-STS‬‬

‫•‬

‫ﺍﻳﻦ ﺳﻪ ﺩﺳﺘﻮﺭ ﻣﺸﺨﺺ ﻣﻲﻛﻨﻨﺪ ﻛﻪ ﭘﻴﻐﺎﻡﻫﺎﻱ ‪ ldp‬ﺑﻪ ﭼﻪ ﺻﻮﺭﺕ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺷﻮﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٥‐٤‬‬

‫‪ ٤‐٣‐٤‬ﻭﺍﺳﻂﻫﺎ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﻣﻘﻴﺪ )‪ (CR-LSP‬ﻭ ‪CR-LDP‬‬ ‫‪$MPLSnode setup-crlsp $fec $er $lspid $TRate $BSize $PSize $SPrio $Hprio‬‬

‫•‬

‫ﺑﻮﺳﻴﻠﻪ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻳﻚ ﻣﺴﻴﺮ ‪ CR-LSP‬ﺑﺎ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ‪ ،$er‬ﻭ ‪ $fec FEC‬ﻭ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪ $lspid‬ﺳﺎﺧﺘﻪ‬ ‫ﻣﻲﺷﻮﺩ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ FEC :$fec‬ﻣﺴﻴﺮ‬ ‫‪ :$er‬ﻣﺴﻴﺮ ﺻﺮﻳﺢ‬ ‫‪ :$lspid‬ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ‬ ‫‪ :$TRate‬ﻧﺮﺥ ﺗﺮﺍﻓﻴﻜﻲ ﻛﻪ ﻗﺮﺍﺭ ﺍﺳﺖ ﺍﺯ ﺍﻳﻦ ﻣﺴﻴﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﺪ‪.‬‬ ‫‪ :$Bsize‬ﺍﻧﺪﺍﺯﻩ ﺑﺎﻓﺮ‬ ‫‪ :$Psize‬ﺍﻧﺪﺍﺯﻩ ﺑﺴﺘﻪﻫﺎ‬ ‫‪ :$Sprio‬ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ﺍﻳﻦ ﻣﺴﻴﺮ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻚ ﻣﺸﺨﺺ ﺷﺪﻩ‬ ‫‪ :$Hprio‬ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ ﺍﻳﻦ ﻣﺴﻴﺮ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻚ ﻣﺸﺨﺺ ﺷﺪﻩ‬ ‫‪$MPLSnode send-crldp-release-msg $lspid‬‬

‫•‬

‫ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﭘﻴﻐﺎﻡ ‪ CR-LDP Release‬ﺑﻪ ﻣﻨﻈﻮﺭ ﺣﺬﻑ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﻳﺎ ﻣﺴﻴﺮ ﻣﻘﻴﺪ ﺑﺎ ﻣﺸﺨﺼﻪ‬ ‫‪ $lspid‬ﺍﺯ ﮔﺮﻩ ‪ $MPLSnode‬ﺑﻪ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ DownStream‬ﻛﻪ ﺩﺭ ﻃﻮﻝ ﻣﺴﻴﺮ ﻣﺸﺨﺺ ﺷﺪﻩ ﻭﺟﻮﺩ‬ ‫ﺩﺍﺭﻧﺪ ﻓﺮﺳﺘﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$MPLSnode send-crldp-withdraw-msg $lspid‬‬

‫•‬

‫ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﭘﻴﻐﺎﻡ ‪ CR-LDP WithDraw‬ﺑﻪ ﻣﻨﻈﻮﺭ ﺣﺬﻑ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﻳﺎ ﻣﺴﻴﺮ ﻣﻘﻴﺪ ﺑﺎ‬ ‫ﻣﺸﺨﺼﻪ ‪ $lspid‬ﺍﺯ ﮔﺮﻩ ‪ $MPLSnode‬ﺑﻪ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ UpStream‬ﻛﻪ ﺩﺭ ﻃﻮﻝ ﻣﺴﻴﺮ ﻣﺸﺨﺺ ﺷﺪﻩ‬ ‫ﻭﺟﻮﺩ ﺩﺍﺭﻧﺪ ﻓﺮﺳﺘﺎﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪$MPLSnode send-crldp-notification-msg $status $lspid $tr‬‬

‫•‬

‫ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﭘﻴﻐﺎﻡ ‪ CR-LDP Notification‬ﺑﻪ ﮔﺮﻩﻫﺎﻱ ‪ UpStream‬ﮔﺮﻩ ‪ $MPLSnode‬ﻓﺮﺳﺘﺎﺩﻩ‬ ‫ﻣﻲﺷﻮﺩ ﺗﺎ ﺍﻃﻼﻋﺎﺗﻲ ﺭﺍﺟﻊ ﺑﻪ ﺁﻧﻬﺎ ﺑﺪﻫﺪ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٦‐٤‬‬

‫‪ :$status‬ﺍﻃﻼﻋﺎﺕ ﻭﺿﻌﻴﺖ ﻛﻪ ﺩﺭ ‪ CR-LDP‬ﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫‪ :$lspid‬ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ‬ ‫‪ :$tr‬ﺍﻃﻼﻋﺎﺗﻲ ﺩﺭ ﻣﻮﺭﺩ ﺗﺮﺍﻓﻴﻚ‬ ‫‪$MPLSnode set-flow-prio $fec $flowid $priority‬‬

‫•‬

‫ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻓﻠﻮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ $flowid‬ﻭ ‪ $fec:FEC‬ﺍﻭﻟﻮﻳﺖ ‪ $priority‬ﺭﺍ ﺑﮕﻴﺮﺩ‪ .‬ﻣﻘﺪﺍﺭ ‪$priority‬‬

‫ﻣﻲﺗﻮﺍﻧﺪ ﺻﻔﺮ ﻳﺎ ﻳﻚ ﺑﺎﺷﺪ ﻛﻪ ﺍﻭﻟﻮﻳﺖ ﻳﻚ ﺑﻴﺸﺘﺮ ﺍﺯ ﺻﻔﺮ ﺍﺳﺖ‪.‬‬

‫‪ ٥‐٣‐٤‬ﻭﺍﺳﻄﻬﺎ ﺑﺮﺍﻱ ﻓﺮﺍﺧﻮﺍﻧﻲ ﺭﻭﺍﻟﻬﺎ‬ ‫ﺳﻪ ﺭﻭﺍﻝ ﻭﺟﻮﺩ ﺩﺍﺭﺩ ﻛﻪ ﺑﺎ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻥ ﻭﺍﻗﻌﻪﺍﻱ ﺑﻪ ﻃﻮﺭ ﺧﻮﺩﻛﺎﺭ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﻧﺪ‪ .‬ﺍﻳﻦ ﺭﻭﺍﻟﻬﺎ ﺑﻪ‬ ‫ﻣﻨﻈﻮﺭ ﺍﻃﻼﻉ ﺩﺍﺩﻥ ﻛﺎﺭﺑﺮ ﺍﺯ ﻭﻗﻮﻉ ﺁﻥ ﺍﺗﻔﺎﻕ ﺧﺎﺹ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﻧﺪ ﻭ ﻛﺎﺭﺑﺮ ﻣﻲﺗﻮﺍﻧﺪ ﺍﻳﻦ ﺭﻭﺍﻟﻬﺎ ﺭﺍ ﺑﺎﺯﻧﻮﻳﺴﻲ‬ ‫ﻧﻤﺎﻳﺪ ﺗﺎ ﺩﺭ ﺯﻣﺎﻥ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻥ ﻭﺍﻗﻌﻪ ﺧﺎﺹ‪ ،‬ﻛﺎﺭ ﺩﻟﺨﻮﺍﻫﺶ ﺍﻧﺠﺎﻡ ﺷﻮﺩ‪.‬‬ ‫}‪proc notify-erlsp-setup {node lspid‬‬

‫•‬

‫ﺍﻳﻦ ﺭﻭﺍﻝ ﺯﻣﺎﻧﻴﻜﻪ ﭘﻴﻐﺎﻡ ‪ CR-LDP Mapping‬ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ lspid‬ﺑﻪ ﮔﺮﻩ ‪node‬‬

‫ﺭﺳﻴﺪ ﻓﺮﺍﺧﻮﻧﻲ ﻣﻲﺷﻮﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺯﻣﺎﻧﻴﻜﻪ ﻣﺴﻴﺮ ﺳﺎﺧﺘﻪ ﺷﺪ ﭘﻴﻐﺎﻡ ‪ CR-LDP Mapping‬ﺑﻪ ﮔﺮﻩ‬ ‫ﺍﺑﺘﺪﺍﻳﻲ ﻣﻲﺭﺳﺪ ﻭ ﺩﺭ ﺁﻥ ﺯﻣﺎﻥ ﺍﻳﻦ ﺭﻭﺍﻝ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ ﻛﻪ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﻣﻲﺗﻮﺍﻥ ﺩﺭ ﺍﻳﻦ ﺭﻭﺍﻝ ﻓﻠﻮ‬ ‫ﺧﺎﺻﻲ ﺭﺍ ﺑﻪ ﺍﻳﻦ ﻣﺴﻴﺮ ﻣﺮﺗﺒﻂ ﻧﻤﻮﺩ‪.‬‬ ‫}‪proc notify-erlsp-fail {node status lspid tr‬‬

‫•‬

‫ﺍﻳﻦ ﺭﻭﺍﻝ ﺯﻣﺎﻧﻲ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ ﻛﻪ ﭘﻴﻐﺎﻡ ‪ CR-LDP Notification‬ﺑﺎ ﻣﺸﺨﺼﺎﺕ ‪ lspid ،status‬ﻭ ‪ tr‬ﺑﻪ‬ ‫ﮔﺮﻩ ‪ node‬ﻣﻲﺭﺳﺪ‪.‬‬ ‫}‪proc notify-erlsp-release {node lspid‬‬

‫•‬

‫ﺍﻳﻦ ﺭﻭﺍﻝ ﺯﻣﺎﻧﻲ ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ ﻛﻪ ﮔﺮﻩ ‪ node‬ﭘﻴﻐﺎﻡ ‪ CR-LDP Release/Withdraw‬ﺑﺎ ﻣﺸﺨﺼﻪ‬ ‫ﻣﺴﻴﺮ ‪ lspid‬ﺭﺍ ﺩﺭﻳﺎﻓﺖ ﻛﻨﺪ‪.‬‬

‫‪ ۶‐۳‐۴‬ﻭﺍﺳﻄﻬﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﻘﻴﺪ‬ ‫‪$ns collect-resource-info $itime‬‬

‫•‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٧‐٤‬‬

‫ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﻨﺎﺑﻊ ﺭﺍ ﺑﻪ ﻃﻮﺭ ﻣﺘﻨﺎﻭﺏ ﺩﺭ ﻫﺮ ‪ $time‬ﺛﺎﻧﻴﻪ ﺍﺯ ﻫﻤﻪ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺟﻤﻊﺁﻭﺯﻱ‬ ‫ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode constraint-based-routing $dstid $bw‬‬

‫•‬

‫ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﻣﻘﻴﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ ﺍﮔﺮ ﭼﻨﻴﻦ ﻣﺴﻴﺮﻱ ﭘﻴﺪﺍ ﺷﺪ ﻣﺴﻴﺮ ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‬ ‫ﻭﮔﺮﻧﻪ ﻣﻘﺪﺍﺭ ‪ -1‬ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :$bw‬ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮ‬ ‫‪ :$dstid‬ﻣﺸﺨﺼﺔ ‪ LSR‬ﻣﻘﺼﺪ‬ ‫ﺑﻨﺎﺑﺮﺍﻳﻦ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻳﻚ ‪CR-LSP‬ﻣﺴﻴﺮ ﻣﻘﻴﺪ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻣﺴﻴﺮ ﺩﺍﺭﺍﻱ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ‬ ‫ﻧﻈﺮ ﺭﺍ ﺑﺪﺳﺖ ﺁﻭﺭﺩ ﻭ ﺳﭙﺲ ﺑﻮﺳﻴﻠﻪ ‪ setup-crlsp‬ﻣﺴﻴﺮ ﺭﺍ ﺳﺎﺧﺖ‪.‬‬

‫‪ ٧‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ‬ ‫‪$ns enable-reroute $option‬‬

‫•‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺍﻣﻜﺎﻥ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ‪ MNS .‬ﭼﻨﺪ ﻧﻮﻉ‬ ‫ﻣﺴﻴﺮﻳﺎﺑﻲ ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ ﻛﻪ ﺗﻮﺳﻂ ﮔﺰﻳﻨﻪ ‪ $option‬ﻣﻲﺗﻮﺍﻥ ﻧﻮﻉ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺭﺍ ﺍﻧﺘﺨﺎﺏ ﻛﺮﺩ‪.‬‬ ‫ﻣﻘﺎﺩﻳﺮﻱ ﻛﻪ ‪ $option‬ﻣﻲﺗﻮﺍﻧﺪ ﺑﮕﻴﺮﺩ ﺑﻪ ﺷﺮﺡ ﺯﻳﺮ ﻫﺴﺘﻨﺪ‪:‬‬ ‫• ‪ : drop‬ﺍﮔﺮ ﺍﻳﻦ ﮔﺰﻳﻨﻪ ﺍﻧﺘﺨﺎﺏ ﺷﻮﺩ ﻫﻴﭻ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺟﺪﻳﺪﻱ ﺳﺎﺧﺘﻪ ﻧﻤﻲﺷﻮﺩ‪.‬‬ ‫• ‪ :L3‬ﺍﮔﺮ ﺍﻳﻦ ﮔﺰﻳﻨﻪ ﺍﻧﺘﺨﺎﺏ ﺷﻮﺩ ﺑﻌﺪ ﺍﺯ ﺍﻳﻨﻜﻪ ﻳﻚ ﻟﻴﻨﻚ ﺧﺮﺍﺏ ﺷﺪ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺟﺪﻭﻝ‬ ‫ﻣﺴﻴﺮﻳﺎﺑﻲ ﻻﻳﻪ ‪ ٣‬ﻳﻚ ﻣﺴﻴﺮ ﺩﻳﮕﺮ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫•‬

‫‪ :notify-prenegotiated‬ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺁﻥ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﻳﻚ ﭘﻴﻐﺎﻡ ‪Notification‬‬

‫‪ LDP‬ﺑﻪ ﮔﺮﻩﻫﺎﻱ ‪ UpStream‬ﺧﻮﺩ ﻣﻲﻓﺮﺳﺘﺪ‪.‬‬ ‫• ‪ :simple-dynamic‬ﻳﻚ ﻣﺴﻴﺮ ﺟﺪﻳﺪﻱ ﺑﻴﻦ ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺁﻥ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﻭ ﻣﻘﺼﺪ‬ ‫ﻣﻲﺳﺎﺯﺩ‪.‬‬ ‫•‬

‫‪ :shortest-dynamic‬ﻳﻚ ﻣﺴﻴﺮ ﺟﺪﻳﺪ ﺑﻴﻦ ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺁﻥ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﻭ ﮔﺮﻩ‬ ‫ﺑﻌﺪﻱ ﻣﻲﺳﺎﺯﺩ‪ .‬ﺍﻟﺒﺘﻪ ﺍﮔﺮ ﭼﻨﻴﻦ ﻣﺴﻴﺮﻱ ﻣﻮﺟﻮﺩ ﺑﺎﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٨‐٤‬‬ ‫‪$ns set-protection-lsp $stime $itime $lspid‬‬

‫•‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺮﺍﻱ ﭼﻚ ﻛﺮﺩﻥ ﺍﻳﻨﻜﻪ ﺧﺮﺍﺑﻲ ﺭﻭﻱ ﻣﺴﻴﺮﻱ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻩ ﻳﺎ ﺧﻴﺮ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :$stime‬ﺯﻣﺎﻥ ﺷﺮﻭﻉ ﺑﺮﺍﻱ ﭼﻚ ﻛﺮﺩﻥ‬ ‫‪ :$itime‬ﻓﺎﺻﻠﻪ ﺯﻣﺎﻧﻲ ﺑﻴﻦ ﻫﺮ ﺑﺎﺭ ﭼﻚ ﻛﺮﺩﻥ‬ ‫‪ :$lspid‬ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮﻱ ﻛﻪ ﺁﻥ ﺭﺍ ﻣﻲﺧﻮﺍﻫﺪ ﭼﻚ ﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode reroute-lsp-binding $w_lspid a_lspid‬‬

‫•‬

‫ﺗﻮﺳﻂ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻣﻲﺗﻮﺍﻥ ﻳﻚ ﻣﺴﻴﺮ ﺭﺍ ﺑﺎ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﻣﺮﺗﺒﻂ ﻛﺮﺩ ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﺍﮔﺮ ﺩﺭ ﻣﺴﻴﺮﻱ ﻛﻪ ﺩﺭ ﺣﺎﻝ ﻛﺎﺭ ﻛﺮﺩﻥ‬ ‫ﺍﺳﺖ ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺑﻴﺎﻓﺘﺪ ﺍﺯ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺑﺠﺎﻱ ﺁﻥ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬

‫‪ :w_lspid‬ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮﻱ ﻛﻪ ﺩﺭ ﺣﺎﻝ ﻛﺎﺭ ﻛﺮﺩﻥ ﺍﺳﺖ‪.‬‬ ‫‪ :a_lspid‬ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ‬ ‫‪$MPLSnode enable-reroute-egress-lsr‬‬

‫•‬

‫ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ‪ $MPLSnode‬ﺑﻪ ﻋﻨﻮﺍﻥ ‪ lsr‬ﭘﺸﺘﻴﺒﺎﻥ ﻋﻤﻞ ﻛﻨﺪ‪.‬‬

‫‪ ٨‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ‪ trace‬ﻛﺮﺩﻥ‬ ‫‪$MPLSnode trace-mpls‬‬

‫•‬

‫ﺑﺴﺘﻪﻫﺎﻱ ‪ MPLS‬ﺩﺭ ﮔﺮﻩ ‪ $MPLSnode‬ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode trace-ldp‬‬

‫•‬

‫ﺑﺴﺘﻪﻫﺎﻱ ‪ ldp‬ﺩﺭ ﮔﺮﻩ ‪ $MPLSnode‬ﺭﺍ ‪ trace‬ﻣﻲﻛﻨﺪ‪.‬‬ ‫‪$MPLSnode pft-dump‬‬

‫•‬

‫ﺟﺪﻭﻝ ‪ PFT‬ﮔﺮﻩ ‪ $MPLSnode‬ﺭﺍ ﻧﻤﺎﻳﺶ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪$MPLSnode erb-dump‬‬

‫•‬

‫ﺟﺪﻭﻝ ‪ ERB‬ﮔﺮﻩ ‪ $MPLSnode‬ﺭﺍ ﻧﻤﺎﻳﺶ ﻣﻲﺩﻫﺪ‪.‬‬ ‫‪$MPLSnode lib-dump‬‬

‫•‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٦٩‐٤‬‬

‫ﺟﺪﻭﻝ ‪ LIB‬ﮔﺮﻩ ‪ $MPLSnode‬ﺭﺍ ﻧﻤﺎﻳﺶ ﻣﻲﺩﻫﺪ‪.‬‬

‫‪ ٩‐٣‐٤‬ﻭﺍﺳﻂﻫﺎﻱ ﺑﺮﻧﺎﻣﻪﻧﻮﻳﺴﻲ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩ ﺩﺭ ‪namulator‬‬ ‫‪$ns ldp-request-color $color‬‬

‫•‬

‫‪$ns ldp-mapping-color $color‬‬

‫•‬

‫‪$ns ldp-withdraw-color $color‬‬

‫•‬

‫‪$ns ldp-release-color $color‬‬

‫•‬

‫‪$ns ldp-notification-color $color‬‬

‫•‬

‫ﺩﺳﺘﻮﺭﺍﺕ ﺑﺎﻻ ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﺩﺭ ‪ namulator‬ﺑﺴﺘﻪﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﭘﻴﻐﺎﻡﻫﺎﻱ ﻣﺨﺘﻠﻒ ‪ ldp‬ﺑﻪ ﺭﻧﮕﻬﺎﻱ‬ ‫ﻣﺸﺨﺺ ﺷﺪﻩ ﺩﻳﺪﻩ ﺷﻮﻧﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ‪ $color‬ﺭﻧﮓ ﺭﺍ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪٤-٤‬‬ ‫ƒ‬

‫ﻣﺜﺎﻟﻬﺎي از اﺳﺘﻔﺎدﻩ از ‪ MPLS‬در ﺷﺒﻴﻪﺳﺎز ‪:‬‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﻫﺪﺍﻳﺖ ﺑﺴﺘﻪﻫﺎ‬

‫‪ MPLS‬ﻣﻲﺗﻮﺍﻧﺪ ﺑﻪ ﻣﻨﻈﻮﺭ ﻫﺪﺍﻳﺖ ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﺟﻠﻮ )‪ (Forwarding‬ﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﺩ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﻛﺎﻓﻲ‬ ‫ﺍﺳﺖ ﺩﺭ ﺷﺒﻴﻪﺳﺎﺯ ﮔﺮﻫﻬﺎﻱ ﺣﻮﺯﻩ ‪ MPLS‬ﺑﻪ ﺻﻮﺭﺕ"‪ "MPLSnode‬ﺗﻌﺮﻳﻒ ﺷﻮﻧﺪ ﻭ ‪ ldp- agent‬ﺭﻭﻱ ﮔﺮﻩﻫﺎ‬ ‫ﻓﻌﺎﻝ ﺷﻮﺩ‪ .‬ﻣﺜﺎﻝ ﺯﻳﺮ ﺍﻳﻦ ﻣﺴﺌﻠﻪ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪:‬‬

‫ﺷﻜﻞ ‪ ١١‐١‬ﺗﻮﭘﻮﻟﻮﮊﻱ‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٧٠‐٤

set set

ns nf

[new Simulator] [open test-lsp.nam]

$ns

namtrace-all $nf

proc finish{} { global ns nf $ns flush-trace close $nf exec nam test-lsp.nam& exit 0 } #create topology set Node0 set LSR1 set LSR2 set LSR3 set LSR4 set LSR5 set Node6

[$ns [$ns [$ns [$ns [$ns [$ns [$ns

$ns $ns $ns $ns $ns $ns $ns

Node0 LSR1 LSR2 LSR1 LSR4 LSR5 LSR3

duplex-link duplex-link duplex-link duplex-link duplex-link duplex-link duplex-link

node] MPLSnode] C1 MPLSnode] MPLSnode] MPLSnode] MPLSnode] node] LSR1 LSR2 LSR3 LSR4 LSR5 LSR3 Node4

1M 1M 1M 1M 1M 1M 1M

10ms 10ms 10ms 10ms 10ms 10ms 10ms

DropTail DropTail DropTail DropTail DropTail DropTail DropTail

Part -1

#configure Ldp-agents $ns configure-ldp-on-all-mpls-nodes #configure Driven type $ns enable-control-driven #$ns enable-data-driven #$ns enable-on-demand #$ns enable-ordered

C2 C3 C4 C5 C6

# #create traffic generators #######################################Part-2 # set Src0 [new Application/Traffic/CBR[ $Src0 set packetSize_ 500 $Src0 set interval_ 0.010

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٧١‐٤

#create UDP agents and attach to src0 set Udp0 [new Agent/UDP[ $Src0 attach-agent $Udp0 #attach udp to node0 $ns attach-agent $Node0 $Udp0 #create agent reciever for udp packets and attach it to node reciever set Dst0 [new Agent/Null[ $ns attach-agent $Node4 $Dst0 #onnect sendr agent to reciever agent $ns connect $Udp0 $Dst0 $ns at 0.1 "$Src0 start" # # End Traffic Generator ####################################### # #get MPLS module of all MPLS nodes for {set i 0}{ $i<4 }{incr i} set MPLS-LSRi [$LSRi get-module }

MPLS]

#send to output all the tables of every MPLS node $ns at 5.0 “$MPLS-LSR1 dump-LIB”

$ns at 1.7 "$LSRmpls1 pft-dump" $ns at 1.7 "$LSRmpls1 erb-dump" $ns at 1.7 "$LSRmpls1 lib-dump" $ns at 1.7 "$LSRmpls2 pft-dump" $ns at 1.7 "$LSRmpls2 erb-dump" $ns at 1.7 "$LSRmpls2 lib-dump" $ns at 1.7 "$LSRmpls3 pft-dump" $ns at 1.7 "$LSRmpls3 erb-dump" $ns at 1.7 "$LSRmpls3 lib-dump"

Part-3

C7

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٢‐٤‬‬

‫ﺩﺭ ﻛﺪ ﺩﺍﺩﻩ ﺷﺪﻩ‪:‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C1‬ﻳﻚ ﮔﺮﻩ ‪ MPLS‬ﺗﻌﺮﻳﻒ ﻣﻲﻛﻨﺪ‬ ‫™ ﺩﺳﺘﻮﺭﺍﺕ ﻗﺴﻤﺖ ‪ Part1‬ﻟﻴﻨﻜﻬﺎﻱ ﺑﻴﻦ ﮔﺮﻩﻫﺎ ﺭﺍ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﻨﺪ‬ ‫™ ﺩﺳﺘﻮﺭ ‪ ldp-agent ،C2‬ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C3‬ﺭﻭﺵ ﺗﻮﺯﻳﻊ ‪ Control-driven‬ﺭﺍ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ‪.‬‬ ‫™ ﺍﮔﺮ ﺑﺨﻮﺍﻫﻴﻢ ﺍﺯ ﺭﻭﺵ ‪ data-driven‬ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻴﻢ ﺑﺎﻳﺪ ﺩﺳﺘﻮﺭ ‪ C3‬ﻏﻴﺮﻓﻌﺎﻝ ﻭ ﺩﺳﺘﻮﺭ ‪ C4‬ﺑﻪ ﻫﻤﺮﺍﻩ‬ ‫ﻳﻜﻲ ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ‪ C5‬ﻳﺎ ‪ C6‬ﻓﻌﺎﻝ ﺷﻮﺩ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭﺍﺕ ﻗﺴﻤﺖ ‪ Part-2‬ﺗﺮﺍﻓﻴﻜﻲ ﺑﻴﻦ ﮔﺮﻩ ﺻﻔﺮ ﻭ ﮔﺮﻩ ﭼﻬﺎﺭ ﺗﻮﻟﻴﺪ ﻣﻲﻛﻨﻨﺪ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﻧﻮﻉ ‪CBR‬‬

‫ﺍﺳﺖ ﻭ ﺑﻮﺳﻴﻠﻪ ﭘﺮﻭﺗﻜﻞ ‪ UDP‬ﺣﻤﻞ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C7‬ﻣﺎﺟﻮﻝ ‪ MPLS‬ﺍﺯ ﮔﺮﻩ ‪ MPLS‬ﺭﺍ ﻣﻲﮔﻴﺮﺩ‪ .‬ﺩﺭ ﻭﺍﻗﻊ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ‪MNS‬‬

‫ﻧﻤﻲ ﺗﻮﺍﻥ ﺍﺯ ﮔﺮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﻛﺮد ﺑﻠﻜﻪ ﺑﺎﻳﺪ ﺍﺯ ﻣﺎﺟﻮﻝ ‪ MPLS‬ﺁﻥ ﮔﺮﻩ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ ﻛﻪ ﺍﻳﻦ ﺩﺳﺘﻮﺭ‬ ‫ﻣﺎﺟﻮﻝ ‪ MPLS‬ﮔﺮﻩ ﻣﻮﺭﺩ ﻧﻈﺮ ﺭﺍ ﺩﺭ ﺍﺧﺘﻴﺎﺭ ﻣﺎ ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭﺍﺕ ‪ Part-3‬ﺟﺪﺍﻭﻝ ﻣﺮﺑﻮﻁ ﺑﻪ ﻫﺮ ﮔﺮﻩ ﺭﺍ ﭼﺎﭖ ﻣﻲﻛﻨﺪ ﺑﺮﺍﻱ ﻧﻤﻮﻧﻪ ﺟﺪﻭﻟﻬﺎﻱ ﮔﺮﻩ ‪ 2‬ﺭﺍ ﺩﺭ‬ ‫ﺣﺎﻟﺖ ‪ Control-driven‬ﺭﺍ ﺗﻮﺿﻴﺢ ﻣﻲﺩﻫﻴﻢ‪.‬‬

‫ﺟﺪﺍﻭﻝ ﻣﺮﺑﻮﻁ ﺑﻪ ‪LSR1‬‬

‫‪ ‐۱‬ﺟﺪﻭﻝ‬

‫‪PFT‬‬

‫‪AlternativePath‬‬

‫‪SLIBptr‬‬

‫‪LIBptr‬‬

‫‪PRio‬‬

‫‪Fid‬‬

‫‪FEC‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪0‬‬

‫‪0‬‬

‫‪-1‬‬

‫‪2‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪1‬‬

‫‪0‬‬

‫‪-1‬‬

‫‪4‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪2‬‬

‫‪0‬‬

‫‪-1‬‬

‫‪3‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪3‬‬

‫‪0‬‬

‫‪-1‬‬

‫‪5‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪-1‬‬

‫‪٧٣‐٤‬‬ ‫‪-1‬‬

‫‪0‬‬

‫‪4‬‬

‫‪6‬‬

‫‪-1‬‬

‫ﻫﻤﺎﻧﻄﻮﻛﻪ ﻗﺒﻼ ﺍﺷﺎﺭﻩ ﺷﺪ ﺩﺭ ﺟﺪﻭﻝ ‪ PFT‬ﻣﺸﺨﺺ ﻣﻲﺷﻮﺩ ﻛﻪ ﭼﻪ ﻓﻠﻮﻳﻲ ﺑﺎﻳﺪ ﺑﻪ ﭼﻪ ﺑﺮﭼﺴﺒﻲ ﻧﮕﺎﺷﺖ‬ ‫ﺷﻮﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺩﺭ ﺟﺪﻭﻝ ‪ PFT‬ﺑﺎﻻ ﻛﻪ ﻣﺮﺑﻮﻁ ﺑﻪ ﮔﺮﻩ ‪ LSR1‬ﺍﺳﺖ ﺁﻣﺪﻩ ﺍﺳﺖ ﻛﻪ ﻣﺸﺨﺼﺎﺕ‬ ‫ﻣﺮﺑﻮﻁ ﺑﻪ ﺭﺍﻩﮔﺰﻳﻨﻲ ﺑﺮﭼﺴﺐ‪ ،‬ﻓﻠﻮﻫﺎﻱ ﺑﻪ ﻣﻘﺼﺪ ‪ 3‬ﺩﺭ ﺭﺩﻳﻒ ﺷﻤﺎﺭﻩ ‪ 1‬ﺟﺪﻭﻝ ‪ LIB‬ﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ‪.‬‬ ‫‪ ‐۲‬ﺟﺪﻭﻝ ‪ERB‬‬

‫ﺍﺯ ﺁﻧﺠﺎﻳﻴﻜﻪ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺗﻨﻬﺎ ﺍﻧﺘﻘﺎﻝ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺑﺎ ﺭﻭﺵ ‪ MPLS‬ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ ﻭ ﻫﻴﭻ ﺳﺮﻭﻳﺴﻲ ﺍﺭﺍﺋﻪ‬ ‫ﻧﺸﺪﻩ ﺍﺳﺖ ﺟﺪﻭﻝ ‪ ERB‬ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺧﺎﻟﻲ ﺍﺳﺖ‪.‬‬ ‫‪ ‐۳‬ﺟﺪﻭﻝ‬

‫‪LIB‬‬

‫?‪Linkerror‬‬

‫‪LIBptr‬‬

‫‪oLabel‬‬

‫‪oIface‬‬

‫‪ILable‬‬

‫‪iIFace‬‬

‫‪#‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪0‬‬

‫‪2‬‬

‫‪1‬‬

‫‪-1‬‬

‫‪0‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪0‬‬

‫‪4‬‬

‫‪2‬‬

‫‪-1‬‬

‫‪1‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪2‬‬

‫‪2‬‬

‫‪3‬‬

‫‪-1‬‬

‫‪2‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪2‬‬

‫‪4‬‬

‫‪4‬‬

‫‪-1‬‬

‫‪3‬‬

‫‪-1‬‬

‫‪-1‬‬

‫‪4‬‬

‫‪2‬‬

‫‪5‬‬

‫‪-1‬‬

‫‪4‬‬

‫ﺍﺯ ﻃﺮﻳﻖ ﺟﺪﻭﻝ ‪ LIB‬ﻣﺸﺨﺺ ﻣﻲﺷﻮﺩ ﺍﮔﺮ ﺑﺴﺘﻪﺍﻱ ﺑﺎ ﺑﺮﭼﺴﺐ ﻭﺭﻭﺩﻱ ‪ ilable‬ﻭ ﺍﺯ ﭘﻮﺭﺕ ‪iIFace‬‬

‫ﺑﻴﺎﻳﺪ ﺑﺎﻳﺪ ﺑﺎ ﭼﻪ ﺑﺮﭼﺴﺒﻲ ‪ oLabel‬ﻭ ﺍﺯ ﻛﺪﺍﻡ ﭘﻮﺭﺕ ﺧﺮﻭﺟﻲ ‪ oIface‬ﺧﺎﺭﺝ ﺷﻮﺩ‪ .‬ﺍﮔﺮ ﺑﺴﺘﻪﺍﻱ ﺑﺎ‬ ‫ﺑﺮﭼﺴﺐ ﺻﻔﺮ ﺗﻮﺳﻂ ‪ LSR‬ﺩﺭﻳﺎﻓﺖ ﺷﻮﺩ ﺑﻪ ﺍﻳﻦ ﻣﻌﻨﺎﺳﺖ ﻛﻪ ﻳﺎ ‪ LSR‬ﻓﻌﻠﻲ ﻣﻘﺼﺪ ﺍﺳﺖ ﻭ ﻳﺎ ‪Egress‬‬

‫‪.Router‬‬ ‫ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﮔﺮﻩ ‪ LSR1‬ﺑﻪ ﮔﺮﻩﻫﺎﻱ ‪ LSR3 ،LSR2‬ﻭ ‪ Node0‬ﻣﺴﺘﻘﻴﻤﺎ ﻣﺘﺼﻞ ﺍﺳﺖ ﺑﻨﺎﺑﺮﺍﻳﻦ‬ ‫ﺑﺮﭼﺴﺐ ﺧﺮﻭﺟﻲ ﺑﺴﺘﻪﻫﺎﻳﻲ ﻛﻪ ﻣﻲﺧﻮﺍﻫﺪ ﺑﻪ ﺍﻳﻦ ﮔﺮﻩﻫﺎ ﺍﺭﺳﺎﻝ ﻛﻨﺪ ﺭﺍ ﺻﻔﺮ ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ‪ .‬ﻛﻪ ﺍﻳﻦ‬ ‫ﻣﺴﺌﻠﻪ ﺩﺭ ﺟﺪﻭﻝ ‪ LIB‬ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﻫﻤﺎﻧﻄﻮﺭﻳﻜﻪ ﺩﺭ ﺟﺪﻭﻝ ﻫﻢ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ﺑﺴﺘﻪﻫﺎﻳﻲ ﻛﻪ‬ ‫ﺑﻪ ﻣﻘﺼﺪ ﮔﺮﻩ ‪ LSR5 ،LSR3‬ﻭ ‪ Node6‬ﺑﻪ ‪ LSR1‬ﻣﺘﺼﻞ ﻧﻴﺴﺘﻨﺪ ﮔﺮﻩ ﺑﻌﺪﻱ ﻣﻘﺼﺪ ﺍﻳﻦ ﺑﺴﺘﻪﻫﺎ ﻧﻴﺴﺖ‬ ‫ﻭ ﺑﺮﭼﺴﺐ ﺧﺮﻭﺟﻲ ﺁﻧﻬﺎ ﻋﺪﺩﻱ ﻏﻴﺮ ﺻﻔﺮ ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٤‐٤‬‬

‫‪ ١‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ‬ ‫ﺷﺒﻴﻪﺳﺎﺯ ‪ MPLS‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﺮﻭﺗﻜﻞ ‪ cr-ldp‬ﺍﻧﺠﺎﻡ ﻣﻲ ﺩﻫﺪ‪ .‬ﺑﺮﺍﻱ ﺍﻳﻨﻜﻪ ﺍﺯ‬ ‫ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﺩ ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﻣﺴﻴﺮﻱ ﻛﻪ ﺗﻮﺳﻂ ﭘﺮﻭﺗﻜﻞ ‪ ldp‬ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺍﺳﺖ ﺣﺬﻑ ﺷﻮﺩ ﻭ‬ ‫ﺳﭙﺲ ﻣﺴﻴﺮ ﺗﻮﺳﻂ ﻣﺴﻴﺮﻳﺎﺑﻲ ﺻﺮﻳﺢ ﺳﺎﺧﺘﻪ ﺷﻮﺩ‪ .‬ﺍﻳﻦ ﻛﺎﺭ ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ‪ ldp-release‬ﻳﺎ ‪)ldp-withdraw‬‬ ‫ﺑﺴﺘﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ﺍﺯ ﭼﻪ ﻧﻮﻉ ﺭﻭﺵ ﺗﻮﺯﻳﻊ ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻣﺘﻔﺎﻭﺕ ﺍﺳﺖ( ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺭﻭﺍﻝ }‪ proc notify-erlsp-setup {node lspid‬ﺯﻣﺎﻧﻴﻜﻪ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ lspid‬ﺳﺎﺧﺘﻪ ﺷﺪ‪،‬‬ ‫ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ؛ ﻛﻪ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺩﺭ ﺍﻳﻦ ﺯﻣﺎﻥ ﻣﻲ ﺗﻮﺍﻥ ﻓﻠﻮﻳﻲ ﺭﺍ ﺑﻪ ﺍﻳﻦ ﻣﺴﻴﺮ ﻣﺘﺼﻞ ﻛﺮﺩ‪.‬‬ ‫™ ﺍﮔﺮ ﺩﺭ ﻛﺪ ﻗﺒﻠﻲ ﻛﺪ ﺯﻳﺮ ﺍﺿﺎﻓﻪ ﺷﻮﺩ ﺍﺯ ﺯﻣﺎﻥ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺑﺴﺘﻪﻫﺎ ﺍﺯ ﻣﺴﻴﺮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ٣٠٠٠‬ﺍﻧﺘﻘﺎﻝ‬ ‫ﻣﻲﻳﺎﺑﻨﺪ‬

‫‪C8‬‬

‫"‪"$LSRmpls3 send-ldp-withdraw-msg 3‬‬

‫‪$ns at 0.7‬‬

‫‪C9‬‬

‫"‪"$LSRmpls1 setup-erlsp 3 4_5_3 3000‬‬

‫‪$ns at 0.7‬‬

‫‪"$LSRmpls1 bind-flow-erlsp 4 -1‬‬

‫‪$ns at 0.9‬‬

‫‪C10‬‬

‫"‪3000‬‬

‫™ ﺩﺳﺘﻮﺭ ‪ C8‬ﺩﺭ ﺍﻳﻦ ﻛﺪ ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﮔﺮﻩ ‪ LSR3‬ﭘﻴﻐﺎﻡ ‪ ldp-withdraw‬ﺭﺍ ﺑﻪ ﻫﻤﻪ ﮔﺮﻩﻫﺎﻱ‬ ‫‪ UpStream‬ﺧﻮﺩ ﺑﻪ ﻣﻨﻈﻮﺭ ﺣﺬﻑ ﻣﺴﻴﺮ ﺑﻪ ﻣﻘﺼﺪ ‪ ۳‬ﺍﺭﺳﺎﻝ ﻛﻨﺪ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C9‬ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ۳۰۰۰‬ﺍﺯ ﮔﺮﻩ ‪ LSR1‬ﺑﻪ ﻣﻘﺼﺪ ﮔﺮﻩ ‪ ۳‬ﻭ ﺑﺎ‬ ‫ﻣﺴﻴﺮ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺳﺎﺧﺘﻪ ﺷﻮﺩ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C10‬ﻓﻠﻮﻫﺎﻱ ﺑﺎ ‪) FEC‬ﺩﺭ ﺍﻳﻨﺠﺎ ﻫﻤﺎﻥ ﻣﻘﺼﺪ ﺍﺳﺖ( ﻭ ﺑﺎ ﻣﺸﺨﺼﻪ ﻓﻠﻮ –‪)۱‬ﻳﻌﻨﻲ ﺑﺴﺘﻪﻫﺎ‬ ‫‪ Flow-id‬ﻧﺪﺍﺭﻧﺪ(ﺭﺍ ﺑﻪ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ۳۰۰۰‬ﻣﺘﺼﻞ ﻣﻲ ﻛﻨﺪ‪.‬‬ ‫™ ﺑﺮﺍﻱ ﺍﺯ ﺑﻴﻦ ﺭﻓﺘﻦ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﻣﻲﺗﻮﺍﻥ ﺍﺯ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﺩ‬ ‫"‪3000‬‬

‫‪$ns at 1.1 "$LSRmpls1 send-crldp-release-msg‬‬

‫ﺑﺎ ﺍﺿﺎﻓﻪ ﺷﺪﻥ ﺩﺳﺘﻮﺭ ‪ C9 ،C8‬ﻭ ‪ C10‬ﺟﺪﺍﻭﻝ ﮔﺮﻩ ‪ ۱‬ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﻣﻲ ﺷﻮﻧﺪ‪.‬‬

NS-2 ‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ‬

٧٥‐٤

PFT ‫‐ ﺟﺪﻭﻝ‬۱ FEC

Fid

Prio

LIBptr

SLIBptr

AlternativePath

2

-1

0

0

-1

-1

4

-1

0

1

-1

-1

5

-1

0

3

-1

-1

6

-1

0

2

-1

-1 ERB ‫‐ ﺟﺪﻭﻝ‬۲

FEC

LspId

LIBptr

SLIBptr

QoSid

3

300

2

-1

-1

aPATHptr iLable iIFace -1

-1

-1

FailNext *

‫ ﻭ ﻣﺸﺨﺼﺎﺕ‬.‫ ﻣﻨﺘﻘﻞ ﺷﻮﻧﺪ‬3000 ‫ ﺑﺎﻳﺪ ﺍﺯ ﻣﺴﻴﺮ ﺑﻪ ﻣﺸﺨﺼﻪ‬3 ‫ﺍﻳﻦ ﺟﺪﻭﻝ ﻣﻲﮔﻮﻳﺪ ﺑﺴﺘﻪﻫﺎﻱ ﺑﻪ ﻣﻘﺼﺪ‬ .‫ ﻗﺮﺍﺭ ﺩﺍﺭﺩ‬LIB ‫ ﺟﺪﻭﻝ‬۲ ‫ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﻳﻦ ﻣﺴﻴﺮ ﺩﺭ ﺭﺩﻳﻒ ﺷﻤﺎﺭﻩ‬ LIB ‫‐ ﺟﺪﻭﻝ‬۳

#

iIFace

iLable

oIface

oLabel

LIBptr

Linkerror?

0

-1

1

2

0

-1

-1

1

-1

2

4

0

-1

-1

2

-1

-1

4

7

-1

-1

3

-1

4

4

2

-1

-1

4

-1

5

2

4

-1

-1

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٦‐٤‬‬

‫‪ ٢‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ‬ ‫‪ ١‐٢‐٤‐٤‬ﻣﺴﻴﺮﻫﺎﻱ ‪CR-LSP‬‬ ‫ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﻧﺤﻮﻩ ﺍﺭﺍﺋﻪ ﺳﺮﻭﻳﺲ ﺑﻪ ﻛﻼﺳﻬﺎﻱ ﻣﺨﺘﻠﻒ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺑﺎ ﻣﺜﺎﻟﻲ ﺗﺸﺮﻳﺢ ﻣﻲﻛﻨﻴﻢ‪.١‬‬ ‫‪MPLS Domain‬‬

‫ﺷﻜﻞ ‪١٢‐١‬‬

‫ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﻜﻞ ‪ ۱۲‐۱‬ﺭﺍ ﺩﺭ ﻧﻈﺮ ﺑﮕﻴﺮﻳﺪ ﮔﺮﻩ ‪ Node0‬ﻣﻲﺧﻮﺍﻫﺪ ﺗﺮﺍﻓﻴﻜﻬﺎﻳﻲ ﺑﺎ ﺳﺮﻭﻳﺴﻬﺎﻱ ﻣﺘﻤﺎﻳﺰ ﺑﻪ ﮔﺮﻩ‬ ‫‪ Node4‬ﺍﺭﺳﺎﻝ ﻛﻨﺪ‪ .‬ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﺷﻜﻞ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ﺗﺮﺍﻓﻴﻜﻬﺎﻳﻲ ﺑﺎ ﺳﺮﻭﻳﺴﻬﺎﻱ ‪ RT ،HBT ،SBT‬ﻗﺮﺍﺭ‬ ‫ﺍﺳﺖ ﻣﻨﺘﻘﻞ ﺷﻮﻧﺪ‪ .‬ﻧﻮﻉ ﺗﺮﺍﻓﻴﻚ ﺑﺮﺍﻱ ﻫﻤﻪ ﺳﺮﻭﻳﺴﻬﺎ ‪ CBR‬ﻭ ﻧﺮﺥ ﺁﻧﻬﺎ ‪ 250Kbs‬ﺍﺳﺖ‪ .‬ﺑﻪ ﺟﺰ ‪ RT1‬ﻛﻪ ﻧﺮﺥ‬ ‫ﺁﻥ ‪ 350Kbs‬ﻭ ‪ RT2‬ﻛﻪ ﻧﺮﺥ ﺁﻥ ‪ 420Kbs‬ﺍﺳﺖ‪ .‬ﺑﻨﺎﺑﺮﺍﻳﻦ ﻣﺠﻤﻮﻉ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﭼﻬﺎﺭ ﺗﺮﺍﻓﻴﻚ‬ ‫ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺩﺭ ﺩﺳﺘﺮﺱ ﺑﻴﻦ ﮔﺮﻩ ‪ LSR1‬ﻭ ‪ LSR2‬ﺑﻴﺸﺘﺮ ﺍﺳﺖ‪.‬‬ ‫‹‬

‫ﻗﺴﻤﺘﻬﺎﻱ ﻣﺨﺘﻠﻒ ﺑﺮﻧﺎﻣﻪ‪:‬‬

‫‪ ‐۱‬ﻟﻴﻨﻜﻬﺎﻱ ﺑﻴﻦ ﮔﺮﻩ ﻫﺎ‬ ‫‪10ms DropTail‬‬ ‫‪10ms CBQ‬‬ ‫‪10ms CBQ‬‬ ‫‪10ms DropTail‬‬

‫‪$LSR1 2Mb‬‬ ‫‪$LSR2 1Mb‬‬ ‫‪$LSR3 1Mb‬‬ ‫‪$Node4 1Mb‬‬

‫‪$ns duplex-link $Node0‬‬ ‫‪$ns duplex-link $LSR1‬‬ ‫‪$ns duplex-link $LSR2‬‬ ‫‪$ns duplex-link $LSR3‬‬

‫ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﻛﺪ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ﻟﻴﻨﻚ ﺑﻴﻦ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺑﺎﻳﺪ ﺍﺯ ﻧﻮﻉ ﺻﻒ ‪ CBQ‬ﺗﻌﺮﻳﻒ ﺷﻮﺩ‪.‬‬ ‫‪ ‐۲‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺻﻒ ‪ CBQ‬ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﺍﻧﻮﺍﻉ ﻛﻼﺳﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ‬ ‫{‪#configure-cbq-for-SBTS {qlim cbq_qtype okborrow bw maxidle extradelay‬‬ ‫‪$ns cfg-cbq-for-SBTS‬‬ ‫‪10 DropTail 1 0.1 auto‬‬ ‫‪0 C1‬‬ ‫‪$ns cfg-cbq-for-HBTS‬‬ ‫‪10 DropTail 1 0.05 auto‬‬ ‫‪0‬‬ ‫‪$ns cfg-cbq-for-RTS‬‬ ‫‪10 DropTail 0 0.8 auto‬‬ ‫‪0‬‬ ‫‪1‬آﺪ آﺎﻣﻞ اﻳﻦ ﻣﺜﺎل دردارآﺘﻮري ‪ mns‬ﻣﻮﺟﻮد اﺳﺖ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٧‐٤‬‬ ‫‪0.05 auto‬‬

‫‪0‬‬

‫‪1‬‬

‫‪10 DropTail‬‬

‫‪$ns cfg-cbq-for-STS‬‬

‫‪$ns bind-flowid-to-SBTS 100 C2‬‬ ‫‪$ns bind-flowid-to-SBTS 200‬‬ ‫‪$ns bind-flowid-to-SBTS 300‬‬ ‫‪$ns bind-flowid-to-SBTS 400‬‬ ‫‪$ns bind-ldp-to-STS‬‬

‫™ ﺩﺳﺘﻮﺭ ‪ C1‬ﺭﻭﻱ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺳﺮﻭﻳﺲ ‪ SBTS‬ﺭﺍ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ‬ ‫ﺗﺮﺍﻓﻴﻚﻫﺎﻳﻲ ﻛﻪ ﻗﺮﺍﺭ ﺍﺳﺖ ﺑﻪ ﺁﻧﻬﺎ ﺳﺮﻭﻳﺲ ‪ SBTS‬ﺩﺍﺩﻩ ﺷﻮﺩ ﻭﺍﺭﺩ ﺻﻒ ﺍﺯ ﻧﻮﻉ ‪DropTail‬‬ ‫ﻣﻲﺷﻮﻧﺪ ﻛﻪ ﻃﻮﻝ ﺻﻒ ‪ 10‬ﺑﺴﺘﻪ ﺍﺳﺖ ﻭ ‪ 0.1‬ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﻣﻲﺗﻮﺍﻧﻨﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻨﺪ ﻭ ﺩﺭ‬ ‫ﺻﻮﺭﺗﻲ ﻛﻪ ﭘﺪﺭ ﺁﻥ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺍﺿﺎﻓﻲ ﺩﺍﺷﺘﻪ ﺑﺎﺷﺪ ﻣﻲﺗﻮﺍﻧﻨﺪ ﺍﺯ ﺁﻥ ﻧﻴﺰ ﺍﺳﺘﻔﺎﺩﻩ ﻛﻨﻨﺪ‪.‬‬ ‫ﺩﺳﺘﻮﺭﻫﺎﻱ ﺑﻌﺪﻱ ﺑﻪ ﻫﻤﻴﻦ ﺗﺮﺗﻴﺐ ﺳﺮﻭﻳﺴﻬﺎﻱ ‪ RTS ،HBTS‬ﻭ ‪ STS‬ﺭﺍ ﺭﻭﻱ ﻫﻤﻪ ﮔﺮﻩﻫﺎﻱ‬ ‫‪ MPLS‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﻨﺪ‪.‬‬ ‫™ ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ‪ C2‬ﺑﻪ ﻓﻠﻮﻫﺎﻱ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ 100‬ﺩﺭ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺳﺮﻭﻳﺲ ‪ SBTS‬ﺩﺍﺩﻩ‬ ‫ﻣﻲﺷﻮﺩ‪ .‬ﻭ ﺑﻪ ﻫﻤﻴﻦ ﺗﺮﺗﻴﺐ ﺩﺭ ﺩﺳﺘﻮﺭﻫﺎﻱ ﺑﻌﺪﻱ ﺑﻪ ﻓﻠﻮﻫﺎﻱ ﺑﺎ ﻣﺴﺨﺼﻪ ‪ 300 ،200‬ﻭ ‪400‬‬ ‫ﺳﺮﻭﻳﺴﻬﺎﻱ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‪ -٣‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺳﺎﺧﺘﻦ ﻣﺴﻴﺮﻫﺎﻱ ‪cr-lsp‬‬

‫‪C1‬‬

‫"‪$ns at 0.1 "$LSRmpls1 setup-erlsp 3 1_2_3 1000‬‬ ‫"‪$ns at 0.1 "$LSRmpls1 setup-erlsp 3 1_2_3 1100‬‬

‫‪###‬‬ ‫{‪#RtModule/MPLS instproc setup-crlsp {fec er lspid TRate BSize PSize SPrio HPrio‬‬ ‫‪#‬‬ ‫"‪$ns at 0.1 "$LSRmpls1 setup-crlsp 3 1_2_3 1200 350K 400B 200B 7 3‬‬ ‫‪C2‬‬ ‫"‪$ns at 1.0 "$SBT start‬‬ ‫"‪$ns at 1.0 "$HBT start‬‬ ‫"‪$ns at 1.0 "$RT1 start‬‬ ‫{‪#RtModule/MPLS instproc setup-crlsp {fec er lspid TRate BSize PSize SPrio HPrio‬‬ ‫‪#‬‬ ‫‪$ns at 10.0 "$LSRmpls1 setup-crlsp 3 1_2_3 1300 450K 400B 200B 7 3" C3‬‬

‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C1‬ﻭ ﺩﺳﺘﻮﺭ ﺑﻌﺪ ﺍﺯ ﺁﻥ ﺩﻭ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﺎ ﻣﺸﺨﺼﻪﻫﺎﻱ ‪ 1000‬ﻭ ‪ 1100‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C2‬ﻭ ‪ C3‬ﺩﻭ ‪ cr-lsp‬ﺑﺎ ﻣﺸﺨﺼﻪﻫﺎﻱ ‪ 1200‬ﻭ ‪ 1300‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪ .‬ﻛﻪ ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ﻭ‬ ‫ﻧﮕﻬﺪﺍﺭﻱ ﺍﻳﻦ ﺩﻭ ﻣﺴﻴﺮ ﻳﻜﺴﺎﻥ ﺍﺳﺖ ﻭ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ 1200‬ﺑﺮﺍﺑﺮ‬ ‫‪ 350‬ﻛﻴﻠﻮ ﺑﺎﻳﺖ ﻭ ﺑﺮﺍﻱ ﻣﺴﻴﺮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ 1300‬ﺑﺮﺍﺑﺮ ‪ 450‬ﻛﻴﻠﻮ ﺑﺎﻳﺖ ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٨‐٤‬‬

‫‪ ‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺍﺗﺼﺎﻝ ﻓﻠﻮﻫﺎ ﺑﻪ ﻣﺴﻴﺮﻫﺎ‬ ‫™ ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﮔﻔﺘﻪ ﺷﺪ ﺯﻣﺎﻧﻴﻜﻪ ﭘﻴﻐﺎﻡ ‪ CR-LDP Mapping‬ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﺴﻴﺮﻱ ﺑﺎ ﻣﺸﺨﺼﻪ‬ ‫‪ lspid‬ﺑﻪ ﮔﺮﻫﻲ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ node‬ﺑﺮﺳﺪ ﺭﻭﺍﻝ }‪ notify-erlsp-setup{node lspid‬ﻓﺮﺍﺧﻮﺍﻧﻲ‬ ‫ﻣﻲﺷﻮﺩ‪ .‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ﻣﺴﻴﺮ ‪ er-lsp‬ﻭ ‪ cr-lsp‬ﺗﻮﺳﻂ ﭘﺮﻭﺗﻜﻞ ‪ CR-LDP‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ ﻭ‬ ‫ﻫﻤﭽﻨﻴﻦ ﺑﺎ ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻦ ﺍﻳﻨﻜﻪ؛ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻣﺴﻴﺮﻫﺎ ﺍﺯ ﮔﺮﻩ ‪ LSR1‬ﺷﺮﻭﻉ ﻣﻲﺷﻮﻧﺪ‪ ،‬ﻣﻲﺗﻮﺍﻥ‬ ‫ﺍﻳﻦ ﺭﻭﺍﻝ ﺭﺍ ﺑﻪ ﮔﻮﻧﻪﺍﻱ ﺑﺎﺯﻧﻮﻳﺴﻲ ﻧﻤﻮﺩ ﻛﻪ ﺍﺯ ﺯﻣﺎﻥ ﺳﺎﺧﺘﻪ ﺷﺪﻥ ﺍﻳﻦ ﻣﺴﻴﺮﻫﺎ ﺍﻃﻼﻉ ﭘﻴﺪﺍ ﻛﺮﺩ ﻭ‬ ‫ﺳﭙﺲ ﺩﺭ ﺍﻳﻦ ﺯﻣﺎﻥ ﻣﻲﺗﻮﺍﻥ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺟﺮﺑﺎﻥ ﺧﺎﺻﻲ ﺭﺍ ﺑﻪ ﺍﻳﻦ ﻣﺴﻴﺮﻫﺎ ﻣﺘﺼﻞ ﻧﻤﻮﺩ‪ .‬ﺩﺭ‬ ‫ﻛﺪ ﺯﻳﺮ ﺍﻳﻦ ﺭﻭﺍﻝ ﺑﺎﺯﻧﻮﻳﺴﻲ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬

‫{ }‪proc notify-erlsp-setup {node lspid‬‬ ‫[‪set ns [Simulator instance‬‬ ‫"‪puts "[$ns now] nodeid=[$node id] : lspid=$lspid‬‬ ‫"[‪set module [$node get-module "MPLS‬‬ ‫{ }‪if {[$node id] == 1‬‬ ‫{ ‪switch $lspid‬‬ ‫{‬

‫‪1000‬‬

‫‪$module bind-flow-erlsp 4 100 $lspid‬‬ ‫}‬ ‫{‪1100‬‬ ‫‪$module bind-flow-erlsp 4 200 $lspid‬‬ ‫‪4 200 1‬‬

‫‪$module set-flow-prio‬‬ ‫}‬ ‫{‪1200‬‬

‫‪$module bind-flow-erlsp 4 300 $lspid‬‬ ‫}‬ ‫{‪1300‬‬ ‫‪$module bind-flow-erlsp 4 400 $lspid‬‬ ‫}‬ ‫{ ‪default‬‬ ‫"‪puts "error‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٧٩‐٤‬‬ ‫‪exit 1‬‬ ‫}‬ ‫}‬ ‫}‬ ‫}‬

‫™ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻛﺪ ﺑﺎﻻ ﺩﺭ ﺍﻳﻦ ﺭﻭﺍﻝ ﺑﺮﺭﺳﻲ ﻣﻲﺷﻮﺩ ﻛﻪ ﺍﮔﺮ ﻣﺸﺨﺼﻪ ﮔﺮﻩ ﺑﺮﺍﺑﺮ ﮔﺮﻩ ‪ LSR1‬ﺑﺎﺷﺪ ﺑﺎ‬ ‫ﺗﻮﺟﻪ ﺑﻪ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ﺟﺮﻳﺎﻥ ﺧﺎﺻﻲ ﺑﻪ ﺁﻥ ﻣﺘﺼﻞ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻓﻠﻮ ‪ 300‬ﻭ ‪ 400‬ﻛﻪ ﻗﺮﺍﺭ ﺍﺳﺖ ﺑﻪ ﺻﻮﺭﺕ ‪ RTS‬ﺳﺮﻭﻳﺲ ﺩﻫﻲ ﺷﻮﻧﺪ ﺑﻪ ﻣﺴﻴﺮﻫﺎﻱ‬ ‫‪ cr-lsp‬ﻣﺘﺼﻞ ﻣﻲﺷﻮﻧﺪ ﻭ ﺍﺯ ﺍﻳﻦ ﻃﺮﻳﻖ ﻣﻨﺘﻘﻞ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫™ ﻓﻠﻮﻫﺎﻱ ‪ 100‬ﻭ ‪ 200‬ﺑﻪ ﻣﺴﻴﺮﻫﺎﻱ ‪ er-lsp‬ﻣﺘﺼﻞ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫‪ ‐۵‬ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺑﺮﺍﻱ ﻫﺮ ﺗﺮﺍﻓﻴﻚ‬ ‫ﺷﻜﻞ ‪ ۱۳‐۱‬ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﺑﺮﺍﻱ ﻫﺮ ﺳﺮﻭﻳﺲ ﺩﺭ ﻃﻮﻝ ﺷﺒﻴﻪﺳﺎﺯﻱ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺍﺳﺖ‪ .‬ﻫﻤﺎﻧﻄﻮﺭ‬ ‫ﻛﻪ ﺩﺭ ﺷﻜﻞ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ‪ RT1‬ﻭ ‪ RT2‬ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺧﻮﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻨﺪ ﻭ ‪ HBT‬ﻭ ‪ SBT‬ﺍﺯ‬ ‫ﻣﺎﺑﻘﻲ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻧﻤﺎﻳﻨﺪ‪ .‬ﺑﻴﻦ ﺯﻣﺎﻥ ﺻﻔﺮ ﺗﺎ ‪ ١٠‬ﺛﺎﻧﻴﻪ ﻭ ‪ ٣٠‬ﺗﺎ ‪ ٤٠‬ﻛﻪ ﻫﻨﻮﺯ ﺗﺮﺍﻓﻴﻚ ‪ RT2‬ﺷﺮﻭﻉ‬ ‫ﻧﺸﺪﻩ ﻳﺎ ﻣﺘﻮﻗﻒ ﺷﺪﻩ ﺍﺳﺖ ‪ HBT‬ﻭ ‪ SBT‬ﺗﻤﺎﻡ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺧﻮﺩ ﺭﺍ ﺑﺪﺳﺖ ﻣﻲﺁﻭﺭﺩ‪.‬‬

‫ﺷﻜﻞ ‪ ١٣‐١‬ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺗﻮﺳﻂ ﺗﺮﺍﻓﻴﻜﻬﺎ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪۲‐۲‐۴‐۴‬‬

‫‪٨٠‐٤‬‬

‫‪ CR-LSP‬ﺑﺎ ﺧﺼﻮﺻﻴﺖ ﺑﻪ ﺯﻭﺭ ﮔﺮﻓﺘﻦ ﻣﻨﺎﺑﻊ‬

‫ﺩﺭ ﻣﺜﺎﻝ ﻗﺒﻞ ﺍﻭﻟﻮﻳﺖ ‪ RT1‬ﻭ ‪ RT2‬ﻳﻜﺴﺎﻥ ﺑﻮﺩ ﺣﺎﻝ ﺍﮔﺮ ﻧﺮﺥ ﺗﺮﺍﻓﻴﻚ ‪ RT1‬ﺭﺍ ﺑﻪ ‪ 600K‬ﻭ ﻧﺮﺥ‬ ‫ﺗﺮﺍﻓﻴﻚ ‪ RT2‬ﺭﺍ ﺑﻪ ‪ 700K‬ﺗﻐﻴﻴﺮ ﺩﻫﻴﻢ ﻭ ﻧﻴﺰ ﻣﺴﻴﺮﻫﺎﻱ ‪ CR-LSP‬ﺭﺍ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺗﻐﻴﻴﺮ ﺩﻫﻴﻢ‪:‬‬

‫‪#MplsNode instproc setup-crlsp {fec er lspid TRate BSize PSize SPrio HPrio‬‬ ‫"‪$ns at 0.1 "$LSRmpls1 setup-crlsp 3 1_2_3 1200 600K 400B 200B 7 4‬‬ ‫"‪$ns at 10.0 "$LSRmpls1 setup-crlsp 3 1_2_3 1300 700K 400B 200B 3 2‬‬

‫ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﻛﺪ ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ‪ RT1‬ﺩﺍﺭﺍﻱ ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ‪ ۷‬ﻭ ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ ‪ ۴‬و ‪ RT2‬ﺩﺍﺭﺍﻱ‬ ‫ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ‪ ۳‬ﻭ ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺭﻱ ‪ ۲‬ﺍﺳﺖ ﺑﻨﺎﺑﺮﺍﻳﻦ ﺍﻭﻟﻮﻳﺖ ﻧﺼﺐ ‪ RT2‬ﻛﻤﺘﺮ ﺍﺯ ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ ‪RT1‬‬

‫ﺍﺳﺖ)ﻳﻌﻨﻲ ﻧﺼﺐ ‪ RT2‬ﻧﺴﺒﺖ ﺑﻪ ﻧﮕﻬﺪﺍﺭﻱ ‪ RT1‬ﺩﺍﺭﺍﻱ ﺍﻭﻟﻮﻳﺖ ﺑﻴﺸﺘﺮﻱ ﺍﺳﺖ( ﺑﻨﺎﺑﺮﺍﻳﻦ ‪ RT2‬ﺩﺭ ﺯﻣﺎﻥ‬ ‫ﻧﺼﺐ ﺩﺭ ﺻﻮﺭﺕ ﻟﺰﻭﻡ )ﻳﻌﻨﻲ ﺍﮔﺮ ﻣﻨﺎﺑﻊ ﻛﺎﻓﻲ ﺩﺭ ﺩﺳﺘﺮﺱ ﻧﺒﺎﺷﺪ( ﻣﻲﺗﻮﺍﻧﺪ ﻣﻨﺎﺑﻊ ﺭﺍ ﺍﺯ ‪ RT1‬ﺑﮕﻴﺮﺩ‪ .‬ﺩﺭ‬ ‫ﺯﻳﺮ ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺑﺮﺍﻱ ﺍﻳﻦ ﻗﺴﻤﺖ ﻧﺸﺎﻥ ﺩﺍﺩﻩ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬

‫ﺷﻜﻞ ‪ ۱۴‐۱‬ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺗﻮﺳﻂ ﺗﺮﺍﻓﻴﻜﻬﺎ‬

‫ﻫﻤﺎﻧﻄﻮﺭ ﻛﻪ ﺩﺭ ﺷﻜﻞ ‪ ۱۴‐۱‬ﺩﻳﺪﻩ ﻣﻲﺷﻮﺩ ﺩﺭ ﺯﻣﺎﻥ ‪ ۱۱‬ﺛﺎﻧﻴﻪ ﻛﻪ ‪ RT2‬ﻣﻲﺧﻮﺍﻫﺪ ﻧﺼﺐ ﺷﻮﺩ ﺍﺯ ﺁﻧﺠﺎﻳﻲ ﻛﻪ‬ ‫ﻣﻨﺎﺑﻊ ﻛﺎﻓﻲ ﺩﺭ ﺩﺳﺘﺮﺱ ﻧﻴﺴﺖ ﻣﻨﺎﺑﻊ ﺭﺍ ﺍﺯ ‪ RT1‬ﻣﻲﮔﻴﺮﺩ ﻭ ﺍﺯ ﺍﻳﻦ ﺯﻣﺎﻥ ﺑﻪ ﺑﻌﺪ ﺑﻪ ﺻﻮﺭﺕ ‪Best Effort‬‬

‫ﺳﺮﻭﻳﺲﺩﻫﻲ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٣‐٢‐٤‐٤‬‬

‫‪٨١‐٤‬‬

‫‪Constraint Based Routing‬‬

‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ cr-lsp‬ﻣﻲﺗﻮﺍﻥ ﺗﺎ ﺟﺎﻳﻴﻜﻪ ﻣﻤﻜﻦ ﺍﺳﺖ ﺑﻪ ﺗﺮﺍﻓﻴﻚ ‪ RT‬ﺳﺮﻭﻳﺲ ﺩﺍﺩ ﻭﻟﻲ ﺗﻀﻤﻴﻨﻲ‬ ‫ﻭﺟﻮﺩ ﻧﺪﺍﺭﺩ ﻛﻪ ﺣﺘﻤﺎ ﺳﺮﻭﻳﺲ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺩﺍﺩﻩ ﺷﻮﺩ ﻳﺎ ﺧﻴﺮ‪ .‬ﻳﻚ ﺭﺍﻩ ﻣﻄﻤﺌﻦ ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ‬ ‫‪ Constraint Based Routing‬ﺍﺳﺖ‪ .‬ﺩﺭ ﺍﻳﻨﺠﺎ ﺑﺮﺭﺳﻲ ﻣﻲﺷﻮﺩﺁﻳﺎ ﻣﺴﻴﺮ ﻱ ﺑﺎ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﻭﺟﻮﺩ‬ ‫ﺩﺍﺭﺩ ﻳﺎ ﺧﻴﺮ ﺩﺭ ﺻﻮﺭﺗﻴﻜﻪ ﭼﻨﻴﻦ ﻣﺴﻴﺮﻱ ﻭﺟﻮﺩ ﺩﺍﺷﺖ ﺗﻮﺳﻂ ‪ cr-lsp‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﭼﻨﻴﻦ ﻛﺎﺭﻱ ﺑﺎﻳﺪ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﻗﺎﺑﻠﻴﺖ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ ﻣﻨﺎﺑﻊ ﺭﺍ ﺩﺍﺷﺘﻪ‬ ‫ﺑﺎﺷﻨﺪ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺩﺭ ﻛﺪ ﺑﺎﻻ ﻣﻲﺗﻮﺍﻥ ﻣﺴﻴﺮ ‪ RT2‬ﺭﺍ ﺑﻪ ﺍﻳﻦ ﺻﻮﺭﺕ ﺗﻌﻴﻴﻦ ﻧﻤﻮﺩ ﺑﺮﺍﻱ ﺍﻳﻦ ﻣﻨﻈﻮﺭ‬ ‫ﻛﺪﻫﺎﻱ ﺯﻳﺮ ﺭﺍ ﺟﺎﻳﮕﺰﻳﻦ ﺩﺳﺘﻮﺭ ‪ setup cr-lsp‬ﺑﺮﺍﻱ ﻣﺴﻴﺮ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ 1300‬ﻣﻲﻛﻨﻴﻢ‪.‬‬

‫‪C1‬‬

‫‪$ns collect-resource-info 4‬‬

‫‪set er [$sLSRmodule constraint-based-routing 3 700k] C2‬‬ ‫{ }‪if {$er != -1‬‬ ‫‪puts "--> The result of constraint-based routing for lspid 1300 : Explicit‬‬ ‫"‪Route=$er‬‬ ‫‪C3‬‬

‫‪$sLSRmodule setup-crlsp 3 1300 $700k 400B 200B 7 3‬‬ ‫}‬ ‫{ ‪else‬‬

‫‪puts "--> The result of constraint-based routing for lspid 1300 :‬‬ ‫"‪Explicit Route= No path‬‬ ‫}‬

‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C1‬ﻗﺎﺑﻠﻴﺖ ﺟﻤﻊﺁﻭﺭﻱ ﺍﻃﻼﻋﺎﺕ ﻣﻨﺎﺑﻊ ﺩﺭ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﻓﻌﺎﻝ ﻣﻲﺷﻮﺩ ﻭ ﮔﺮﻫـﻬﺎ‬ ‫ﻫﺮ ﺛﺎﻧﻴﻪ ﺍﻃﻼﻋﺎﺕ ﺭﺍﺟﻊ ﺑﻪ ﻣﻨﺎﺑﻊ ﺭﺍ ﺟﻤﻊﺁﻭﺭﻱ ﻣﻲﻛﻨﻨﺪ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C2‬ﭘﻴﻐﺎﻣﻲ ﻣﺒﻨﻲ ﺑﺮ ﺗﻘﺎﺿﺎﻱ ﻣﺴﻴﺮﻱ ﺑﺎ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ‪ 700k‬ﻭ ﺑﻪ ﻣﻘﺼﺪ ﮔﺮﻩ ‪ ۳‬ﺍﺭﺳﺎﻝ‬ ‫ﻣﻲﺷﻮﺩ‪ .‬ﺍﮔﺮ ﭼﻨﻴﻦ ﻣﺴﻴﺮﻱ ﻭﺟﻮﺩ ﺩﺍﺷﺖ ﻣﺴﻴﺮ ﺑﺮﮔﺮﺩﺍﻧﺪﻩ ﻣﻲﺷﻮﺩ ﻭ ﺩﺭ ﻏﻴﺮ ﺍﻳﻦ ﺻﻮﺭﺕ ﻋﺪﺩ ‪-‬‬

‫‪1‬ﺑﺮﮔﺮﺩﺍﻧﺪﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨٢‐٤‬‬

‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C3‬ﺩﺭ ﺻﻮﺭﺕ ﻭﺟﻮﺩ ﻣﺴﻴﺮ‪ ،‬ﺁﻥ ﻣﺴﻴﺮ ﺍﺯ ﻃﺮﻳﻖ ﻓﺮﻣﺎﻥ ‪ setup-crlsp‬ﺑﺎ ﻣﺸﺨﺼﻪ‬ ‫‪1300‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺍﺯ ﺁﻧﺠﺎﻳﻴﻜﻪ ﺗﻨﻬﺎ ﻣﺴﻴﺮ ﻣﻮﺟﻮﺩ ﺩﺍﺭﺍﻱ ‪ 700k‬ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺩﺭ ﺩﺳﺘﺮﺱ ﻧﻴﺴﺖ ﻓﺮﻣﺎﻥ‬ ‫‪ Costraint-based-routing‬ﭼﻴﻨﻦ ﻣﺴﻴﺮﻱ ﭘﻴﺪﺍ ﻧﻤﻲﻛﻨﺪ‪.‬‬

‫‪ ٣‐٤‐٤‬ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪ MPLS‬ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ‬ ‫ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﺑﺎ ﻣﺜﺎﻟﻲ ﭼﮕﻮﻧﮕﻲ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺗﻜﻨﻴﻚ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪ mns‬ﺗﺸﺮﻳﺢ ﻣﻲﺷﻮﺩ‪ .‬ﻓﺮﺽ ﻛﻨﻴﺪ‬ ‫ﺗﻮﭘﻮﻟﻮﮊﻱ ﺷﻜﻞ ‪ ١٥‐١‬ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﻗﺮﺍﺭ ﺍﺳﺖ ﺗﺮﺍﻓﻴﻜﻲ ﺍﺯ ‪ Node0‬ﺑﻪ ‪ Node19‬ﺍﺭﺳﺎﻝ ﺷﻮﺩ‪.‬‬

‫ﺷﻜﻞ ‪١٥‐١‬‬

‫ﻛﺪ ﺯﻳﺮ ﻳﻚ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺑﻪ ﻃﻮﺭ ﺻﺮﻳﺢ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻜﻲ ﻛﻪ ﻗﺮﺍﺭ ﺍﺳﺖ ﺍﺯ ﮔﺮﻩ ﺻﻔﺮ ﺑﻪ ﮔﺮﻩ ‪ ٩‬ﺭﺳﺎﻝ ﺷﻮﺩ ﺭﺍ‬ ‫ﻣﻲﺳﺎﺯﺩ ﻭ ﺩﺳﺘﻮﺭﺍﺕ ﺍﻭﻟﻴﻪ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺭﺍ ﻓﻌﺎﻝ ﻣﻲﻛﻨﺪ‬ ‫™ ﺑﺮﺍﻱ ﭘﺸﺘﻴﺒﺎﻧﻲ ﺍﺯ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺩﺭ ‪ MNS‬ﺍﺑﺘﺪﺍ ﺑﺎﻳﺪ ﮔﺮﻩﻫﺎﻱ ‪ MPLS‬ﺭﺍ ﻃﻮﺭﻱ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﻧﻤﻮﺩ ﺗﺎ ﺍﺯ ﺍﺗﻔﺎﻕ ﺍﻓﺘﺎﺩﻥ ﺧﺮﺍﺑﻲ ﺩﺭ ﻣﻨﺎﺑﻊ ﺍﻃﻼﻉ ﭘﻴﺪﺍ ﻛﻨﻨﺪ‪ .‬ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ‬ ‫ﺩﺳﺘﻮﺭ ‪ C1‬ﺍﻳﻦ ﻛﺎﺭ ﺭﺍ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪ .‬ﺩﺳﺘﻮﺭ ‪ C1‬ﺗﻤﺎﻡ ﮔﺮﻩ ﻫﺎﻱ ‪ MPLS‬ﺭﺍ ﻃﻮﺭﻱ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﺪ ﻛﻪ ﺍﺯ ﺯﻣﺎﻥ ‪ ١,٩‬ﺛﺎﻧﻴﻪ ﺗﺎ ﺯﻣﺎﻥ ‪ ١٠٠٠‬ﺛﺎﻧﻴﻪ ﻫﺮ ‪ ۰,۰۱‬ﺛﺎﻧﻴﻪ ﻭﺿﻌﻴﺖ‬ ‫ﻟﻴﻨﻜﻬﺎ ﺭﺍ ﺍﺯ ﻧﻈﺮ ﺧﺮﺍﺑﻲ ﺑﺮﺭﺳﻲ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨٣‐٤‬‬

‫™ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺗﻜﻨﻴﻚ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪ Mackam‬ﻭ ‪ Hashkin‬ﻧﻴﺎﺯ ﺍﺳﺖ ﮔﺮﻩ ‪PML‬‬

‫)ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ﮔﺮﻫﻲ ﻛﻪ ﺩﺭ ﺻﻮﺭﺕ ﺧﺮﺍﺏ ﺷﺪﻥ ﻳﻚ ﻟﻴﻨﻚ‪ ،‬ﺑﻴﻦ ﮔﺮﻩ ﻣﺒﺪﺍ ﻭ ﺍﻳﻦ ﮔﺮﻩ‬ ‫ﻣﺴﻴﺮ ﺟﺪﻳﺪ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ( ﻣﺸﺨﺺ ﺷﻮﺩ‪ .‬ﺩﺳﺘﻮﺭ ‪ LSR ،C2‬ﺷﻤﺎﺭﻩ ‪ ٩‬ﺭﺍ ﺑﻪ ﻋﻨﻮﺍﻥ‬ ‫‪ PML‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﺪ‪.‬‬

‫™ ﺩﺳﺘﻮﺭ ﻗﺴﻤﺖ ‪ Part1‬ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﻴﻦ ﮔﺮﻩ ‪ ١‬ﻭ ﮔﺮﻩ ‪ ۱۰‬ﻣﻲﺳﺎﺯﺩ ﻛﻪ ﻣﺸﺨﺼﻪ ﺍﻳﻦ ﻣﺴﻴﺮ‬ ‫ﺑﺮﺍﺑﺮ ﺑﺎ ‪ ۱۰۰۰‬ﺍﺳﺖ‪ .‬ﻭ ﺍﺯ ﺍﻳﻦ ﻣﺴﻴﺮ ﻣﻲﺗﻮﺍﻥ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻜﻬﺎﻳﻲ ﻛﻪ ﺍﺯ ﮔﺮﻩ ‪ ١‬ﻣﻲ ﺧﻮﺍﻫﻨﺪ ﺑﻪ ﮔﺮﻩ ‪۱۰‬‬ ‫ﺑﺮﻭﺩ ﻣﻲﺗﻮﺍﻧﺪ ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﻮﺩ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ﻗﺴﻤﺖ ‪ Part2‬ﻳﻚ ﻣﺴﻴﺮ ﻣﻘﻴﺪ ﻛﻪ ﺻﺮﺍﺣﺘﺎ ﺍﻋﻼﻡ ﺷﺪﻩ ﺍﺳﺖ ﺭﺍ ﺑﺎ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪، ۱۰۰۰‬‬ ‫ﺍﻧﺪﺍﺯﻩ ﺑﺎﻓﺮ ‪ ،500k‬ﺍﻧﺪﺍﺯﻩ ﺑﺎﻓﺮ ‪ 400‬ﺑﺎﻳﺖ ﺑﺮﺍﻱ ﺑﺴﺘﻪ ﻫﺎﻱ ﺑﻪ ﺍﻧﺪﺍﺯﻩ ‪ 200‬ﺑﺎﻳﺖ ﺭﺯﺭﻭ ﻣﻲﻛﻨﺪ‪ .‬ﺍﻭﻟﻮﻳﺖ‬ ‫ﻧﺼﺐ ﺍﻳﻦ ﻣﺴﻴﺮ ﺑﺮﺍﺑﺮ ‪ ٧‬ﻭ ﺍﻭﻟﻮﻳﺖ ﻧﮕﻬﺪﺍﺭﻱ ﺍﻳﻦ ﻣﺴﻴﺮ ﺑﺮﺍﺑﺮ ‪ ۵‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫™ ﺩﺳﺘﻮﺭ ‪ C3‬ﻣﺴﻴﺮ ﺳﺎﺧﺘﻪ ﺷﺪﻩ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ١٠٠٠‬ﺭﺍ ﺩﺭ ﺯﻣﺎﻥ ‪ ٠,٤‬ﺛﺎﻧﻴﻪ ﺑﻪ ﻓﻠﻮﻫﺎﻱ ﺑﻪ ﻣﻘﺼﺪ ‪ ۱۹‬ﻭ‬ ‫ﻣﺸﺨﺼﻪ ﻓﻠﻮ ‪ ١٠٠‬ﻣﺘﺼﻞ ﻣﻲﻛﻨﺪ‪ .‬ﺍﺯ ﺍﻳﻦ ﺯﻣﺎﻥ ﺑﻪ ﺑﻌﺪ ﺍﻳﻦ ﻓﻠﻮﻫﺎ ﺍﺯ ﻣﺴﻴﺮ ‪ ١٠٠٠‬ﺍﻧﺘﻘﺎﻝ ﻣﻲﻳﺎﺑﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪١‐٣‐٤‐٤‬‬

‫‪٨٤‐٤‬‬

‫ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺭﻭﺵ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪Hashkin‬‬

‫™ ﺍﺑﺘﺪﺍ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C1‬ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ﺍﺯ ﻧﻮﻉ ‪ Drop‬ﻓﻌﺎﻝ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C2‬ﻳﻚ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺍﺯ ‪ (PIL)LSR1‬ﺑﻪ ‪ PML)LSR9‬ﻛﻪ ﺩﺭ ﻛﺪ ‪ LSR9 ۱‬ﺑﻌﻨﻮﺍﻥ‬ ‫‪ PML‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﺷﺪﻩ ﺑﻮﺩ( ﺑﺎ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪ ٢٠٠٠‬ﻭ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ‪ C3‬ﻳﻚ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺍﺯ ‪ (PML)LSR9‬ﺑﻪ ‪ (PIL)LSR1‬ﺑﺎ ﻣﺸﺨﺼﻪ ﻣﺴﻴﺮ ‪ ٢٠٠۵‬ﻭ‬ ‫ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﻛﻪ ﺑﻪ ﻣﺴﻴﺮ ‪ 2000 PIL → PML‬ﻣﺘﺼﻞ ﺷﺪﻩ ﺍﺳﺖ ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C4‬ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ١٠٠٠‬ﺑﻪ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ) ‪ ( PIL → PML‬ﻣﺘﺼﻞ‬ ‫ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ‪ C5‬ﻣﺴﻴﺮ ﺍﺻﻠﻲ ‪ ١٠٠٠‬ﺩﺭ ﻃﻮﻝ ﺗﻤﺎﻡ ﮔﺮﻩﻫﺎﻱ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ) ‪ ( PIL → PML‬ﺑﻪ‬ ‫ﻣﺴﻴﺮ ‪ ( PML → PIL )۲۰۰۵‬ﻣﺘﺼﻞ ﻣﻲﺷﻮﺩ‪.‬‬

‫™ ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﺍﮔﺮ ﺑﻴﻦ ﻫﺮ ﺩﻭ ﮔﺮﻩ ﻣﺸﺨﺺ ﺷﺪﻩ ﺩﺭ ﻣﺴﻴﺮ ‪ ١٠٠٠‬ﺧﺮﺍﺑﻲ ﺍﺗﻔﺎﻕ ﺑﻴﺎﻓﺘﺪ ‪ .‬ﺑﺴﺘﻪ ﻫﺎ ﺍﺯ‬ ‫ﻫﻤﺎﻥ ﮔﺮﻩ ﺑﻪ ﺳﻤﺖ ‪ LSR1‬ﺑﺮﻣﻲﮔﺮﺩﻧﺪ ﻭ ﺳﭙﺲ ﺍﺯ ﻣﺴﻴﺮ ‪ ٢٠٠٠‬ﺑﻪ ﮔﺮﻩ ‪ LSR9‬ﺍﻧﺘﻘﺎﻝ ﻣﻲﻳﺎﺑﻨﺪ‪ .‬ﺩﺭ‬ ‫ﺻﻮﺭﺕ ﺑﺮ ﻃﺮﻑ ﺷﺪﻥ ﺧﺮﺍﺑﻲ ﺑﺴﺘﻪﻫﺎ ﻣﺠﺪﺩﺍ ﺍﺯ ﻣﺴﻴﺮ ‪ ١٠٠٠‬ﺍﻧﺘﻘﺎﻝ ﻣﻲﻳﺎﺑﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٢‐٣‐٤‐٤‬‬

‫‪٨٥‐٤‬‬

‫ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﺭﻭﺵ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪Makam‬‬ ‫‪C1‬‬

‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C1‬ﺭﻭﺵ ﻣﺴﻴﺮﻳﺎﺑﻲ ‪ notify-prenegotiated‬ﻓﻌﺎﻝ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C2‬ﻳﻚ ﻣﺴﻴﺮ ﺻﺮﻳﺢ ﺑﻴﻦ ‪ PIL‬ﺑﻪ ‪ PML‬ﺑﺎ ﻣﺸﺨﺼﻪ ‪ ۲۰۰۰‬ﺳﺎﺧﺘﻪ ﻣﻲﺷﻮﺩ ﻛﻪ ﺍﺯ‬ ‫ﺍﻳﻦ ﻣﺴﻴﺮ ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﻗﺮﺍﺭ ﺍﺳﺖ ﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﺩ‪.‬‬ ‫™ ﺩﺭ ﺩﺳﺘﻮﺭ ‪ C3‬ﻣﺴﻴﺮ ‪ ۲۰۰۰‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﻣﺴﻴﺮ ﺍﺻﻠﻲ‪ ،‬ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬ ‫™ ﻣﺠﻤﻮﻋﻪ ﺍﻳﻦ ﺩﺳﺘﻮﺭﺍﺕ ﺑﺎﻋﺚ ﻣﻲﺷﻮﺩ ﺯﻣﺎﻧﻲ ﻛﻪ ﺧﺮﺍﺑﻲ ﺩﺭ ﻣﺴﻴﺮ ﺍﺻﻠﻲ ﺍﺗﻔﺎﻕ ﺑﻴﺎﻓﺘﺪ ﭘﻴﻐﺎﻡ‬ ‫‪ Notification‬ﺑﻪ ﺭﻭﺗﺮ ‪ PIL‬ﺩﺍﺩﻩ ﺷﻮﺩ ﻭ ﭘﺲ ﺍﺯ ﺁﻥ ﻣﺴﻴﺮ ﭘﺸﺘﻴﺒﺎﻥ ﺟﺎﻳﮕﺰﻳﻦ ﻣﺴﻴﺮ ﺍﺻﻠﻲ‬ ‫ﺧﻮﺍﻫﺪ ﺷﺪ‪.‬‬ ‫‪ ۳‐۳‐۴‐۴‬ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪Simple-Dynamic‬‬

‫‪٤‐٣‐٤‐٤‬‬

‫ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪shortest-dynamic‬‬ ‫‪shortest-dynamic‬‬

‫‪٥‐٣‐٤‐٤‬‬

‫‪enable-reroute‬‬

‫‪$ns‬‬

‫ﻛﺪ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻣﺴﻴﺮﻳﺎﺑﻲ ﻣﺠﺪﺩ ‪L3‬‬

‫‪L3‬‬

‫‪enable-reroute‬‬

‫‪$ns‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪.٥‬‬

‫‪٨٦‐٥‬‬

‫ﻣﻜﺎﻧﻴﺰم ‪ Diffrentiated Service‬در ‪NS-2‬‬ ‫ﺩﺭ ﺍﻳﻦ ﻓﺼﻞ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺩﺭ ﺷﺒﻴﻪﺳﺎﺯ ‪ NS-2‬ﺑﺮﺭﺳﻲ ﻣﻲﺷﻮﺩ‪ DiffServ.‬ﺍﺯ ﻣﻜﺎﻧﻴﺰﻡﻫﺎﻱ‬

‫ﭘﻴﺸﻨﻬﺎﺩﻱ ﺗﻮﺳﻂ ‪ IETF‬ﺑﺮﺍﻱ ﺍﺭﺍﺋﻪ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺩﺭ ﺷﺒﻜﻪ ‪ IP‬ﻣﻲﺑﺎﺷﺪ ﻭ ﺭﺍﻩ ﺣﻠﻲ ﺩﺭ ﻻﻳﻪ ‪ ۳‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫‪ DiffServ‬ﺍﻣﻜﺎﻥ ﺍﺭﺍﺋﻪ ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺭﺍ ﻣﻴﺴﺮ ﻣﻲﺳﺎﺯﺩ ﻭ ﺑﻨﺎﺑﺮﺍﻳﻦ ﻛﻴﻔﻴﺖ ﺳﺮﻭﻳﺲ ﺭﺍ ﺩﺭ ﻳﻚ‬ ‫ﻣﺤﻴﻂ ﺑﻲﺍﺗﺼﺎﻝ ﺍﺭﺍﺋﻪ ﻣﻲﺩﻫﺪ‪ .‬ﺑﻌﺒﺎﺭﺗﻲ ﺩﻳﮕﺮ ‪ DiffServ‬ﻧﮕﺎﺷﺖ ﻛﻼﺱﻫﺎﻱ ﻣﺨﺘﻠﻒ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺑﻪ ﻓﻴﻠﺪ‬ ‫‪ DSCP‬ﺑﺴﺘﻪ ‪ IP‬ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ‪ .‬ﻭ ﺭﻭﺗﺮﻫﺎ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻣﻘﺪﺍﺭ ﺍﻳﻦ ﻓﻴﻠﺪ ﺭﻓﺘﺎﺭﻫﺎﻱ ﺍﺯ ﭘﻴﺶ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺭﺍ ﺑﺎ‬ ‫ﻛﻼﺳﻬﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﻨﺪ‪.‬‬

‫‪۱‐۵‬‬

‫ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺩﺭ ‪NS-2‬‬

‫‪ DiffServ‬ﺑﻪ ﺩﻭ ﺭﻭﺵ ﺩﺭ ‪ NS-2‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪:‬‬ ‫• ﺗﻮﺳﻂ ﺷﺮﻛﺖ ‪ Nortel‬ﻛﻪ ﺩﺭ ‪ NS-2-1b9a‬ﻧﺼﺐ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﺗﻮﺳﻂ ‪ Sean Murphy‬ﻛﻪ ﺗﺎ ﺑﻪﺣﺎﻝ ﺗﻨﻬﺎ ﺩﺭ‪ Ns-2-1b6a‬ﻧﺼﺐ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫‪ DiffServ‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺗﻮﺳﻂ ‪ Sean Morphy‬ﺑﺎ ‪ MPLS‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺗﻮﺳﻂ ‪ Gaeil Ahn‬ﻣﺠﺘﻤﻊ‬ ‫ﺷﺪﻩ ﺍﺳﺖ‪ ١‬ﻭ ﺑﻮﺳﻴﻠﻪ ﺍﻳﻦ ﺩﻭ ﻣﻲﺗﻮﺍﻥ ‪ MPLS‬ﺭﺍ ﺑﺎ ‪ DiffServ‬ﺑﺎ ﻫﻢ ﺑﻜﺎﺭﺑﺮﺩ‪ .‬ﻭﻟﻲ ‪ DiffServ‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ‬ ‫ﺷﺪﻩ ﺗﻮﺳﻂ ﺷﺮﻛﺖ ‪ Nortel‬ﻫﻨﻮﺯ ﺑﺎ ﻫﻴﭻ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ‪ MPLS‬ﻣﺠﺘﻤﻊ ﻧﺸﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﺩﺭ ﺍﻳﻦ ﮔﺰﺍﺭﺵ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﻛﻪ ﺗﻮﺳﻂ ﺷﺮﻛﺖ ‪ Nortel‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ؛ ﺭﺍ ﺷﺮﺡ ﻣﻲﺩﻫﻴﻢ‪.‬‬

‫‪٢-۵‬‬

‫ﻣﻌﻤﺎري ﻣﺎﺟﻮل ‪DiffServ‬‬

‫ﺍﻳﻦ ﻣﺎﺟﻮﻝ ﺳﻪ ﺟﺰﺀ ﺍﺻﻠﻲ ﺩﺍﺭﺩ‪:‬‬ ‫• ‪ :Policing‬ﺳﻴﺎﺳﺖﻫﺎﻳﻲ ﺍﺳﺖ ﻛﻪ ﺑﺎﻳﺪ ﺗﻮﺳﻂ ﻣﺪﻳﺮ ﺷﺒﻜﻪ ﺗﻌﺮﻳﻒ ﺷﻮﺩ ﻭ ﻣﺸﺨﺺ ﻣﻲﻛﻨﺪ ﻛﻪ ﻳﻚ‬ ‫ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﭼﻪ ﺳﻄﻮﺡ ﺳﺮﻭﻳﺴﻲ ﺭﺍ ﺑﺎﻳﺪ ﺍﺯﺷﺒﻜﻪ ﺩﺭﻳﺎﻓﺖ ﻛﻨﺪ‪.‬‬

‫‪ 1‬ﺍﻳﻦ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﻛﺎﻣﻞ ﻧﻴﺴﺖ‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨٧‐٥‬‬

‫• ‪ :Edge Router‬ﺭﻭﺗﺮ ﻟﺒﻪ ﺩﺭ ﺣﻮﺯﻩ ‪ DiffServ‬ﺍﺳﺖ ﻛﻪ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻭﺭﻭﺩ ﺑﺴﺘﻪ ﻳﺎ ﺧﺮﻭﺝ ﺑﺴﺘﻪ ﺑﻪ‬ ‫ﺣﻮﺯﻩ ‪ ،DiffServ‬ﺑﺴﺘﻪﻫﺎﻱ ‪ IP‬ﺭﺍ ﺑﻮﺳﻴﻠﻪ ﻳﻚ ﻛﺪ ﻛﻪ ﺑﺎ ﺳﻴﺎﺳﺖ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ‪Policing‬‬

‫ﻣﻄﺎﺑﻘﺖ ﺩﺍﺭﺩ ﻋﻼﻣﺖﮔﺬﺍﺭﻱ ﻣﻲﻛﻨﺪ ﻭ ﻳﺎ ﻋﻼﻣﺖ ﺭﺍ ﺍﺯ ﺭﻭﻱ ﺑﺴﺘﻪﻫﺎ ﺑﺮﻣﻲﺩﺍﺭﺩ‪.‬‬ ‫• ‪ : Core Router‬ﺭﻭﺗﺮﻫﺎﻱ ﻫﺴﺘﻪ ﺩﺭ ﺣﻮﺯﻩ ‪ DiffServ‬ﻫﺴﺘﻨﺪ ﻛﻪ ﻧﺤﻮﻩ ﺭﻓﺘﺎﺭ ﺑﺎ ﺳﻄﻮﺡ ﻣﺨﺘﻠﻒ‬ ‫ﻛﻼﺳﻬﺎﻱ ﺳﺮﻭﻳﺲ ﺩﺭ ﺁﻧﻬﺎ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺍﺳﺖ ﻭ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻛﺪ ﺑﺴﺘﻪ ﺳﺮﻭﻳﺲ ﻣﻨﺎﺳﺐ ﺭﺍ ﺑﻪ ﺁﻥ‬ ‫ﻣﻲﺩﻫﻨﺪ‪.‬‬ ‫ﺍﻳﻦ ﻋﻤﻠﻴﺎﺗﻬﺎ ﺩﺭ ﺩﻧﻴﺎﻱ ﻭﺍﻗﻌﻲ ﺭﻭﻱ ﺭﻭﺗﺮﻫﺎ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﻧﺪ ﻭﻟﻲ ﺩﺭ ﺍﻳﻦ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﻋﻤﻠﻴﺎﺕ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺭﻭﺗﺮ ﻟﺒﻪ ﻭ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺭﻭﻱ ﻟﻴﻨﻜﻬﺎ ﻭ ﺍﺯ ﻃﺮﻳﻖ ﺻﻒ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩ ﺍﺳﺖ‪.‬‬ ‫ﺩﺭ ﻛﻞ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﭼﻨﺪ ﻛﻼﺱ ﺍﺻﻠﻲ ﺩﺍﺭﺩ‪ .‬ﻛﻼﺱ ﺍﺻﻠﻲ ﺁﻥ ﻛﻼﺱ ‪ dsRedQueue‬ﻣﻲﺑﺎﺷﺪ)ﺩﺭ‬ ‫ﻓﺎﻳﻞ ‪ (dsRed‬ﻛﻪ ﻛﻼﺱ ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ )‪ (EdgeQueue‬ﻭ ﻛﻼﺱ ﺭﻭﺗﺮﻫﺎﻱ ﻣﺮﻛﺰﻱ) ‪ (CoreQueue‬ﺍﺯ ﺁﻥ‬ ‫ﻣﺸﺘﻖ ﺷﺪﻩﺍﻧﺪ‪ .‬ﺍﺯ ﺁﻧﺠﺎﻳﻴﻜﻪ ﺩﺭ ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﺑﺎﻳﺪ ﺳﻴﺎﺳﺘﻬﺎ ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﺷﻮﻧﺪ ﺗﺎ ﺑﺮ ﺍﺳﺎﺱ ﺁﻥ ﺑﺴﺘﻪﻫﺎ ﺭﺍ‬ ‫ﻋﻼﻣﺖﮔﺬﺍﺭﻱ ﻧﻤﺎﻳﻨﺪ ﻛﻼﺱ ﻟﺒﻪ ﻳﻚ ﻣﺘﻐﻴﺮ ﺍﺯ ﻛﻼﺱ ‪ PolicyClassifier‬ﺩﺍﺭﺩ ﻛﻪ ﺍﻳﻦ ﻛﻼﺱ ﺷﺎﻣﻞ‬ ‫ﺳﻴﺎﺳﺖﻫﺎ ﻣﻲﺑﺎﺷﺪ‪.‬‬

‫‪ ۱‐۲‐۵‬ﻣﻌﻤﺎﺭﻱ ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﻭ ﻣﺮﻛﺰﻱ‬ ‫ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﻭ ﻣﺮﻛﺰﻱ ﺑﺮﺍﻱ ﺗﻤﺎﻳﺰ ﻗﺮﺍﺭ ﺩﺍﺩﻥ ﺑﻴﻦ ﺗﺮﺍﻓﻴﻜـﻬﺎﻱ ﻣﺨﺘﻠﻒ ﻭ ﺭﺩﻩﺑﻨﺪﻱ ﻛﻼﺳﻬﺎ ﺍﺯ ﺻﻔﻬﺎﻱ ﻣﺠﺎﺯﻱ‬ ‫ﻭ ﻓﻴﺰﻳﻜﻲ ﻛﻪ ﺩﺭ ﻛﻼﺱ ‪ dsRedQueue‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩﺍﻧﺪ‪ ،‬ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻨﺪ‪ .‬ﺗﻮﺳﻂ ﺍﻳﻦ ﻗﺎﺑﻠﻴﺖ ﻣﻲﺗﻮﺍﻥ‬ ‫ﻫﺮ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺑﻪ ﻳﻚ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ﻧﺴﺒﺖ ﺩﺍﺩ ﻭ ﻧﺤﻮﻩ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺑﻪ ﺗﺮﺍﻓﻴﻜﻬﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻳﻚ‬ ‫ﻛﻼﺱ ﺭﺍ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺻﻔﻬﺎﻱ ﻣﺠﺎﺯﻱ ﺍﻧﺠﺎﻡ ﺩﺍﺩ‪ .‬ﺩﺭ ﻛﻞ ﻛﻼﺱ ‪ dsRedQueue‬ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ﺯﻳﺮ ﺭﺍ ﺑﻪ‬ ‫ﺭﻭﺗﺮﻫﺎﻱ ﻟﺒﻪ ﻭ ﻣﺮﻛﺰﻱ ﻣﻲﺩﻫﺪ‪:‬‬ ‫•‬

‫ﺍﻳﺠﺎﺩ ﭼﻨﺪﻳﻦ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ﺩﺭ ﻳﻚ ﻟﻴﻨﻚ‬

‫• ﺍﻳﺠﺎﺩ ﺟﻨﺪﻳﻦ ﺻﻒ ﻣﺠﺎﺯﻱ ﺩﺭ ﻳﻚ ﺻﻒ ﻓﻴﺰﻳﻜﻲ‬ ‫• ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺟﺪﻭﻟﻲ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ ﻫﺮ ﺑﺴﺘﻪ ﻣﺘﻌﻠﻖ ﺑﻪ ﻛﺪﺍﻡ ﺻﻒ ﻣﺠﺎﺯﻱ ﻭ ﻓﻴﺰﻳﻜﻲ ﺍﺳﺖ‪ .‬ﻭ ﺑﺮ‬ ‫ﺍﺳﺎﺱ ﺁﻥ ﺑﺴﺘﻪ ﺭﺍ ﻭﺍﺭﺩ ﺻﻒ ﻣﻨﺎﺳﺐ ﻣﻲﻧﻤﺎﻳﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨٨‐٥‬‬

‫• ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﻛﺪ ﺑﺴﺘﻪ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﺑﺴﺘﻪ ﺭﺍ ﺗﻌﻴﻴﻦ ﻣﻴـﻜﻨﺪ ﻭ ﺑﺮ ﻃﺒﻖ ﺁﻥ ﺑﺴﺘﻪ ﺭﺍ ﺳﺮﻭﻳﺲ‬ ‫ﻣﻲﺩﻫﺪ‪.‬‬ ‫ﻛﻼﺱ ‪ dsRedQueue‬ﺩﺍﺭﺍﻱ ﭼﻬﺎﺭ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ﻭ ﺳﻪ ﺻﻒ ﻣﺠﺎﺯﻱ ﻣﻲﺑﺎﺷﺪ‪ .‬ﺑﺎ ﺗﻌﺮﻳﻒ ﺻﻔﻬﺎﻱ ﻣﺠﺎﺯﻱ ﻭ‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﺁﻥ ﻗﺎﺩﺭ ﺧﻮﺍﻫﻴﻢ ﺑﻮﺩ ﺩﺭ ﻫﺮ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﻣﻜﺎﻧﻴﺰﻡ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﻭ ‪ ...‬ﺭﺍ ﺑﻪ ﻃﻮﺭ‬ ‫ﻣﺴﺘﻘﻞ ﺗﻌﺮﻳﻒ ﻛﻨﻴﻢ‪.‬‬ ‫ﻛﻼﺱ ‪ dsRedQueue‬ﻳﻚ ﺟﺪﻭﻝ ﺑﻪﻧﺎﻡ ‪ Per Hop Beheavior‬ﺩﺍﺭﺩ‪ ،‬ﺭﻭﺗﺮ ﻟﺒﻪ ﺑﺴﺘﻪ ﺭﺍ ﺑﺎ ﻛﺪﻱ‬ ‫ﻋﻼﻣﺖﮔﺬﺍﺭﻱ ﻣﻲﻛﻨﺪ ﻭ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻦ ﻛﺪ ﺑﻪ ﺑﺴﺘﻪ ﺳﺮﻭﻳﺲ ﻣﻲﺩﻫﺪ ﻭ ﻫﺮ ﺩﻭ ﻧﻮﻉ ﺭﻭﺗﺮ ﺗﻮﺳﻂ‬ ‫ﺟﺪﻭﻝ ‪ PHB‬ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﻨﺪ ﻛﻪ ﻫﺮ ﺑﺴﺘﻪ ﻣﺘﻌﻠﻖ ﺑﻪ ﻛﺪﺍﻡ ﺻﻒ ﻓﻴﺰﻛﻲ ﻭ ﻣﺠﺎﺯﻱ ﺍﺳﺖ‪ .‬ﺍﻳﻦ ﺟﺪﻭﻝ ﺩﺍﺭﺍﻱ‬ ‫ﺳﻪ ﻓﻴﻠﺪ ﺍﺳﺖ‪:‬‬ ‫‪ :codept‬ﻛﺪ ﻫﺮ ﺑﺴﺘﻪ ﻳﺎ ﻛﻼﺱ‬ ‫‪ :Queue‬ﺷﻤﺎﺭﻩ ﺻﻒ ﻓﻴﺰﻳﻜﻲ‬ ‫‪ :Precd‬ﺷﻤﺎﺭﻩ ﺻﻒ ﻣﺠﺎﺯﻱ‬

‫‪ ۲‐۲‐۵‬ﺳﻴﺎﺳﺖﻫﺎ‬ ‫ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﻳﻚ ﻛﻼﺱ ‪ Policy‬ﺩﺍﺭﺩ ﻛﻪ ﺍﻳﻦ ﻛﻼﺱ ﺑﻪ ﻫﻤﺮﺍﻩ ﺯﻳﺮﻛﻼﺳﻬﺎﻳﺶ ﺭﻭﺵ ﻋﻼﻣﺖﮔﺬﺍﺭﻱ‬ ‫ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﻨﺪ‪ .‬ﺩﺭ ﻭﺍﻗﻊ ﺳﻴﺎﺳﺘﻲ ﺑﻴﻦ ﮔﺮﻩ ﻣﺒﺪﺍ ﻭ ﻣﻘﺼﺪ ﺗﻌﺮﻳﻒ ﻣﻲﺷﻮﺩ ﻭ ﺳﭙﺲ ﺑﺮ ﺍﺳﺎﺱ ﺁﻥ‬ ‫ﺗﻤﺎﻡ ﺑﺴﺘﻪﻫﺎﻳﻲ ﻛﻪ ﻣﺘﻌﻠﻖ ﺑﻪ ﺍﻳﻦ ﺟﺮﻳﺎﻥ ﻫﺴﺘﻨﺪ ﺩﺍﺧﻞ ﻳﻚ ﺩﺳﺘﻪ ﺍﺯ ﻛﻼﺱﻫﺎ ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ‪.‬‬ ‫ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﺳﻴﺎﺳﺘﻬﺎ ﺑﺮﺍﻱ ﻫﺮ ﺟﺮﻳﺎﻥ ﺗﺮﺍﻓﻴﻚ ﺍﺯ ﺳﻪ ﻣﺸﺨﺼﻪ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪meter-type ،Policy-type :‬‬

‫ﻭ ‪.initialcode-point‬‬ ‫ﺍﺑﺘﺪﺍ ﺑﻪ ﻫﺮ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﻳﻚ ﻛﺪ ﺍﻭﻟﻴﻪ ﺍﺧﺘﺼﺎﺹ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﺗﻮﺳﻂ ‪ Policy-type‬ﺳﻴﺎﺳﺘﻲ ﻛﻪ‬ ‫ﺑﺎﻳﺪ ﺑﺮﺍﻱ ﺑﺴﺘﻪﻫﺎﻱ ﻫﺮ ﺟﺮﻳﺎﻥ ﺑﻪ ﻣﻨﻈﻮﺭ ﺗﻌﻴﻴﻦ ﺗﺨﻠﻒ ﺍﺯ‪ ،‬ﺣﺪﻭﺩ ﺍﺯ ﭘﻴﺶ ﺗﻌﻴﻴﻦ ﺷﺪﻩ‪ ،‬ﺍﺟﺮﺍ ﻣﻲﺷﻮﺩ‪ .‬ﻛﻪ ﺩﺭ‬ ‫ﺻﻮﺭﺕ ﺗﺨﻠﻒ‪ ،‬ﺩﻳﮕﺮ ﺑﺴﺘﻪﻫﺎ )ﺑﺮﺣﺴﺐ ﺳﻴﺎﺳﺖ( ﺑﺎ ﻛﺪ ﺍﻭﻟﻴﻪ ﻋﻼﻣﺖﮔﺬﺍﺭﻱ ﻧﻤﻲﺷﻮﻧﺪ‪ Meter-type .‬ﺭﻭﺵ ﻭ‬ ‫ﻧﻮﻉ ﺍﻧﺪﺍﺯﻩﮔﻴﺮﻱ ﺭﺍ ﺑﺮﺍﻱ ‪ Policy‬ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ‪ Policer .‬ﺑﺮ ﺍﺳﺎﺱ ‪ meter-type‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺑﻪ‬ ‫ﻣﻨﻈﻮﺭ ﺟﻠﻮﮔﻴﺮﻱ ﺍﺯ ﺗﺨﻠﻒ ﺍﻧﺪﺍﺯﻩﮔﻴﺮﻱ ﻣﻲﻛﻨﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٨٩‐٥‬‬

‫ﺯﻣﺎﻧﻴﻜﻪ ﺑﺴﺘﻪﺍﻱ ﺑﻪ ﺭﻭﺗﺮ ﻟﺒﻪ ﻣﻲﺭﺳﺪ ﺍﺑﺘﺪﺍ ﺗﻌﻴﻴﻦ ﻣﻲﺷﻮﺩ ﻛﻪ ﺑﺴﺘﻪ ﻣﺘﻌﻠﻖ ﺑﻪ ﻛﺪﺍﻡ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﺍﺳﺖ‬ ‫ﺳﭙﺲ ‪ meter-type‬ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ‪ policy‬ﺗﻤﺎﻡ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﺁﻥ ﺟﺮﻳﺎﻥ ﺭﺍ ﺑﻪ ﺭﻭﺯ ﺩﺭ ﻣﻲﺁﻭﺭﺩ‪.‬‬ ‫ﺳﭙﺲ ‪ Policer‬ﻓﺮﺍﺧﻮﺍﻧﻲ ﻣﻲﺷﻮﺩ ﺗﺎ ﺑﺮ ﺍﺳﺎﺱ ‪ policy-type‬ﻭ ﻛﺪ ﺍﻭﻟﻴﻪ ﺑﺴﺘﻪ ﻭ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻓﻠﻮ‬ ‫ﺗﻌﻴﻴﻦ ﻛﻨﺪ ﭼﮕﻮﻧﻪ ﺑﺎﻳﺪ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﻋﻼﻣﺖﮔﺬﺍﺭﻱ ﻛﻨﺪ‪ .‬ﻭ ﺑﺎﻻﺧﺮﻩ ﺑﺮﺍﺳﺎﺱ ﻛﺪ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺑﺴﺘﻪ ﺑﻪ ﺩﺍﺧﻞ‬ ‫ﺻﻒ ﻣﻨﺎﺳﺒﻲ ﻣﻲﺭﻭﺩ‪.‬‬

‫‪ ٣‐٢‐٥‬ﺍﻧﻮﺍﻉ ‪policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﻣﺎﺟﻮﻝ ‪DiffServ‬‬ ‫ﺩﺭ ﺣﺎﻝ ﺣﺎﺿﺮ ‪ policy ۶‬ﺩﺭ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ ﻛﻪ ﺍﻳﻦ ‪ Policy‬ﻫﺎ ﺍﺯ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺯﻳﺮ‬ ‫ﺑﺮﺍﻱ ﺍﻧﺪﺍﺯﻩﮔﻴﺮﻱ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﻨﺪ‪:‬‬ ‫• ‪ :CIR١‬ﻧﺮﺥ ﺍﻃﻼﻋﺎﺕ )ﺑﺮ ﺣﺴﺐ ﺑﻴﺖ ﺑﺮ ﺛﺎﻧﻴﻪ(‬ ‫• ‪ :٢PIR‬ﻧﺮﺥ ﺑﻴﺸﻴﻨﻪ ﺍﻃﻼﻋﺎﺕ )ﺑﺮ ﺣﺴﺐ ﺑﻴﺖ ﺑﺮ ﺛﺎﻧﻴﻪ(‬ ‫• ‪ : CBS3‬ﺍﻧﺪﺍﺯﻩ ﺑﺮﺳﺖ )ﺑﺮ ﺣﺴﺐ ﺑﺎﻳﺖ(‬ ‫• ‪ :EBS4‬ﻣﻘﺪﺍﺭ ﺯﻳﺎﺩﻱ ﺑﺮﺳﺖ )ﺑﺮ ﺣﺴﺐ ﺑﺎﻳﺖ(‬ ‫• ‪ :PBS5‬ﺍﻧﺪﺍﺯﻩ ﺑﻴﺸﻴﻨﻪ ﺑﺮﺳﺖ )ﺑﺮ ﺣﺴﺐ ﺑﺎﻳﺖ(‬ ‫• ‪ :C bucket‬ﺍﻧﺪﺍﺯﻩ ﻓﻌﻠﻲ ﺳﻄﻞ‬ ‫• ‪ :E bucket‬ﺍﻧﺪﺍﺯﻩ ﻓﻌﻠﻲ ﺯﻳﺎﺩﻱ ﺳﻄﻞ‬ ‫• ‪ :P bucket‬ﺍﻧﺪﺍﺯﻩ ﻓﻌﻠﻲ ﺑﻴﺸﻴﻨﻪ ﺳﻄﻞ‬ ‫• ﻣﻴﺎﻧﮕﻴﻦ ﻧﺮﺥ ﺑﺴﺘﻪ ﺁﺧﺮ)‬ ‫• ‪ :TSW window length‬ﻣﻴﺎﻧﮕﻴﻦ ﻧﺮﺥ ﺗﺮﺍﻓﻴﻚ ﺭﺍ ﺩﺭ ﻓﺎﺻﻠﻪ ﺯﻣﺎﻧﻲ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺍﻧﺪﺍﺯﻩ ﻣﻲﮔﻴﺮﺩ‪.‬‬ ‫‪Policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‹‬

‫)‪Time SlidingWindow With 2 Color Mapping(TSW2CMPolicer‬‬

‫‪Commited Information Rate‬‬

‫‪1‬‬

‫‪Peak Information rate‬‬ ‫‪Commited Burst Size‬‬ ‫‪Excess Burstt Size‬‬

‫‪2‬‬

‫‪Peak Burst Size‬‬

‫‪3‬‬ ‫‪4‬‬

‫‪5‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩٠‐٥‬‬

‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ‪) CIR‬ﻧﺮﺥ ﺍﻃﻼﻋﺎﺕ ﺗﻌﻴﻴﻦ ﺷﺪﻩ( ﺑﺴﺘﻪﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ﻳﻚ ﻛﻼﺱ ﺭﺍ ﺭﺩﻩﺑﻨﺪﻱ)ﺑﻪ ﻣﻨﻈﻮﺭ ﺣﺬﻑ‬ ‫ﺑﺴﺘﻪﻫﺎ( ﻣﻲﻛﻨﺪ ﻭ ﺩﺍﺭﺍﻱ ﺩﻭ ﺳﻄﺢ ﺭﺩﻩﺑﻨﺪﻱ ﺍﺳﺖ‪ .‬ﺍﮔﺮ ‪ CIR‬ﺍﺯ ﺣﺪﻱ ﺍﺿﺎﻓﻪﺗﺮ ﺷﻮﺩ ﺑﺴﺘﻪﻫﺎ ﺩﺭ ﺭﺩﻩﭘﺎﻳﻴﻨﺘﺮ‬ ‫ﻗﺮﺍﺭ ﻣﻲﮔﻴﺮﻧﺪ ﻭ ﻛﺪ ﻣﺮﺑﻮﻁ ﺑﻪ ﺍﻳﻦ ﺭﺩﻩ ﺑﻪ ﺁﻧﻬﺎ ﻣﻨﺘﺴﺐ ﻣﻲﺷﻮﺩ‪.‬‬ ‫‹‬

‫)‪Time Sliding Window With (TSW#CMPolicer‬‬

‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﻭ ﭘﺎﺭﺍﻣﺘﺮ ‪ CIR‬ﻭ ‪ PIR‬ﺭﺩﻩﺑﻨﺪﻱ ﺑﺴﺘﻪﻫﺎ ﺭﺍ ﺑﻪ ﻣﻨﻈﻮﺭ ﭼﮕﻮﻧﮕﻲ ﺣﺬﻑ ﺁﻧﻬﺎ ﺍﻧﺠﺎﻡ ﻣﻲﺩﻫﺪ ﻭ ﺳﻪ‬ ‫ﺭﺩﻩ ﺑﺮﺍﻱ ﺍﻧﺠﺎﻡ ﺍﻳﻨﻜﺎﺭﺩﺍﺭﺩ‪ :‬ﺯﻣﺎﻧﻴﻜﻪ ‪ CIR‬ﺍﺯ ﺣﺪ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺍﺿﺎﻓﻪﺗﺮ ﻣﻲﺷﻮﺩ ﺍﺣﺘﻤﺎﻻ ﻛﺪ ﻣﺮﺑﻮﻁ ﺑﻪ ﺭﺩﻩ‬ ‫ﻣﻴﺎﻧﻲ ﺑﻪ ﺑﺴﺘﻪﻫﺎ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ ﻭ ﺯﻣﺎﻧﻴﻜﻪ ‪ PIR‬ﺍﺯ ﺣﺪ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺍﺿﺎﻓﻪﺗﺮ ﻣﻲﺷﻮﺩ ﺍﺣﺘﻤﺎﻻ ﻛﺪ ﻣﺮﺑﻮﻁ ﺑﻪ‬ ‫ﺭﺩﻩ ﭘﺎﻳﻴﻨﻲ ﺑﻪ ﺑﺴﺘﻪﻫﺎ ﺩﺍﺩﻩ ﻣﻲﺷﻮﺩ‪.‬‬

‫‹‬

‫)‪:Token Bucket(tokenBucketPolicer‬‬

‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﺩﻭ ﭘﺎﺭﺍﻣﺘﺮ ‪ CIR‬ﻭ ‪ CBS‬ﺍﺯ ﺩﻭ ﺭﺩﻩ ﺑﺮﺍﻱ ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪ .‬ﻳﻚ ﺑﺴﺘﻪ ﺩﺭ ﺻﻮﺭﺗﻴﻜﻪ‬ ‫ﺑﺰﮔﺘﺮ ﺍﺯ ﺍﻧﺪﺍﺯﺓ ﺳﻄﻞ ﺑﺎﺷﺪ‪ ،‬ﺑﺎ ﺭﺩﻩ ﭘﺎﻳﻴﻨﺘﺮ ﻛﺪ ﻣﻲﺷﻮﺩ‪.‬‬

‫‹‬

‫)‪:Single RateThree Color Marker(srTCMPolicer‬‬

‫ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ‪ CBS ،CIR‬ﻭ ‪ ،EBS‬از ﺳﻪ ﺭﺩﻩ ﺑﺮﺍﻱ ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪.‬‬

‫‹‬

‫)‪:Two Rate Three Color Marker(trTCMPolicer‬‬

‫ﺍﺯ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ‪ PIR ،CBS ،CIR‬ﻭ ‪ PBS‬ﺑﺮﺍﻱ ﺗﻌﻴﻴﻦ ﺳﻪ ﺭﺩﻩ ﺑﻪ ﻣﻨﻈﻮﺭ ﺣﺬﻑ ﺑﺴﺘﻪﻫﺎ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪ ۴‐۲‐۵‬ﺳﺎﺧﺘﺎﺭ ‪ Policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ‬ ‫ﻫﻤﻪ ‪Policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﺑﺎﻻ ﺑﻪ ﺻﻮﺭﺕ ﻳﻚ ﺯﻳﺮﻛﻼﺱ ﺍﺯ ‪ dsPolicy‬ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﺪﻩﺍﻧﺪ‪.‬‬ ‫ﻧﻜﺘﻪ ‪ :‬ﺑﺮﺍﻱ ﺍﻋﻤﺎﻝ ‪ Policy‬ﻭ ‪ meter‬ﺧﺎﺹ ﺍﺯ ﺗﻮﺍﺑﻊ ‪ applyMeter‬ﻭ ‪ applyPolicer‬ﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺍﺳﺖ ﻛﻪ‬ ‫ﺍﻳﻦ ﺗﻮﺍﺑﻊ ﻣﺠﺎﺯﻱ ﺑﻮﺩﻩ ﻭ ﺩﺭ ﻛﻼﺱ ‪ dsPolicy‬ﺗﻌﺮﻳﻒ ﺷﺪﻩﺍﻧﺪ ﻭ ‪Policy‬ﻫﺎﻱ ﻛﺎﺭﺑﺮ ﻧﻴﺰ ﺑﻪ ﻫﻤﻴﻦ ﻃﺮﻳﻖ‬ ‫ﻣﻲﺗﻮﺍﻧﻨﺪ ﺩﺭ ﻣﺎﺟﻮﻝ ﭘﻴﺎﺩﻩﺳﺎﺯﻱ ﺷﻮﻧﺪ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩١‐٥‬‬

‫‪Policy‬ﻫﺎﻱ ﺗﻌﻴﻴﻦ ﺷﺪﻩ ﺑﺮﺍﻱ ﻫﺮ ﻛﻼﺱ ﺗﺮﺍﻓﻴﻚ ﺩﺭ ﺟﺪﻭﻝ ‪ Policy‬ﺩﺭ ﻛﻼﺱ ‪ PolicyClassifier‬ﺫﺧﻴﺮﻩ‬ ‫ﻣﻲﺷﻮﻧﺪ‪ .‬ﻓﻴﻠﺪﻫﺎﻱ ﺍﻳﻦ ﺟﺪﻭﻝ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ initial-codepoint ،meter-type ،policer-type‬ﻭ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻛﻪ ﺗﻮﺳﻂ ‪ Policer‬ﺍﺯ ﺁﻧﻬﺎ ﺍﺳﺘﻔﺎﺩﻩ‬ ‫ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻛﻼﺱ ‪ PolicerClassifier‬ﻫﻤﭽﻨﻴﻦ ﺷﺎﻣﻞ ﻳﻚ ﺟﺪﻭﻝ ‪ Policer‬ﺍﺳﺖ ﻛﻪ ﺍﻳﻦ ﺟﺪﻭﻝ ﺑﺎ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﻛﺪ ﺍﻭﻟﻴﻪ‬ ‫ﻭ ﻧﻮﻉ ‪ Policy‬ﻣﻘﺎﺩﻳﺮ ﻛﺪﻫﺎﻱ ﺭﺩﻩﻫﺎﻱ ﭘﺎﻳﻴﻨﺘﺮ ﻳﻚ ﻛﻼﺱ ﺭﺍ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ‪.‬‬

‫‪٣-۵‬‬

‫ﭘﻴﻜﺮﺑﻨﺪي ﭘﺎراﻣﺘﺮهﺎي ﻣﺎﺟﻮل ‪DiffServ‬‬

‫‪ ۱‐۳‐۵‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺻﻒ‬ ‫ﻓﺮﻣﺎﻧﻬﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﻗﺴﻤﺖ‪ ،‬ﻣﻲﺗﻮﺍﻧﻨﺪ ﺑﺮﺍﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻧﻤﻮﻧﻪﻫﺎﻳﻲ ﻛﻪ ﺍﺯ ﻛﻼﺳﻬﺎﻱ ‪ edgeQueue‬ﻭ‬ ‫‪ coreQueue‬ﮔﺮﻓﺘﻪ ﺷﺪﻩﺍﻧﺪ ﺍﺳﺘﻔﺎﺩﻩ ﺷﻮﻧﺪ‪.‬‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﺭﻭﺗﺮﻫﺎ ﺑﺎﻳﺪ ﺩﺭ ﺯﻣﺎﻥ ﺷﺒﻴﻪﺳﺎﺯﻱ ﻭ ﻗﺒﻞ ﺍﺯ ﺍﻳﻨﻜﻪ ﺑﺴﺘﻪﺍﻱ ﺍﻧﺘﻘﺎﻝ ﻳﺎﺑﺪ ﺍﻧﺠﺎﻡ ﺷﻮﺩ‪.‬‬ ‫ﺗﻌﺪﺍﺩ ﺻﻒﻫﺎﻱ ﻓﻴﺰﻳﻜﻲ ﻭ ﻣﺠﺎﺯﻱ ﻫﺮ ﻟﻴﻨﻚ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﺷﻮﻧﺪ‪:‬‬ ‫_‪$dsredq set numQueue‬‬

‫‪2‬‬

‫‪2‬‬

‫‪$dsredq setNumPrec‬‬

‫_‪ NumQueue‬ﻣﺘﻐﻴﺮ ﻛﻼﺱ ‪ dsRedQueeu‬ﻣﻲﺑﺎﺷﺪ ﻭ ﺗﻌﺪﺍﺩ ﺻﻔﻬﺎﻱ ﻓﻴﺰﻳﻜﻲ ﻛﻪ ﺩﺭ ﻳﻚ ﻟﻴﻨﻚ ﻧﮕﺎﺷﺖ‬ ‫ﻣﻲﺷﻮﻧﺪ ﺭﺍ ﻧﺸﺎﻥ ﻣﻲﺩﻫﺪ‪ .‬ﻣﻘﺪﺍﺭ ﭘﻴﺶ ﻓﺮﺽ ﺁﻥ ‪ ۴‬ﺍﺳﺖ ﻭ ﺑﻪ ﺻﻮﺭﺕ ﺑﺎﻻ ﻣﻲﺗﻮﺍﻥ ﺁﻥ ﺭﺍ ﺗﻐﻴﻴﺮ ﺩﺍﺩ‪ .‬ﻣﻘﺪﺍﺭ‬ ‫‪ setNumQueeu‬ﺗﻌﺪﺍﺩ ﺻﻔﻬﺎﻱ ﻣﺠﺎﺯﻱ ﺭﺍ ﺩﺍﺧﻞ ﻳﻚ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ﺗﻌﻴﻴﻦ ﻣﻲﻛﻨﺪ‪.‬‬ ‫ﺗﻌﺪﺍﺩ ﺻﻔﻬﺎﻱ ﻓﻴﺰﻳﻜﻲ ﻭ ﻣﺠﺎﺯﻱ ﺩﺍﺭﺍﻱ ﻣﺤﺪﻭﺩﻳﺖ ﻫﺴﺘﻨﺪ)ﺣﺪﺍﻛﺜﺮ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ‪ ۴‬ﻭ ﺣﺪﺍﻛﺜﺮ ﺗﻌﺪﺍﺩ ﺻﻒ‬ ‫ﻣﺠﺎﺯﻱ ‪ (۳‬ﻭﻟﻲ ‪ TCL‬ﻣﻘﺪﺍﺭ ﺍﻳﻦﺩﻭ ﭘﺎﺭﺍﻣﺘﺮ ﺭﺍ ﺑﺮﺍﻱ ﺧﻄﺎ ﭼﻚ ﻧﻤﻲﻛﻨﺪ‪ .‬ﻓﺮﺽ ﺑﺮ ﺍﻳﻦ ﺍﺳﺖ ﻛﻪ ﻛﺎﺭﺑﺮ ﺍﺯ ﺍﻳﻦ‬ ‫ﻣﺤﺪﻭﺩﻳﺖ ﺍﻃﻼﻉ ﺩﺍﺭﺩ‪.‬‬ ‫ﭘﻴﻜﺮﺑﻨﺪﻱ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ‪ Red‬ﺑﺮﺍﻱ ﻫﺮ ﺻﻒ ﻣﺠﺎﺯﻱ ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﻣﻲﺑﺎﺷﺪ‪:‬‬ ‫‪$dsredq configQ 0 1 10 20 0.10‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩٢‐٥‬‬

‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ‪ RED‬ﺭﺍ ﺑﺮﺍﻱ ﻳﻚ ﺻﻒ ﻣﺠﺎﺯﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﻣﻲﻛﻨﺪ ﺩﺭ ﻣﺜﺎﻝ ﺑﺎﻻ ﺻﻒ ﻣﺠﺎﺯﻱ ﺷﻤﺎﺭﻩ‬ ‫ﻳﻚ ﻣﺮﺑﻮﻁ ﺑﻪ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ﺷﻤﺎﺭﻩ ﺻﻔﺮ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺷﺪﻩ ﺍﺳﺖ‪ .‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ‬ ‫ﺍﺯ‪:‬‬ ‫_‪ :thresh‬ﻛﻤﺘﺮﻳﻦ ﺣﺪ ﺁﺳﺘﺎﻧﻪ ﺑﺮﺍﻱ ﻣﻴﺎﻧﮕﻴﻦ ﺍﻧﺪﺍﺯﻩ ﺻﻒ)ﺑﺮ ﺣﺴﺐ ﺑﺴﺘﻪ(‪ .‬ﺩﺭ ﻣﺜﺎﻝ ﺑﺎﻻ ﺍﻳﻦ ﻣﻘﺪﺍﺭ ‪۱۰‬‬ ‫ﻣﻲﺑﺎﺷﺪ_‪ :maxthresh‬ﺑﻴﺸﺘﺮﻳﻦ ﺣﺪ ﺁﺳﺘﺎﻧﻪ ﺑﺮﺍﻱ ﻣﻴﺎﻧﮕﻴﻦ ﺍﻧﺪﺍﺯﻩ ﺻﻒ)ﺑﺮﺣﺴﺐ ﺑﺴﺘﻪ(‪ .‬ﺩﺭ ﻣﺜﺎﻝ ﺑﺎﻻ ﻣﻘﺪﺍﺭ‬ ‫ﺍﻳﻦ ﭘﺎﺭﺍﻣﺘﺮ ‪ ۲۰‬ﻣﻲﺑﺎﺷﺪ‪.‬‬ ‫‪$dsredq addPHBEntry $codepoint $phisicalq $virtualq‬‬

‫ﺍﻳﻦ ﻓﺮﻣﺎﻥ ﻳﻚ ﺭﻛﻮﺭﺩ ﺑﻪ ﺟﺪﻭﻝ ‪ PHB‬ﺍﺿﺎﻓﻪ ﻣﻲﻛﻨﺪ‪ .‬ﻛﻪ ﺗﻮﺳﻂ ﺍﻳﻦ ﺟﺪﻭﻝ ﻛﺪ ‪ $codepoint‬ﺑﻪ ﺻﻒ‬ ‫ﻣﺠﺎﺯﻱ ‪ $virtualq‬ﺩﺭ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ‪ $phisicalq‬ﻧﮕﺎﺷﺖ ﻣﻲﺷﻮﺩ‪:‬‬ ‫‪$dsredq addPHBEntry 11 0 1‬‬

‫ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﻛﺪ ‪ ١١‬ﺑﻪ ﺻﻒ ﻣﺠﺎﺯﻱ ‪ ۱‬ﺩﺭ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ‪ ٠‬ﻧﮕﺎﺷﺖ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻧﻜﺘﻪ ‪ :‬ﺩﺭ ‪ ns‬ﺑﺴﺘﻪﻫﺎ ﺑﻪ ﺻﻮﺭﺕ ﭘﻴﺶﻓﺮﺽ ﺩﺍﺭﺍﻱ ﻛﺪ ﺻﻔﺮ ﻫﺴﺘﻨﺪ‪ .‬ﺑﻨﺎﺑﺮﺍﻳﻦ ﺑﺮﺍﻱ ﭘﺮﺩﺍﺯﺵ ﺗﺮﺍﻓﻴﻚ ‪Best‬‬

‫‪ Effort‬ﺑﺎﻳﺪ ﺭﻛﻮﺭﺩﻱ ﺑﺮﺍﻱ ﻛﺪ ﺻﻔﺮ ﺩﺭ ﺟﺪﻭﻝ ‪ PHB‬ﺍﺿﺎﻓﻪ ﺷﻮﺩ‪.‬‬ ‫‪$dsredq meanPktSize $Mpsize‬‬

‫ﺑﺮﺍﻱ ﻣﺤﺎﺳﺒﺔ ﻣﻴﺎﻧﮕﻴﻦ ﻃﻮﻝ ﺻﻒ ‪ ،RED‬ﻣﻴﺎﻧﮕﻴﻦ ﺍﻧﺪﺍﺯﺓ ﺑﺴﺘﻪﻫﺎ ﻣﻮﺭﺩ ﻧﻴﺎﺯﺍﺳﺖ ﻛﻪ ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ﺑﺎﻻ‬ ‫ﻣﻲﺗﻮﺍﻥ ﺍﻳﻦ ﭘﺎﺭﺍﻣﺘﺮ ﺭﺍ ﺗﻌﻴﻴﻦ ﻧﻤﻮﺩ‪.‬‬ ‫‪$dsredq setMREDMode $mred $phisicalq‬‬

‫ﻣﺘﻐﻴﺮ ﻣﺪ ‪ MRED‬ﺑﺎﻳﺪ ﺑﻪ ﻣﻨﻈﻮﺭ ﻣﺤﺎﺳﺒﻪ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺷﻮﺩ‪ .‬ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ﺑﺎﻻ ﺍﻳﻨﻜﺎﺭ ﺭﺍ ﻣﻲﺗﻮﺍﻥ‬ ‫ﺍﻧﺠﺎﻡ ﺩﺍﺩ‪ .‬ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﻣﺪﻫﺎﻱ ﻣﺨﺘﻠﻔﻲ ﺭﺍ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪:‬‬ ‫)‪ :RIO-C(RIO Coupled‬ﺍﺣﺘﻤﺎﻝ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ )ﺩﺭ ‪ out of profile‬ﻳﻌﻨﻲ ﺯﻣﺎﻧﻲﻛﻪ ﻃﻮﻝ ﺻﻒ‬ ‫ﺍﺯ ﺣﺪ ﺑﻴﺸﺘﺮﻳﻦ ﺑﺰﺭﮔﺘﺮ ﻣﻲﺷﻮﺩ( ﺑﺮ ﺍﺳﺎﺱ ﻣﻴﺎﻧﮕﻴﻦ ﻭﺯﻧﻲ ﻃﻮﻝ ﻫﻤﻪ ﺻﻔﻬﺎﻱ ﻣﺠﺎﺯﻱ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪ .‬ﺩﺭ‬ ‫ﺣﺎﻟﻴﻜﻪ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ )ﺩﺭ ‪ in-profile‬ﻳﻌﻨﻲ ﺯﻣﺎﻧﻲﻛﻪ ﻃﻮﻝ ﺻﻒ ﺍﺯ ﺣﺪ ﻛﻤﺘﺮﻳﻦ ﺑﺰﺭﮔﺘﺮ ﻣﻲﺷﻮﺩ(‬

‫ﺗﻨﻬﺎ ﺑﺮ ﺍﺳﺎﺱ ﻣﻴﺎﻧﮕﻴﻦ ﻭﺯﻧﻲ ﻃﻮﻝ ﺻﻒ ﻣﺠﺎﺯﻱ ﺁﻥ ﺍﺳﺖ‪.‬‬ ‫)‪ : RIO-D(RIO De-coupled‬ﺷﺒﻴﻪ ‪ RIO-C‬ﺍﺳﺖ‪ .‬ﺑﻪ ﺟﺰ ﺍﻳﻨﻜﻪ ﺍﺣﺘﻤﺎﻝ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻦ ﺑﺴﺘﻪﻫﺎ ﺩﺭ‬ ‫ﺯﻣﺎﻧﻲﻛﻪ ﻃﻮﻝ ﺻﻒ ﺍﺯ ﺣﺪ ﺑﻴﺸﺘﺮﻳﻦ ﺑﺰﺭﮔﺘﺮ ﻣﻲﺷﻮﺩ ﺑﺮ ﺍﺳﺎﺱ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﻣﺠﺎﺯﻱ ﺍﺳﺖ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩٣‐٥‬‬

‫• )‪ :WRED(Weighted RED‬ﻫﻤﻪ ﺍﺣﺘﻤﺎﻻﺕ ﺑﺮ ﺍﺳﺎﺱ ﺍﻧﺪﺍﺯﻩ ﺗﻨﻬﺎ ﻳﻚ ﺻﻒ ﺍﺳﺖ‪.‬‬ ‫• ‪ :DROP‬ﻣﺎﻧﻨﺪ ﺻﻒ ‪ DropTail‬ﻋﻤﻞ ﻣﻲﻛﻨﺪ ﺑﻪ ﺍﻳﻦ ﺻﻮﺭﺕ ﻛﻪ ﺯﻣﺎﻧﻲ ﻛﻪ ﺍﻧﺪﺍﺯﻩ ﻃﻮﻝ ﺻﻒ ﺑﺮﺍﺑﺮ‬ ‫ﺁﺳﺘﺎﻧﻪ ﻛﻤﺘﺮﻳﻦ ﺷﺪ ﺑﺴﺘﻪﻫﺎ ﻣﺎﻧﻨﺪ ﻣﻜﺎﻧﻴﺰﻡ ‪ DropTail‬ﺣﺬﻑ ﻣﻲﺷﻮﻧﺪ‪.‬‬

‫‪ ١‐١‐٣‐٥‬ﭘﻴﻜﺮﺑﻨﺪﻱ ﺷﻤﺎﻱ ﺯﻣﺎﻥﺑﻨﺪﻱ ﺑﻴﻦ ﺻﻒﻫﺎﻱ ﻓﻴﺰﻳﻜﻲ‬ ‫ﻣﺎﺟﻮﻝ ‪ Diffserv‬ﺷﻤﺎﻫﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﺯﻳﺮ ﺭﺍ ﺑﺮﺍﻱ ﺳﺮﻭﻳﺲ ﺩﺍﺩﻥ ﺑﻪ ﺻﻔﻬﺎﻱ ﻓﻴﺰﻳﻜﻲ ﭘﺸﺘﻴﺒﺎﻧﻲ ﻣﻲﻛﻨﺪ‪.‬‬ ‫•‬

‫)‪Weighted Round Robin(WRR‬‬

‫•‬

‫)‪Weighted Interleaved Round Robin(WIRR‬‬

‫•‬

‫)‪Round Robin(RR‬‬

‫•‬

‫)‪Priority(PRI‬‬

‫ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﭘﻴﺶﻓﺮﺽ ‪ RR‬ﻣﻲﺑﺎﺷﺪ‪ .‬ﺑﻮﺳﻴﻠﻪ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﻲﺗﻮﺍﻥ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﺭﺍ ﺗﻐﻴﻴﺮ ﺩﺍﺩ‪.‬‬ ‫‪$dsredq setSchedularMode $shema‬‬

‫اﻳﻦ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﺭﺍ ﺑﻪ ‪ $shema‬ﺗﻐﻴﻴﺮ ﻣﻲﺩﻫﺪ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ‪ WRR‬ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ‬ ‫ﺗﻌﺮﻳﻒ ﻣﻲﺷﻮﺩ‪:‬‬ ‫‪$dsredq setSchedularMode WRR‬‬ ‫‪$dsredq addQueueWeights 1 5‬‬

‫ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺩﺳﺘﻮﺭ ﺍﻭﻝ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ﺭﺍ ﺑﻪ ‪ WRR‬ﺗﻐﻴﻴﺮ ﻣﻲﺩﻫﺪ ﻭ ﺩﺳﺘﻮﺭ ﺩﻭﻡ ﻭﺯﻥ ﺻﻒ ﺍﻭﻝ ﺭﺍ ﺑﺮﺍﺑﺮ ‪٥‬‬ ‫ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ‪.‬‬ ‫ﺩﺭ ﻣﻮﺭﺩ ﺷﻤﺎﻱ ﺯﻣﺎﻧﺒﻨﺪﻱ ‪ ،PRI‬ﺍﻭﻟﻮﻳﺖ ﺻﻔﻬﺎ ﺑﻪ ﺗﺮﺗﻴﺐ ﺷﻤﺎﺭﺓ ﺻﻒ ﺍﺳﺖ‪ .‬ﻭ ﺻﻒ ﺻﻔﺮ ﺩﺍﺭﺍﻱ ﺑﺎﻻﺗﺮﻳﻦ‬ ‫ﺍﻭﻟﻮﻳﺖ ﻣﻲﺑﺎﺷﺪ‪ .‬ﻫﻤﭽﻨﻴﻦ ﻣﻲﺗﻮﺍﻥ ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﺑﺮﺍﻱ ﻫﺮ ﺻﻒ ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﻣﺤﺪﻭﺩ‬ ‫ﻛﺮﺩ‪:‬‬ ‫‪$dsredq addQueueRate $queue $bw‬‬ ‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻣﻴﺰﺍﻥ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺭﺍ ﺑﺮﺍﻱ ﺻﻒ ‪ $queue‬ﺑﻪ ‪ $bw‬ﻣﺤﺪﻭﺩ ﻣﻲﻛﻨﺪ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫‪$dsredq setSchedularMode PRI‬‬ ‫‪$dsredq addQueueRate 0 5000000‬‬

‫ﺩﺭ ﺍﻳﻦ ﻣﺜﺎﻝ ﺍﺯ ﺯﻣﺎﻧﺒﻨﺪﻱ ‪ PRI‬ﺑﺮﺍﻱ ﻧﺤﻮﻩ ﺳﺮﻭﻳﺲﺩﻫﻲ ﺑﻴﻦ ﺻﻔﻬﺎﻱ ﻓﻴﺰﻳﻜﻲ ﺍﺳﺘﻔﺎﺩﻩ ﻣﻲﺷﻮﺩ‪ .‬ﻭ ﻣﻴﺰﺍﻥ‬ ‫ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﭘﻬﻨﺎﻱ ﺑﺎﻧﺪ ﺻﻒ ﺻﻔﺮ ﺑﻪ ‪ 5MB‬ﻣﺤﺪﻭﺩ ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪٩٤‐٥‬‬

‫‪ ٢‐٣‐٥‬ﭘﻴﻜﺮﺑﻨﺪﻱ ‪Policy‬‬ ‫ﺑﻪ ﻣﻨﻈﻮﺭ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺳﻴﺎﺳﺖﻫﺎ ﺑﻴﻦ ﮔﺮﻩ ﻣﺒﺪﺍ ﻭ ﻣﻘﺼﺪ ﺑﺎﻳﺪ ﻣﺸﺨﺼﺎﺕ ﺗﺮﺍﻓﻴﻚ ﻭ ﻧﻮﻉ ‪ Policy‬ﺩﺭ ﺟﺪﻭﻝ‬ ‫‪ Policy‬ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﺷﻮﻧﺪ ﻛﻪ ﺍﻳﻦ ﻛﺎﺭ ﺩﺭ ﺭﻭﺗﺮ ﻟﺒﻪ ﺗﻮﺳﻂ ﻓﺮﻣﺎﻥ ﺯﻳﺮ ﺍﻧﺠﺎﻡ ﻣﻲﺷﻮﺩ‪:‬‬ ‫‪$q addPolicyEntry [$s id] [$d id] $Policy $parameters‬‬

‫ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﭘﻴﻜﺮﺑﻨﺪﻱ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ : $q‬ﻣﺘﻐﻴﺮﻱ ﺍﺯ ﺟﻨﺲ ‪EdgeQueue‬‬

‫‪ :$s‬ﮔﺮﻩ ﻣﺒﺪﺍ‬ ‫‪ :$d‬ﮔﺮﻩ ﻣﻘﺼﺪ‬ ‫‪ :$policy‬ﻧﻮﻉ ﺳﻴﺎﺳﺘﻲ ﻛﻪ ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻚ ﺑﻴﻦ ﻣﺒﺪﺍ ﻭ ﻣﻘﺼﺪ ﺑﺎﻳﺪ ﺑﻜﺎﺭ ﮔﺮﻓﺘﻪ ﺷﻮﺩ‪.‬‬ ‫‪ $parametes‬ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻨﻜﻪ ﻫﺮ ‪ policy‬ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺗﺮﺍﻓﻴﻚ ﻣﺨﺼﻮﺹ ﺑﻪ ﺧﻮﺩ ﺭﺍ ﺩﺍﺭﺩ ﺑﻌﺪ ﺍﺯ ﺗﻌﻴﻴﻦ‬ ‫‪ policy‬ﺩﺭ ﺍﻳﻦ ﻗﺴﻤﺖ ﺑﺎﻳﺪ ﻣﻘﺎﺩﻳﺮ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﺮﺑﻮﻁ ﺑﻪ ‪ Policy‬ﺁﻭﺭﺩﻩ ﺷﻮﺩ‪.‬‬ ‫‪Policy‬ﻫﺎﻱ ﺗﻌﺮﻳﻒ ﺷﺪﻩ ﺩﺭ ﻣﺎﺟﻮﻝ ‪ DiffServ‬ﺑﻪ ﻫﻤﺮﺍﻩ ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﻣﻮﺭﺩ ﻧﻴﺎﺯ ﺑﺮﺍﻱ ﻫﺮ ﻛﺪﺍﻡ ﺩﺭ ﺯﻳﺮ ﺧﻼﺻﻪ‬ ‫ﺷﺪﻩﺍﻧﺪ‪:‬‬

‫‪PB‬‬

‫‪PIR‬‬ ‫‪CBS‬‬ ‫‪CBS EBS‬‬ ‫‪CBS PIR‬‬

‫‪CIR‬‬ ‫‪CIR‬‬ ‫‪CIR‬‬ ‫‪CIR‬‬ ‫‪CIR‬‬

‫‪Initial code point‬‬ ‫‪Initial code point‬‬ ‫‪Initial code point‬‬ ‫‪Initial code point‬‬ ‫‪Initial code point‬‬

‫‪• TSW2CM‬‬ ‫‪• TSW3CM‬‬ ‫‪• TokenBucket‬‬ ‫‪• srTCM‬‬ ‫‪• trTCM‬‬

‫ﺗﻮﺟﻪ ﺑﻪ ﺍﻳﻦ ﻧﻜﺘﻪ ﺿﺮﻭﺭﻱ ﺍﺳﺖ ﻛﻪ ﺑﻪ ﺍﺯﺍﻱ ﻫﺮ ﮔﺮﻩ ﻣﺒﺪﺍ ﻭ ﻣﻘﺼﺪ ﺗﻨﻬﺎ ﻳﻚ ‪ Policy‬ﺭﺍ ﻣﻲﺗﻮﺍﻥ ﺑﻴﻦ ﺁﻧﻬﺎ ﻗﺮﺍﺭ‬ ‫ﺩﺍﺩ‪ .‬ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫‪$q addPolicyEntry [$s1 id] [$d1 id] TSW2CM 10 2000000‬‬

‫ﺩﺭ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺳﻴﺎﺳﺖ ‪ TSW2CM‬ﺑﺎ ﭘﺎﺭﺍﻣﺘﺮ ‪ CIR=10‬ﻭ ‪ PIR=2000000‬ﺑﺮﺍﻱ ﺗﺮﺍﻓﻴﻚ ﺑﻴﻦ ﻣﺒﺪﺍ ‪ s1‬ﻭ‬ ‫ﻣﻘﺼﺪ ‪ d1‬ﺩﺭ ﻧﻈﺮ ﮔﺮﻓﺘﻪ ﻣﻲﺷﻮﺩ‪.‬‬ ‫ﻫﻤﭽﻨﻴﻦ ﺑﻪ ﺍﺯﺍﻱ ﻫﺮ ﺟﻔﺖ ﻛﺪ ﺍﻭﻟﻴﻪ ﻭ ﻧﻮﻉ ‪ Policy‬ﺑﺎﻳﺴﺘﻲ ﻳﻚ ﺭﻛﻮﺭﺩ ﺑﻪ ﺟﺪﻭﻝ ‪ Policer‬ﺍﺿﺎﻓﻪ ﺷﻮﺩ ﺗﺎ‬ ‫ﺑﺘﻮﺍﻥ ﻧﮕﺎﺷﺘﻲ ﺍﺯ ﺍﻳﻦ ﺟﻔﺘﻬﺎ ﺑﻪ ﻛﺪﻫﺎﻱ ﺭﺩﺓ ﭘﺎﻳﻴﻨﺘﺮ ‪ policy‬ﺑﺪﺳﺖ ﺁﻭﺭﺩ‪ .‬ﺍﻳﻦ ﻛﺎﺭ ﺗﻮﺳﻂ ﺩﺳﺘﻮﺭ ﺯﻳﺮ ﺍﻧﺠﺎﻡ‬ ‫ﻣﻲﺷﻮﺩ‪.‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪$downgradedcode1‬‬

‫‪٩٥‐٥‬‬ ‫‪$initcode‬‬

‫‪$dsredq‬‬ ‫‪addPolicerEntry‬‬ ‫‪$downgradedcode2‬‬

‫‪$policer-type‬‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺮﺍﻱ ﺳﻴﺎﺳﺖ ‪ $policer-type‬ﺑﺎ ﻛﺪ ﺍﻭﻟﻴﻪ ‪ $initcode‬ﻛﺪﻫﺎﻱ ﺭﺩﻩ ﭘﺎﻳﻴﻦ ﺭﺍ ﺑﻪ ﺗﺮﺗﻴﺐ‬ ‫‪ $downgradedcode1‬ﻭ ‪ $downgraded-code2‬ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ ﺍﻟﺒﺘﻪ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺗﻌﺪﺍﺩ ﺭﺩﻩﺑﻨﺪﻱ ﺩﺭ ﻫﺮ‬ ‫‪ Policy‬ﻣﻤﻜﻦ ﺍﺳﺖ ‪ $downgraded-code2‬ﻧﻴﺎﺯﻱ ﻧﺒﺎﺷﺪ‪.‬‬ ‫ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ‪:‬‬ ‫‪$dsredq addPolicerEntry trTCM 10 11 12‬‬

‫ﺩﺳﺘﻮﺭ ﺑﺎﻻ ﺑﺮﺍﻱ ﺳﻴﺎﺳﺖ ‪ trTCM‬ﺑﺎ ﻛﺪ ﺍﻭﻟﻴﻪ ‪ ،١٠‬ﻛﺪﻫﺎﻱ ﺭﺩﻩ ﭘﺎﻳﻴﻨﺘﺮ ﺭﺍ ﺑﻪ ﺗﺮﺗﻴﺐ ‪ ۱۱‬ﻭ ‪ ۱۲‬ﻗﺮﺍﺭ ﻣﻲﺩﻫﺪ‪.‬‬

‫‪٤-٥‬‬

‫واﺳﻂهﺎي ﺑﺮﻧﺎﻣﻪ ﻧﻮﻳﺴﻲ ﺑﺮاي اﺳﺘﻔﺎدﻩ از ﻣﺎﺟﻮل ‪Diffserv‬‬ ‫‪$ns simplex-link $edge $core $bw $delay dsRED/edge‬‬

‫•‬

‫‪$ns simplex-link $edge $core $bw $delay dsRED/core‬‬

‫•‬

‫ﺩﻭ ﻓﺮﻣﺎﻥ ﺑﺎﻻ ﺻﻒ ﺑﻴﻦ ﺭﻭﺗﺮ ﻟﺒﻪ ﻭ ﻣﺮﻛﺰﻱ ﺭﺍ ﺍﻳﺠﺎﺩ ﻣﻲﻛﻨﻨﺪ‪ .‬ﺗﻮﺟﻪ ﺷﻮﺩ ﻛﻪ ﺻﻒ ﺑﻴﻦ ﺭﻭﺗﺮ ﻟﺒﻪ ﺑﻪ ﺭﻭﺗﺮ‬ ‫ﻣﺮﻛﺰﻱ ﺑﺎ ﺻﻒ ﺑﻴﻦ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﻭ ﺭﻭﺗﺮ ﻟﺒﻪ ﺑﺎ ﻫﻢ ﻣﺘﻔﺎﻭﺕ ﺍﺳﺖ‪ .‬ﺻﻒ ﺑﻴﻦ ﺭﻭﺗﺮ ﻟﺒﻪ ﺑﻪ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺑﺎﻳﺪ ﺑﻪ‬ ‫ﺻﻮﺭﺕ ‪ dsRed/edge‬ﺗﻌﺮﻳﻒ ﺷﻮﺩ ﻭ ﺻﻒ ﺑﻴﻦ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺑﻪ ﺭﻭﺗﺮ ﻟﺒﻪ ﻳﺎ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺑﻪ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺑﺎﻳﺪ‬ ‫ﺍﺯ ﻧﻮﻉ ‪ dsRED/core‬ﺗﻌﺮﻳﻒ ﺷﻮﻧﺪ‪.‬‬ ‫‪$dsredq printPolicyTable‬‬

‫•‬

‫‪$dsredq printPolicerTable‬‬

‫•‬

‫‪$dsredq printPHBtable‬‬

‫•‬

‫ﺗﻮﺳﻂ ﺳﻪ ﺩﺳﺘﻮﺭ ﺑﺎﻻ ﺑﻪ ﺗﺮﺗﻴﺐ ﺟﺪﻭﻝ ‪ policy‬ﻭ ﺟﺪﻭﻝ ‪ Policer‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺭﻭﺗﺮ ﻟﺒﻪ ﻣﺸﺨﺺ ﺷﺪﻩ ﻭ ﺟﺪﻭﻝ‬ ‫‪ PHB‬ﻣﺮﺑﻮﻁ ﺑﻪ ﺭﻭﺗﺮ ﻟﺒﻪ ﻳﺎ ﺭﻭﺗﺮ ﻣﺮﻛﺰﻱ ﺗﻌﻴﻴﻦ ﺷﺪﻩ‪ ،‬ﭼﺎﭖ ﻣﻲﺷﻮﻧﺪ‪.‬‬ ‫‪$dsredq printState‬‬

‫•‬

‫ﭘﺎﺭﺍﻣﺘﺮﻫﺎﻱ ﺁﻣﺎﺭﻱ ﺗﺮﺍﻓﻴﻚ ﻣﺮﺑﻮﻁ ﺑﻪ ﺭﻭﺗﺮ ﻟﺒﻪ ﺗﻌﻴﻴﻦ ﺷﺪﻩ‪ ،‬ﭼﺎﭖ ﻣﻲﺷﻮﺩ‪ .‬ﻳﻚ ﺧﺮﻭﺟﻲ ﻧﻤﻮﻧﻪ ﺍﺯ ﺍﻳﻦ ﺩﺳﺘﻮﺭ‬ ‫ﺑﻪ ﺻﻮﺭﺕ ﺯﻳﺮ ﺍﺳﺖ ‪:‬‬ ‫‪Edrops‬‬ ‫‪15‬‬ ‫‪10‬‬

‫‪Ldrops‬‬ ‫‪21‬‬ ‫‪21‬‬

‫‪TxPkts‬‬ ‫‪249090‬‬ ‫‪98790‬‬

‫‪TotPkts‬‬ ‫‪249126‬‬ ‫‪98821‬‬

‫‪CP‬‬ ‫‪All‬‬ ‫‪10‬‬

‫ﻣﺮﻭﺭﻱ ﺑﺮ ﻗﺎﺑﻠﻴﺘﻬﺎﻱ ‪NS-2‬‬

‫‪5‬‬

‫‪٩٦‐٥‬‬ ‫‪150300‬‬

‫‪0‬‬

‫‪20‬‬

‫‪15035‬‬

‫ﻓﻴﻠﺪﻫﺎﻱ ﺍﻳﻦ ﺟﺪﻭﻝ ﻋﺒﺎﺭﺗﻨﺪ ﺍﺯ‪:‬‬ ‫‪ :CP‬ﻛﺪ‬ ‫‪ :TotPkts‬ﺗﻌﺪﺍﺩ ﻛﻞ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‬ ‫‪ :TxPkts‬ﺗﻌﺪﺍﺩ ﻛﻞ ﺑﺴﺘﻪﻫﺎﻱ ﺩﺭﻳﺎﻓﺖ ﺷﺪﻩ‬ ‫‪ :Ldrops‬ﺗﻌﺪﺍﺩ ﺑﺴﺘﻪﻫﺎﻳﻲ ﻛﻪ ﺑﺎ ﺗﻮﺟﻪ ﺑﻪ ﺳﺮﺭﻳﺰ ﺷﺪﻥ ﻟﻴﻨﻚ ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩﺍﻧﺪ‪.‬‬ ‫‪ :Edrops‬ﺑﺴﺘﻪﻫﺎﻳﻲ ﻛﻪ ﺩﺭ ﺻﻒ ‪ RED‬ﺑﻪ ﺩﻭﺭ ﺍﻧﺪﺍﺧﺘﻪ ﺷﺪﻩﺍﻧﺪ‪.‬‬ ‫‪getAverage $queue‬‬

‫‪$dsredq‬‬

‫•‬

‫ﺩﺳﺘﻮﺭ ﺑﺎﻻ ﻣﻴﺎﻧﮕﻴﻦ ﻭﺯﻧﻲ ﺍﻧﺪﺍﺯﻩ ﺻﻒ ﻓﻴﺰﻳﻜﻲ ‪ $queue‬ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‪.‬‬ ‫‪getCBucket‬‬

‫ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺍﻧﺪﺍﺯﻩ ﻓﻌﻠﻲ ﺳﻄﻞ ‪ C‬ﺭﺍ ﺑﺮﻣﻲﮔﺮﺩﺍﻧﺪ‪.‬‬

‫ﭘﺎﻳﺎن‬

‫‪$dsredq‬‬

‫•‬

Related Documents

Persian
November 2019 32
Persian
October 2019 35
Beginners
November 2019 43