BCA / B.Tech 10 min read

Running NS2 & NAM

Running NS2 & NAM in Hindi  |  Running in NS2 & NAM in Hindi:


  • NS2 (Network Simulator 2) and NAM (Network Animator) are network simulation tools that are used to test and analyze the behavior of network protocols.
  • These tools are mainly used in academic research and network engineering. Here we will discuss in detail about NS2 and NAM, along with some examples.
  • NS2 and NAM are powerful tools for network simulation. By using NS2, you can test various network protocols, while NAM provides you with a graphical animation of the functions of these protocols.
  • By using these tools correctly, you can enhance your skills in network design and management.

What is NS2 (Network Simulator 2)?

  • NS2 is an open-source simulator that is used to research network protocols. It has been developed using C++ and OTcl (Object Tcl) programming languages. NS2 supports various types of network topologies and protocols, such as TCP, UDP, and IP.

Features of NS2 in Hindi | Features of NS2:

  • Multi-protocol support: NS2 supports various protocols such as TCP, UDP, IPv4, IPv6, etc.
  • Topology design: Users can design network topologies according to their needs.
  • Flow control: NS2 supports flow control and queuing mechanisms.
  • Real-time animation: The simulation of NS2 can be analyzed with NAM, which is a graphical tool.

What is NAM (Network Animator)?

NAM is a graphical animator that is used to show the simulation results produced by NS2. By using NAM, users can analyze various network activities, such as packet transfer, network latency, and bandwidth usage.

Features of NAM in Hindi | Features of NAM:

  • Graphical user interface: NAM provides a simple and user-friendly interface.
  • Simulation animation: It visualizes network activities through animation, which allows users to easily see the flow of packets.
  • Diagrams and graphs: NAM provides various graphs and charts that help in analyzing the results of the simulation.

How to use NS2 and NAM

  • Install NS2: To install NS2 on your system, you need to download it and follow its installation instructions. This is usually done on a Linux system.
  • Prepare the script: Write a simple topology script. For example, if you want to establish a TCP connection between two nodes, you can write a script using OTcl.

# Simple NS2 Script
set ns [new Simulator]
set n0 [$ns node]
set n1 [$ns node]

$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns queue-limit $n0 $n1 10

# TCP Connection
set tcp [new Agent/TCP]
set sink [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n1 $sink
$ns connect $tcp $sink

# Start the simulation
$tcp send 1024
$ns at 1.0 "$tcp close"
$ns run

Animation with NAM:

  • After running the above script, you can see the animation of the results using NAM. For this, you can use the following command in NS2:
nam output.nam

  • This command will open a graphical window in which the animation of the network activities will be shown.
  • Example: Suppose you want to do a simple network simulation in which there are three nodes, and you want to see how these nodes exchange data using the TCP protocol. Here is an example script:

# Three node example
set ns [new Simulator]

# Create nodes
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

# Create links
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n3 1Mb 10ms DropTail

# Create TCP agents
set tcp1 [new Agent/TCP]
set sink1 [new Agent/TCPSink]
$ns attach-agent $n1 $tcp1
$ns attach-agent $n2 $sink1
$ns connect $tcp1 $sink1

# Sending data
$tcp1 send 512
$ns at 1.0 "$tcp1 close"
$ns at 2.0 "$sink1 start"

# Run simulation
$ns run

In this Chapter

Running NS2 & NAM
Auto-Configuration and Anycast
Modified EUI-64 | What is Modified EUI-64?
Architecture of Mobile Computing
Wireless LAN in Hindi | What is Wireless LAN?
Wireless User Devices
MAC Protocol | What is MAC Protocol?
IEEE 802.11 | What is IEEE 802.11
Mobile IP | What is Mobile IP
Wireless TCP/IP
Unicast & Multicast Communication
Bluetooth | What is Bluetooth?
NS2 & NAM | What are NS2 and NAM?
Purpose & installation of NS2 & NAM
Background of NS2 & NAM
Architecture of NS2 & NAM
Interface of OTcl & C++
Trace Files & Formats
Protocol Support of NS2
Simulation Object of NS2 & NAM
Basic Syntax of NS2 & NAM
Node Creation of NS2 & NAM
Finish Procedure NS2 & NAM
Invoking external commands within NS2
Nodes & Agents of NS2 & NAM
NS2 Commands
Creating Links in Wired Network
Setting Link Parameters
Sending Traffics Through NS2 Links
Routing Protocol Support of NS2
Scenarios in Wired Networks
Additional Parameters
Setting node positions
God object & topography
Protocol Support
Scenarios in Wireless Networks
What is the Internet? Difference Between Intranet and Extranet
Types of Internet
OSI Model and its Layers
Computer Network (CN) All Important Questions and Answers in English (MDSU)
BCA | Computer Network | 2025 Paper | MDSU Exam Paper
Importance of the Layer Model in Computer Networks
Network Classification
Network Topology
Network Switching & Components
Ethernet
Token Ring
Basic Networking Concepts & Cabling
What is a Computer in English?
Bridges in Computer Networks
Routers in Computer Networks
Gateways in Computer Networks
Public & Private Networks
FDMA (Frequency Division Multiple Access)
BCA | CN(Computer Network) Paper | 2023 MDSU Exam Paper
What is World Wide Web (WWW)
TDMA, SDMA, CDMA
Personal Communication System | What is PCS
IPv4 | What is IPv4?
Subnetting IPv4 Address
Casting in IPv4
Private IPv4 Addressing
IPv4 Address Scheme
IPv6 Addressing Scheme
Types of IPv6 Addressing