Network Simulator 2: a Simulation Tool for Linux
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.
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.
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.
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.
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.
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.
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Nice article, thanks for the
7 hours 25 min ago
- I once had a better way I
13 hours 11 min ago
- Not only you I too assumed
13 hours 29 min ago
- another very interesting
15 hours 22 min ago
- Reply to comment | Linux Journal
17 hours 15 min ago
- Reply to comment | Linux Journal
1 day 9 min ago
- Reply to comment | Linux Journal
1 day 25 min ago
- Favorite (and easily brute-forced) pw's
1 day 2 hours ago
- Have you tried Boxen? It's a
1 day 8 hours ago
- seo services in india
1 day 12 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?