In this problem set you will run more complex network simulations in ns-3 and look at examples of how the operation of a network is modelled in the simulator. We'll also review some basic networking principles.
Throughout this instruction the PDF version of the ns-3 tutorial is referenced because it contains numbered sections. However, you may want to use the HTML version if you wish.
Based on the code of examples/tutorial/second.cc and Section 6.1 of the ns-3 tutorial answer the following questions.
A key advantage of the simulation method over experiments in real networks is its flexibility. How is this achieved in the second.cc example using the nCsma parameter?
How is routing in this simulation script achieved? How does this method of implementing routing relate to the system vs. model difference?
How is .pcap tracing enabled in the CSMA network? Why do we need to use promiscuous mode (which was not needed in the point-to-point network)?
Compile and run the script by executing the following commands from the ns-3.x working directory:
cp examples/tutorial/second.cc scratch/mysecond.cc
./waf --run scratch/mysecond
Which .pcap files do you need to open to observe how the packet flows through the network? Which .pcap file contains an ARP exchange? Why?
Using second.cc as a basis:
Is there a difference between the configured data rates of the channel in the network and the achieved throughput? Why? Provide verification for your observations (e.g., screenshots) and relevant fragments of the simulation code.
Suggestion: disable logging to speed up the simulation.
Recall, from the previous exercise set, that ns-3 by default does not calculate the checksum values which generates errors in Wireshark. This default behavior can be changed by adding the following line to your code:
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
Verify that after adding this code the checksum calculations are enabled in ns-3 and that Wireshark no longer raises an error.
Perform an analysis of how much time the simulator spends on calculating and validating checksums:
second.cctime commandCommand-line arguments are an important tool for configuring any simulation scenario and we will be using them extensively in the next labs. To see how they can be used in ns-3, we will briefly return to the first.cc example. Read and perform the actions described in Section 5.2 of the ns-3 tutorial to learn how to work with command-line arguments. Implement the nPackets variable.
Check that you can successfully run the command below:
./waf --run "scratch/myfirst --nPackets=X"
where X is an arbitrary integer. Is the outcome as you expected?
Command-line arguments can be also used to configure the network topology as in the case of second.cc. Finish reading Section 6 of the ns-3 tutorial (starting from page 61 "Finally, recall that we added..." to the end of the section) to learn how to use node number and device number as parameters.
Check that you can successfully run the command below:
./waf --run "scratch/mysecond --nCsma=100"
What is the difference in content between the second-100-0.pcap and second-101-0.pcap files?
Read Section 6.2 from the ns-3 tutorial to learn about simulation modelling and abstraction in ns-3. Provide three examples of networking functionalities which were not modelled in the studied scenarios. Provide three examples of how the simulation scenarios could be configured so as to "defy reality".