高級計算機網(wǎng)絡(luò)實驗報告 ns3模擬數(shù)據(jù)中心_第1頁
高級計算機網(wǎng)絡(luò)實驗報告 ns3模擬數(shù)據(jù)中心_第2頁
高級計算機網(wǎng)絡(luò)實驗報告 ns3模擬數(shù)據(jù)中心_第3頁
高級計算機網(wǎng)絡(luò)實驗報告 ns3模擬數(shù)據(jù)中心_第4頁
高級計算機網(wǎng)絡(luò)實驗報告 ns3模擬數(shù)據(jù)中心_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、Project1-ns3模擬數(shù)據(jù)中心實驗要求Datacenter network topology1根據(jù)上面的數(shù)據(jù)中心拓撲圖,完成以下要求:根據(jù)給定的數(shù)據(jù)中心的拓撲結(jié)構(gòu),利用ns3進行仿真模擬兩種通信模式(traffic pattern)o all-to-all :每個服務(wù)器都發(fā)送消息給其他服務(wù)器消息,由拓撲結(jié)構(gòu)可知,超過50%的消息傳送將跨越兩個簇(cluster)o many-to-one :每個服務(wù)器都發(fā)送消息給其中一個服務(wù)器測量兩種模式下網(wǎng)絡(luò)的仿真可以達到的吞吐量,找出網(wǎng)絡(luò)瓶頸,并且說明如何改進注:拓撲中的網(wǎng)絡(luò)都是Ethernet網(wǎng)實驗內(nèi)容數(shù)據(jù)中心模擬實現(xiàn)及主要代碼解釋a.設(shè)置自定義的

2、attribute為了做實驗方便,設(shè)置如下自定義attribute :pattern:通信模式,all-to-all 或 many-to-one,默認為 1defaultDst:多對一模式下,接收消息的默認服務(wù)器序號,默認為0verbose:enable 或者 disable PacketSink和 OnOffApplication 的日志,默認為 falseDataRatel:定義數(shù)據(jù)中心拓撲第一層的數(shù)據(jù)傳輸速率(Mbps),默認為1.0DataRate2:定義數(shù)據(jù)中心拓撲第二層的數(shù)據(jù)傳輸速率(Mbps),默認為1.0DataRate3:定義數(shù)據(jù)中心拓撲第三層的數(shù)據(jù)傳輸速率(Mbps),默認

3、為1.5實現(xiàn)代碼如下:uint16_t pattern = 1;uint16_t nodesNum = 8;uint16_t defaultDst = 0;float DataRate1 = 1.0;float DataRate2 = 1.0;float DataRate3 =1.5;uint16_t port = 50000;bool verbose = false;CommandLine cmd;cmd.AddValue(pattern, number of traffic pattern, pattern);/pattern1:all-to-all pattern2:many-to-on

4、ecmd.AddValue(defaultDst, default destination server node in pattern 2, defaultDst);cmd.AddValue(DataRate1, data rate of csma network at level 1, DataRatel);cmd.AddValue(DataRate2, data rate of csma network at level 2, DataRate2);cmd.AddValue(DataRate3, data rate of csma network at level 3, DataRate

5、3);cmd.AddValue (verbose, Tell sink and onoff applications to log if true, verbose);cmd.Parse(argc, argv);LogComponentEnable (DataCenterSimulation, LOG_LEVEL_INFO);if (verbose)(LogComponentEnable (PacketSink, LOG_LEVEL_INFO);LogComponentEnable (OnOffApplication, LOG_LEVEL_INFO);b.創(chuàng)建結(jié)點根據(jù)實驗要求,總共需要創(chuàng)建15

6、個結(jié)點,包括:8 servers4 ToR switches2 Aggregation switches1 Core switch實現(xiàn)代碼如下:/create nodesNodeContainer n1_8;n1_8.Create(8);NodeContainer t1_4;t1_4.Create(4);NodeContainer a12;a12.Create(2);NodeContainer c1;c1.Create(1);c.創(chuàng)建CSMA網(wǎng)絡(luò)節(jié)點整個數(shù)據(jù)中心網(wǎng)絡(luò)拓撲從下往上可以分為三層,即第一層:由服務(wù)器與ToR組成的ethernet網(wǎng)絡(luò),共有4個,編號為CSMA11,CSMA12,CSM

7、A13,CSMA14第二層:由ToR與Aggregation組成的ethernet網(wǎng)絡(luò),共有2個,編號為CSMA21,CSMA22 第三層:由Aggregation與Core組成的ethernet網(wǎng)絡(luò),共有1個,編號為CSMA3將創(chuàng)建好的15個網(wǎng)絡(luò)結(jié)點分配到這7個CSMA網(wǎng)絡(luò)中,實現(xiàn)代碼如下:/create csma nodesNodeContainer csmaNodes11 =NodeContainer(n1_8.Get(0),n1_8.Get(1),t1_4.Get(0);NodeContainer csmaNodes12 =NodeContainer(n1_8.Get(2),n1_8.

8、Get(3),t1_4.Get(1);NodeContainer csmaNodes13 =NodeContainer(n1_8.Get(4),n1_8.Get(5),t1_4.Get(2);NodeContainer csmaNodes14 =NodeContainer(n1_8.Get(6),n1_8.Get(7),t1_4.Get(3);NodeContainer csmaNodes21 =NodeContainer(t1_4.Get(0),t1_4.Get(1),a12.Get(0);NodeContainer csmaNodes22 =NodeContainer(t1_4.Get(2

9、),t1_4.Get(3),a12.Get(1);NodeContainer csmaNodes3 =NodeContainer(a12.Get(0),a12.Get(1),c1.Get(0);d.設(shè)置CSMA網(wǎng)絡(luò)attribute,并將其安裝到相應(yīng)結(jié)點上根據(jù)實驗要求中的網(wǎng)絡(luò)拓撲,設(shè)置相應(yīng)網(wǎng)絡(luò)的屬性所有直接相連的兩個結(jié)點之間的延遲都為500ns第一層和第二層CSMA網(wǎng)絡(luò)的數(shù)據(jù)傳輸速率都為1.0Mbps,第三層為1.5Mbps然后安裝到相應(yīng)的網(wǎng)絡(luò)結(jié)點上,實現(xiàn)代碼如下(DataRate可以通過命令行參數(shù)設(shè)置,默 認值即為原實驗要求):/create the channels first witho

10、ut any IP addressing information CsmaHelper csma1;sprintf(buf, 1.1fMbps,DataRate1);csma1.SetChannelAttribute (DataRate”, StringValue (buf);csma1.SetChannelAttribute (Delay, StringValue (500ns);NetDeviceContainer csmaDevices11 = csma1.Install (csmaNodes11);NetDeviceContainer csmaDevices12 = csma1.Ins

11、tall (csmaNodes12);NetDeviceContainer csmaDevices13 = csma1.Install (csmaNodes13);NetDeviceContainer csmaDevices14 = csma1.Install (csmaNodes14);CsmaHelper csma2;sprintf(buf, %1.1fMbps”,DataRate2);csma2.SetChannelAttribute (DataRate, StringValue (buf);csma2.SetChannelAttribute (Delay, StringValue (5

12、00ns);NetDeviceContainer csmaDevices21 = csma2.Install (csmaNodes21);NetDeviceContainer csmaDevices22 = csma2.Install (csmaNodes22);CsmaHelper csma3;sprintf(buf, %1.1fMbps”,DataRate3);csma3.SetChannelAttribute (DataRate, StringValue (buf);csma3.SetChannelAttribute (Delay, StringValue (500ns);NetDevi

13、ceContainer csmaDevices3 = csma3.Install (csmaNodes3);根據(jù)實驗要求,為每個結(jié)點安裝協(xié)議棧,并為7個CSMA網(wǎng)絡(luò)分配IP,實現(xiàn)代碼如下/assign IP addressNS_LOG_INFO (Assign IP address.);InternetStackHelper stack;stack.Install (n1_8);stack.Install (t1_4);stack.Install (a12);stack.Install (c1);Ipv4AddressHelper address;address.SetBase (10.0.1

14、.0, ”255.255.255.0);Ipv4InterfaceContainer csmaInterfaces11 = address.Assign(csmaDevices11);address.SetBase (10.0.2.0, ”255.255.255.0);Ipv4InterfaceContainer csmaInterfaces12 = address.Assign (csmaDevices12);address.SetBase (10.0.3.0, 255.255.255.0);Ipv4InterfaceContainer csmaInterfaces13 = address.

15、Assign (csmaDevices13);address.SetBase (10.0.4.0, 255.255.255.0);Ipv4InterfaceContainer csmaInterfaces14 = address.Assign (csmaDevices14);address.SetBase (10.1.1.0, 255.255.255.0);Ipv4InterfaceContainer csmaInterfaces21 = address.Assign (csmaDevices21);address.SetBase (10.2.1.0, 255.255.255.0);Ipv4I

16、nterfaceContainer csmaInterfaces22 = address.Assign (csmaDevices22);address.SetBase (192.168.1.0, 255.255.255.0);Ipv4InterfaceContainer csmaInterfaces3 = address.Assign (csmaDevices3);f.初始化路由表這里直接調(diào)用了 ns3自帶的路由實現(xiàn),實現(xiàn)代碼如下/ Create router nodes, initialize routing database and set up the routing/ tables i

17、n the nodes.Ipv4GlobalRoutingHelper:PopulateRoutingTables ();g.創(chuàng)建和分配 PacketSink 和0nOffClient首先,創(chuàng)建sink和OnOff,實現(xiàn)代碼如下/Create sinkApp and OnOffClientApplicationContainer clientAppnodesNum4;ApplicationContainer sinkAppnodesNum;然后,分配sink到所有的server結(jié)點上,實現(xiàn)代碼如下俱中nodesNum表示server個數(shù)):for (unsigned int i = 0;i n

18、odesNum; i+)(PacketSinkHelper packetSinkHelper (ns3:TcpSocketFactory, getAddress(i,port,csmaInterfaces11,csmaInterfaces12,csmaInterfaces13, csmaInterfaces14);sinkAppi = packetSinkHelper.Install (n1_8.Get (i);sinkAppi.Start(Seconds (1.0);sinkAppi.Stop(Seconds (60.0);再然后,分配OnOffClient到server結(jié)點上,并且根據(jù)pa

19、ttern不同,進行不同的配置pattern 1 :每個服務(wù)器都發(fā)送消息給其他服務(wù)器消息,即發(fā)送消息給在另一個簇上面的4 個服務(wù)器(每個服務(wù)器上建立4個OnOffClient)pattern 2 :每個服務(wù)器都發(fā)送消息給同一個服務(wù)器,可以默認為n1(每個服務(wù)器(n1除外)上建立1個OnOffClient)實現(xiàn)代碼如下for (int i = 0; i nodesNum; i+)(uint16_t dst = 0;if (pattern=1)(/all-to-all patternfor(int j = 0 ;j 4; j+)(if(i nodes- chanfi&ls. IP address.

20、 sinkApp and dniDfFClient-1 build Create Create/ns-alLLnorie-l. 1 g / n & n-a-alltnofte-i. iB/ihs -run scratch/DC-3.is/bulld,-patterfi=lCreatefClient feiient pnDff Cl-Lent WftOffGlicnt pOffClicnt DoOffCllent hnOffClient OoOffClLtenit OnOffClient hoOffClient jOnOff Client OnOffClient inQf fcltent fif

21、tOff Client (iDffClLlent jo naff Client OhOffClient OftOf fCltent OnOf fdtent OftOf fell tent flftOffClient OmDfrcilent CiiiOfrcitent OftorrcitentNodc Node Node Mode E*Eck gNGdc gfriodc iNode gwodr gfiMQdc gwodegwode *Jode gfrJode 整Mode* gfMode gfM&de Node gMode 耕1凸施 glMode godeains aifis-auns-flitf

22、lS ai nsot*is ains aiis otfis aifis atfis atns ainssins806&atns ai/is 鞏/is at/is atfis atnsatatat atat at at at at at at at at at at at at at at at at atServer Server Server Server Strvtr Server Server Serwer Serwer Server Server Server Server Server Server Server Server Server Server Server Server

23、Server Server ServerNlade Nnde hiadeflNode gpdu Mode 0Mode ModeNode Mode Mode Mode NodeMode (pHode 前白血 0Nioie 前口 de* $Nsode iNcideTCP Stream Graph-Throughput Graphs看整個過程中該結(jié)點上的吞吐量變化情況使用statistics-Summary來查看當前結(jié)點上網(wǎng)絡(luò)平均吞吐量,以此估計相應(yīng)CSMA網(wǎng)絡(luò)的吞吐量server n1上的測量結(jié)果如下Throughput GraphThroughputThFoughpMt Cr 叩 hdSMM ?

24、(KXX)-TraFficCapturedDisplayedMarkedPackets413941330Between Firit and lasL packet轉(zhuǎn).973 sec48.972 secAvg. packels/s&tS4.51684.355Avg. packet size377.211 bytes377. kbytesBytes15612761560892Avg. bytes/sec31830.23531S73.061Zwg, MBit/sec0.2550.255ToR t1上的測量結(jié)果如下Throughput GraphTCP Graph 1; DataCentersimul

25、ition-B-1Ppeap 1 1,1.1249153 - 1040,3,1;50000Throughput GraphThrough|utB/i7Q0M 60000 400M 洶的一100K 20304045Times|TraFficCapturedDisplayedMarkedPackets8604859&0Between First and hst packet4S.986 5ee48.985 SAvg. packets/sec175-643175.525Avg. packet size384.747 bytes384.971 bytesBytes33103663309982Avg.

26、bytes/sec6757S.36267571.938Avg. MBit/sec0.5410.541Aggregation al上的測量結(jié)果如下ThroughplitTrafficCapturedDisplayedMarkedPacketetweer first and last packet48.990 sec48.989 SECAvg. packets/sec323.476323.399Avg. packet size383.565 bytes3 S3.646 bytesBytes6078358607S10ZAvg. bytes/sec124074.16&1240

27、70.677Avg. MBit/s0.9930.993b. pattern 1實驗結(jié)果分析首先對實驗結(jié)果進行簡單匯總網(wǎng)絡(luò)結(jié)點帶寬(Mbps)網(wǎng)絡(luò)平 均gUB(Mbps)CSMA11server n11.00.255CSMA21ToR t11.00.541CSMA3Aggregation a11.50.993從上面的結(jié)果可以看出第1層CSMA網(wǎng)絡(luò)平均吞吐量是0.255Mbps,帶寬利用率為25.5% ;第2層CSMA網(wǎng)絡(luò)平均吞吐量是0.541Mbps,帶寬利用率為54.1% ;第3層CSMA網(wǎng)絡(luò)平均吞吐量是0.993Mbps,帶寬利用率為662%。c. pattern 1瓶頸及改進瓶頸根據(jù)以上的

28、實驗結(jié)果可以看出來,從網(wǎng)絡(luò)的平均吞吐量來看:第3層CSMA第2層CSMA第1層CSMA2,從帶寬利用率上看也是這樣,所以作為core switch連接兩個子 網(wǎng)絡(luò)但帶寬過小的第三層網(wǎng)絡(luò)成了整個網(wǎng)絡(luò)的瓶頸。改進可以加大第3層網(wǎng)絡(luò)的帶寬,防止數(shù)據(jù)流量過大出現(xiàn)擁塞的情況發(fā)生。因此最后確定的網(wǎng) 絡(luò)帶寬如下所示:o CSMA11-14 : 1.0Mbpso CSMA21-22 : 1.0Mbpso CSMA3 : 2.0Mbps改進結(jié)果執(zhí)行命令彳亍/waf -run scratch/DC -DataRate1=1.0 -DataRate2=1.0 -DataRate3=2.0,以相同方式測量網(wǎng)絡(luò),得到的

29、結(jié)果如下:網(wǎng)絡(luò)結(jié)點帶寬(Mbps)網(wǎng)絡(luò)平 均SUB(Mbps)CSMA11server n11.00.306CSMA21ToR t11.00.523CSMA3Aggregation a12.00.990從上面的結(jié)果可以看出加大第三層網(wǎng)絡(luò)的帶寬,確實提高了整個網(wǎng)絡(luò)的吞吐量,尤其是對 最底層的server結(jié)點來說。d. pattern 2實驗結(jié)果執(zhí)行命令./waf -run scratch/DC -pattern=2,實驗運行結(jié)果如下所示atjisaxns8N0de3.185PCDPpspNode N&de gMode BN&de griodeServer Server Server SerwrS

30、erver Server Server ServerbuildCreateCreateAssignCreateOflorrciient aifisstnkApp ancrffclient onoffcllent nDffEllent OhDffClUnt OnOffClient oniJffclient OnOffClient anDrffclient Slnrulator beg Ln. Silator done,.Uiur zimu r z vt r tu * iBox t - /kJor k? pace/advfie-t / pro J1 /ns - a l L1 n 3,18 / n

31、s - i, 185 , /w*T - r Datacenterstnulattoo-9-0. Detacent已rslEulatlGn9-I*/示從上面的結(jié)果可以看出,8個OnOffClient都將數(shù)據(jù)傳輸?shù)絥1,產(chǎn)生的 pcap 文件如下所為了分析Patten 2的網(wǎng)絡(luò)吞吐量根據(jù)網(wǎng)絡(luò)拓撲的對稱性,選取測量位置 CSMA11 :通過 server n1(node 0/device 0)來估計 CSMA12 :通過 server nnode 2/device 0)來估計CSMA13 :通過 server n5;node 4/device 0)來估計CSMA21 :通過 ToR t1(node

32、8/device 1)來估計CSMA22 :通過 ToR t3(node 10/device 1)來估計CSMA3 :通過 Aggregation a1node 12/device 1)來估計選取的測量標準為吞吐量,具體方法是使用wireshark分析相應(yīng)的pcap文件中的tcp包 使用 statistics-TCP Stream Graph-Throughput Graphs看整個過程中該結(jié)點上的吞吐量變化情況使用statistics-Summary來查看當前結(jié)點上網(wǎng)絡(luò)平均吞吐量,以此估計相應(yīng)CSMA網(wǎng)絡(luò)的吞吐量server n1上的測量結(jié)果如下Throughput GraphThrough

33、putTCP Grap80000 70000 MOOCi 50000 40000 30000 20000 10000 TraFHcCapturedDisplayedMarkedPackets14&31148230Between first and last packet4&.9B9 sec48.9 & secAvg. packets/sec302.744302.5 &7Avg. packet size401.958 bytes402.141 bytesBytes59614465 泌0934Avg. by tes/s &c121690.443121682.542Avq. MBit/sec0.97

34、40.973server n3上的測量結(jié)果如下Throughput Graph9000G &0000-7M0D 60000-.50000 4M00 30000 2 WOO-10000TCP Graprhroijghput 網(wǎng)10M00 TraFfieCapturedDisplayedMarkedPackets27912785aBetween first and Last packet48.925 sec48.924 secAvg. packeti/sec57.04656.925Avg. packetsize396.318 bytes397.034 bytesBytes1106124110574

35、0Avg. bytes/sec22608.45922601.084Avq. MBit/海0.1IS10.181server n5上的測量結(jié)果如下Throughput GraphTCP Graph li DdtdCinterslimultlO.10.0.3,1:49-153 - l&.G.l-liSCKMK)Throughput GraphThroughoutB/5TQMO 60000 50000 4O0OQ 30000 20MQ 15M。TrafficCapturedDisplayedMarkedPackets179017840Between first and last packet48.9

36、35 sec48.934 secAvg. patkels/sec36.57936.457Avg. packet size392.955 byLes394.062 bytesBytes703390703006Avg. bytes/sec14373.86614366.320Avq. MBiL/sec0.1150.115ToR t1上的測量結(jié)果如下SOOM 70000 60000-EOOM 40000 30000 Througihput e/5 90000 W 1520 Z5 30354045Time520000 TrafficCapturedDisplayedMarkedPackets930492

37、980Between first and hst packet48.989 sec48.9 BO secAvg. packets/sec1&9.921189.&32Avg. packet size395.877 bytes396.091 bytesBytes36S32363682852Avg. bytes/sec.75185.40675190.755Avg. MBi t/sec0.6010.602ToR t3上的測量結(jié)果如下Throughput GraphTCP Graph 1: OtaCenterSinriLlIatiQn-lO-O.pcap 10.03.1:4915B - 10,0.1.1

38、:50000ThroughputB/s|thro ugh put Grap h70000 600M 30000-354045Time400W 200M TrafficCapturedDisplayedMarkedPackets275427460Between first and last packet4&.940 sec48.939 secAvg. packets/sec56.27356.111Avg. packet size395.587 bytes396.553 bytesBytes10894461088934Avg. by tes/s &c22261.04222251.047Avq. MBit/sec0.1780.117&Aggregation al上的測量結(jié)果如下Throughput Graphtcf Craph i: Oataccnterimulati?nlz-a.pcdp 10,0.4,1:415 -a 10,0.l-i:500oaThroughput Grep-hThroughput B/s90000 80000-70000 soooo50000-40000 30000-20000 TraFficCapturedDisplayedMarkedPackets557455680Between first and

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論