Last year, I learned the 2.34 installation method. Later I changed Ubuntu11.10 and re-installed it. I found that the NS was upgraded to 2.35. The official manual still used the April installation method. I personally suggest learning the English version of the Manual, because the new version contains some new things. The versions of the Chinese-simplified manual are relatively old, and are generally earlier than 08 years ago. Of course, this varies from person to person. The Chinese version is easier to see and has been used as an artist. The English version is original. Radish cabbage, each with love. Now let's talk about the latest 2.35 installation method. We found that 2.34 is required for installation.
I learned how to install 2.34 last year. After I changed Ubuntu 11.10 and then re-installed it, I found that the NS was upgraded to 2.35. The official manual still uses the one from April. I personally suggest learning the English version of the Manual, because the new version contains some new things. The versions of the Chinese-simplified manual are relatively old, and are generally earlier than 08 years ago. Of course, this varies from person to person. The Chinese version is easier to see and has been used as an artist. The English version is original. Radish cabbage, each with love.
Now let's talk about the latest 2.35 installation method. We found that many minor problems need to be fixed during 2.34 installation. Fortunately, 2.35 has been corrected, so it is much easier to install it. The following describes the specific steps.
Related reading:
Install ns-allinone-2.34.tar.gz http://www.linuxidc.com/Linux/2011-09/43745.htm under Ubuntu 11.04
1. Install the necessary package, the same as 2.34
Sudo apt-get install build-essential
Sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev
Sudo apt-get install libxmu-dev libxmu-headers
sudo apt-get install xorg-dev g++ xgraph
Sudo apt-get install g ++-4.4
2. Place the downloaded tar package where you want to place it, And then install it directly in the Terminal Go To The ns-allinone-2.35 folder
Sudo./install
3. After a long wait
Please put/usr/local/collecting/ns-allinone-2.34/bin:/usr/local/collecting/ns-allinone-2.34/tcl8.4.18/unix:/usr/local/collecting/ns-allinone-2.34/tk8.4.18/unix
Into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
Important notices:
(1) You MUST put/usr/local/NS2./ns-allinone-2.34/otcl-1.13,/usr/local/NS2./ns-allinone-2.34/lib,
Into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
Into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
Setenv LD_LIBRARY_PATH
If you are using sh, you can set it like:
Export LD_LIBRARY_PATH =
(2) You MUST put/usr/local/int32/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental
Variable. Otherwise ns/nam will complain during startup.
After these steps, you can now run the ns validation suite
Cd ns-2.34;./validate
For trouble shooting, please first read ns problems page
Http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
For related posts.
Root@www.linuxidc.com:/usr/local/NS2./ns-allinone-2.34 #
Show youThe installation is successful. You only need to change the following parameters:
EnterGedit ~ /. Bashrc
Then add at the end of the text
Export PATH = "$ PATH: /Usr/local/NS2/Ns-allinone-2.35/bin: /Usr/local/NS2/A ns-allinone-2.35/tcl8.5.10/unix: /Usr/local/NS2/Ns-allinone-2.35/tk8.5.10/unix"
Export LD_LIBRARY_PATH =" /Usr/local/NS2/Ns-allinone-2.35/otcl-1.14: /Usr/local/NS2/Ns-allinone-2.35/lib"
Export TCL_LIBRARY = "$ TCL_LIBRARY: Usr/local/NS2/Ns-allinone-2.35/tcl8.5.10/library"
The red part is the relative path. Change it to your own installation path.
Then input ns in Terminal, and % indicates that the operation is successful. You can edit a test. tcl file. Enter the example mentioned at the beginning of the manual:
# The preamble
Set ns [new Simulator]
; # Initialise the simulation
# Predefine tracing
Set f [open out. tr w]
$ Ns trace-all $ f
Set nf [open out. nam w]
$ Ns namtrace-all $ nf
Set n0 [$ ns node]
Set n1 [$ ns node]
Set n2 [$ ns node]
Set n3 [$ ns node]
$ Ns duplex-link $ n0 $ n2 5 Mb 2 ms DropTail
$ Ns duplex-link $ n1 $ n2 5 Mb 2 ms DropTail
$ Ns duplex-link $ n2 $ n3 1.5 Mb 10 ms DropTail
# Some agents.
Set udp0 [new Agent/UDP]
$ Ns attach-agent $ n0 $ udp0
Set cbr0 [new Application/Traffic/CBR]
$ Cbr0 attach-agent $ udp0
$ Udp0 set class _ 0
; # A udp agent
; # On node $ n0
; # A cbr traffic generator agent
; # Attached to the UDP agent
; # Actually, the default,...
; # Its sink
; # On node $ n3
Set null0 [new Agent/Null]
$ Ns attach-agent $ n3 $ null0
$ Ns connect $ udp0 $ null0
$ Ns at 1.0 "$ cbr0 start"
Puts [$ cbr0 set packetSize _]
Puts [$ cbr0 set interval _]
# A ftp over TCP/Tahoe from $ n1 to $ n3, flowid 2
Set tcp [new Agent/TCP]
$ Tcp set class _ 1
$ Ns attach-agent $ n1 $ tcp
Set sink [new Agent/TCPSink]
$ Ns attach-agent $ n3 $ sink
; # TCP does not generate its own traffic
Set ftp [new Application/FTP]
$ Ftp attach-agent $ tcp
$ Ns at 1.2 "$ ftp start"
$ Ns connect $ tcp $ sink
$ Ns at 1.35 "$ ns detach-agent $ n0 $ tcp; $ ns detach-agent $ n3 $ sink"
# The simulation runs for 3 s.
# The simulation comes to an end when the schedinvoinvokes the finish {} procedure below.
# This procedure closes all trace files, and invokes nam visualization on one of the trace files.
$ Ns at 3.0 "finish"
Proc finish {}{
Global ns f nf
$ Ns flush-trace
Close $ f
Close $ nf
Puts "running nam ..."
Exec nam out. nam &
Exit 0
}
# Finally, start the simulation.
$ Ns run
After saving, Terminal enters the folder where the file is located and runs ns test. tcl. If it is successful, nam is opened to display the simulation information.
Finally, a useful software, gnuplot, is added.
Sudo apt-get install gnuplot