Ahyoung Lee Lab 1: CS 6027 – Advanced Computer Networking Fall 2023
Introduction to Network Simulator 2 (NS2)
Max: 100 points
Name and ID (print) _______________________________________________________
Objectives
The purpose of today’s lab is to familiarize yourself with the network simulation tool: “Network Simulator (Version 2)”, widely known as NS2 that is an open-source event-driven simulator designed specifically for research in computer communication networks. NS2 contains modules for numerous network components such as routing, transport layer protocol, application, mobility, etc. To investigate network performance, researchers can simply use an easy-to-use scripting language to configure a network, and observe results generated by NS2. So, NS2 has become the most widely used open source network simulator, and one of the most widely used network simulators. Therefore, we will use NS2 to evaluate network performance such as end-to-end delay, packet loss, and throughput.
Activities
Before you get started, you need to know how to install NS2. So, please follow the instruction how to download and install NS2 on Ubuntu.
****** How to Install NS2 on Ubuntu at VirtualBox ******
-
1) Install VirtualBox on your OS system
Download Ubuntu ISO file (Ubuntu 22.04 latest version) (18.04 – that is the best version for ns2)
https://ubuntu.com/download/desktop
-
2) Install Ubuntu on VirtualBox
Tutorial: https://brb.nci.nih.gov/seqtools/installUbuntu.html
- Do not select “Download updates while installing”, better to do after installation done. - After install Ubuntu do the following steps:-
a) Get update software list:
sudo apt-get update
-
b) Update software:
sudo apt-get upgrade
-
-
3) Install NS2 on Ubuntu at VirtualBox Follow the ns2 installation below.
Installation: NS2
• Go to NS2 web page:
o https://www.isi.edu/nsnam/ns/ns-build.html
o Click“allatonce”ontheNS2webpage:https://www.isi.edu/nsnam/ns/ns-
build.html#allinone • Download:
o ns-allinone-2.35.tar.gz
-
Make a directory named as “ns2”
o mkdirns2
-
Unzip the file in the directory “ns2”
o tar–xzfns-allinone-2.35.tar.gz
-1-
Ahyoung Lee Lab 1: CS 6027 – Advanced Computer Networking Fall 2023
**** Configuration and Errors for gcc compiler*****
-
ns2 uses gcc-4.8 as c compiler and g++-4.8 as C++ Compiler, thus ns2, nam and xgraph all these
softwares were comfortable with 4.8 version.
-
So, add xenial to o
o anddo o
o•
-
Next, we need to change these settings in the Makefile.in
o Wehavetomodifyatthreelocations; 1.
2.
-
Go to the directory “linkstate” in /ns2/ns-allinone-2.35/ns-2.35/linkstate
o Inthe“ls.h”file,thereisanerrorattheline137th:add“this->”erase -
Use the installation package:
o sudoapt-getinstalllibx11-devxorg-devlibxmu-devlibperl4-corelibs-perl o cdns-allinone-2.35
o ./install§ follow the instruction that shows important path setups into .bash profile.
/etc/apt/sources.list
sudo gedit /etc/apt/sources.list
temporarily to install g++-4.8:
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe
sudo apt update && sudo apt install g++-4.8
sudo apt update
sudo apt install build-essential autoconf automake libxmu-dev
~/ns-allinone-2.23/ns-2.35/Makefile.in
~/ns-allinone-2.23/nam-1.15/Makefile.in
~/ns-allinone-2.23/xgraph-12.2/Makefile.in
Change as per the following in the above three files
@CC@ --> gcc-4.8
@CPP@ --> g++-4.8
-2-
Ahyoung Lee
Lab 1: CS 6027 – Advanced Computer Networking
Fall 2023
§ Go to home directory, just type “cd” and enter § “ls -a”
§ open the “.bashrc” file.
§ Add paths into the bashrc file. For example:
§ Save the bashrc file.
§ Do “source ~/.bashrc”
§ Type “ns” on a terminal, if you see “%” symbol then the installation is correct.
NS2 tutorial:
-3-
Ahyoung Lee Lab 1: CS 6027 – Advanced Computer Networking Fall 2023 • Marc Greis' Tutorial for the UCB/LBNL/VINT Network Simulator "ns":
o https://www.isi.edu/nsnam/ns/tutorial/ Exercise (100 points)
A Network Simulation Example
Try to write a script the given network simulation example and save the script with “lab1.tcl” run it as “ns lab1.tcl”.
CBR
UDPAgent
TCPAgent
100 Mbps n0 5 ms Delay
n1 100 Mbps 5 ms Delay
n2
54 Mbps
10 ms Delay n4
54 Mbps n3 10 ms Delay
TCPSink
NullAgent
FTP
You may look at the tutorial website: http://nile.wpi.edu/NS/simple_ns.html
Submission
Please finish it and submit the exercise (lab1.tcl file) and captured demo (screenshot) outputs (one docx
file) into the dropbox by next Wendesay (September 6, Wednesday, 2023).
The demo outputs look like as follows:
Next lab class, we will learn how to analyze .tr file that is the output about your script file (lab1.tcl), then we will see results of network performance.
-4-