help about ns

535 views
Skip to first unread message

nadiui

unread,
Feb 20, 2014, 3:50:45 PM2/20/14
to ns-u...@googlegroups.com
Hi,
please i have two questions about ns2:

1) if i have many versions of ns2 installed in my ubuntu, when executing a script, how can i specify which version of ns to work with?

2) if i get the following error after running a script, how can i correct it:

(_o124  cmd line 1)
invoked from within  "_o124 cmd addr"
invoked from within
"catch "$self cmd $args" ret"
.....


Thnk you

knudfl

unread,
Feb 21, 2014, 4:06:09 AM2/21/14
to ns-u...@googlegroups.com
@nadiui  , Hi.

Yes, you can have as many versions of ns-allinone-2.xx as you want,
installed at the same time.  ( I have about 70 versions with different extra protocols.)
But : Do never add any *PATH text to  .bashrc .

The trick is to keep all the executable 'ns'  in /usr/local/bin/ ,
and use different naming for the 'ns' files , like these examples :
ns-aodvuu, ns-aqua, ns-bgp, ns-umolsr, ns-wimax, ns-zrp.

And then run the simulations with : $ ns-name file.tcl
Only in very few occasions you will have to use a copy of 'ns' with the original name "ns".
If  required, then simply copy 'ns' to /usr/local/bin/

-

knudfl

unread,
Feb 21, 2014, 4:09:32 AM2/21/14
to ns-u...@googlegroups.com
@nadiui  , your 2) :

Generic errors : Any faulty file.tcl can do that.

To get an answer, you will have to attach the <file>.tcl .
And then specify ns-2.xx version , and the changes that were made to ns-2.xx ( If any.)

-

nadiui

unread,
Feb 21, 2014, 5:54:08 AM2/21/14
to ns-u...@googlegroups.com
Dear sir, 

thank you for your answer, so let's say i work with ns2.31 i have to go to ns-allinone-2.31/bin   and copy all the files, and then put them in usr/local/bin  is that right??

and should i rename all ns files that are inside ns-2.31 ??

 ps: i don't know how to go to usr/local/bin  becuz i don't work with ubuntu very often ??

knudfl

unread,
Feb 21, 2014, 8:19:33 AM2/21/14
to ns-u...@googlegroups.com
@nadiui.

There are no usable files in ns-allinone-2.31/bin/ , mostly links,
and none of those are required to be copied to another location.

There is only one file 'ns' to copy to /usr/local/bin/ , that's the executable ns-allinone-2.31/ns-2.31/ns.
Default is ( When you have one file only by name ns )  : $ cd ns-allinone-2.31/ns-2.31/ && sudo make install
With more than one version : Rename or copy ns to a new name ns-<protocol>,
 and copy ns-<protocol>  to  /usr/local/bin/
* See my above posting for examples.

-

nadiui

unread,
Feb 21, 2014, 9:35:27 AM2/21/14
to ns-u...@googlegroups.com
Thank you sir,  i understand your solution, actually before you answered me i removed all versions of ns (with shift delete without terminal), and then i reinstalled ns2.31, but now when i run ns example.tcl i get the following problem:
bash:  /home/nana/ns-allinone-2.35/bin/ns:  aucun fichier ou dossier de ce type

how can i solve this problem please

best wishes 

knudfl

unread,
Feb 21, 2014, 11:13:03 AM2/21/14
to ns-u...@googlegroups.com
@nadiui.

> aucun fichier ou dossier de ce type > "No such file or directory".
You are simple using ns2 in a wrong way,  I think.

You will have to install the excutable 'ns' to /usr/local/bin/  :
$ cd ns-allinone-2.xx/ns-2.xx/
$ sudo cp ns /usr/local/bin/
( Or : sudo cp ns /usr/local/bin/ ) ( Or : sudo cp ns-<new-name> ns /usr/local/bin/ ).
... And this is very important :  Delete any *PATH text, that was added to .bashrc .

? ? Why did you remove ns-2.31 ? You can have all versions installed at the same time !

-

nadiui

unread,
Feb 21, 2014, 11:42:25 AM2/21/14
to ns-u...@googlegroups.com
Thank you so much, this solved my problem. so about the error i was getting when i run my tcl script : actually i was trying to add a new routing protocol blackholeaodv following steps i found on internet
this is the whole error:

invalid command name "Agent/blackholeAODV"
    while executing
"Agent/blackholeAODV create _o127 5"
    invoked from within
"catch "$className create $o $args" msg"
    invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
    (procedure "new" line 3)
    invoked from within
"new Agent/blackholeAODV [$node node-addr]"
    (procedure "_o3" line 2)
    (Simulator create-blackholeaodv-agent line 2)
    invoked from within
"$self create-blackholeaodv-agent $node"
    ("blackholeAODV" arm line 2)
    invoked from within
"switch -exact $routingAgent_ {
DSDV {
set ragent [$self create-dsdv-agent $node]
}
DSR {
$self at 0.0 "$node start-dsr"
}
AODV {
set ragent [$self cre..."
    (procedure "_o3" line 11)
    (Simulator create-wireless-node line 11)
    invoked from within
"_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
"eval $self create-wireless-node $args"
    (procedure "_o3" line 23)
    (Simulator node line 23)
    invoked from within
"$ns_ node"
    ("for" body line 2)
    invoked from within
"for {set i $val(nnaodv)} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node]
$ns_ initial_node_pos $node_($i) 10
$node_($i) random-motion 0 ; # disab..."
    (file "test.tcl" line 78)


Can you please help me with that??

knudfl

unread,
Feb 21, 2014, 2:20:58 PM2/21/14
to ns-u...@googlegroups.com
@ nadiui.

> "invalid command name "Agent/blackholeAODV" "  That's a failed build.
..... Or you are using the wrong 'ns' executable.

And : Please do not show more than "one line" error output from $ ns unknown.tcl
... It's usually generic that any file.tcl show with a faulty 'ns'.

The one and only way to get answers about a tcl file :   Attach the file  !

BlackholeAODV info : http://www.linuxquestions.org/questions/tags/blackholeaodv/ ,
, http://www.linuxquestions.org/questions/search.php?searchid=6186005
The proof patch is blackholeaodv2005-ns235-patch.tar.gz
Examples that will work with "blackholeaodv2005-ns235" :   blackholeaodv2005-examples.tar.gz .

-

nadiui

unread,
Feb 21, 2014, 3:00:09 PM2/21/14
to ns-u...@googlegroups.com
attached you can find my tcl script and blackhole folder that i add to ns-allinone-2.31/ns-2.31
then i add these red lines to \tcl\lib\ ns-lib.tcl
blackholeAODV {
set ragent [$self create-blackholeaodv-agent $node]
}
Simulator instproc create-blackholeaodv-agent { node } {
set ragent [new Agent/blackholeAODV [$node no
de-addr]]
$self at 0.0 "$ragent start" # start BEACON/HELLO Messages
$node set ragent_ $ragent
return $ragent
}

and those two lines in makefile that is in ns2.31
blackholeaodv/blackholeaodv_logs.o blackholeaodv/blackholeaodv.o \
blackholeaodv/blackholeaodv_rtable.o blackholeaodv/blackholeaodv_rqueue.o \

then i recompile all ns2 files. and when running tcl script i get error i described before.
test1.tcl
blackholeaodv.zip

nadiui

unread,
Feb 21, 2014, 3:00:42 PM2/21/14
to ns-u...@googlegroups.com
test1.tcl
blackholeaodv.zip

knudfl

unread,
Feb 21, 2014, 6:46:13 PM2/21/14
to ns-u...@googlegroups.com
$nadiui.

OK, I will have a look at your code tomorrow.
About  tcl/lib/ns-lib.tcl  : To which line number did you add the new code ? ?
About  test1.tcl  :  Works OK here : 
$ ns-blackholeaodv2005 test1-nadiui.tcl : Nam displays some "blackhole" text.

-
Nam-blackhole-test1.jpg

knudfl

unread,
Feb 21, 2014, 6:50:08 PM2/21/14
to ns-u...@googlegroups.com
@nadiui.

By the way, which Ubuntu are you using ?
Please show the output from these two commands :
a)  $ uname -m  <Enter>
b)  $ cat  /etc/issue  <Enter>

-

knudfl

unread,
Feb 22, 2014, 7:03:21 AM2/22/14
to ns-u...@googlegroups.com
@nadiui , Hi.

Don't know what's wrong with your files, the simulation result here is the same (ns-2.31) :
invalid command name "Agent/blackholeAODV"

The two "patch-packages" that I use are working perfectly OK :
ns-2.34 → → blackhole2013-ns234-patch.tar.gz
ns-2.35 → → blackholeaodv2005-ns235-patch.tar.gz

-

On Friday, February 21, 2014 9:00:09 PM UTC+1, nadiui wrote:
blackhole2013-ns234-patch.tar.gz
blackholeaodv2005-ns235-patch.tar.gz
blackholeaodv2005-examples.tar.gz

nadiui

unread,
Feb 22, 2014, 4:16:22 PM2/22/14
to ns-u...@googlegroups.com
Hi, i'm sorry for being late to answer, actually i'm using ubuntu 13.04 and the lines in tcl/lib/ns-lib.tcl  are not specific, i just add the blackhole aodv lines, wherever i find similar code for other protocols (aodv for example). anyways i'm going to try the patch you gave me, and thank you so much for your help i really appreciate it

best wishes 

nadiui

unread,
Feb 23, 2014, 1:30:44 PM2/23/14
to ns-u...@googlegroups.com
Dear Sir,

i've just installed ns2.35 in mu ubuntu so now i have ns2.31(the one i installed at first), and ns2.35  . i just wanna make sure that what i understood was correct. so to be able to work with ns2.35 I should rename the executble file ns (that is in ns-allinone-2.35/ns-2.35) to let's say ns-new  and then copy it to /usr/local/bin/  and then when i wanna run my simulation i should type ns-new  test1.tcl

is that correct?? 

nadiui

unread,
Feb 23, 2014, 2:53:15 PM2/23/14
to ns-u...@googlegroups.com
And Sir olease how do i apply the patch to the blackhole file, should i use patch -p1< file.patch ???

knudfl

unread,
Feb 23, 2014, 5:32:57 PM2/23/14
to ns-u...@googlegroups.com
@nadiui , Hi.

`blackhole2013-ns234-patch.tar.gz' and `blackholeaodv2005-ns235-patch.tar.gz' :
Not real "patches", but packages with the edited files. ( A patch is a text file.)
That's an advantage when it's Ubuntu :  A lot of patches will fail with the patch command.
So it's a lot simpler, and prevents that anything goes wrong, when the "patch package" is unpacked.
( Please also unpack the two packages into some "empty test folders",  just to know the files.)

* This is it : a)  $ cd ns-allinone-2.xx/ && tar xvf <blackhole-files-package>.tar.gz
* b)   ns-allinone-2.34 : $ export CC=gcc41 CXX=g++41 && ./install
* Or b1)  for  ns-allinone-2.35 : $ export CC=gcc-4.4 CXX=g++-4.4 && ./install

* Blackhole info  http://www.linuxquestions.org/questions/tags/blackhole/
* And  http://www.linuxquestions.org/questions/tags/blackholeaodv/

-

nadiui

unread,
Feb 24, 2014, 7:04:38 AM2/24/14
to ns-u...@googlegroups.com
Hi
I'm actually using ubuntu13.04 do you think i can use export CC=gcc-4.4 CXX=g++-4.4  ??
because when i used it at first and run the blackhole simulation it didn't work. and then i removed ns2.35 and when i wanted to reinstall it i had many problems, but i finally installed it again.

nadiui

unread,
Feb 24, 2014, 9:40:05 AM2/24/14
to ns-u...@googlegroups.com
Can i just use ./configure and make  after puting the : tar xvf blackholeaodv2005-ns235-patch.tar.gz ??

knudfl

unread,
Feb 24, 2014, 10:22:39 AM2/24/14
to ns-u...@googlegroups.com
> @nadiui.

> Can i just use ./configure and make  after puting the : tar xvf blackholeaodv2005-ns235-patch.tar.gz ??

No.  Why would you do that ?    The instructions say :
a) $ cd ns-allinone-2.35/ && tar xvf  tar xvf blackholeaodv2005-ns235-patch.tar.gz
b) $ export CC=gcc-4.4 CXX=g++-4.4 && ./install
......  That's it.

If you for other reasons want to do a reconfigure in any ns-allinone-2.35/ns-2.35/ , 
... like $ export CC=gcc-4.4 CXX=g++-4.4 && ./configure ,
... you cannot use 'make' , but will have to go back to the top directory, ns-allinone-2.35/ ,
... and do  $ export CC=gcc-4.4 CXX=g++-4.4 && ./install

Reason :  `ns-allinone-2.35'  has a "not so good" build system  as ns-2.26 ... 2.34 .

-

nadiui

unread,
Feb 24, 2014, 10:29:41 AM2/24/14
to ns-u...@googlegroups.com
So it doesn't matter if i work with ubuntu13.04 i mean can i still use export CC=gcc-4.4 CXX=g++-4.4  ??

knudfl

unread,
Feb 24, 2014, 12:28:30 PM2/24/14
to ns-u...@googlegroups.com
@nadiui.

Not quite clear what you mean. You will of course have to install the ns2 prerequisites :
$ sudo apt-get install g++ g++-4.4 autoconf automake make libtool libxmu-dev xgraph

And yes, the ns235 build command is  $ export CC=gcc-4.4 CXX=g++-4.4 && ./install
.. for all Ubuntu 11.04 ... 14.04 .

-

nadiui

unread,
Feb 24, 2014, 1:09:46 PM2/24/14
to ns-u...@googlegroups.com
ok i followed all the steps, and when i run the tcl file sim1forBlackHole_5.tcl (that is in ex-2005), i get the following error attached. plzz help me
error.txt

knudfl

unread,
Feb 24, 2014, 1:49:47 PM2/24/14
to ns-u...@googlegroups.com
@nadiui , Hi.

Ref. "error.txt" :    Are you sure the right executable 'ns' is used ?
→ When I use a default unpatched 'ns', I get the same errors : $ ns-orig sim1forBlackHole_5.tcl
*** The "ns blackholeaodv" executable must be used.
*** No *PATH text can be added to .bashrc ! Please delete any added text.

You are supposed to make a copy of the right 'ns' to a new name, e.g.  ns235-b-aodv.
And then copy "ns235-b-aodv" to /usr/local/bin/ .
The  simulations must then be run with $ ns235-b-aodv sim1forBlackHole_5.tcl
..... etc. etc.

-

nadiui

unread,
Feb 24, 2014, 2:03:27 PM2/24/14
to ns-u...@googlegroups.com
yess exactly that was the problem, i didn't pay attention to the fact that i had another ns named nstk so now that i worked with it i finally run my tcl script. Thank you very much for your help i really appreciate it.

very best wishes

nadiui

unread,
Feb 27, 2014, 10:02:11 AM2/27/14
to ns-u...@googlegroups.com

Hi sir, i have a simple question concerning nodes positions, actually in file test1.tcl that i sent you i have nodes that are far from each other but in the nam (out.nam) the nodes are colse as if they were in the same position. how can i fix this please??
Message has been deleted
Message has been deleted

knudfl

unread,
Feb 27, 2014, 10:51:11 AM2/27/14
to ns-u...@googlegroups.com
Hi.

Please compare 'test1.tcl' with the files in blackholeaodv2005-examples.tar.gz .
Most of the files ( or all )  will display the nodes nicely.

-

nadiui

unread,
Feb 27, 2014, 4:01:26 PM2/27/14
to ns-u...@googlegroups.com

Actually i did the same as in the examples, now the problem is if i generate a cbr file in cmu-scen-gen i get nodes from 1 to 9 so i set the nodes in my simulation from 1 to 9 (instead of 0 to 8), but when i run simulation i get in the nam and tr files nodes from 0 to 8 ???

nadiui

unread,
Feb 27, 2014, 4:41:56 PM2/27/14
to ns-u...@googlegroups.com
here is my tcl file i set node 7 as black hole node, but in the nam i see that node 8 is labeled as black hole, i don't understand why, pleasse help me
testblack.tcl

knudfl

unread,
Feb 28, 2014, 5:42:20 AM2/28/14
to ns-u...@googlegroups.com
@nadiui , Hi.

> "" .. if I generate a cbr file in cmu-scen-gen I get nodes from 1 to 9
so I set the nodes in my simulation from 1 to 9 (instead of 0 to 8),
but when I run simulation I get in the nam and tr files nodes from 0 to 8""

* Not unusual that you will have to edit files generated with the "cmu-scen-gen  tools".
* I.e. you can edit the resultant files to fit with your file.tcl .

-

nadiui

unread,
Feb 28, 2014, 7:52:15 AM2/28/14
to ns-u...@googlegroups.com
yeah i did this, however when i run my ns simulation i have blackhole node label beside node 8 instead of node 7 that i define as a blackhole node in my simulation. the nam representation of nodes doesn't correspond to my tcl script!!

knudfl

unread,
Feb 28, 2014, 9:38:35 AM2/28/14
to ns-u...@googlegroups.com
Yes, I saw your other post and tried experimenting with "testblack.tcl" yesterday : No luck

-


On Friday, February 28, 2014 1:52:15 PM UTC+1, nadiui wrote:
yeah i did this, however when i run my ns simulation i have blackhole node label beside node 8 instead of node 7 that i define as a blackhole node in my simulation. the nam representation of nodes doesn't correspond to my tcl script!!

nadiui

unread,
Feb 28, 2014, 2:50:39 PM2/28/14
to ns-u...@googlegroups.com
now it works, it was a problem of order when we create the nodes, i just wanna make sure of a simple thing:
if i have nodes from 0 to 6 as normal nodes (i use the for loope), then i define 7 as blackhole so i add  the line $ns- node-config -adhocRouting blackholeAODV. then i add the node 8 which is a normal node, so before this node definition i add the line $ns- node-config -adhocRouting blackholeAODV  is that correct??  

knudfl

unread,
Feb 28, 2014, 5:12:42 PM2/28/14
to ns-u...@googlegroups.com
Sorry, that is beyond my knowledge.

By the way, can you please attach your edited file "testblack-1.tcl   ?

Kind Regards ,  knudfl.

-

nadiui

unread,
Mar 2, 2014, 7:50:30 AM3/2/14
to ns-u...@googlegroups.com
Hi, this is my file testblack-1.tcl with cbr-9-test , sorry for being late.
testblack-1.tcl
cbr-9-test9.txt

Soorya subburam

unread,
Sep 18, 2014, 5:02:32 AM9/18/14
to ns-u...@googlegroups.com
hi sir,
i am unable to find blackholeaodv 2.34 patch file. so please upload the patch file sir 

knudfl

unread,
Sep 18, 2014, 8:02:27 AM9/18/14
to ns-u...@googlegroups.com
@Soorya subburam , Hi .

" blackholeaodv2013-ns234_4.patch " is attached.
Using : $ cd ns-allinone-2.34/
$ patch -p0 < blackholeaodv2013-ns234_4.patch

-
blackholeaodv2013-ns234_4.patch

Soorya subburam

unread,
Oct 9, 2014, 11:14:59 AM10/9/14
to ns-u...@googlegroups.com
thank you for giving patch file sir,
can you help me to change rsa algorithm encryption file in english.
the encrypted message in chinesh language, how to change in english.
the rsa algorithm file is attached here.please check it.

--
You received this message because you are subscribed to a topic in the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-users/K2pQg96g6pE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-users+u...@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.

rsa.tcl

Soorya subburam

unread,
Oct 13, 2014, 1:30:10 AM10/13/14
to ns-u...@googlegroups.com
hi sir,
 can you help me. please send me the rsa.tcl, rsa.h, rsa.cc file sir. thanks in advance

On Thu, Sep 18, 2014 at 5:32 PM, knudfl <knu...@ofir.dk> wrote:

--

Gaurav Gupta

unread,
Nov 5, 2014, 1:52:45 AM11/5/14
to ns-u...@googlegroups.com
hi

i am using ubuntu 14.04 64 bit
i am installing ns2.33 and applying mobiwan patch in it
Downloaded Patch from :- http://www.nicta.com.au/people/mehanio/nsmisc/ns-233-mobiwan-1.patch.
     c) After installation keep the patch file "ns-233-mobiwan-1.path" in ns-2.33 folder in ns-allinone-2.33 directory.
     d) Install the patch by running "patch -p1 < ns-233-mobiwan-1" from the ns-2.33 directory.  
     e) re run "./configure ; make clean ; make" in ns-2.33 directory

problem is my simulation is ending at 31.0 second and there is no flow of mipv6 packet

when i applied http://www.nicta.com.au/__data/assets/file/0005/16871/ns-233-mobiwan-rfc3775-1.patch second patch

mipv6 packets start flowing but u am getting segmentation fault (core dumped ) error

knudfl

unread,
Nov 5, 2014, 6:49:09 AM11/5/14
to ns-u...@googlegroups.com
@Gaurav Gupta ,  Hi .

Please do not use a "blackhole thread" for an {off topic question}.
http://linuxsilo.net/docs/smart-questions_en.html
If you want an answer : Please start your own thread about mobiwan.

-
Reply all
Reply to author
Forward
0 new messages