Skip to main content

Installing ns-3.37 and ns-3.35 in Ubuntu | Ubuntu 22.04 | NS3

Multiple Versions of ns3 in Ubuntu 22.04 In this post, we are going to install two versions of ns3 namely ns-3.35 and ns-3.37  My OS is : Ubuntu 22.04 LTS (Long Term Support) ns-3.35 uses waf and (./waf --run scratch/first)  ns-3.37 uses cmake  (./ns3 run scratch/first.cc) So we will install both the packages  Go through the video for complete instructions To start with  $ sudo apt update  $ sudo apt install build-essential autoconf automake libxmu-dev g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip libxml2 libxml2-dev libboost-all-dev  I have downloaded both the versions of ns3 fr

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 (ns-2.35) in Ubuntu 20.04

Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS Step 1: Install the basic libraries like      $] sudo apt install build-essential autoconf automake libxmu-dev Step 2: install gcc-4.8 and g++-4.8 open the file using sudo mode $] sudo nano /etc/apt/sources.list Include the following line deb http://in.archive.ubuntu.com/ubuntu bionic main universe $] sudo apt update $] sudo apt install gcc-4.8 g++-4.8 Step 3:  Unzip the ns2 packages to home folder $] tar zxvf ns-allinone-2.35.tar.gz $] cd ns-allinone-2.35/ns-2.35 Modify the following make files. ~ns-2.35/Makefile.in Change @CC@ to gcc-4.8 change @CXX@ to g++-4.8 ~nam-1.15/Makefile.in ~xgraph-12.2/Makefile.in ~otcl-1.14/Makefile.in Change in all places  @CC@ to gcc-4.8 @CPP@ or @CXX@ to g++-4.8 open the file: ~ns-2.35/linkstate/ls.h Change at the Line no 137  void eraseAll() { erase(baseMap::begin(), baseMap::end()); } to This void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); } All changes made Step 4: Open a new termi

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-

VPL Jail Server Installation | Virtual Programming Laboratory with Moodle

Virtual Programming Laboratory (VPL)  This post tells you how to install VPL Jail Server Installation in Ubuntu 20.04 and how to configure it using Moodle Learning Management System. VPL - Virtual Programming Laboratory  For full installation with complete description, follow the video What is VPL? VPL is Virtual Programming Laboratory which is a tool for programming assignments, evaluation and running of programs. The programming languages supported by VPL is C, C++, Java, Python, Perl, PHP, NodeJS, Verilog, etc. Step 1 - Install  VPN Jail Server Installation  My Server configuration  16GB RAM and 16 Core PRocessor (Intel Xeon)  Virtual Machine  Ubuntu 20.04 (64 bit OS). To download the softwares  https://vpl.dis.ulpgc.es/index.php/home/download  Unzip or untar the above file in the home folder (in my case it is /home/tspradeepkumar/ ) $ cd vpl-jail-system-2.7.2/ $ sudo ./install-vpl-sh VPL Jail Server Installation This will take some time based on your internet connection: To Star