In this project you will use a simulator to construct a network, run TCP flows among a set of source-destination pairs, and monitor the packets “walking” through the network. You will use the ns-3 simulator. This is a very useful simulation tool that supports all kinds of networks and network devices, such as routers, Ethernet, WIFI, and SDN-enabled switches. Ns-3 supports both Python and C languages, but I suggest you use C since it is the most common language ns-3 researchers use.
Project 1
Objectives for this lab:
In this project you will use a simulator to construct a network, run TCP flows among a set of
source-destination pairs and monitor the packets “walking” through the network.
You will use ns-3 simulator. This is a very useful simulation tool which supports all kinds of
networks and network devices, such as routers, Ethernet, WIFI and SDN-enabled switches. Ns-3
supports both Python and C languages, but I suggest you use C since it is the most common
language ns-3 researchers use.
This is an individual project. You can discuss with other students, but you need to write your
simulation code independently. You can use any integrated development environment (IDE),
such as Visual Studio/Eclipse, to write but must be executable by ns-3.
Code: The code needs to simulate the following network and the flows running through it:
•
•
•
There are total of 8 pairs of senders (SX with source X)-receivers (DX with destination X) with a
TCP session running between each pair that keep sending packets for 30 seconds.
The nodes which are named bX and eX are routers.
The propagation delays and link capacities are marked in the graph.
Outputs:
The simulation code needs to generate two outputs for observation.
•
•
An animation records all TCP messages communications of all 8 sender-receiver pairs through
the network.
The overall throughput and goodput of each TCP flows in the 30 second simulation time.
NOTE: You may assign any IP address to a link, only making sure that each IP address assigned is
unique. The port numbers for the sender and receiver in a sender-receiver pair must be the same, and
there is no restriction on what the port number value you may assign to a pair.
Running the Script
The script file should have the following content
project1.cc
/* Copy Right */
/* CSE 5344 */
/* Your name */
#includes ….
int main{
/*main body*/
}
Put the project1.cc under the folder of ns-3.xx/scratch/
Runing it by ./waf –run project1 at ns-3.xx/ directory
Programming Hints & Grading Policy
You can go to the /example/tutorial/ to read first.cc second.cc third.cc. Copy them to ns-3.xx/scratch/
then go to main direction and run ./waf –run scratch/first
Here’s a material to help you understand how the script file work.
https://www.nsnam.org/docs/tutorial/html/building-topologies.html
This are the steps (with the percentage of grade allocated) you need to take to complete the project:
•
•
•
•
•
•
•
Create the hosts; 10%
Connect the hosts by router; 10%
Set up and assign the link status for each link; 10%
Populate the routing table; 10%
Deploy TCP connection on receiving and sending hosts pairs. 10%
Generate the monitoring animation. 10%
Generate the overall performance of each flow; 10%
The executable would take the rest 30% of the total grade.
NS-3 Installation Guidelines
Platform: (prefer: Ubuntu. If you have Ubuntu already, jump to step 5)
Windows, Mac users:
Step 1: install VirtualBox. https://www.virtualbox.org/
Step 2: download Ubuntu. https://ubuntu.com/download/desktop
Step 3: Load Ubuntu into VirtualBox
Click “new” button
Name your virtual machine, choose a folder your file would be stored.
Select Linux and Ubuntu-64bit as Type and Version. Then click create
And click create again
Right click your new virtual machine and choose setting
At Storage section choose the Empty under Controller:IDE. Then click the disk button right to the optical
drive. Select Choose a disk file and find your ubuntu file just downloaded at step 2
Click OK
Start your virtual machine
Step 4: Install Ubuntu by install instruction
Step 5: install ns-3 https://www.nsnam.org/wiki/Installation
Step 6. Install netanim
This animation tool would be automatically installed with ns-3. If you find that this tool does not
work, you can read https://www.nsnam.org/wiki/NetAnim_3.105
NS-3 Use Guidelines
Before go to the next step, you should make sure that in the ./ns-allinone-3.xx/ns-3.xx/ directory, you
can run ./waf –configure successfully.
You should put your code like xxxx.cc under .ns-3.xx/scratch directory and run ./waf –run scratch/xxxx
at ./ns-3.xx/ directory
NS-3 Use Guidelines
You can go to the ns-allinone-3.xx/netanim-3.xx directory and run the ./Netanim to open the netanim
program. (If you cannot find the ./Netanim executable program go back to ns-allinone-3.xx directory and
run ./build.py
When you successfully put the animation tracer in the script file, you can generate a xxx.xml file.
Use the open button(looks like a folder at the top left corner) and choose the xml file to see the packet
transmission animation.