How to Install Ns2 in Ubuntu Using Terminal
Our technical experts have years of experience in this filed, over this experience we have derived this article about Ns2 installation in Ubuntu.
Step: 1 Installation of Ns2 in Ubuntu Using Terminal
Here, our technical professionals have highlighted the commands that have to be implemented in the terminal for the Ns2 installation. We have to open the terminal or command window for the execution process.
- sudo apt-get update
- sudo apt-get install ns2
- sudo apt-get install nam
- sudo apt-get install tcl
Ns2 Code for Simulation Execution
For your case, our research professionals have highlighted the sample source code based on Ns2 to create the Ns2 simulation file and that have to be stored with the file extension .tcl.
- Ns2 code to establish the links among nodes with bandwidth and delay
$ns duplex-link $n0 $n1 2MB 1ms DropTail
$ns duplex-link $n1 $n2 2.5MB 1ms RED
$ns duplex-link $n2 $n3 2MB 1.5ms DropTail
$ns duplex-link $n3 $n1 12MB 10ms DropTail
- Ns2 code to create the Tcp source and sink agents for FTP application
set tcp [new Agent/TCP]
set sink [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n2 $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns connect $tcp $sink
$ns at 1.0 “$ftp start”
Ping us to know more about Ns2 installation!!!