How to install NS2 on windows 7 with the help of Cygwin Window

Here I will show you how to install NS2 on Windows 7(32-bit | 64-bit):

Step 1:

Please go to below given link and download the three .rar files after that place these files into in a single folder.

Step 2: 

  • Now Extract the NS 2.35.part1 only.It will extract the part2 an part3 automatically.
  • Extract after complete download
  • Don’t Extract the part2 and part3 

Step 3:

  •  After extraction you’ll get a folder named NS 2.35
  • Inside this folder you get cygwin setup , .bashrc etc..
  • Now install the setup.  Choose install from local directory
  • Press Next
  • Don’t change the default Root Directory
  • In Local Package Rpository field browse to: NS 2.35/nslocal/release
  • Click Next
  • Click on the Circle
  • After clicking the circle the default turn to install
  • After this press Next it will install the necessary packages for NS2
  • check create a desktop shortcut and start menu shortcut
  • Then installation finished.:)p
  • Now you are halfway done !!!

Step 4:

  • Now create a folder Named Noureddine inside the C:\cygwin\home
  • Now copy the ns-allinone-2.35-RC7avecxgraph.rar and Extract there. You’ll get  ns-allinone-2.35-RC7 folder.
  • Now cpoy the .bashrc file from the downloaded Extract folder
  • Now go to the “C:\cygwin\home\user” folder and replace(i.e paste) the .bashrc file that you copied.
  • Now open the Cygwin command window which is on your desktop and type source .bashrc
  • Now type ns  “$” change to “%”
  • Now type ns-version it will show like:
  • Now press exit.
  • Now type startxwin you’ll get a new window.
  • Now type nam you will get a screen.
  • Now go to file and quit the nam window
  • Now hold the main tab and drag your mouse to quit from Cygwin window(the white window)
  • And exit from ‘cygwin command’ window (type exit)
  • Important:
  • go to Task manager (Alt+Ctrl+Del) and goto process tab and search for XWin.exe
  • End process

33 thoughts on “How to install NS2 on windows 7 with the help of Cygwin Window

      • Dear

        when i write command ” ns filename.tcl ”
        i got this problem ” could not read the file “wireless.tcl” no such file in the directory.

        but the file exist and i can run wireless.nam and work with me fine but wireless.tcl no can not work or run


  1. I am getting the following error when running startxwin. What to do ?

    $ startxwin
    0 [main] startxwin 26988 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    573 [main] startxwin 26988 open_stackdumpfile: Dumping stack trace to startxwin.exe.stackdump
    2 [main] startxwin 10712 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    1289 [main] startxwin 10712 open_stackdumpfile: Dumping stack trace to startxwin.exe.stackdump

    giving up.
    startxwin: No such file or directory (errno 2): unable to connect to X server
    startxwin: No such process (errno 3): Server error.


    • Dear
      Thank you very much, i have install ns2 on windows 7, but i have problem if you allow me which is i need to use xgraph for display PDR or throughput. how should i do or install to get them.
      thanks again


  2. i have one problem i could not solve and make running or executing not working with me, which is.

    for step which is.
    here when i type ” ns” it gives me error message which is

    ” bash: ns :command not found ”
    i do not know howto solve it because i can not run or execute and program.

    could you provide me your help to solve this problem


      • thank you i solve the problem and it works fine.
        and i need to know something,
        how can i get the output for such as performance or PDR or throughput.
        thanks again


      • Hello,
        1) First you need to design a TCL files according to your requirement.
        2) When you will run the TCL then you will get trace file (.tr) and network file (.nam)
        3) Now you need to download awk file for throughput and pdr.
        4) Put these two awk file into same folder of tr file
        5) Now run this command “awk -f pdr.awk”
        6) Now results will come on terminal.
        Thank you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.