⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nsbasic.html

📁 NS的教程
💻 HTML
字号:
<HTML>

<HEAD>
 <TITLE>Marc Greis' Tutorial for the UCB/LBNL/VINT Network Simulator "ns"</title>
</HEAD>

<BODY BGCOLOR="#ffffff" TEXT="#000000">

<H1 ALIGN=CENTER>III. The Basics</H1>

<P>
[<A HREF="nsdoc.html">Previous section</A>]
[<A HREF="nsscript1.html">Next section</A>]
[<A HREF="nsindex.html">Back to the index</A>]
</P>

<HR>
<A NAME="inst">
<P>
<STRONG>III.1. Downloading/Installing ns&nam</STRONG><BR>
You can build ns either from the the various packages (Tcl/Tk, otcl,
etc.), or you can download an 'all-in-one' package. I would recommend
that you start with the all-in-one package, especially if you're not
entirely sure which packages are installed on your system, and where
exactly they are installed. The disadvantage of the all-in-one
distribution is the size, since it contains some components that you
don't need anymore after you compiled ns and nam. It's still good
for first tests, and you can always switch to the single-package
distribution later.
</P>

<P>
Note: The all-in-one package only works on Unix systems.
</P>

<P>
You can download the package from the 
<A HREF="http://www.isi.edu/nsnam/ns/ns-build.html">ns
download page</A> at UCB. If you have any problems with your 
installation, take a look at the
<A HREF="http://www.isi.edu/nsnam/ns/ns-problems.html">installation
problems page</A> on their server. If that also doesn't solve your problem,
you might want to ask the <A HREF="http://www.isi.edu/nsnam/ns/ns-lists.html">
ns-users mailing list</A>.
</P>

<P>
After the installation is complete, you should make sure that your 
path points to the 'ns-allinone/bin' directory (if you installed the
ns-allinone package) where links to the ns and nam executables in the 
'ns-2' and 'nam-1' directories can be found or (if you built ns and
nam from the pieces) let your path point directly to the directories
with the ns and nam executables.
</P>

<P>
On some systems you will also have to make sure that ns can find
the library 'libotcl.so'. If you installed the ns-allinone package,
it should be in 'ns-allinone/otcl/'. On Solaris systems you would have
to add this path to the 'LD_LIBRARY_PATH' environment variable. For help
with other systems, consult the
<A HREF="http://www.isi.edu/nsnam/ns/ns-problems.html">installation
problem page</A>, the 
<A HREF="http://www.isi.edu/nsnam/ns/ns-lists.html">ns-users
mailing list</A> or your local Unix gurus.
</P>

<P>
A note concerning the ns-allinone version 2.1b3: There is a bug in it which
causes some problems on Solaris systems when nam trace generation is turned
on. You can either download 
<A HREF="http://www.isi.edu/nsnam/dist/vint/ns-allinone-2.1b2.tar.gz">ns-allinone version 2.1b2</A>
instead or go to the <A HREF="http://www.isi.edu/nsnam/ns/index.html">ns web page</A>
to download a current snapshot of ns. If you do that, you have to unzip and
untar the file in your allinone directory. Then you change into the new
directory and run './configure', then 'make'.
</P>
<HR>

<A NAME="ns">
<STRONG>III.2. Starting ns</STRONG>
<P>
You start ns with the command 'ns &lt;tclscript&gt;' (assuming that you are in
the directory with the ns executable, or that your path points to that
directory), where '&lt;tclscript&gt;' is the name of a Tcl script 
file which defines the simulation scenario (i.e. the topology and 
the events). You could also just start ns without any arguments and 
enter the Tcl commands in the Tcl shell, but that is definitely less 
comfortable. For information on how to write your own Tcl scripts 
for ns, see <A HREF="nsscripts.html">section IV</A>.
</P>

<P>
Everything else depends on the Tcl script. The script might create some
output on stdout, it might write a trace file or it might start nam to
visualize the simulation. Or all of the above. These possibilities will all
be discussed in later sections.
</P>

<HR>

<A NAME="nam">
<STRONG>III.3. Starting nam</STRONG>
<P>
You can either start nam with the command 'nam &lt;nam-file&gt;' where
'&lt;nam-file&gt;' is the name of a nam trace file that was generated by
ns, or you can execute it directly out of the Tcl simulation
script for the simulation which you want to visualize. The latter
possibility will be described in <A HREF="nsscripts">Section IV</A>. For additional
parameters to nam, see the <A HREF="nam.txt">nam manual page</A>. Below
you can see a screenshot of a nam window where the most important functions
are being explained.
</P>

<P>
<IMG SRC="images/namss1.gif">
</P>

<HR>
<P>
[<A HREF="nsdoc.html">Previous section</A>]
[<A HREF="nsscript1.html">Next section</A>]
[<A HREF="nsindex.html">Back to the index</A>]
</P>
ns-users <BR>
<ADDRESS><A HREF="mailto:ns-users@isi.edu">ns-users@isi.edu</A></ADDRESS>

</BODY>

</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -