last update: 9/11/2021
(NOTE: I plan on updating this so all information
we present on NS3 can be found here )
--------------------------------------------------------------------------------------------
NS3 Simulator - refer to this page for information on NS3
The goal of this section is to provide a path for someone not
familiar with ns3 to get started. In overview, you should
assume the following algorithm:
//Goal is to develop sufficient background and experience with
ns3 such that when complete, you are comfortable using ns3 to
model/solve appropriate problems
developPreliminaryModelProblemStatement();
initProgressMeasure();
while (true)
{
Read/learn something about ns3;
Try something based on what you just read;
rc = refineModelStatement();
upDateProgressMeasure();
if (rc == complete)
{
rc = validateModel();
if (rc == complete)
break ;
else
resetProgressMeasure();
}
else
{
adjustProgressMeasure();
if (getCurrentProgressMeasure() >
getCurrent_PAIN_THRESHOLD()) {
getHelp();
reduce_PAIN_THRESHOLD();
}
if
(getCurrentProgressMeasure() >
getCurrent_PROGRESS_THRESHOLD()) {
increase_PROGRESS_THRESHOLD();
}
}
}
The algorithm should make it clear that an iterative process is
required to get through the learning curve associated with
ns3. The secret to success is to work in increments that
reflect forward progress. Initially, you should be asking
questions daily. As you make progress, you will learn how to
answer more and more of your own
questions.
Example scripts (this will be updated shortly):
---------------------------------------------------------------------------------------------
FAQ
---------------------------------------------------------------------------------------------
Question
How can ns3 operate in a more 'real' manner?
https://www.nsnam.org/wiki/HOWTO_make_ns-3_interact_with_the_real_world
It's possible to tell the ns3 scheduler to use real time rather
than simulation time.
It's possible to setup ns3 for use as an emulator. The
Linux programs and the network stack can make use of ns3 to
emulate complex wired/wireless networks.
Aspects of this is captured by NS3's Direct Code Execution (DCE)
mode (see https://www.nsnam.org/docs/dce/manual/html/getting-started.html
)
---------------------------------------------------------------------------------------------
Question
How to use the network emulation platform CORE/EMANE with
NS3?
Going one step beyond ns3's native
support for emulation, a set of tools (CORE and
EMANE) were
created to address a R&D environment that supports a blend
of simulation, emulation, and measurement-based methods.
This paper is a bit old but it gives a good description of CORE/EMANE.
Refer to this page that talks of how ns3 fits into the
picture. CORE/EMANE is a much cleaner way of doing
emulation
compared to NS3's DCE mode:
https://www.nsnam.org/wiki/HOWTO_Use_CORE_to_test_ns-3_protocols
---------------------------------------------------------------------------------------------
Question:
How do you install ns3 on a new Linux machine?
Clone, build and test an ns-3 release or the ns development tree to use as a clean starting point. One way to do this is:
a. hg clone http://code.nsnam.org/ns-3-allinone b. cd ns-3-allinone c. ./download.py d. ./build.py e. cd ns-3-dev f. ./test.py
-------------------------------------------------------------------------------
Question: How do I check the
version of VBox ?
On a Ubuntu VM: sudo VBoxService --version
-------------------------------------------------------------------------------
Question: How do I check
if Guest Additions are installed?
On a Ubuntu VM: "lsmod | grep vboxguest"
Also try sudo modprobe
vboxadd
-------------------------------------------------------------------------------
Question: how to reinstall Guest Additions from the Linux VM?
Issue df -k to find
/media ....
cd to this location and run sudo ./VBoxLinuuxAdditions.run
and then reboot the VM
----------------------------------------------------------------------------
Question: How to create a new application?
Refer to https://www.nsnam.org/wiki/HOWTO_make_and_use_a_new_application
This page clones the udp-echo-client and server in
src/applications/model.
Summary
-best to clone an existing app - just change names
-modify ./wscript file
-modify helper - add a helper function
-modify wscript
Run ./waf
Then build a script that uses the app
a. change directory into ns-3-dev/examples/udp/
b. cp udp-echo.cc request-response.cc
c. Edit the new script (request-response.cc) and make the same substitutions as in step 3 above.
d. Edit the wscript in this directory and add the new example to the build
search for udp-echo
copy the two lines of build instructions and rename udp-echo to request response in the copied lines.
obj = bld.create_ns3_program('request-response',
['csma', 'internet'])
obj.source = 'request-response.cc'
e. save file
f. change into the top level directory (ns-3-dev)
cd ../..
g. build the whole thing
./waf
Keys:
-After adding new code (model, helper, our scripts), run
./waf either at the NS$HOME or in the source code dir.
To run the new script :
cd .. b. ./waf --run request-response
4. Observe the pcap traces to see what you've done
a. tcpdump -nn -tt -r request-response-0-1.pcap
reading from file request-response-0-1.pcap, link-type EN10MB (Ethernet)
2.000000 arp who-has 10.1.1.2 (ff:ff:ff:ff:ff:ff) tell 10.1.1.1
2.004148 arp reply 10.1.1.2 is-at 00:00:00:00:00:02
2.004148 IP 10.1.1.1.49153 > 10.1.1.2.9: UDP, length 10
2.008312 arp who-has 10.1.1.1 (ff:ff:ff:ff:ff:ff) tell 10.1.1.2
2.008312 arp reply 10.1.1.1 is-at 00:00:00:00:00:01
2.014100 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024
b. Note that a 10 byte request packet goes from 10.1.1.1 (node zero)
c. Note that a 1024 byte response packet comes back from 10.1.1.2
-------------------------------------------------------------------------------
Question: is it easier to
write script models using Python rather than C++ ?
When it comes to writing ns-3 scripts in Python, my short advice is "Don't bother".
-------------------------------------------------------------------------------
Question How do I setup a script so I can
explore TCP competing flows ?
Question 3:
I tried to make a development directory under NS3 and now things
don't work.
- Waf
must be run directly from the NS3 install folder (as your CWD)
A related problem is
when I issue:
./waf --run scratch/<subdirectory><X>
NS3 does not compile...it gives a link error.
Place X in
the first level directory scratch as
NS3 is not aware of how to properly use subdirectories without
additional hints
Last update 8/29/2021