Network Simulator 2: a Simulation Tool for Linux

Using Network Simulator 2 to simulate case scenarios using SCTP and TCP protocols with FTP and HTTP traffic.
Using NS2 to Monitor Web Traffic over TCP

This scenario examines web traffic over a TCP network. To simulate this case, we defined six nodes:

  • node 0 is the client that will request a web page from the web server.

  • node 1 is the client's router.

  • node 2 is the web cache's primary router.

  • node 3 is the web cache's secondary router.

  • node 4 is the web cache server.

  • node 5 is the web server.

The web cache (node 4) is connected to a web server (node 5) through a router (node 3). The web client (node 0) is connected to web cache (node 4) with connection routed through the client's router (node 1). To simulate this case scenario, you need the script shown in Listing 2.

Listing 2. TCP Script

When executing ns ./tcpweb.tcl, you will obtain two windows: the network animator and the simulation window. Figure 5 shows a possible layout of the nodes in simulation window. To get an accurate picture of traffic from client, bandwidth graphs for the link between nodes 1 and 2 are displayed.

Figure 5. Dynamic Rerouting of Packets

Link failure occurs between nodes 2 and 4 (Figure 5) as defined by the following lines:

$ns rtmodel-at 3 down $lrmon3 $lmcrt1
$ns rtmodel-at 7 up $lrmon3 $lmcrt1

Packets that were on the link are lost and must be retransmitted. After failure, notice the break in packet traffic in the bandwidth graphs. TCP packets are now taking another path from web cache to web client. Yet the connection is not lost because of the failure, since we can see that packets are still being exchanged between client and cache. If the display of nodes is not to your liking, you can change it using the Re-layout function button in the simulator window. While playing the simulation, you can change the step using the slider bar. This will be especially useful during the link failure between three and seven seconds to see dropped packets.

Another interesting aspect of this scenario is the visual server-cache and client-cache interaction. You can see a model of real-time common interactions on the Internet. Of course, bear in mind that this is a generalized simulation.

NS2 Graphical Editor

If you prefer a graphical interface to setup network simulations, NAM supports a drag-and-drop user interface. You can place network nodes, link them together and define user agents and their associated application or traffic generator. SCTP is not included in this interface because the patch was specific to NS2 source code, not NAM. NAM is useful for quickly building a network topology. However, we experienced multiple segmentation faults during editing (back up your files often).

The following example explains how to use basic NAM features. The first step is to start an instance of NAM by executing ./nam. Selecting New in the file menu, you will see the editor window appear. For this example, we are trying to build the topology seen in Figure 6.

Figure 6. NAM Editor

On the toolbar, click on the Add node button and place three nodes in editor window by right clicking at the correct positions. To link nodes, click on Add link. Select one node and drag-click to the next node to create link. Next, choose which agents you want to use on network in agent drop-down menu. To add an agent, click on the appropriate node. Lastly, you choose what applications you want to simulate: either FTP or CBR source. To add an application, click on the chosen agent. At this point, you can right click on different elements in your topology and edit their properties such as color or start and end time for applications. If you get a dialog saying that you must connect your agents, use Add link and connect different agents to simulate your scenario. In case of a blunder, there is a delete button on the toolbar. Note that editor and simulation windows are both part of NAM, but simulation must first be interpreted by NS2 so that NAM can replay the log of simulation.

Conclusion

We decided to test NS2 because of its support of SCTP (which is a requirement for us), graphical representations, multiple protocols and many other reasons. However, you need to patch the source code in case the protocol you want to simulate is not supported and live with low-quality graphics tool.

NS2 is a tool that helps you better understand certain mechanisms in protocol definitions, such as congestion control, that are difficult to see in live testing. It provides good documentation and support for different add-ons. We recommend NS2 as a tool to help understand how protocols work and interact with different network topologies.

We would like to enforce the need for such tools to be open source and targeted toward supporting Linux. With the emergence of new protocols, such as IPv6 and SCTP, NS2 can be very useful for the Open Source community.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Simulation for a High speed mass data transfer protocol

echonyne's picture

Hello everybody,

I'll be doing a project simulation for a high speed mass data transfer protocol.
Will be needing your help..

If anybody interested or want to contribute they are humbly invited.. :)
Just drop me a mail at:

kanishk@speedpost.net

is there any specific kernel support required for installing ns2

sujo's picture

is there any specific kernel support required for installing ns-2.1b8-mcast

Change queue parameters dynamically during the simulation r

raeisy's picture

Dear friend,
I want to change parameters of a RED queue during the simulation but it seems that some parameters can be modified only before starting the simulation, not dynamically, while the simulation is in progress. For example the following subroutines works before $ns run command but it do not affect the behavior of the queue during the simulation( I want to change maxthresh_ and thresh_ after $ns run command):
#---------------------------------------------------------------
proc setREDParameters { redQueue MINth MAXth PER_MaxP Wq } {
$redQueue set thresh_ $MINth
$redQueue set maxthresh_ $MAXth
$redQueue set q_weight_ $Wq
$redQueue set linterm_ $PER_MaxP
return $redQueue
}

Who knows what I should do ?
Email:raeisy@shirazu.ac.ir

ns2-wsn

sharath's picture

pls send me the ns2 code for any topology scheme preferably span in wireless sensor networking

voice security in ns-2

Jay Jay's picture

please, can i implement voice security in ns-2
all contributions would be appreciated.

cellular envirnoment in NS-2

Anonymous's picture

i m doing the project in channel allocation in mobile communication, i wants to implement it in NS-2. i wants to create the wireless envirnoment. can anybody helps me in doing that?

Hi, Iam also doing project

Anonymous's picture

Hi,

Iam also doing project in cellular networks. if you know how to simulate it in ns2 please tell me. My email: kiran.mvk123@gmail.com
Thankyou

About SCTP and NS-2.32

Nhan's picture

Now, I want to simulate SCTP on NS-2. And I use NS-2 2.32. I want to know does NS-2 2.32 support SCTP???
Thank for your help.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix