Sie sind auf Seite 1von 12

Network Simulators

Network Simulators

GNS3 NS2 NS3

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

GNS3 Installation
Download:
http://www.gns3.net/ all-in-one installation Download Cisco/Juniper IOS

FIX GNS3 / Dynamips 100% CPUProblem


http://www.youtube.com/watch?v=NkEv6v6rqlA

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Installation
Preparation
sudo apt-get install libxt-dev libx11-dev libxmu-dev kdebase-dev build-essential autoconf automake g++

Installation
Download: sudo su tar -xzvf ns-allinone-2.33.tar.gz cd ns-allinone-2.33 ./install ./validate ns

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Installation
After Installation
sudo su gedit ~/.bashrc

Change lines:
# LD_LIBRARY_PATH OTCL_LIB=/teu/caminho/ns-allinone-2.33/otcl-1.13 NS2_LIB=/teu/caminho/ns-allinone-2.33/lib X11_LIB=/usr/X11R6/lib USR_LOCAL_LIB=/usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL _LIB # TCL_LIBRARY TCL_LIB=/teu/caminho/ns-allinone-2.33/tcl8.4.18/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB # PATH XGRAPH=/teu/caminho/ns-allinone-2.33/bin:/teu/caminho/ns-allinone2.33/tcl8.4.18/unix:/teu/caminho/ns-allinone-2.33/tk8.4.14/unix NS=/teu/caminho/ns-allinone-2.33/ns-2.33/ NAM=/teu/caminho/ns-allinone-2.33/nam-1.13/ PATH=$PATH:$XGRAPH:$NS:$NAM

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Initialization
#Create a simulator object set ns [new Simulator] #Open a trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } #CODE #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" #Run the simulation $ns run

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Options

#Define different colors for data flows $ns color 1 Blue $ns color 2 Red $ns color 3 green

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Nodes and Links


#Create nodes set n0 [$ns node] set n1 [$ns node] #Connect nodes with links $ns duplex-link $n0 $n3 1Mb 1ms DropTail $ns duplex-link $n1 $n3 2Mb 0.5ms DropTail #$ns duplex-link $n0 $n1 <bandwidth> <delay> <queue_type> #<queue_type>: DropTail, RED, etc #Change Link up/down $ns rtmodel-at 1.0 down $n0 $n1 $ns rtmodel-at 2.0 up $n0 $n1 #$ns rtmodel-at <time> up|down $n0 $n1 #Queuing Limitation #$ns duplex-link-op $n3 $n4 queuePos 0.5 # Queuing Limitation #$ns queue-limit $n3 $n4 50

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Transport Generation


#Create a TCP agent set tcp0 [new Agent/TCP] $tcp0 set class_ 1 $ns attach-agent $n0 $tcp0 #Create a UDP agent set udp2 [new Agent/UDP] $udp2 set class_ 3 $ns attach-agent $n2 $udp2 #Create a Null agent (a traffic sink) set null0 [new Agent/TCPSink] $ns attach-agent $n5 $null0 #Connect the traffic source with the traffic sink $ns connect $tcp0 $null0

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

NS2 Traffic Generation


# Create a CBR traffic source and attach it to udp2 set cbr2 [new Application/Traffic/CBR] $cbr2 set packetSize_ 500 $cbr2 set interval_ 0.005 $cbr2 attach-agent $udp2

set ftp1 [new Application/FTP] $ftp1 set packetSize_ 500 $ftp1 set interval_ 0.005 $ftp1 attach-agent $tcp1

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

10

NS2 Events
#Schedule events for the CBR agent $ns at 0.5 "$cbr0 start" inicio aos 0,5 $ns at 4.5 "$cbr0 stop" fim aos 4,5 $ns at 0.8 "$ftp1 start" $ns at 4.5 "$ftp1 stop" $ns at 0.3 "$cbr2 start" $ns at 4.5 "$cbr2 stop" #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" #Run the simulation $ns run correr a simulao

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

11

NS3 Installation
Ns3
Download:http://www.nsnam.org/releases/ns-3.3.tar.bz2 sudo su tar xvf ns-3.X.tar.bz2 (descompactao) cd ns-3.X (pasta descompactada) ./waf configure (configurao da instalao) ./waf build (compilao) ./waf check (verificao) ./waf --run first
Este comando compila e executa o programa examples/first.cc e gera os ficheiros .pcap (captura de trfego) e .tr (trace data) relativos simulao.

Pyviz
http://code.nsnam.org/gjc/ns-3-pyviz-dev sudo apt-get install python-dev python-pygraphviz python-kiwi pythonpygoocanvas python-gnome2 use --pyrun instead of --run

SSR - EERC Pedro Pinto pedropinto@estg.ipvc.pt

12

Das könnte Ihnen auch gefallen