NS2 (Network Simulator 2) was created based on Unix environment. It works very well with Linux. However, there is a possibility to install and run NS2 from your Windows machine.
* This document is modified from [ Sumathi Gopal ]'s [ "Installing NS2 and relevant binaries on Windows 98" ] *
What do I need?
- Tcl/Tk binaries version "8.3" for Windows. Version 8.4 does not work with the current version of NS2 binaries.
- Network Simulator 2 (NS2) and The Network Animator (NAM) binaries.
- Cygwin (optional)
- Tool for converting CR/LF (DOS new line delimiters) to LF (Unix new line delimiter) such as tofrodos.
Why do I need Cygwin?
The NS2's output is the NAM's input. NS2 for Windows produce the result simulation file with CR/LF. Unfortunately NAM for Windows seems to accept only the simulation file with LF. This can be handled under Cygwin. But if you don't want to install Cygwin, you can choose to convert the format of simulation file manually.
Where to download?
How to install?
- Double click tcl830.exe to install tcl83.dll. Let's say the directory c:\apps\tcl\ is used for the installation.
- Copy and rename NS2 and NAM executable files downloaded to c:\apps\tcl\bin\ns.exe and c:\apps\tcl\bin\nam.exe respectively.
- Copy "fromdos.exe" to c:\apps\tcl\bin\fromdos.exe
Note: According to an experiment, ns and nam executable files seem to need only tcl83.dll. If you don't want to install tcl completely, you can try downloading just the dll file [ here ].
Test
- Make sure that ns.exe, nam.exe and tcl83.dll are in the same directory.
- Create a test script (See lab 2 exercise). Assume that you name it "file1.tcl"
- Run "ns file1.tcl".
- In your script, DON'T call nam.exe directly. From the lab description, for example, change
a line
- from $ns at 2.0 "$ns flush-trace; exec nam -a $namfile; exit 0"
- to $ns at 2.0 "$ns flush-trace; exit 0"
- After executing "ns file1.tcl", use fromdos.exe to convert the output file from Dos delimiter to Unix delimiter.
- For the output file named "tcp.nam", execute "nam tcp.nam" to run the animator tool.
- You can create a batch file to make these steps easier. Try to modify the example batch file [ here ]
|