the addressing structure in ns. the default address format 32 lower bits for port-id, 1 higher bit...

27
The Addressing Structure in NS

Upload: shona-caldwell

Post on 17-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 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

The Addressing Structure in NS

Page 2: 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

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

Page 3: 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

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

Page 4: 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

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.

Page 5: 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

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).

Page 6: 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

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

Page 7: 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

Mobile Networking in ns

Page 8: 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

Mobile Networking

Mobile node Routing mechanisms Network components

Channel Network interface Radio propagation model MAC protocols Interface Queue Link Layer ARP

Page 9: 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

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

Page 10: 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

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

Page 11: 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
Page 12: 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
Page 13: 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

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.

Page 14: 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

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

Page 15: 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

Network Components in a mobilenode

MobileNode method add-interface() in ~ns/tcl/lib/ns-mobilenode.tcl

Page 16: 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

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

Page 17: 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

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

Page 18: 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

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().

Page 19: 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

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

Page 20: 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

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]

Page 21: 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

Example for wireless

Default Script Options Main Program produce some simple node movements simulation ends

Page 22: 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

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_.

Page 23: 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

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

Page 24: 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

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

Page 25: 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

new trace format

Page 26: 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

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

Page 27: 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

new trace format

General tag The second field starting with "-t" may

stand for time or global setting -t time -t * (global setting)