NS Fundamentals (contd..) Padma Haldar USC/ISI 1
Outline � Ns fundamentals – Part I (by Chen) � NS fundamentals –Part II � NS Internals 2
Ns Internals � Tcl commands translates into � series of object creation � plumbing of these objects � Step-by-step review of how each network component gets set up in ns 3
Network Topology: Node n0 n1 Port Multicast Unicast dmux_ Classifier Node Node Addr classifier_ Classifier Node entry Node entry 0 0 dmux_ entry_ 1 entry_ Multicast classifier_ Classifier multiclassifier_ Set ns_ [new Simulator –multicast on] set n0 [ns_ node] 4 Set n1 [ns_ node]
Node Addressing � Two basic address styles available: flat and hierarchical � Default flat address: 32 bits each for node and port id � Default hier address: � 3 levels of hierarchy � 10 11 11 or 1 9 11 11 if mcast specified � Different bit allocation possible for specific hier addresses 5
Hierarchical Node n2 Address classifier To Port demux Node Level 3 entry Level 2 Level 1 6 ns_ node-config –addressing hier
Network Topology: Link n0 n1 duplex link n1 head_ entry_ enqT_ queue_ deqT_ link_ ttl_ drophead_ drpT_ tracing simplex link 7 [ns_ duplex-link $n0 $n1 5Mb 2ms drop-tail]
Transport n0 n1 Port Port Classifier Classifier dst_= 0.0 dst_= 1.0 Addr Addr Agent/TCP Agent/TCPSink 0 0 Classifier Classifier agents_ agents_ 0 1 dmux_ dmux_ entry_ entry_ classifier_ classifier_ set tcp [new Agent/TCP] set tcpsink [new Agent/TCPSink] ns_ attach-agent $n0 $tcp ns_ attach-agent $n1 $tcpsink 8 ns_ connect $tcp $tcpsink
Application: Traffic Generator n0 n1 Port Application/FTP Port Classifier Classifier dst_= 0.0 dst_= 1.0 Addr Addr Agent/TCPSink Agent/TCP 0 0 Classifier Classifier agents_ agents_ 0 1 dmux_ dmux_ entry_ entry_ classifier_ classifier_ set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 1.2 “$ftp start” 9
Routing n0 n1 Port Application/FTP Classifier Addr Agent/TCP 0 Classifier agents_ n1 Node entry 0 head_ entry dmux_ enqT_ queue_ deqT_ link_ ttl_ _ 1 entry_ classifier_ drophead_ drpT_ 10
Routing (con’t) n0 n1 Application/FTP Port Port Classifier Classifier Agent/TCP Addr Addr Agent/TCP Classifier Classifier agents_ 0 1 dmux_ dmux_ Link n0-n1 1 0 entry_ entry_ classifier_ classifier_ Link n1-n0 11
Plumbing: Packet Flow n0 n1 Port Application/FTP Port Classifier Classifier dst_= 0.0 dst_= 1.0 Addr Addr Agent/TCPSink Agent/TCP 0 0 Classifier Classifier 0 1 Link n0-n1 1 0 entry_ entry_ Link n1-n0 12
Recommend
More recommend