30.7 Commands at a glance
Following is a list of unicast routing related commands used in simulation
$ns_ rtproto routing-proto args
where <routing-proto> defines the type of routing protocol to be used, like
Static, Manual, Session , DV etc. args may define the list of nodes on
which the protocol is to be run. The node list defaults to all nodes in
This command computes next_hop information for all nodes in the
topology using the topology connectivity. This next_hop info is
then used to populate the node classifiers or the routing tables.
compute-routes calls compute-flat-routes or compute-hier-routes depending
on the type of addressing being used for the simulation.
This returns a handle to the RouteLogic object (the routing table),
if one has been created. Otherwise a new routing table object is created.
This dumps next hop information in the routing table.
This dumps the distance information in the routing table.
$node add-route dst Target
This is a method used to add routing entries (nexthop information) in
routing table. The nexthop to <dst> from this node is the <target> object
and this info is added to the node's classifier.
$routelogic lookup srcid destid
Returns the id of the node that is the next hop from the node with id
srcid to the node with id destid.
$routelogic dump nodeid
Dump the routing tables of all nodes whose id is less than nodeid. Node
ids are typically assigned to nodes in ascending fashion starting from 0
by their order of creation.
rtobject dump-routes fileID
Dump the routing table to the output channel specified by fileID. fileID
must be a file handle returned by the Tcl open command and it must have
been opened for writing.
$rtobject rtProto? proto
Returns a handle to the routing protocol agent specified by proto if it
exists at that node. Returns an empty string otherwise.
$rtobject nextHop? destID
Returns the id of the node that is the next hop to the destination
specified by the node id, <destID>.
$rtobject rtpref? destID
Returns the preference for the route to destination node given by destid.
$rtobject metric? destID
Returns metric for the route to destid.