📄 node160.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>14.9 LANs and routing</TITLE><META NAME="description" CONTENT="14.9 LANs and routing"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html"><LINK REL="previous" HREF="node159.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node159.html"><LINK REL="up" HREF="node142.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html"><LINK REL="next" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html3732" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3726" HREF="node142.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3720" HREF="node159.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node159.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3728" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3730" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3733" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html">14.10 Commands at a</A><B> Up:</B> <A NAME="tex2html3727" HREF="node142.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html">14. Local Area Networks</A><B> Previous:</B> <A NAME="tex2html3721" HREF="node159.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node159.html">14.8 Other Components</A>   <B> <A NAME="tex2html3729" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3731" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION031190000000000000000"></A><A NAME="sec:lan_ns-routing"></A><BR>14.9 LANs and routing</H1><P>When a LAN is created using either <TT>make-lan</TT> or <TT>newLan</TT>, a``<I>virtual LAN node</I>'' <TT>LanNode</TT> is created.<TT>LanNode</TT> keeps together all shared objects on the LAN:<TT>Channel</TT>, <TT>Classifier/Mac</TT>, and <TT>LanRouter</TT>. Then foreach node on the LAN, a <TT>LanIface</TT> object is created.<TT>LanIface</TT> contains all other objects that are needed on theper-node basis: a <TT>Queue</TT>, a link layer (<TT>LL</TT>),<TT>Mac</TT>, etc. It should be emphasized that <TT>LanNode</TT> is anode only for routing algorithms: <TT>Node</TT> and <TT>LanNode</TT> havevery little in common. One of few things that they share is anidentifier taken from the <TT>Node</TT> ID-space. If<I>hierarchical routing</I> is used, <TT>LanNode</TT> <I>has to beassigned a hierarchical address</I> just like any other node. From thepoint of view of (static) routing, <TT>LanNode</TT> is just anothernode connected to every node on the LAN.<DIV ALIGN="CENTER"><A NAME="fig:lan-routing1"></A><A NAME="6052"></A><TABLE><CAPTION ALIGN="BOTTOM"><STRONG>Figure:</STRONG>Actual LAN configuration (left) and as seen by routing (right)</CAPTION><TR><TD><DIV ALIGN="CENTER">lan2</DIV></TD></TR></TABLE></DIV>Links connecting the <TT>LanNode</TT> with the nodes on the LAN are also``virtual'' (<TT>Vlink</TT>). The default routing cost of such a linkis , so the cost of traversing two <TT>Vlink</TT>s(e.g. <B>n1 LAN n2</B>) is counted as just onehop. <P>Most important method of <TT>Vlink</TT> is the one that gives the headof the link:<PRE>Vlink instproc head {} { $self instvar lan_ dst_ src_ if {$src_ == [$lan_ set id_]} { # if this is a link FROM the lan vnode, # it doesn't matter what we return, because # it's only used by $lan add-route (empty) return "" } else { # if this is a link TO the lan vnode, # return the entry to the lanIface object set src_lif [$lan_ set lanIface_($src_)] return [$src_lif entry] }}</PRE>This method is used by static (default) routing to install correctroutes at a node (see <TT>Simulator</TT> methods <BR><TT>compute-flat-routes</TT> and<TT>compute-hier-routes</TT> in <TT>tcl/lib/ns-route.tcl</TT>, as wellas <TT>Node</TT> methods <TT>add-route</TT> and <TT>add-hroute</TT> in<TT>tcl/lib/ns-node.tcl</TT>). <P>From the code fragment above it can be seen that it returns LANinterface of the node as a head of the link to be installed in theappropriate classifier. <P>Thus, <TT>Vlink</TT> <I>does not impose any delay on the packet</I>and serves the only purpose to install LAN interfaces instead ofnormal links at nodes' classifiers. <P>Note, that this design allows to have nodes connected by parallelLANs, while in the current implementation it is impossible to havenodes connected by parallel simple links and use them both (the array<TT>Simulator instvar link_</TT> holds the link object for eachconnected pair of source and destination, and it can be only oneobject per source/destination pair).<P><HR><!--Navigation Panel--><A NAME="tex2html3732" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3726" HREF="node142.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3720" HREF="node159.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node159.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3728" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3730" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3733" HREF="node161.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node161.html">14.10 Commands at a</A><B> Up:</B> <A NAME="tex2html3727" HREF="node142.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node142.html">14. Local Area Networks</A><B> Previous:</B> <A NAME="tex2html3721" HREF="node159.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node159.html">14.8 Other Components</A>   <B> <A NAME="tex2html3729" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html3731" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -