📄 mobility.tex
字号:
As mentioned earlier, the original CMU wireless model allowssimulation of wireless LANs and ad-hoc networks. However in order touse the wireless model for simulations using both wired and wirelessnodes we had to add certain extensions to cmu model. We call this wired-cum-wireless feature. Also SUN's MobileIP (implementedfor wired nodes) was integrated into the wireless model allowingmobileIP to run over wireless mobilenodes. The following twosubsections describe these two extensions to the wireless model in \ns. \subsection{wired-cum-wireless scenarios}\label{sec:wired-cum-wireless}The mobilenodes described so far mainly supports simulation ofmulti-hop ad-hoc networks or wireless LANs. But what if we need tosimulate a topology of multiple wireless LANs connected through wirednodes, or may need to run mobileIP on top of these wireless nodes? Theextensions made to the CMU wireless model allows us to do that. The main problem facing the wired-cum-wireless scenario was the issueof routing. In ns, routing information is generated based on theconnectivity of the topology, i.e how nodes are connected to oneanother through \code{Links}. Mobilenodes on the other hand have noconcept of links. They route packets among themselves, within thewireless topology, using their routing protocol. so how would packetsbe exchanged between these two types of nodes? So a node called \code{BaseStationNode} is created which plays therole of a gateway for the wired and wireless domains. The\code{BaseStationNode} is essentially a hybrid between a Hierarchicalnode\footnote{Refer to Chapter~\ref{chap:hier-rtg} for details on hierarchical routing and internals of \code{HierNode}.}(\code{HierNode}) and a \code{MobileNode}. The basestation node isresponsible for delivering packets into and out of the wirelessdomain. In order to achieve this we need Hierarchical routing. Each wireless domain along with its base-station would have an uniquedomain address assigned to them. All packets destined to a wirelessnode would reach the base-station attached to the domain of thatwireless node, who would eventually hand the packetover to the destination (mobilenode). And mobilenodes route packets,destined to outside their (wireless) domain, to their base-stationnode. The base-station knows how to forward these packets towards the(wired) destination.\begin{figure} \centerline{\includegraphics{basestation}} \caption{Schematic of a baseStationNode} \label{fig:mobilenode-basestation}\end{figure}The schematic of a \code{BaseStationNode} is shown inFigure~\ref{fig:mobilenode-basestation}.The mobilenodes in wired-cum-wireless scenario are required to supporthierarchical addressing/routing. Thus the \code{MobileNode} looksexactly like the \code{BaseStationNode}. The SRNode, however, simplyneeds to have its own hier-address since it does not require anyaddress demuxes and thus is not required to support hierrouting\footnote{In order to do away with all these different variations of the definition of a node, we are planning to revise the node architecture that would allow a more flexible and modularised construction of a node without the necessity of having to define and be limited to certain Class definitions only.}.The DSDV agent on having to forward a packet checks to see if thedestination is outside its (wireless) subnet. If so, it tries toforward the packet to its base-station node. In case no route tobase-station is found the packet is dropped. Otherwise thepacket is forwarded to the next\_hop towards the base-station. Whichis then routed towards the wired network by base-station'sclassifiers.The DSR agent, on receiving a pkt destined outside its subnet, sendsout a route-query for its base-station in case the route tobase-station is not known. The data pkt is temporarily cached while itwaits to hear route replies from base-station. On getting a reply thepacket is provided with routing information in its header and sendaway towards the base-station. The base-station address demuxes routesit correctly toward the wired network.The example script for a wired-cum-wireless simulation can be found at\nsf{tcl/ex/wired-cum-wireless-sim.tcl}. The methods forwired-cum-wireless implementations are defined in\nsf{tcl/lib/ns-bsnode.tcl}, \nsf{tcl/mobility/\{com.tcl,dsr.tcl, dsdv.tcl\}}, \nsf{dsdv/dsdv.\{cc,h\}} and\nsf{dsr/dsragent.\{cc,h\}}.\subsection{MobileIP}\label{sec:mobileip}The wired-cum-wireless extensions for the wireless model paved thepath for supporting wireless MobileIP in \ns. Sun Microsystem's(Charlie Perkins {\em et al}) MobileIP model was based on ns's wired model(consisting of \code{Node}'s and \code{Link}'s) and thus didnot useCMU's mobility model.Here we briefly describe the wireless MobileIP implementation. We hopethat Sun would provide the detailed version of the documentation inthe future.The mobileIP scenario consists of Home-Agents(HA) andForeign-Agents(FA) and have Mobile-Hosts(MH) moving between their HAand FAs.The HA and FA are essentially base-station nodes we have describedearlier. While MHs are basically the mobileNodes described insection~\ref{sec:mobilenode-creation}.The methods and procedures for MobileIP extensions are described in\nsf{mip.\{cc,h\}}, \nsf{mip-reg.cc}, \nsf{tcl/lib/ns-mip.tcl} and\nsf{tcl/lib/ns-wireless-mip.tcl}.\begin{figure} \centerline{\includegraphics{wireless-mip}} \caption{Schematic of a Wireless MobileIP BaseStation Node} \label{fig:mobilenode-wireless-mip}\end{figure}The HA and FA nodes are defined as \code{MobileNode/MIPBS} having aregistering agent (regagent\_) that sends beacon out to themobilenodes, sets up encapsulator and decapsulator, as required andreplies to solicitations from MHs. The MH nodes are defined as \code{MobileNode/MIPMH} which too have aregagent\_ that receives and responds to beacons and sends outsolicitations to HA or FAs. Figure~\ref{fig:mobilenode-wireless-mip}illustrates the schematic of a \code{MobileNode/MIPBS} node. The \code{MobileNode/MIPMH} node is very similar to this exceptfor the fact that it doesnot have any encapsulator or decapsulator. Asfor the SRNode version of a MH, it doesnot have the hierarchicalclassifiers and the RA agent forms the entry point of the node. SeeFigure~\ref{fig:mobilenode-dsr} for model of a SRNode. The \code{MobileNode/MIPBS} node routinely broadcasts beacon oradvertisement messages out to MHs. A solicitation from a mobilenodegenerates an ad that is send directly to the requesting MH. Theaddress of the base-station sending out beacon is heard by MH and is used as the COA (care-of-address) of the MH. Thus as the MHmoves from its native to foreign domains, its COA changes. Upon receiving reg\_request (as reply to ads) from a mobilehost thebase-station checks to see if it is the HA for the MH. If not, it setsup its decapsulator and forwards the reg\_request towards the HA ofthe MH. In case the base-station {\em is} the HA for the requesting MH but theCOA doesnot match its own, it sets up an encapsulator and sendsreg-request-reply back to the COA (address of the FA) who hasforwarded the reg\_request to it. so now all packets destined to theMH reaching the HA would be tunneled through the encapsulator whichencapsulates the IP pkthdr with a IPinIP hdr, now destined to the COAinstead of MH. The FA's decapsulator recives this packet, removes theencapsulation and sends it to the MH.If the COA matches that of the HA, it just removes the encapsulator itmight have set up (when its mobilehost was roaming into foreignnetworks) and sends the reply directly back to the MH, as the MH havenow returned to its native domain.The mobilehost sends out solicitations if it doesnot hear any ads from thebase-stations. Upon receiving ads, it changes its COA to the address ofthe HA/FA it has heard the ad from, and replies back to the COA with arequest for registration (\code{reg-request}).Initially the MH maybe in the range of the HA and receives all pktsdirectly from its COA which is HA in this case. Eventually as the MH moves out of range of its HA and into the a foreigndomain of a FA, the MH's COA changes from its HA to that of the FA. The HAnow sets up an encapsulator and tunnels all pkts destined for MH towardsthe FA. The FA decapsulates the pkts and hands them over to the MH. Thedata from MH destined for the wired world is always routed towards itscurrent COA. An example script for wireless mobileIP can be found at\nsf{tcl/ex/wireless-mip-test.tcl}. The simulation consists of a MH movingbetween its HA and a FA. The HA and FA are each connected to a wireddomain on one side and to their wireless domains on the other. TCP flowsare set up between the MH and a wired node. \section{Commands at a glance}\label{sec:wirelesscommand}Following is a list of commands used in wireless simulations:\begin{program}$ns_ node-config -addressingType <usually flat or hierarchical used for wireless topologies> -adhocRouting <adhoc rotuing protocol like DSDV, DSR, TORA, AODV etc> -llType <LinkLayer> -macType <MAC type like Mac/802_11> -propType <Propagation model like Propagation/TwoRayGround> -ifqType <interface queue type like Queue/DropTail/PriQueue> -ifqLen <interface queue length like 50> -phyType <network inteface type like Phy/WirelessPhy> -antType <antenna type like Antenna/OmniAntenna> -channelType <Channel type like Channel/WirelessChannel> -topoInstance <the topography instance> -wiredRouting <turning wired routing ON or OFF> -mobileIP <setting the flag for mobileIP ON or OFF> -energyModel <EnergyModel type> -initialEnergy <specified in Joules> -rxPower <specified in W> -txPower <specified in W> -agentTrace <tracing at agent level turned ON or OFF> -routerTrace <tracing at router level turned ON or OFF> -macTrace <tracing at mac level turned ON or OFF> -movementTrace <mobilenode movement logging turned ON or OFF>\end{program}This command is used typically to configure for a mobilenode. For more infoabout this command (part of new node APIs) see chapter titled "Restructuringns node and new Node APIs" in ns Notes and Documentation.\begin{flushleft}\code{$ns_ node <optional:hier address>}\\This command is used to create a mobilenode after node configuration is doneas shown in the node-config command. Incase hierarchical addressing is beingused, the hier address of the node needs to be passed as well.\code{$node log-movement}\\This command previously used to enable logging of mobilenode's movement has nowbeen replaced by \code{$ns_ node-config -movementTrace <ON or OFF>}.\code{create-god <num_nodes>}\\This command is used to create a God instance. The number of mobilenodesis passed as argument which is used by God to create a matrix to storeconnectivity information of the topology.\code{$topo load_flatgrid <X> <Y> <optional:res>}\\This initializes the grid for the topography object. <X> and <Y> are the x-yco-ordinates for the topology and are used for sizing the grid. The gridresolution may be passed as <res>. A default value of 1 is normally used.\code{$topo load_demfile <file-descrptor>}\\For loading DEMFile objects into topography. See \ns/dem.{cc,.h} for details onDEMFiles.\code{$ns_ namtrace-all-wireless <namtrace> <X> <Y>}\\This command is used to initialize a namtrace file for logging node movementsto be viewed in nam. The namtrace file descriptor, the X and Y co-ordinates of the wireless topology is passed as parameters withthis command.\code{$ns_ nam-end-wireless <stop-time>}\\This command is used to tell nam the simulation stop time given by <stop-time>.\code{$ns_ initial_node_pos <node> <size>}\\This command defines the node initial position in nam. <size> denotes the sizeof node in nam. This function must be called after mobility model has beendefined.\code{$mobilenode random-motion <0 or 1>}\\Random-motion is used to turn on random movements for the mobilenode, in whichcase random destinations are assigned to the node. 0 disables and 1 enablesrandom-motion.\code{$mobilenode setdest <X> <Y> <s>}\\This command is used to setup a destination for the mobilenode. The mobilenode starts moving towards destination given by <X> and <Y> at a speed of<s> m/s.\code{$mobilenode reset}\\This command is used to reset all the objects in the nodes (network components like LL, MAC, phy etc).Internal procedures\\Following is a list of internal procedures used in wireless networking:\code{$mobilenode base-station <BSnode-hier-addr>}\\This is used for wired-cum-wireless scenarios. Here the mobilenode is providedwith the base-stationnode info for its domain. The address is hierarchicalsince wired-cum-wireless scenarios typically use hierarchical addressing.\code{$mobilenode log-target <target-object>}\\The <target-object>, which is normally a trace object, is used to logmobilenode movements and their energy usage, if energy model is provided.\code{$mobilenode topography <topoinstance>}\\This command is used to provide the node with a handle to the topographyobject.\code{$mobilenode addif}\\A mobilenode may have more than one network interface. This command is usedto pass handle for a network interface to the node.\code{$mobilenode namattach <namtracefd>}\\This command is used to attach the namtrace file descriptor <namtracefd>to the mobilenode. All nam traces for the node are then written into thisnamtrace file.\code{$mobilenode radius <r>}\\The radius <r> denotes the node's range. All mobilenodes that fall withinthe circle of radius <r> with the node at its center are considered asneighbours. This info is typically used by the gridkeeper.\code{$mobilenode start}\\This command is used to start off the movement of the mobilenode.\end{flushleft}%\end{document}\endinput
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -