DOC PREVIEW
TAMU ECEN 602 - Kiran-NS-2

This preview shows page 1-2-14-15-30-31 out of 31 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 31 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Adapted from a presentation by Gayatri UCSB An Introduction to NS 2 Kiran Kotla Teaching Assistant ECEN 602 Ns 2 learning resources are available on this page http www ece tamu edu reddy ee602 07 html Course webpage for ECEN 602 NS 2 Learning Resources To analyze how different protocols work in complex real world scenarios It is difficult to deploy and test customized protocols in different machines across the world Why Simulation This is developed by ISI at USC www isi edu The most widely used open source network simulator available for free with Source code NS 2 stands for Network Simulator version 2 Why NS 2 Object oriented discrete event driven network simulator Written in C and OTcl What is ns ns new Simulator at 1 puts Hello World at 1 5 exit run World bash shell set ns ns ns Hello bash shell ns Hello World Interactive mode Basic Tcl ex tcl tcl 8 7 6 5 4 3 2 1 Create Simulator object Turn on tracing Create topology Setup packet loss link dynamics Create routing agents Create application and or traffic sources Post processing procedures i e nam Post Start simulation NS 2 Generic Script Structure Create event scheduler set ns new Simulator Step1 Create Simulator Object Trace packets on all links ns namtrace all nf set nf open out nam w ns trace all nf Insert immediately after scheduler Step2 Tracing n1 n0 Two nodes One link Step 3 Create network n1 n0 ns duplex link n0 n1 bandwidth delay queue type queue type DropTail RED etc ns duplex link n0 n1 1Mb 10ms RED Links and queuing set n0 ns node set n1 ns node Nodes Step 3 Create Network for set i 0 i 7 incr i set n i ns node for set i 0 i 7 incr i ns duplex link n i n expr i 1 7 1Mb 10ms RED Creating a larger topology 8 7 6 5 4 3 2 1 Create Simulator object Turn on tracing Create topology Setup packet loss link dynamics Create routing agents Create application and or traffic sources Post processing procedures i e nam Post Start simulation NS 2 Generic Script Structure For example Link failures Hooks in routing module to reflect routing changes ns rtmodel at time up down n0 n1 ns rtmodel at 1 0 down n0 n1 ns rtmodel at 2 0 up n0 n1 Step 4 Network Dynamics ns connect udp null ns attach agent n0 udp ns attach agent n1 null set udp new Agent UDP set null new Agent Null null n1 n0 udp Step 5 Creating UDP connection cbr attach agent udp cbr set packetSize 500 cbr set rate 2Mb CBR set cbr new Application Traffic CBR Step 6 Creating Traffic On Top of UDP null n1 n0 udp cbr ns connect tcp tcpsink ns attach agent n0 tcp ns attach agent n1 tcpsink set tcp new Agent TCP set tcpsink new Agent TCPSink Creating TCP connection sink n1 n0 tcp Telnet set telnet new Application Telnet telnet attach agent tcp FTP set ftp new Application FTP ftp attach agent tcp Step 6 Creating Traffic On Top of TCP sink n1 n0 tcp ftp 8 7 6 5 4 3 2 1 Examples set ns new Simulator Turn on tracing Create topology Setup packet loss link dynamics Create agents Create application and or traffic sources Post processing procedures i e nam Post Start simulation Recall Generic Script Structure proc finish global ns nf ns flush trace close nf exec nam out nam exit 0 Add a finish procedure that closes the trace file and starts nam Post Processing Procedures event any legitimate ns tcl commands Run the simulation ns run Call finish ns at 5 0 finish ns at 0 5 cbr start ns at 4 5 cbr stop ns at time event Schedule Events Run Simulation 8 7 6 5 4 3 2 1 Examples set ns new Simulator Turn on tracing Create topology Setup packet loss link dynamics Create routing agents Create application and or traffic sources Post processing procedures i e nam Post Start simulation Recall Generic Script Structure Step2 Tracing 8 7 6 5 4 3 2 1 Create Simulator object Turn on tracing Create topology Setup packet loss link dynamics Create routing agents Create application and or traffic sources Post processing procedures i e nam Post Start simulation NS 2 Generic Script Structure Packet level animation Well supported by ns Simulation results xgraph nam 1 Network AniMator Version 1 Visualization Tools circle box hexagon ns at 1 1 n0 label web cache 0 Label single string node shape box Shape can t be changed after sim starts node color red Color nam Interface Nodes Label ns duplex link op n0 n1 label backbone Color ns duplex link op n0 n1 color green nam Interfaces Links duplex link op duplex link op duplex link op duplex link op n 0 n 1 n 2 n 3 n 1 n 2 n 3 n 4 orient orient orient orient If anything missing automatic layout ns ns ns ns Manual layout specify everything nam Interface Topology Layout right right right 60deg Simulation Example


View Full Document

TAMU ECEN 602 - Kiran-NS-2

Documents in this Course
lec16

lec16

16 pages

lec6

lec6

14 pages

lec21

lec21

20 pages

lec12

lec12

5 pages

lec152

lec152

16 pages

lec16

lec16

4 pages

lec1

lec1

23 pages

socket

socket

10 pages

lec23

lec23

12 pages

lec3

lec3

42 pages

lec15

lec15

14 pages

lec13

lec13

28 pages

Load more
Download Kiran-NS-2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Kiran-NS-2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Kiran-NS-2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?