Skip to main content

NS2 (NS-2.35) Installation in Fedora 16

This post will help you in installing Network Simulator 2 version NS2.35 in Fedora 16

Steps:'

  • Install Fedora using a DVD ISO (if you go for a CD iso, then you need to download lot of packages)
  • Download NS-2.35 from this website.
  • Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one

tar zxvf ns-allinone-2.35.tar.gz

cd ns-allinone-2.35

./install

  • Once installed the PATH information will be shown in the screen.
  • Copy the PATH and LD_LIBRARY_PATH Variable to .bash_profile (see a dot in the beginning)

Input the path information in .bash_profile like this

There will be a PATH Variable already available in the .bash_profile file, just copy the PATH information from the NS2 installation and append it over the existing PATH variable (but put a separator : between each path)

export PATH=$HOME/bin:<Put a colon and Place your paths here>

export LD_LIBRARY_PATH=<place the LD_LIBRARY_PATHS> here.

Once done, save the file and close

execute the command

source .bash_profile

try ns (if you see a % indicates ns is installed successfully) or nam (a animation window will be opened).

Comments

  1. can we run ns2 program written in older version like ns2.33 in ns2.35?

    ReplyDelete
  2. how to create a .bashrc file?
    please provide with an example.

    ReplyDelete
  3. What are the required libraries for installing ns2.35 on Fedora 16 without any problems or errors (compile time/ run time)?

    http://fsdportal.blogspot.com

    ReplyDelete
  4. For a single PC is OK.. (Fedora 16)

    What about networked systems - using centralized logging?

    How any user can access ns and nam?

    http://fsdportal.blogspot.com

    ReplyDelete
  5. You can create a ns2.sh file inside the /etc/profile.d and set the PATH and LD_LIBRARY_PATH and restart the system. ?In this anyone can be able to access the ns and nam.

    ReplyDelete
  6. Hello Pradeepji...

    I rectified the error.. while running NAM on fedora 16... after installing ns2.35 on f16.


    In the path settings in .bash_profile...

    I removed the path representation for tk

    after/before I installed 'tk' from fedora 16's DVD.

    Now its works fine..


    I think there is some bugs in "tk section" of ns2.35.allinone.tar.gz pack content.

    Thank You for your Basic Guidance to NS2 on Fedora 16

    Krishna Valoor

    http://fsdportal.blogspot.com

    ReplyDelete
  7. Hello..

    Can You Help Me... (tried both NS2.34 and NS2.35 on Fedora 16)

    NS & NAM are working fine...


    Xgraph run-time error ..
    ###########################

    Example.

    File name: data.txt

    content :

    0 0
    1 1
    2 3

    (or any valid data for testing xgraph)
    Executing command :

    $xgraph "data.txt"

    It shows an error:
    ==================

    Parameter LabelFont: can't translate `helvetica-10' into a font (defaulting to `fixed')
    X Error: BadFont (invalid Font parameter)
    Major opcode of failed request: 55 (X_CreateGC)
    Aborted (core dumped)

    or

    Parameter TitleFont: can't translate `helvetica-18' into a font (defaulting to `fixed')
    X Error: BadFont (invalid Font parameter)
    Major opcode of failed request: 55 (X_CreateGC)
    Aborted (core dumped)

    ReplyDelete
    Replies
    1. Hi,
      I have the same error.
      Can you help me please!

      Delete
    2. Hii, i am getting the same error.Could you plz help me out.

      Delete
  8. please help me, where can I find the .bash_profile?

    ReplyDelete
  9. i have a trace file as output of a mobility model of manet.this trace file consist of co-ordinate of X,Y and is ns-compatible.i want to input this trace file in ns-2 and get a visual output.how can i fed my output file in ns-2? plz someone help me

    ReplyDelete
  10. Sir, i have downloaded ns 2.34 allinone in fedora 8. But after ./install it works properly but at the end it says:No rule to make target VERSION,needed by gen.version/c.ns make failed.Please help me asap.It is urgent

    ReplyDelete
  11. I have install fedora 16. I want to install NS 2.35. I get the following error when I try ./install. Please anybody help me.

    [root@sham ns-allinone-2.35]# ./install
    ============================================================
    * Testing for Darwin (OS X) environment
    ============================================================
    ============================================================
    * Testing for Cygwin environment
    ============================================================
    Cygwin not detected, proceeding with regular install.
    ============================================================
    * Testing for FreeBSD environment
    ============================================================
    FreeBSD not detected
    ============================================================
    * Build XGraph-12.2
    ============================================================
    configure: error: expected an absolute directory name for --prefix: ..
    make all-am
    make[1]: Entering directory `/home/for/ns-allinone-2.35/xgraph-12.2'
    gcc -DHAVE_CONFIG_H -I. -g -MT xgraph.o -MD -MP -MF .deps/xgraph.Tpo -c -o xgraph.o xgraph.c
    make[1]: gcc: Command not found
    make[1]: *** [xgraph.o] Error 127
    make[1]: Leaving directory `/home/for/ns-allinone-2.35/xgraph-12.2'
    make: *** [all] Error 2
    Can not create xgraph; But xgraph is an optional package, continuing...
    ============================================================
    * Build CWeb
    ============================================================
    Making cweb
    gcc -g -c -o ctangle.o ctangle.c
    make: gcc: Command not found
    make: *** [ctangle.o] Error 127
    cweb failed to make, but it's optional
    chmod: cannot access `cweave': No such file or directory
    chmod: cannot access `ctangle': No such file or directory
    ln: failed to create symbolic link `cweave': File exists
    ln: failed to create symbolic link `ctangle': File exists
    ============================================================
    * Build Stanford GraphBase
    ============================================================
    Making sgb
    if test -r gb_io.ch; then ctangle gb_io.w gb_io.ch; else ctangle gb_io.w; fi
    /bin/sh: ctangle: command not found
    make: *** [gb_io.c] Error 127
    Unable to create sgb library, but it's optional, so continuing...
    ============================================================
    * Build GT-ITM
    ============================================================
    sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing..
    ============================================================
    * Build zlib
    ============================================================
    Checking for gcc...
    Building static library libz.a version 1.2.3 with cc.
    Checking for unistd.h... No.
    Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()
    Checking for snprintf() in stdio.h... No.
    WARNING: snprintf() not found, falling back to sprintf(). zlib
    can build but will be open to possible buffer-overflow security
    vulnerabilities.
    Checking for return value of sprintf()... No.
    WARNING: apparently sprintf() does not return a value. zlib
    can build but will be open to possible string-format security
    vulnerabilities.
    Checking for errno.h... No.
    Checking for mmap support... No.
    cc -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c
    make: cc: Command not found
    make: *** [example.o] Error 127
    Zlib make failed, but it's optional Continue ...
    =====================================================================================================================================================================================================================

    ReplyDelete
    Replies
    1. hey install gcc compiler, only then installation will proceed.

      Delete
    2. how can i install gcc compiler in fedora 16

      Delete
  12. ok found bash_profile already before this..it is a hidden file in Home directory..but when i try to run a tcl file for example "example.tcl" by using "ns example.tcl" I got "ns: command not found".. why is that?

    ReplyDelete
  13. thanks for your reply..but, it only happens like that when i try to run "ns example.tcl" in 'ex' folder in tcl...but when i try to run other tcl files such as in 'test' folder in tcl, for example "ns test-all-jobs.tcl jobs-rate", it's working..is that really means that ns is not installed?

    ReplyDelete
  14. dear sir,
    i m working on dccp for manets.......
    i m not able to create a topology by giving dccp instead of tcp......
    i m using ns-2.34.......please help me what should i do.......
    my work is for my dissertation....


    the error that is generated is


    num_nodes is set 3
    Configuring Nodes
    INITIALIZE THE LIST xListHead
    dccp1 variable created
    dccp1 class set OK
    Connection - 1 Establised
    Connection - 2 Established
    Printing the window size Completed
    Everything is done
    *** stack smashing detected ***: ns terminated
    ======= Backtrace: =========
    /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0xb9a0a0]
    /lib/i386-linux-gnu/libc.so.6(+0xe704a)[0xb9a04a]
    ns(_ZN8CMUTrace10nam_formatEP6Packeti+0xbcf)[0x82bc1d9]
    ns(_ZN8CMUTrace6formatEP6PacketPKc+0x6b)[0x82bc24f]
    ns(_ZN8CMUTrace4recvEP6PacketP7Handler+0x71)[0x82bc587]
    ns(_ZN5Agent4sendEP6PacketP7Handler+0x2c)[0x81d4ebe]
    ns(_ZN9DCCPAgent6outputEb+0x732)[0x8236dee]
    ns(_ZN9DCCPAgent7sendmsgEiPKc+0x1a3)[0x8239e95]
    ns(_ZN5Agent7commandEiPKPKc+0x30b)[0x81ded1b]
    ns(_ZN9DCCPAgent7commandEiPKPKc+0xad)[0x82391a1]
    ns(_ZN16DCCPTCPlikeAgent7commandEiPKPKc+0x1f)[0x823f74d]
    ns(_ZN8TclClass12dispatch_cmdEPvP10Tcl_InterpiPPKc+0x32)[0x83d1396]
    ns[0x83d4f83]
    ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
    ns(TclEvalObjvInternal+0x373)[0x83db713]
    ns[0x8407aba]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns[0x8407dd3]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns(TclObjInterpProc+0x2a7)[0x8435dc7]
    ns(TclProcInterpProc+0x80)[0x8436280]
    ns[0x83d5153]
    ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
    ns(TclEvalObjvInternal+0x373)[0x83db713]
    ns[0x8407aba]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns(TclObjInterpProc+0x2a7)[0x8435dc7]
    ns(TclProcInterpProc+0x80)[0x8436280]
    ns[0x83d4f83]
    ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
    ns(TclEvalObjvInternal+0x373)[0x83db713]
    ns(Tcl_EvalEx+0x4fc)[0x83dc3ac]
    ns(Tcl_Eval+0x3c)[0x83dc64c]
    ns(Tcl_GlobalEval+0x36)[0x83dc6e6]
    ns(_ZN3Tcl4evalEPc+0x1b)[0x83d09a3]
    ns(_ZN9AtHandler6handleEP5Event+0x24)[0x81c4e1a]
    ns(_ZN9Scheduler8dispatchEP5Eventd+0x94)[0x81c4dd0]
    ns(_ZN9Scheduler3runEv+0x2c)[0x81c4d04]
    ns(_ZN9Scheduler7commandEiPKPKc+0x6b)[0x81c4eb1]
    ns(_ZN8TclClass12dispatch_cmdEPvP10Tcl_InterpiPPKc+0x32)[0x83d1396]
    ns[0x83d4f83]
    ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
    ns(TclEvalObjvInternal+0x373)[0x83db713]
    ns[0x8407aba]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns[0x8407dd3]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns(TclObjInterpProc+0x2a7)[0x8435dc7]
    ns(TclProcInterpProc+0x80)[0x8436280]
    ns[0x83d5153]
    ns(TclInvokeStringCommand+0x6e)[0x83d9a0e]
    ns(TclEvalObjvInternal+0x373)[0x83db713]
    ns[0x8407aba]
    ns(TclCompEvalObj+0xdd)[0x840bd4d]
    ns(TclObjInterpProc+0x2a7)[0x8435dc7]
    ns(TclProcInterpProc+0x80)[0x8436280]
    ns[0x83d4f83]




    the e

    ReplyDelete
    Replies
    1. mintu, can u send me the code so that i will look into it. there was some problem with the CMU Trace error it seems, have u created any tracing for DCCP.

      Delete
    2. sir,
      i m executing the example given in tcl for wireless in ns 2.34.
      i had implemented the dccp patch in it.
      it worked for dccp in wired networks.
      but for wireless it is given error as:

      num_nodes is set 2
      INITIALIZE THE LIST xListHead
      can't read "ns": no such variable
      while executing
      "$ns attach-agent $node_(0) $dccp1"
      (file "wireless-mitf.tcl" line 153).


      warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

      my code is present in tcl/ex/wireless-mitf.tcl

      the modification i did is that i replaced tcp with dccp as:


      set dccp1 [new Agent/DCCP/TCPlike]
      $dccp1 set class_ 2
      set dccpsink1 [new Agent/DCCP/TCPlike]
      $ns attach-agent $node_(0) $dccp1
      $ns attach-agent $node_(1) $dccpsink1
      $ns connect $dccp1 $dccpsink1
      set ftp [new Application/FTP]
      $ftp attach-agent $dccp1
      $ns at 10.0 "$ftp start"

      plz help me sir.

      Delete
    3. mintu,
      i got the output for ur program. its working fine. contact me at tspembedded@gmail.com

      Pradeep

      Delete
  15. Good morning,

    Can you please tell me what is the difference between "installing" ns-2 and "compiling" it?
    I am looking into using Evalvid with ns-2 so is installing ns-2 enough or I do need to compile it ( I hope you have experinced using Evalvid with ns-2 before)

    Thnx in advance

    ReplyDelete
  16. sir. please reply me the correct code
    mintu

    ReplyDelete
  17. hello sir.....

    i have installed ns-2.35 on fedora 14 it was installed sucessfully.when i start ns-2 % prompt comes on terminal,when i write a small tcl script directly on terminal it is running.but when i try to run the same script by creating .tcl file it can't run. sir please reply.........

    ReplyDelete
  18. A. Rajesh

    Hello Sir,

    I am a student of BE EEE in St. Josephs College of Engineering. Sir, I have installed ns2 in fedora 16 and exported the paths. But the problem is.. some tests gets failed while validation... they seems to be the files found in tcl/test. Hence, I request you to guide me for installation...

    Thanking You,

    Your's Sincerely,
    A. Rajesh

    ReplyDelete
    Replies
    1. whether nam is working fine, if not go to ~ns-allinone-2.35/nam-1.xx/
      and type make and see what error is coming, send me that so that i look into your problem.

      Delete
  19. Hello Sir, I am getting this error after running a file.Plz help me out of this

    Parameter LabelFont: can't translate `helvetica-10' into a font (defaulting to `fixed')
    X Error: BadFont (invalid Font parameter)
    Major opcode of failed request: 55 (X_CreateGC)

    ReplyDelete
    Replies
    1. send me the code to tspembedded AT gmail dot com

      Delete
  20. hello sir..can u please help me doing this..im having the same problem that is when i try to run my tcl file and its required the xgraph to appear, the output of the graph doesnt appear,and at the terminal error comeup :
    Parameter TitleFont : can't translate 'helvetica-18' into a font (defaulting to 'fixed')
    X Error: BadFont (invalid Font Parameter)
    Major opcode of failed request: 55(X_CreateGC)

    pls sir..i really need to solve this problem for my final project.

    ReplyDelete
  21. hi sir,
    pls help me withthis error. i have the same error while run my tcl file.can u help me.
    Parameter LabelFont: can't translate `helvetica-10' into a font (defaulting to `fixed')
    X Error: BadFont (invalid Font parameter)
    Major opcode of failed request: 55 (X_CreateGC)

    ReplyDelete
  22. can u send me your tcl file to this email tspembedded@gmail.com. I will look into the problem....

    ReplyDelete
  23. hi sir,
    I use ns2.34 under Centos 6.2. I work with gt-itm topology generator to create a topology
    then I use the sgb2ns to convert to ns I finally execute the tcl file using the following code:
    source ts1000.tcl ///////// ts1000 a file is obtained after conversion with sgb2ns
    set ns [new Simulator]
    set nf [open ts1000.nam w]
    $ns namtrace-all $nf

    create-topology nsns node 1.5Mb
    $ns at 1.0 "exit 0"
    $ns run
    after the execution he displays the following error:
    couldn't read file "ts1OOO.tcl": no such file or directory
    while executing
    "source.orig ts1OOO.tcl"
    ("uplevel" body line 1)
    invoked from within
    "uplevel source.orig [list $fileName]"
    invoked from within
    "if [$instance_ is_http_url $fileName] {
    set buffer [$instance_ read_url $fileName]
    uplevel eval $buffer
    } else {
    uplevel source.orig [list $fileName]
    ..."
    (procedure "source" line 8)
    invoked from within
    "source ts1OOO.tcl"
    please help me I can not forward
    think you very much

    ReplyDelete
    Replies
    1. the file it is searching is ts1000.tcl (in this 0000 is four zero's) and in the program it is mentioned as ts1OOO.tc(This is upper case letter o), so change it either to four zeroes or four upper case O

      Delete
  24. Sir, I want ns2 code for MDPF. Anybody please post code for MDPF.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installation of ns2 in Ubuntu 18.04 - NS2 Tutorial # 2

ns2 installation in Ubuntu 18.04

Unlike earlier version of ubuntu, the 18,04 version does not support the direct installation of ns2, because of the latest C/C++ compiler (7.x), but the latest C/C++ compiler supported by ns2 is gcc-4.8. So this post and video tells you about the installation of gcc-4.8 version, then ns2 and then configuration.
Here are the steps, Please follow the video given below for more information.

$] tar zxvf ns-allinone-2.35.tar.gz


$] sudo apt install gcc-4.8 g++-4.8

if you have installed ubuntu just now, you can try these commands also in the beginning

$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev

$] cd ns-allinone-2.35/ns-2.35
$] gedit Makefile.in
$] gedit linkstate/ls.h

line number 137, change erase to this->erase
$] cd ..
$] ./install

export PATH=$PATH:/home/pradeepkumar/ns-allinone-2.35/bin:/home/pradeepkumar/ns-allinone-2.35/tcl8.5.10/unix:/home/pradeepkumar/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$L…

AWK Scripts for NS2 to process data from Trace Files

AWK Scripts are very good in processing the data from the log (trace files) which we get from NS2. If you want to process the trace file manually, here is the detailHere is a sample of trace file from NS2 (However ns2 supports a new type of trace file also), but this post will make you understand the old trace format only.r 0.030085562 _0_ MAC  --- 0 message 32 [0 ffffffff 1 800] ------- [1:255 -1:255 32 0] r 0.030110562 _0_ RTR  --- 0 message 32 [0 ffffffff 1 800] ------- [1:255 -1:255 32 0] s 1.119926192 _0_ RTR  --- 1 message 32 [0 0 0 0] ------- [0:255 -1:255 32 0]
AWK Scripts are very good in processing the data column wise. For example
the first column in the above trace file represents r, s which indicates receive, sent respectively. If we want to trace the entire r and s alone from this trace file we can represent it as $1
So
$1 represents ACTION
$2 Time
$3 Node ID
$4 Layer
$5 Flags
$6 seqno
$7 type
$8 Size
$14 Energy (if the network nodes includes EnergyModel)To run the awk script in Li…

ns3 installation in Ubuntu 16.04

This post serves the installation instructions of ns3 in ubuntu 16.04 version. Some of my students are working in ns3, this post will benefit them in installing ns3.

OS Used: Ubuntu 16.04.4
ns3 version: ns3 version 3.27

The same procedure will be applied for OS like Debian, Linux Mint.

Fresh installation of Ubuntu 16.04 Let you try the fresh installation of ubuntu in your hard disk along with windows.
Installation of ns3 dependencies ns3 needs so many dependencies, developmental libraries, drivers, etc. so install all those
$] sudo apt update  $] sudo apt upgrade
$] sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake p7zip-full python-matplotlib python-tk python-dev python-kiwi python-gnome2 python-gnome2-desktop-dev python-rsvg qt4-dev-tools qt4-qmake qt4-qmake qt4-default gnuplot-x11 wireshark
The above command make take some time to download, compile and install it, Be Patient. 
Installing ns3 Download the…