the addressing structure in ns. the default address format 32 lower bits for port-id, 1 higher bit...
TRANSCRIPT
The Addressing Structure in NS
The Default Address Format
32 lower bits for port-id, 1 higher bit for mcast and the rest 32 higher bits for node-id.
$ns set-address-format def
The Hierarchical Address Format
Default Hierarchical Setting $ns set-address-format hierarchical 3 levels of hierarchy
Specific Hierarchical Setting $ns set-address-format hierarchical 2 8 15
The Expanded Node-Address Format
address space to 30 bits, allocating 22 higher bits to node-id and lower 8 bits to port-id.
this command is now obsolete given that node address and port address spaces are 32 bits wide.
Errors in setting address format
if number of bits specified is less than 0. if bit positions clash (contiguous number of
requested free bits not found). if total number of bits exceed MAXADDRSIZE_. if expand-port-field-bits is attempted with portbits
less than or equal to the existing portsize. if number of hierarchy levels do not match with
number of bits specified (for each level).
Hierarchical Address Format-ex
- set ns [new Simulator] $ns set-address-format hierarchical
- AddParams set domain_num_ 區域數 AddParams set cluster_num_ 群組數 AddParams set nodes_num_ 節點數
design topology
Mobile Networking in ns
Mobile Networking
Mobile node Routing mechanisms Network components
Channel Network interface Radio propagation model MAC protocols Interface Queue Link Layer ARP
The basic wireless model in ns
MobileNode object is a split object. The C++ class MobileNode is derived from
parent class Node. (ref ch5) Difference
added functionalities of a wireless mobile node like ability to move within a given
topology not connected by means of Links to other nodes or
mobilenodes.
Routing mechanisms
Mobilenode Object
Implemented in C++
The mobility features node movement periodic position
updates maintaining topology
boundary etc
implemented in Otcl
MobileNode itself Classifiers Dmux LL Mac Channel etc
Creating Node movements
Start position: $node set X_ <x1> $node set Y_ <y1> $node set Z_ <z1>
Future destinations: $ns at $time $node setdest <x2> <y2> <speed> Ex:
ns at 3.0 "$node (0) setdest 48.0 38.0 5.0
the third dimension (Z) is not used.
Creating Node movements
random movement $mobilenode start
Set topology set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y)
opt(x) and opt(y) are the boundaries used in simulation
Network Components in a mobilenode
MobileNode method add-interface() in ~ns/tcl/lib/ns-mobilenode.tcl
MN components
Link Layer-(ref.14) ARP module connected to it which resolves all IP to
hardware (Mac) address conversions ARP
O-writes it into the mac header of the packet X-broadcasts an ARP query
Interface Queue priority to routing rotocol packets
Mac Layer carrier sense
MN components-cont. Tap Agents
defined in mac.h register themselves with the mac object using method
installTap() Network Interfaces
mobilenode to access the channel. implemented Phy/WirelessPhy
Radio Propagation Model Friss-space attenuation (1/r2) Two ray Ground (1/r4)
Antenna
MAC layer protocols
802.11MAC protocol See ~ns/mac-802_11.{cc,h} for implementation details.
Preamble based TDMA protocol ns supports a single hop, preamble-based TDMA MAC
protocol multi-hop environment are not considered TDMA frame contains
preamble data transmission slots
avoid unnecessary power consumption set_node_sleep().
Routing Agents DSDV
messages are exchanged between neighbouring mobilenodes
~ns/dsdv directory and ~ns/tcl/mobility/dsdv.tc DSR
checks every data packet for source-route information. X-Routing queries
~ns/tcl/mobility/dsr.tcl TORA
ns/tora directory and ns/tcl/mobility/tora.tcl AODV
ns/aodv and ns/tcl/lib/ns-lib.tcl
Trace Support
cmu-trace objects are of three types CMUTrace/Drop CMUTrace/Recv CMUTrace/Send
~ns/trace.{cc,h} and ~ns/tcl/lib/ns-cmutrace.tcl.
tracing all packets that are sent out in a router set sndT [cmu-trace Send "RTR" $self]
Example for wireless
Default Script Options Main Program produce some simple node movements simulation ends
Trace Support-cont.
The cmu-trace object CMUTrace is derived from the base class Trace. See Chapter 26 for details on class Trace
tracing packets dropped, received and sent by agents, routers,
mac layers or interface queues in ns. All traces are written to the buffer wrk_.
Trace Support-cont.
An example of a trace for a tcp packet is as follows:
r 160.093884945 _6_ RTR --- 5 tcp 1492 [a2 4 6 800] ------- [65536:0 16777984:0 31 16777984] [1 0] 2 0
Revised format for wireless traces
cmu-trace objects This command should be called before the
universal trace command $ns trace-all <trace-fd>
Currently this new trace support is available for wireless
new trace format
new trace format
Event type In the traces above, the first field (as in the
older trace format) describes the type of event taking place at the node and can be one of the four types: s send r receive d drop f forward
new trace format
General tag The second field starting with "-t" may
stand for time or global setting -t time -t * (global setting)