Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems.

Similar presentations


Presentation on theme: "Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems."— Presentation transcript:

1 Network Simulator and problems in installing

2 Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems in compiling running the simulation

3 Problems in installing Installation of NS2 is very easy if you pay attention on the following instructions. However, installing for me was very hard and it last very long time, about 10 days. There is a lot of problems I have meet, such as download speed, choosing the right server for downloading, installing the correct version of NS2. Now I will show you the best and most safe way for installing the NS2. Installing Cygwin: First problem in installation of NS2 is Cygwin platform for Windows. On my computer I have Windows XP Service Pack 3 (SP3). I try to download cygwin, following instruction step by step from book by Apidach Booranawong, except I choose to download all components of Cygwin. But I have no success. At some point (usually about 99% of downloading) I get this message Download incomplete. Try again?. If you choose Yes the installation will start all over again and you have to wait few hours (depend on download speed) to complete your work. If you choose No your Cygwin platform will be installed on your computer, but it will not be ready to support NS2. Another big problem is to choose right server for downloading the Cygwin. This is the most important step. When you start the installation after step 11 (page 5, Apidach Booranawong, Network Simulator NS2), you will need to choose some ftp or http for downloading. I choose many download sites, but most of them are very slow or not available or far away from Thailand, which is very important. And again I havet success. At this point I decided to start all over again, from the root. I do the following:

4 Problems in installing Guide for installing Cygwin: Choose right server for downloading. Always chose that one with word MIRROR or MIRRORS. For example you can choose: or If you choose between http and ftp, you better choose http. Dont install every component of Cygwin (it lasts too long because you have to select file by file, there is no option select all). Install components shown on page No.2, Apidach Booranawong, Network Simulator NS2. Entire X11 and these packages: gcc, gcc-gcc+, gawk, tar, gzip, make, patch, perl, w32api. If your download speed is high, you will finish the job very fast and safe. After installation you must have these 3 files:.bash_profile.bashrc.inputrc, under c:\cygwin\home\MyComputerName. If you dont have it, your installation failed. If you still cant install Cygwin uninstall Windows XP Service Pack 3 (SP3) and install Windows XP Service Pack 2 (SP2) and repeat steps 1,2,3,4.

5 Problems in installing Installing NS2: couldnt execute problem Second problem can be the version of Network Simulator. There is many version, for example ns-allinone-2.28, ns-allinone-2.29 and the latest version at this moment ns-allinone I choose to install ns-allinone- 2.29, because this version have examples of some simulation inside folder c:\cygwin\home\MyComputerName\ns-allinone-2.33\ns-2.33\ns- tutorial\examples. The version ns-allinone-2.33 does not have implemented examples inside. It doesn not have folder ns-tutorial\examples. After installation of ns-allinone-2.29, there was a problem. I try to run command ns example2.tcl to see if my NS is working, but I get this message: running nam... ns: finish: couldn't execute "nam": no such file or directory while executing "exec nam out.nam &" (procedure "finish" line 8) invoked from within finish

6 Problems in installing The problem was in version on Network Animator (NAM). When you download ns-allinone-2.28 or ns-allinone-2.29 or ns-allinone-2.30 you automatically get nam-1.11 which has a bug. You can fix the bug by replacing the NULL with 0 in line 73 of file agent.h in nam-1.11 directory. Then set the path to c:\cygwin\home\MyComputerName\ns- allinone-2.33\ns-2.33 \nam-1.11 and then compile it again, run the command./configure. I try it, but everything was same like before. I dont know why. So I choose do uninstall ns-2.29, by deleting the directory ns-allinone-2.29, ns-allinone-2.33.tar.gz and deleting the file.bash_history under c:\cygwin\home\MyComputerName. Dont delete these files:.bash_profile,.bashrc,.inputrc. I downloaded ns-allinone-2.33.tar.gz, and after installation everything was OK. Guide for installing NS2: Install this verson of NS: ns-allinone-2.33.tar.gz. Its the fastest and most safe way to make your NS usable. Now you have to copy the directory examples from your collegue which already have NS. Put this directory under the c:\cygwin\home\MyComputerName\ns-allinone-2.33\ns-2.33\ns- tutorial. Then check if your NS is working, by running the simulation. You have to type ns example2.tcl, but set the path first. Good luck!

7 Wired networks original example2.tcl: UDP NULL CBR

8 Wired networks my modified example: UDP TCP SINK NULL FTP CBR

9 source code is: #create a simulator object set ns [new Simulator] #define different color for data flow # number of color is fid = flow id $ns color 1 blue $ns color 2 red #open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #define a 'finish ' pocedure proc finish {} { global ns nf $ns flush-trace #close the trace file close $nf #execute nam on trace file exec nam out.nam & exit 0 } 1 #create 6 nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] set n5 [$ns node] #create links between the nodes $ns duplex-link $n0 $n3 1Mb 10ms DropTail $ns duplex-link $n1 $n3 1Mb 10ms DropTail $ns duplex-link $n2 $n3 1Mb 10ms DropTail $ns duplex-link $n3 $n4 1Mb 10ms DropTail $ns duplex-link $n3 $n5 2Mb 20ms DropTail #create the position of nodes in NAM $ns duplex-link-op $n0 $n3 orient right-down $ns duplex-link-op $n1 $n3 orient right $ns duplex-link-op $n2 $n3 orient right-up $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down 2

10 #set queue size of LINK (n3-n4) to 10 $ns queue-limit $n3 $n4 10 #monitor the queue for the link between n3 and n4 $ns duplex-link-op $n3 $n4 queuePos 0.5 #create a UDP agent and attach it to the n0 set udp0 [new Agent/UDP] $udp0 set class_ 1 $ns attach-agent $n0 $udp0 #create a CBR traffic souce and attach it to the udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ $cbr0 attach-agent $udp0 #create a UDP agent and attach it to the n1 set udp1 [new Agent/UDP] $udp1 set class_ 1 $ns attach-agent $n1 $udp1 #create a CBR traffic souce and attach it to the udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 500 $cbr1 set interval_ $cbr1 attach-agent $udp1 #create a TCP agent and attach it to the n2 set tcp0 [new Agent/TCP] $tcp0 set class_ 2 $ns attach-agent $n2 $tcp0 3 #create a FTP traffic source and attach it to the tcp0 set ftp0 [new Application/FTP] $ftp0 attach-agent $tcp0 $ftp0 set type_ FTP #create a NULL agent (a traffic sink) and attach it to the n4 set null0 [new Agent/Null] $ns attach-agent $n4 $null0 #create a NULL agent (a traffic sink) and attach it to the n5 set null1 [new Agent/Null] $ns attach-agent $n5 $null1 #create a SINK agent and attach it to the n4 set sink0 [new Agent/TCPSink] $ns attach-agent $n4 $sink0 #connect the traffic sources with the traffic sinks $ns connect $tcp0 $sink0 $ns connect $udp0 $null0 $ns connect $udp1 $null1 #schedule events for CBR and FTP agents $ns at 0.8 "$cbr0 start" $ns at 1.0 "$ftp0 start" $ns at 1.2 "$cbr1 start" $ns at 4.0 "$cbr0 stop" $ns at 4.5 "$ftp0 stop" $ns at 4.8 "$cbr1 stop" #call the procedure finish after 5 sec of simulation time $ns at 5.0 "finish" #run the simulation $ns run 4

11 Wired networks usual problems in compiling first usual problem is the topology of the network. Topology must have sense. For example you cant connect one source with two sink and send the packages at the same time. Every source has to be connected with one sink. second usuall problem is error in syntax. For example if you replace character $ with # in front of the command $ns, you will get the error message.Or if you type set sink0 [new Agent/TCPsink] instead set sink0 [new Agent/TCPSink] you will again get the error message.

12 Wired networks running the simulation: after checking the topology of network, syntax errors we can run the simulation. First thing we have to do is to set the path first. In my case: c:\cygwin\home\Sasa\ns-allinone-2.33\ns-2.33\ns-tutorial\examples and then run the simulation with command ns NameOfExample.tcl

13 Wired networks THE END


Download ppt "Network Simulator and problems in installing. Introduction Problems in installing Wired networks modified example2.tcl commands in OTcl usual problems."

Similar presentations


Ads by Google