0% found this document useful (0 votes)
18 views99 pages

IT3131 CNLab Manual 2024

The document is a lab manual for the Computer Networks Lab (IT3131) at the School of Information Technology, outlining the course objectives, assessment criteria, and guidelines for students. It details the use of the NetSim Network Simulator for various networking experiments, including routing protocols, network performance measures, and network utilities. The manual also provides a structured format for students to document their experiments and includes a list of experiments to be conducted during the lab sessions.

Uploaded by

patrickholkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views99 pages

IT3131 CNLab Manual 2024

The document is a lab manual for the Computer Networks Lab (IT3131) at the School of Information Technology, outlining the course objectives, assessment criteria, and guidelines for students. It details the use of the NetSim Network Simulator for various networking experiments, including routing protocols, network performance measures, and network utilities. The manual also provides a structured format for students to document their experiments and includes a list of experiments to be conducted during the lab sessions.

Uploaded by

patrickholkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 99

School of Information Technology

Department of Information Technology

LAB MANUAL
IT3131
COMPUTER NETWORKS LAB

Program : B. Tech. Semester: V Semester


Session : 2024-25 Subject Code: IT3131
Subject Name : COMPUTER NETWORKS LAB

Credits : [0 0 2 1]

Mr. Rohit Kumar Gupta (Course Coordinator),


Dr. Narendra Singh Yadav,
Dr. Lokesh Sharma,
Ms. Vineeta Soni,
Mr. Suman Saurabh Sarkar,
Dr. Chandrapal Singh Dangi,
Dr Kavita,
Dr Debolina Ghosh

MR. ROHIT KUMAR GUPTA


Course coordinator
DEPARTMENT OF INFORMATION TECHNOLOGY

1. AIM
To familiarize the students with the fundamental concepts of networking, connecting devices,
implementation of routing, virtual LAN, NAT, DHCP and network utilities.

2. ASSESSMENT CRITERIA:
Continuous Evolution through out the Semester
Ratio of Internal and External : 60:40
Internal assesment :- Continous Evaluation comprises of lab records, viva, performance in lab.
External assesment :- 2 Hr. lab exam followed by viva.

3. LAB OBJECTIVE:

The Computer Network lab will facilitate the students to develop a preliminary yet practical
understanding of web designing.
At the end of this lab session:

1. Demonstrate the concepts of NetSim Network Simulator and Network connecting devices.
2. Demonstrate the concept of topology and configuration. .
3. Demonstrate the implementation of different protocols.

4. Demonstrate the concepts NAT protocol configuration.

5. Demonstrate the usage different network utilities

4. GUIDELINES TO STUDENTS:
1. Students should be regular and come prepared for the lab practice.
2. In case a student misses a class, it is his/her responsibility to complete that missed experiment(s).
3. Students should bring the practical record book, lab journal, and lab manual. prescribed textbook
and class notes can be kept ready for reference if required.
4. Once the case study discussed in the lab the detailed analysis of the experiment to be shown to the
instructors and copy the same in their practical record book.
4. FORMAT OF INDEX
Aim of the Date of Date of Remarks Signature
S.No. Program
Performance Submission

write
complete aim of the
program that
student has written Here faculty will Signature
in the DD/MM/YYYY DD/MM/YYYY
write some of the
aim section in every
remark/grade/co faculty
program
mment/etc.

5. HOW TO WRITE PROGRAM IN THE LAB RECORD

Student will need to write program in following format.

1. Aim: write the complete aim of the program to be developed.


2. Introduction: write brief introduction of experiment.
3. Procedure: write step by step procedure of performing the experiment.
4. Result/Output: write the compete output/result.
5. Conclusion: write inferences.

List of Experiments
1 Introduction to NetSim
2 Understand Measures of Network Performance: Throughput and Delay
3 Understand working of ARP, and IP Forwarding within a LAN and across a router
4 Simulate and study the spanning tree protocol
5 Study the working and routing table formation of Interior routing protocols, i.e. Routing
Information Protocol (RIP) and Open Shortest Path First (OSPF)
6 Understanding Public IP Address & NAT (Network Address Translation)
7 Understand the working of basic networking commands (Ping, Route Add/Delete/Print, ACL)
8 Introduction to TCP connection management
9 Reliable data transfer with TCP
10 TCP Congestion Control Algorithms
1 Introduction to NetSim

1.1 Introduction to network simulation with NetSim, NetSim feature list and NetSim
Simulation environment

NetSim is a network simulation tool that allows you to create network scenarios, model
traffic, design protocols and analyze network performance. Users can study the
behavior of a network by test combinations of network parameters. The various
network technologies covered in NetSim include:
Internetworks - Ethernet, WLAN,
IP, TCP Legacy Networks - Aloha,
Slotted Aloha Cellular Networks -
GSM, CDMA
Mobile Adhoc Networks - DSR, AODV,
OLSR, ZRP Wireless Sensor Networks -
802.15.4
Internet of Things - 6LoWPAN gateway, 802.15.4 MAC /
PHY, RPL Cognitive Radio Networks - 802.22
Long-Term Evolution Networks
– LTE Software Defined
Networking
Advanced Routing and Switching - VLAN, IGMP, PIM, L3 Switch,
ACL and NAT 5G NR mmWave – LTE NR
NetSim home screen will appear as shown below see Figure 1-1.
Figure 1-1: NetSim Home Screen
Network Design Window: NetSim design window or the GUI see Figure 1-2, enables
users to model a network comprising of network devices like switches, routers, nodes,
etc., connect them through links, and model application traffic to flow through the

network. The network devices shown are specific to the network technologies chosen
by the user.

Figure 1-2: Network Design Window


1.1.1 Descrip
tion:

1. File - In order to save the network scenario before or after running the simulation into the current
workspace,

Click on File Save to save the simulation inside the current workspace.
Users can specify their own Experiment Name and Description (Optional).
Click on File Save As to save an already saved simulation in a different
name after performing required modifications to it.
Click on Close, to close the design window or GUI. It will take you to the
home screen of NetSim.
2. Settings - Go to Settings Grid/Map Settings and choose the type of environment. Here we have
chosen the Grid/Map in the form of a Grid. Map option can be used for specific cases like while
designing VANET scenarios.
3. Help - Help option allows the users to access all the help features.
About NetSim – Assists the users with basic information like,
Which version of NetSim is used and whether it is a 32-bit build or
64-bit build? What kind of License is being used? Whether Floating
or Node Locked?
Video Tutorials – Assists the users by directing them to our dedicated
YouTube Channel “TETCOS”, where we have lots of video presentations
ranging from short to long, covering different versions of NetSim up to the
latest release.
Answers/FAQ – Assists the user by directing them to our “NetSim Support Portal”,
where one can find a well-structured “Knowledge Base”, consisting of answers or
solutions to all the commonest queries which a new user can go through.
Raise a Support Ticket – Assists the user by directing them to our “NetSim Support
Portal”, where one can “Submit a ticket” or in other words raise his/her query, which
reaches our dedicated Helpdesk and due support will be provided to the user.
User Manual – Assists the user with the usability of the entire tool and its
features. It highly facilitates a new user with lots of key information about
NetSim.
Source Code Help – Assists the user with a structured documentation for
“NetSim Source Code Help”, which helps the users who are doing their
R&D using NetSim with a structured code documentation consisting of more
than 5000 pages with very much ease of navigation from one part of the
document to another.
Open Source Code – Assists the user to open the entire source codes of
NetSim protocol libraries in Visual Studio, where one can start initiating the
debugging process or performing modifications to existing code or adding
new lines of code. Visual Studio Community Edition is a highly
recommended IDE to our users who are using the R&D Version of NetSim.
Experiments – Assists the user with separate links provided for 30+ different
experiments covering almost all the network technologies present in NetSim.
Technology Libraries – Assists the user by directing them to a folder
comprising of individual technology library files comprising all the
components present in NetSim.

Below the menu options, the entire region constitutes the Ribbon/Toolbar using which
the following actions can be performed:

Click and drop network devices and right click to edit properties
Click on Wired/Wireless links to connect the devices to one another. It
automatically detects whether to use a Wired/Wireless link based on the
devices we are trying to connect
Click on Application to configure different types of applications and generate
traffic
Click on Plots, Packet Trace, and Event Trace and click on the enable check
box option which appears in their respective windows to generate additional
metrics to further analyze the network performance.
Click on Run to perform the simulation and specify the simulation time in
seconds.
Next to Run, we have View Animation and View Results options. Both the
options remain hidden before we run the simulation or if the respective
windows are already open.
Display Settings option is mainly used to display various parameters like
Device Name, IP, etc., to provide a better understanding especially during the
design and animation.
Results Window: Upon completion of simulation, Network statistics or network
performance metrics reported in the form of graphs and tables. The report includes

metrics like throughput, simulation time, packets generated, packets dropped, collision
counts etc. see Figure 1-3 and Figure 1-4.
Figure 1-3: Results Window

Figure 1-4: Application Throughput Plot


1.1.2 Descrip
tion:

1. Below Simulation Results, clicking on a particular metrics will display the respective metrics
window.
2. Clicking on links in a particular metrics will display the plot in a separate window
3. Enabling Detailed View by clicking on it will display the remaining properties
4. Clicking on Restore to Original View will get back to the original view
5. Click on Open Packet Trace / Open Event Trace to open the additional metrics which provide in depth
analysis on each Packets / Events.

Packet Animation Window: When we click on run simulation, we have the option to
record / play & record animation. If this is enabled, users can view the animation during
the run time or upon completion of the simulation see Figure 1-5, users can see the flow
of packets through the network. Along with this, more than 25+ fields of packet
information is available as a table at the bottom. This table contains all the fields

recorded in the packet trace. In addition, animation options are available for viewing
different graphs, IP Addresses, Node movement etc.

Figure 1-5: Packet Animation Window


1.1.3 Description

1. Click on Play to view the animation. You can Pause the animation at any interval and Play again.
2. Click on Stop to stop the animation. Now click on Play to start the animation from the beginning.
3. Next to that we also have speed controllers to increase/decrease Simulation Time and Animation
Speed
4. View More option enables the user to view Plots, Throughputs, and IP Tables during the animation
5. Table Filters are used to filter the packet information’s shown in the below table during simulation
as per user requirement
6. While setting more than one application, it is differentiated using different color indications
7. Packets are indicated using different color combinations say, blue color indicates control packets,
green color indicates data packets and red color indicates error packets.
1.2 How does a user create and save an experiment in
workspace?

To create an experiment, select New Simulation-> <Any Network> in the NetSim Home
Screen
Figure 1-6.

Figure 1-6: NetSim Home Screen

Create a network and save the experiment by clicking on File->Save button on the top
left.

A save popup window appears which contains Experiment Name, Folder Name,
Workspace path and Description see Figure 1-7.
Figure 1-7: NetSim Save Window

Specify the Experiment Name and Description (Optional) and then click on Save. The
workspace path is non-editable. Hence all the experiments will be saved in the default
workspace
path. After specifying the Experiment Name click on Save.
In our example we saved with the name MANET and this experiment can be found in
the default workspace path see below Figure 1-8.

Figure 1-8: NetSim Default Workspace Path

Users can also see the saved experiments in Your work menu shown below Figure 1-9.

Figure 1-9: Your Work Menu


“Save As” option is also available to save the current experiment with a different name.
1.3 Typical sequence of steps to do experiments in this manual

The typical steps involved in doing experiments in NetSim are


Network Set up: Drag and drop devices, and connect them using wired or wireless
links Configure Properties: Configure device, protocol or link properties by right
clicking on the device or link and modifying parameters in the properties window.
Model Traffic: Click on the Application icon present on the ribbon and set traffic
flows.
Enable Trace/Plots (optional): Click on packet trace, event trace and Plots to
enable. Packet trace logs packet flow, event trace logs each event (NetSim is a
discrete event simulator) and the Plots button enables charting of various
throughputs over time.
Save/Save As/Open/Edit: Click on File Save / File Save As to save the experiments
in the current workspace. Saved experiments can then opened from NetSim home
screen to run the simulation or to modify the parameters and again run the
simulation.
View Animation/View Results: Visualize through the animator to understand working and to
analyze results and draw inferences.
NOTE: Example Configuration files for all experiments would available where NetSim
has been installed. This directory
is
(<NetSim_Install_Directory>\Docs\Sample_Configuration\NetSim_Experiment_Man
ual)
2 Understand Measures of Network
Performance: Throughput and Delay

2.1 Introduction

The two main performance measures of a network are:

Throughput: how many bits per second are going through the network
Delay: how long does it take a bit from one end to the other
These are two orthogonal concepts, and one could think of it as width of a pipe and
length of a pipe through with data flows.

2.2 NetSim Simulation Setup

1.1.4 Open NetSim and click Examples > Experiments > Understanding-Measure-of-Network- Performance-
Throughput-and-Delay

Figure 2-1: Experiments List

2.3 Part-1: Throughput Analysis

2.3.1 Without packet acknowledgement (UDP)


Figure 2-2: A WAN network architecture

The following set of procedures were done to generate this


sample.

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Router, and 2


Wired Node in the “Internetworks” Network Library.

Step 2: Right click on Wired link and select Properties, BER is set to 0, and
Propagation Delay is set to 20µs. For link id 2 Link Speed is set to 1 Mbps.

Step 3: Right click on the Application Flow App1 FTP and select Properties or
click on the Application icon present in the top ribbon/toolbar.

A FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size remaining 125000Bytes and Inter Arrival Time remaining 1s.

Transport Protocol is set to UDP instead of TCP.

Step 4: Enable the plots and click on Run simulation. The simulation time is set to 100
seconds

2.3.2 With Packet Acknowledgement (TCP)

Step 1: Right click on Wired link and select Properties, BER is set to 0, and
Propagation Delay is set to 40µs. For link id 2 Link Speed is set to 1 Mbps.
Step 2: Right click on the Application Flow App1 FTP and select Properties or
click on the Application icon present in the top ribbon/toolbar.

A FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size remaining 125000Bytes and Inter Arrival Time remaining 5s.

Transport Protocol is set to TCP.

Step 3: Enable the plots and click on Run simulation. The simulation time is set to 100
seconds.

2.3.3 Output

Sample 1:

Figure 2-3: Application Throughput for Sample 1


Sample 2:

Figure 2-4: Application Throughput for Sample 2

2.4 Part - 2: Delay Analysis

2.4.1 Procedure
Figure 2-5: A LAN network

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 1 L2 Switch, and


2 Wired Node in the “Internetworks” Network Library.

Step 2: Right click on Wired link and select Properties, Link Speed is set to 1 Mbps,
BER is set to 0, and Propagation Delay is set to 0µs.

Step 3: Right click on the Application Flow App1 FTP and select Properties or
click on the Application icon present in the top ribbon/toolbar.

A FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size remaining 1000000Bytes and Inter Arrival Time remaining
100s.

Transport Protocol is set to UDP instead of TCP.

Step 4: Enable the packet trace and plots. Click on Run simulation. The simulation time
is set to 100 seconds.

2.4.2 Output

Sample 1: In packet trace we can see only one file is generated from source to
Destination, the file is divided into packets. Filter the packet type as FTP to calculate
End to end delay = PHY_LAYER_END_TIME - PHY_LAYER_ARRIVAL_TIME

Sending 1 MB file on 1 Mbps link should take 8.29s and the same is seen in the packet
trace. Then it takes another 8.29s to go from the switch to then node, or 16.58s total

see Figure 2-6.

Figure 2-6: End to End Delay from Packet Trace

3 Understand working of ARP, and


IPForwarding within a LAN and across a router

1.2 3.1 Theory

In a network architecture different layers have their own addressing scheme. This helps
the different layers in being largely independent. Application layer uses host names,
network layer uses IP addresses and the link layer uses MAC addresses. Whenever a
source node wants to send an IP datagram to a destination node, it needs to know the
address of the destination. Since there are both IP addresses and MAC addresses, there
needs to be a translation between them. This translation is handled by the Address
Resolution Protocol (ARP). In IP network, IP routing involves the determination of
suitable path for a network packet from a source to its destination. If the destination
address is not on the local network, routers forward the packets to the next adjacent
network.
(Re/'erence: A good reference for this topic is Section 5.4.1: Link Layer Addressing and ARP, of the book, Computer
Networking, A Top-Down Approach, 6" Edition by Kurose and Ross)
2. 3.1.1 ARP protocol Description

1. ARP module in the sending host takes any IP address as input and returns the correspondingMAC
address.
2. First the sender constructs a special packet called an ARP packet, which contains severalfields
including the sending and receiving IP and MAC addresses.
3. Both ARP request and response packets have the same format.
4. The purpose of the ARP request packet is to query all the other hosts and routers on thesubnet
to determine the MAC address corresponding to the IP address that is being resolved.
5. The sender broadcasts the ARP request packet, which is received by all the hosts in thesubnet.
6. Each node checks if its IP address matches the destination IP address in the ARP packet.
7. The one with the match sends back to the querying host a response ARP packet with thedesired
mapping.
8. Each host and router has an ARP table in its memory, which contains mapping of IP
addresses to MAC addresses.
9. The ARP table also contains a Time-to-live (TTL) value, which indicates when each mapping will be
deleted from the table.
3. 3.1.2 ARP Frame Format

Figure 3-1: ARP Frame Format


The ARP message format is designed to accommodate layer two and layer three
addresses of various sizes. This diagram shows the most common implementation,
which uses 32 bits for the layer three (“Protocol”) addresses, and 48 bits for the layer
two hardware addresses.

3.1.1 3.2 IP Forwarding Description

10. Every router has a forwarding table that maps the destination addresses (or portions of the
destination addresses) to that router’s outbound links.
11. A router forwards a packet by examining the value of a field in the arriving packet’s header,and
then using this header value to index into the router’s forwarding table.
12. The value stored in the forwarding table entry for that header indicates the router’s outgoinglink
interface to which that packet is to be forwarded.
13. Depending on the network-layer protocol, the header value could be the destination addressof the
packet or an indication of the connection to which the packet belongs.
14. ARP operates when a host wants to send a datagram to another host on the same subnet.
15. When sending a Datagram off the subnet, the datagram must first be sent to the first-hop router on
the path to the final destination. The MAC address of the router interface is acquired using ARP.
16. The router determines the interface on which the datagram is to be forwarded by consultingits
forwarding table.
17. Router obtains the MAC address of the destination node using ARP.
18. The router sends the packet into the respective subnet from the interface that was identifiedusing
the forwarding table.
3.3 Network Set up
Open NetSim and click Examples > Experiments > Working-of-ARP-and-IP-Forwarding-within-a-
LAN-and-across-a-router » Sample-1 see Figure 3-2.

Figure 3-2: Experiments List


NetSim UI displays the configuration file corresponding to this experiment as shown below Figure
3-3.

Figure 3-3: Application flow within a LAN

3.1.2 3.4 Procedure

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 3 Wired Nodes, 2 L2 Switches, and 1
Router in the “Internetworks” Network Library.
Step 2: Right click on the Application Flow App1 CBR and select Properties or click on the
Application icon present in the top ribbon/toolbar.

A CBR Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining
200009s.

Transport Protocol is set to UDP instead of TCP. If set to TCP, the ARP table will get
updated due to the transmission of TCP control packets thereby eliminating the need for
ARP to resolve addresses.

Step 3: Packet Trace is enabled in the NetSim GUI, and hence we can view the ARP
Request and ARP Reply packets exchanged initially, before transmission of the data
packets.

Step 4: Enable the plots and click on Run simulation. The simulation time is set to 10
seconds. In the
“Static ARP Configuration” tab, Static ARP is set to disable see Figure 3-4.

Figure 3-4: Static ARP Configuration


Window Click on Accept and then click on OK.

If Static ARP is enabled, then NetSim will automatically create an ARP table for each
node. To see the working of the ARP protocol users should disable Static ARP.

By doing so, ARP request would be sent to the destination to find out the destinations
MAC Address.
3.1.3 3.5 Output — I

Once the simulation is complete, to view the packet trace file, click on “Open Packet
Trace” option present in the left-hand-side of the Results Dashboard.

Figure 3-5: Open Packet Trace


NODE 1 will send ARP_REQUEST to SWITCH-4, SWITCH-4 sends this to
ROUTER-6, and SWITCH-4 also sends this to NODE-2. ARP-REPLY is sent by the
NODE-2 to SWITCH -4, and in- turn SWITCH-4 sends it to NODE-1.

3.1.4 3.6 Inference I

3.1.4.1 Intra-LAN-IP-forwarding:

ARP PROTOCOL- WORKING:

Figure 3-6: Intra LAN IP Forwarding


NODE-1 broadcasts ARP_Request, which is then broadcasted by SWITCH-4. NODE-
2 sends the ARP_RepIy to NODE-1 via SWITCH-4. After this step, datagrams are
transmitted from NODE-1 to NODE-2. Notice the DESTINATION_ID column for
ARP_Request type packets, which indicates Broadcast-0.
3.1.4.2 »SampIe-2:

NetSim UI displays the configuration file corresponding to this experiment as shown


below Figure
3-7.

Figure 3-7: Application flow across a WAN


3.2 3.7 Procedure
The following set of procedures were done to generate this sample.
Step 1: A network scenario is designed in the NetSim GUI comprising of 3 Wired Nodes,
2 L2 Switches, and 1 Router.

Step 2: Right click on the Application Flow App1 CBR and select Properties or click on
the Application icon present in the top ribbon/toolbar.

A CBR Application is generated from Wired Node 1 i.e. Source to Wired Node 3 i.e.
Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining
20000gs.

Transport Protocol is set to UDP instead of TCP. If set to TCP, the ARP table will get
updated due to the transmission of TCP control packets thereby eliminating the need for
ARP to resolve addresses.

Step 3: Packet Trace is enabled in the NetSim GUI, and hence we can view the ARP
Request and ARP Reply packets exchanged initially, before transmission of the data
packets.

Step 4: Enable the plots and click on Run simulation. The simulation time is set to 10
seconds. In the
“Static ARP Configuration” tab, Static ARP is set to disable.

3.2.1 3.8 Output — II

Once the simulation is complete, to view the packet trace file, click on “Open Packet
Trace” option present in the left-hand-side of the Results Dashboard.

Figure 3-8: Open Packet Trace


NODE 1 will send ARP_REQUEST to SWITCH-4, SWITCH-4 sends this to
ROUTER-6, and SWITCH-4 also sends this to NODE-2. ARP-REPLY is sent by the
ROUTER-6 to SWITCH -4, and in-turn SWITCH-4 sends it to NODE-1. Again
ROUTER-6 will send ARP„REQUEST to SWITCH-5, SWITCH-5 sends this to
NODE-3. ARP_REPLY is sent by NODE-3 to SWITCH-5 and in-turn SWITCH-5
sends it to ROUTER-6.

The IP forwarding table formed in the router can be accessed from the
IP_Forwarding_TabIe list present in the Simulation Results window as shown below:
Figure 3-9: IP Forwarding Table
Click on Detailed View checkbox to view the additional fields as indicated above.

Router forwards packets intended to the subnet 11.2.0.0 to the interface with the IP
11.2.1.1 based on the first entry in its routing table.

3.2.2 3.9 Inference II

3.2.2.1 Across-Router-IP-forwarding

ARP PROTOCOL- WORKING

Figure 3-10: Across Router IP Forwarding


NODE-1 transmits ARP_Request which is further broadcasted by SWITCH-4.
ROUTER-6 sends ARP_RepIy to NODE-1 which goes through SWITCH-4. Then
NODE-1 starts sending datagrams toNODE-3. If router has the MAC address of NODE-
3 in its ARP table, then ARP ends here and router starts forwarding the datagrams to
NODE-3 by consulting its forwarding table. In the other case, Router sends
ARP_Request to appropriate subnet and after getting the MAC address of NODE-3, it
then forwards the datagrams to NODE-3 using its forwarding table.

4. 4 Simulate and study the protocol

4.1 Introduction
5. Spanning tree
Spanning Tree Protocol (STP) is a link management protocol. Using the spanning tree algorithm, STP provides
path redundancy while preventing undesirable loops in a network that are created by multiple active paths
between stations. Loops occur when there are alternate routes between hosts. To establish path redundancy,
STP creates a tree that spans all of the switches in an extended network, forcing redundant paths into a standby,
or blocked state. STP allows only one active path at a time between any two network devices (this prevents the
loops) but establishes the redundant links as a backup if the initial link should fail. Without spanning tree in
place, it is possible that both connections may simultaneously live, which could result in an endless loop of
traffic on the LAN.

(Reference: A good reference for this topic is Section 3.1.4: Bridges and LAN switches, of the book, Computer Networks, 5th Edition by
Peterson and Davie)

5.1.1 4.2 Network Setup

Open NetSim and click Examples > Experiments > Simulate-and-study-the-spanning-tree- protocol >
Sample-1 as shown below Figure 4-1.

Figure 4-1: Experiments List


NetSim UI displays the configuration file corresponding to this experiment as shown below Figure 4-2.
Figure 4-2: A network with a loop
Note: At least three L2 Switches are required in the network to analyze the spanning tree formation.

5.2 4.3 Procedure

Step 1: A network scenario is designed in the NetSim GUI comprising of 3 Wired Nodes
and 3
L2 Switches in the "lnternetworks" Network Library.

Step 2: Go to L2 Switch 1 Properties. In the Interface 1 (ETHERNET) > Datalink


Layer, "Switch Priority" is set to 2. Similarly, for the other interfaces of L2 Switch 1,
Switch Priority is set to 2.

Step 3: Go to L2 Switch 2 Properties. In the Interface 1 (ETHERNET) > Datalink


Layer, "Switch Priority" is set to 1. Similarly, for the other interfaces of L2 Switch 2,
Switch Priority is set to 1.

Step 4: Go to L2 Switch 3 Properties. In the Interface 1 (ETHERNET) > Datalink


Layer, "Switch Priority" is set to 3. Similarly, for the other interfaces of L2 Switch 3,
Switch Priority is set to 3.

L2_Switch Properties L2_Switch 1 L2_Switch 2 L2_Switch 3

Switch Priority r2
Table 4-1: Switch Priorities for Sample 1
NOTE: Switch Priority is set to all the 3 L2 Switches and Switch Priority has to be changed for all the interfaces of L2 Switch.

Switch Priority is interpreted as the weights associated with each interface of a L2


Switch. A higher value indicates a higher priority.

Step 5: Right click on the Application Flow "App1 CUSTOM" and select Properties
or click on the Application icon present in the top ribbon/toolbar.
A CUSTOM Application is generated from Wired Node 4 i.e. Source to Wired Node 5 i.e. Destination with
Packet Size remaining 1460Bytes and Inter Arrival Time remaining 20000µs. Additionally, the "Start Time"
parameter is set to 1 second while configuring the application see Figure 4-3.

Figure 4-3: Application Configuring Window


Note: Wired Node 6 is not generating traffic to any other nodes.

Here, Wired Node 4 is sending data to Wired Node 5 and the node properties are set to default.

Step 6: Enable the plots and click on Run simulation. The simulation time is set to 10 seconds.

> Sample-2:

The following changes in settings are done from the previous sample:

In Sample 2, the "Switch Priority" of all the 3 L2 Switches are changed as follows Table 4-2:

L2_Switch Properties L2_Switch 1 L2_Switch 2 L2_Switch 3

Switch Priority r1 r2

Table 4-2: Switch Priorities for Sample 2

5.2.1 4.4 Output

In the NetSim Design Window, click on Display Settings > Spanning Tree check box see Figure
4-4.
5.2.1.1 Sample 1:

Figure 4-4: NetSim Design Window - Display Setting for Sample 1

Go to NetSim Packet Animation Window and click on Play button. We can notice that, after the
exchange of control packets, the data packets take the following path. Wired Node 4 > L2 Switch 1
> L2 Switch 2 > L2 Switch 3 > Wired Node 5.

5.2.1.2 Sample 2:

Figure 4-5: NetSim Design Window - Display Setting for Sample 2

Go to NetSim Packet Animation window and click on Play button. We can notice that, after the
exchange of control packets, the data packets take the following path. Wired Node 4 > L2 Switch 1
> L2 Switch 3 > Wired Node 5.
Go to Simulation Results window, In the left-hand-side of the Results Dashboard, click
on the arrow pointer of Switch MAC address table to obtain the Switch MAC address table
list of all the L2 Switches.

For each L2 Switch, a Switch MAC Address Table containing the MAC address entries
see Figure 4-6, the port that is used for reaching it, along with the type of entry can be
obtained at the end of Simulation.

Figure 4-6: MAC Address Table

5.3 4.5 Inference


Each L2 Switch has an ID which is a combination of its Lowest MAC address and
priority. The Spanning tree algorithm selects the L2 Switch with the smallest ID as
the root node of the Spanning Tree. The root node forward frames out over all its ports.
In the other L2 Switches, the ports that have the least cost of reaching the root switch
are set as Forward Ports and the remaining are set as Blocked Ports. In the Sample 1,
L2_Switch 2 was assigned least priority and was selected as a Root Switch. The green
line indicates the forward path and the red line indicates the blocked path. The frame
from Wired Node 4 should take the path through the L2_Switch 1, 2 and 3 to reach
the Wired Node 5. In the Sample 2, L2_Switch 1 was assigned least priority and
selected as a Root switch. In this case, the frame from Wired Node 4 takes the path
through the L2_Switch 1 and 3 to reach the destination Wired Node 5.

5 Study the working and routing table formation of Interior routing

protocols, i.e. Routing Information Protocol (RIP) and Open Shortest


Path First (OSPF)

6. 5.1 Introduction

6.1 5.1.1 RIP

RIP is intended to allow hosts and gateways to exchange information for computing
routes through an IP-based network. RIP is a distance vector protocol which is based
on Bellman-Ford algorithm. This algorithm has been used for routing computation in
the network.

Distance vector algorithms are based on the exchange of only a small amount of
information using RIP messages.

Each entity (router or host) that participates in the routing protocol is assumed to keep
information about all of the destinations within the system. Generally, information about
all entities connected to one network is summarized by a single entry, which describes
the route to all destinations on that network. This summarization is possible because as
far as IP is concerned, routing within a network is invisible. Each entry in this routing
database includes the next router to which datagram’s destined for the entity should be
sent. In addition, it includes a "metric" measuring the total distance to the entity.

Distance is a somewhat generalized concept, which may cover the time delay in getting
messages to the entity, the dollar cost of sending messages to it, etc. Distance vector
algorithms get their name from the fact that it is possible to compute optimal routes
when the only information exchanged is the list of these distances. Furthermore,
information is only exchanged among entities that are adjacent, that is, entities that
share a common network.

6.2 5.1.2 OSPF

In OSPF, the Packets are transmitted through the shortest path between the source and
destination.

OSPF allows administrator to assign a cost for passing through a link. The total cost of
a particular route is equal to the sum of the costs of all links that comprise the route. A
router chooses the route with the shortest (smallest) cost.
In OSPF, each router has a link state database which is tabular representation of the
topology of the network (including cost). Using Dijkstra algorithm each router finds the
shortest path between source and destination.

6.3 5.1.3 Formation of OSPF Routing Table

1. OSPF-speaking routers send Hello packets out all OSPF-enabled interfaces. If two routers sharing a
common data link agree on certain parameters specified in their respective Hello packets, they will
become neighbors.
2. Adjacencies, which can be thought of as virtual point-to-point links, are formed between some
neighbors. OSPF defines several network types and several router types. The establishment of an
adjacency is determined by the types of routers exchanging Hellos and the type of network over
which the Hellos are exchanged.
3. Each router sends link-state advertisements (LSAs) over all adjacencies. The LSAs describe all of the
router's links, or interfaces, the router's neighbors, and the state of the links. These links might be to
stub networks (networks with no other router attached), to other OSPF routers, or to external
networks (networks learned from another routing process). Because of the varying types of link-state
information, OSPF defines multiple LSA types.
4. Each router receiving an LSA from a neighbor records the LSA in its link-state database and sends a
copy of the LSA to all of its other neighbors.
5. By flooding LSAs throughout an area, all routers will build identical link-state databases.
6. When the databases are complete, each router uses the SPF algorithm to calculate a loop- free graph
describing the shortest (lowest cost) path to every known destination, with itself as the root. This
graph is the SPF tree.
7. Each router builds its route table from its SPF tree

7. 5.2 Network Setup

Open NetSim and click Examples > Experiments > Route-table-formation-in-RIP-and-OSPF >
Sample-1 as shown below Figure 5-1.
Figure 5-1: Experiments List

NetSim UI displays the configuration file corresponding to this experiment as shown


below Figure 5-2.

Figure 5-2: Network topology for RIP/OSPF experiments

8. 5.3 Procedure

S ample 1:

The following are the set of procedures were done to generate this sample.

Step 1: A network scenario is designed in the NetSim GUI comprising of 2 Wired Nodes,
2 L2 Switches, and 7 Routers.

Step 2: Go to Router 1 Properties. In the Application Layer, Routing Protocol is set as


RIP Figure 5-3.
Figure 5-3: Application Layer Window - Routing Protocol is set as RIP

The Router Configuration Window shown above, indicates the Routing Protocol set as
RIP along with its associated parameters. The “Routing Protocol” parameter is Global.
i.e. changing in Router 1 will affect all the other Routers. So, in all the Routers, the
Routing Protocol is now set as RIP.

Step 3: Right click on App1 CUSTOM and select Properties or click on the Application
icon present in the top ribbon/toolbar. Transport Protocol is set to UDP.

A CUSTOM Application is generated from Wired Node 10 i.e. Source to Wired Node
11 i.e. Destination with Packet Size remaining 1460Bytes and Inter Arrival Time
remaining 20000µs.

Step 4: Packet Trace is enabled, and hence we are able to track the route which the
packets have chosen to reach the destination based on the Routing Information Protocol
that is set.

Step 5: Enable the plots and run the Simulation for 100 Seconds.
S ample 2:

The following are the set of procedures that are followed to carry out this experiment.
Step 1: A network scenario is designed in the NetSim GUI comprising of 2 Wired Nodes,
2 L2 Switches, and 7 Routers.

Step 2: Go to Router 1 Properties. In the Application Layer, Routing Protocol is set as


OSPF Figure 5-4.
Figure 5-4: Application Layer Window - Routing Protocol is set as OSPF

The Router Configuration Window shown above, indicates the Routing Protocol set as
OSPF along with its associated parameters. The “Routing Protocol” parameter is
Global. i.e. changing in Router 1 will affect all the other Routers. So, in all the Routers,
the Routing Protocol is now set as OSPF.

Step 3: Right click on App1 CUSTOM and select Properties or click on the Application
icon present in the top ribbon/toolbar. Transport Protocol is set to UDP.

Step 4: Go to Router 7 Properties. In both the WAN Interfaces, the Output Cost is set to
2000 Figure 5-5.
Figure 5-5: WAN Interfaces - Output Cost is set to 2000
The “Output Cost” parameter in the WAN Interface > Application Layer of a router indicates the
cost of sending a data packet on that interface and is expressed in the link state metric.

Step 5: Right click on App1 CUSTOM and select Properties or click on the Application
icon present in the top ribbon/toolbar.

A CUSTOM Application is generated from Wired Node 10 i.e. Source to Wired Node
11 i.e. Destination with Packet Size remaining 1460Bytes and Inter Arrival Time
remaining 20000µs.

Additionally, the “Start Time (s)” parameter is set to 40, while configuring the
application. This time is usually set to be greater than the time taken for OSPF
Convergence (i.e. Exchange of OSPF information between all the routers), and it
increases as the size of the network increases.

Step 6: Packet Trace is enabled, and hence we are able to track the route which the
packets have chosen to reach the destination based on the Open Shortest Path First
Routing Protocol that is set.

Step 7: Enable the plots and run the Simulation for 100 Seconds.
9. 5.4 Output I

Go to NetSim Packet Animation window and play the animation. The route taken by the
packets to reach the destination can be seen in the animation as well as in the below
table containing various fields of packet information as shown below Figure 5-6.
Figure 5-6: Animation window for RIP

Users can view the same in Packet Trace.


Shortest Path from Wired Node 10 to Wired Node 11 in RIP is Wired Node 10->L2 Switch 8-
>Router 1->Router 7->Router 6->L2 Switch 9->Wired Node 11. RIP chooses the lower path
(number of hops is less) to forward packets from source to destination, since it is based on hop count.

10. 5.5 Output II

Go to NetSim Packet Animation window and play the animation. The route taken by
the packets to reach the destination can be seen in the animation as well as in the below
table containing various fields of packet information as shown below Figure 5-7.
Figure 5-7: Animation window for OSPF

Users can view the same in Packet Trace.


Shortest Path from Wired Node 10 to Wired Node 11 in OSPF (Use Packet Animation to view) Wired
Node 10->L2 Switch 8->Router 1->Router 2->Router 3->Router 4->Router 5->Router 6->L2
Switch 9->Wired Node 11. OSPF chooses the above path (cost is less-5) since OSPF is based on
cost.

11. 5.6 Inference

11.1 5.2.1 RIP

In Distance vector routing, each router periodically shares its knowledge about the entire
network with its neighbors. The three keys for understanding the algorithm,
1. Knowledge About The Whole Network - Router sends all of its collected knowledge about the network
to its neighbors.
2. Routing Only To Neighbors - Each router periodically sends its knowledge about the network only to
those routers to which it has direct links. It sends whatever knowledge it has about the whole network
through all of its ports. This information is received and kept by each neighboring router and used to
update it’s own information about the network.
3. Information Sharing At Regular Intervals - For example, every 30 seconds, each router sends its
information about the whole network to its neighbors. This sharing occurs whether or not the network
has changed since the last time, information was exchanged

In NetSim the Routing Table Formation has 3 stages,


1. Initial Table: The Initial Table will show the direct connections made by each Router.
2. Intermediate Table: The Intermediate Table will have the updates of the Network in every 30 seconds
3. Final Table: The Final Table is formed when there is no update in the Network.

The data should be forwarded using Routing Table with the shortest distance.

11.2 5.2.2 OSPF

The main operation of the OSPF protocol occurs in the following consecutive stages,
and leads to the convergence of the internetworks:
1. Compiling the LSDB.
2. Calculating the Shortest Path First (SPF) Tree.
3. Creating the routing table entries.

11.3 Compiling the LSDB

The LSDB is a database of all OSPF router LSAs. The LSDB is compiled by an ongoing
exchange of LSAs between neighboring routers so that each router is synchronized with
its neighbor. When the Network converged, all routers have the appropriate entries in
their LSDB.

11.4 Calculating the SPF Tree Using Dijkstra's Algorithm

Once the LSDB is compiled, each OSPF router performs a least cost path calculation
called the Dijkstra algorithm on the information in the LSDB and creates a tree of
shortest paths to each other router and network with themselves as the root. This tree is
known as the SPF Tree and contains a single, least cost path to each router and in the
Network. The least cost path calculation is performed by each router with itself as the
root of the tree

11.5 Calculating the Routing Table Entries from the SPF Tree
The OSPF routing table entries are created from the SPF tree and a single entry for each
network in the AS is produced. The metric for the routing table entry is the OSPF-
calculated cost, not a hop count.

If the application start time isn't changed then,


1. Packets generated before OSPF table convergence may be dropped at the gateway router.
2. The application may also stop if ICMP is enabled in the router
3. If TCP is enabled TCP may stop after the re-try limit is reached (since the SYN packets would not
reach the destination)

NOTE: The device / link numbering and IP Address setting in NetSim is based on order in which in the devices are dragged &
dropped, and the order in which links are connected. Hence if the order in which a user executes these tasks is different from what
is shown in the screen shots, users would notice different tables from what is shown in the screen shots.

6 Understanding Public IP Address & NAT

(Network Address Translation)

12. 6.1 Theory

12.1 6.1.1 Public Address

A public IP address is assigned to every computer that connects to the Internet where
each IP is unique. Hence there cannot exist two computers with the same public IP
address all over the Internet. This addressing scheme makes it possible for the
computers to “find each other” online and exchange information. User has no control
over the IP address (public) that is assigned to the computer. The public IP address is
assigned to the computer by the Internet Service Provider as soon as the computer is
connected to the Internet gateway.

12.2 6.1.2 Private Address

An IP address is considered private if the IP number falls within one of the IP address
ranges reserved for private networks such as a Local Area Network (LAN). The Internet
Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP
address space for private networks (local networks):

Class Starting IP address Ending IP address No. of hosts

A 10.0.0.0 10.255.255.255 16,777,216


B 172.16.0.0 172.31.255.255 1,048,576
C 192.168.0.0 192.168.255.255 65,536
Table 6-2: Private IP address table

Private IP addresses are used for numbering the computers in a private network
including home, school and business LANs in airports and hotels which makes it
possible for the computers in the network to communicate with each other. For example,
if a network A consists of 30 computers each of them can be given an IP starting from
192.168.0.1 to 192.168.0.30.

Devices with private IP addresses cannot connect directly to the Internet. Likewise,
computers outside the local network cannot connect directly to a device with a private
IP. It is possible to interconnect two private networks with the help of a router or a
similar device that supports Network Address Translation.

If the private network is connected to the Internet (through an Internet connection via
ISP) then each computer will have a private IP as well as a public IP. Private IP is used
for communication within the network whereas the public IP is used for
communication over the Internet.
12.3 6.1.3 Network address translation (NAT)

A NAT (Network Address Translation or Network Address Translator) is the


virtualization of Internet Protocol (IP) addresses. NAT helps to improve security and
decrease the number of IP addresses an organization needs.

A device that is configured with NAT will have at least one interface to the inside
network and one to the outside network. In a typical environment, NAT is configured
at the exit device between a stub domain (inside network) and the backbone. When a
packet leaves the domain, NAT translates the locally significant source address into a
globally unique address. When a packet enters the domain, NAT translates the globally
unique destination address into a local address. If more than one exit point exists, each
NAT must have the same translation table. NAT can be configured to advertise to the
outside world only one address for the entire network. This ability provides additional

security by effectively hiding the entire internal network behind that one address. If
NAT cannot allocate an address because it has run out of addresses, it drops the packet
and sends an Internet Control Message Protocol (ICMP) host unreachable packet to the
destination.

Figure 6-3: NAT implementation

NAT is secure since it hides network from the Internet. All communications from
internal private network are handled by the NAT device, which will ensure all the
appropriate translations are performed and provide a flawless connection between
internal devices and the Internet.

In the above figure, a simple network of 4 hosts and one router that connects this
network to the Internet. All hosts in the network have a private Class C IP Address,
including the router's private interface (192.168.0.1), while the public interface that's
connected to the Internet has a real IP Address (203.31.220.134). This is the IP address
the Internet sees as all internal IP addresses are hidden.
13. 6.1 Network Setup

Open NetSim and click Examples > Experiments > Understanding-Public-IP-Address-and-NAT-


(Network-Address-Translation) > Sample-1 as shown below Figure 6-2.

Figure 6-2: Experiments List

NetSim UI displays the configuration file corresponding to this experiment as shown


below Figure 6-3.

Figure 6-3: Application flow between different LAN

14. 6.2 Procedure

The following set of procedures were done to generate this sample:


Step 1: A network scenario is designed in NetSim GUI comprising of 6 Wired Nodes,
2 L2 Switches, and 4 Routers in the “Internetworks” Network Library.

Step 2: In the INTERFACE (ETHERNET) > NETWORK LAYER of the Wired Nodes,
the IP Address and the Subnet Mask are set as per the table given below Table 6-2.

Wired Node IP address Subnet mask

7 10.0.0.2 255.0.0.0
8 10.0.0.3 255.0.0.0
9 10.0.0.4 255.0.0.0
10 172.16.0.2 255.255.0.0
11 172.16.0.3 255.255.0.0
12 172.16.0.4 255.255.0.0

Table 6-2: IP Address and the Subnet mask for Wired nodes

Step 3: The IP Address and the Subnet Mask in Routers are set as per the table given
below Table 6-3.

Router Interface IP address Subnet mask

Interface_2(WAN) 11.1.1.1 255.0.0.0


Router 1
Interface_1(Ethernet) 10.0.0.1 255.0.0.0
Interface_1(WAN) 11.1.1.2 255.0.0.0
Router 2
Interface_2(WAN) 12.1.1.1 255.0.0.0
Router 3 Interface_1(WAN) 12.1.1.2 255.0.0.0
Interface_2(WAN) 13.1.1.2 255.0.0.0
Router 4 Interface_1(WAN) 13.1.1.1 255.0.0.0
Interface_2(Ethernet) 172.16.0.1 255.255.0.0

Table 6-3: IP Address and the Subnet Mask for Routers

Step 4: Right click on the Application Flow App1 CBR and select Properties or click
on the Application icon present in the top ribbon/toolbar.

A CBR Application is generated from Wired Node 7 i.e. Source to Wired Node 10 i.e.
Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining
20000µs.

Additionally, the “Start Time(s)” parameter is set to 50(Figure 6-4), while configuring the
application. This time is usually set to be greater than the time taken for OSPF
Convergence (i.e. Exchange of OSPF information between all the routers), and it
increases as the size of the network increases.
Figure 6-4: Application Properties Window

Step 5: Packet Trace is enabled, and hence we are able to track the route which the
packets have chosen to reach the destination.

Step 6: Enable the plots and run the Simulation for 100 Seconds.

15. 6.3 Output

After simulation open Packet Trace and filter Packet ID to 1.

Figure 6-5: Packet Trace


SOURCE_IP – source node IP (Node)

DESTINATION_IP – gateway IP/ destination IP (Router/ Node)

GATEWAY_IP – IP of the device which is transmitting a packet (Router/ Node)


NEXT_HOP_IP – IP of the next hop (Router/ Node)
Source node 7 (10.0.0.2) wouldn’t know how to route to the destination and hence its
default gateway is Router 1 with interface IP (10.0.0.1). So, the first line in the above
screenshot specifies packet flow from Source Node 7 to L2 Switch 6 with SOURCE_IP
(10.0.0.2), DESTINATION_IP (10.0.0.1), GATEWAY_IP (10.0.0.2) and
NEXT_HOP_IP (10.0.0.1). Since Switch is Layer2 device there is no change in the IPs
in second line. Third line specifies the packet flow from Router 1 to Router 2 with
SOURCE_IP (10.0.0.2), DESTINATION_IP (13.1.1.1- IP of the router connected to
destination. Since OSPF is running, the router is looks up the route to its destination
from routing table), GATEWAY_IP (11.1.1.1) and NEXT_HOP_IP (11.1.1.2) and so
on.

7 Understand the working of basic networking commands (Ping,

Route Add/Delete/Print, ACL)

16. 7.1 Theory

NetSim allows users to interact with the simulation at runtime via a socket or through
a file. User Interactions make simulation more realistic by allowing command
execution to view/modify certain device parameters during runtime.
16.1.1 Ping Command

The ping command is one of the most often used networking utilities for
troubleshooting network problems
You can use the ping command to test the availability of a networking device
(usually a computer) on a network
When you ping a device, you send that device a short message, which it then
sends back (the echo)
If you receive a reply then the device is in the Network, if you don’t, then the
device is faulty, disconnected, switched off, or incorrectly configured.
16.1.2 Route Commands

You can use the route commands to view, add and delete routes in IP routing tables
route print: In order to view the entire contents of the IP routing table
route delete: In order to delete all routes in the IP routing table
route add: In order to add a static TCP/IP route to the IP routing table
16.1.3 ACL Configuration

Routers provide basic traffic filtering capabilities, such as blocking the Internet traffic
with access control lists (ACLs). An ACL is a sequential list of Permit or Deny
statements that apply to addresses or upper-layer protocols. These lists tell the router
what types of packets to: PERMIT or DENY. When using an access-list to filter
traffic, a PERMIT statement is used to “allow” traffic, while a DENY statement is
used to “block” traffic.
17. 7.2 Network setup

Open NetSim and click Examples > Experiments > Basic-networking-commands-Ping-Route-


Add/Delete/Print-and-ACL > Sample-1 as shown below Figure 7-1.

Figure 7-1: Experiments List

NetSim UI displays the configuration file corresponding to this experiment as shown


below Figure 7-2.

Figure 7-2: Network topology in the sample scenario

18. 7.3 Procedure

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Wired Nodes


and 3 Routers in the “Internetworks” Network Library.
Step 2: In the Network Layer properties of Wired Node 1, “ICMP Status” is

set as TRUE. Similarly, ICMP Status is set as TRUE for all the devices as

shown Figure 26-3.

Figure 7-3: Network Layer properties of Wired Node 1


Step 3: In the General properties of Wired Node 1, Wireshark Capture is set as Online.

Step 4: Right click on the Application Flow App1 CBR and select Properties or click
on the Application icon present in the top ribbon/toolbar.

A CBR Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining
20000µs. Transport Protocol is set to UDP.

Additionally, the “Start Time(s)” parameter is set to 30, while configuring the
application. This time is usually set to be greater than the time taken for OSPF
Convergence (i.e. Exchange of OSPF information between all the routers), and it
increases as the size of the network increases.

Step 5: Packet Trace is enabled in NetSim GUI. At the end of the simulation, a very
large .csv file is containing all the packet information is available for the users to
perform packet level analysis. Plots are enabled in NetSim GUI.
Step 6: Click on Run Simulation. Simulation Time is set to 300 Seconds and in the Runtime
Interaction tab Figure 7-4, Interactive Simulation is set to True.
Figure 7-4: Runtime Interaction window
NOTE: It is recommended to specify a longer simulation time to ensure that there is sufficient time for the user to execute the
various commands and see the effect of that before the Simulation ends.

Click on Accept and then click on OK.

Simulation (NetSimCore.exe) will start running and will display a message “waiting for first
client to connect” as shown below Figure 7-5.

Figure 7-5: Waiting for first client to connect


Go back to the network scenario. Click on “Display Settings” in the top ribbon/toolbar and
select the “Device IP” checkbox inorder to display the IP address of all the devices. Now,
Right click on Router 3 or any other Router and select “NetSim Console” option as shown
Figure 7-6.

Figure 7-6: Select NetSim Console

Now Client (NetSimCLI.exe) will start running and it will try to establish a
connection with NetSimCore.exe. After the connection is established, the
following will be displayed Figure 7-7.
Figure 7-7: Connection established

After this the command line interface can be used to execute all the supported
commands.

19. 7.4 Network Commands

19.1.1 Ping Command

You can use the ping command with an IP address or


Device name ICMP_Status should be set as True in all
nodes for ping to work

Ping <IP address> e.g. ping 11.4.1.2

Ping <Node Name> e.g. ping Wired_Node_2

Figure 7-8: Pinging Wired_Node_2


19.1.2 Route
Commands

In order to view the entire contents of the IP routing table, use following command
route print
route print
Figure 7-9: IP routing table

You’ll see the routing table entries with network destinations and the gateways
to which packets are forwarded, when they are headed to that destination. Unless
you’ve already added static routes to the table, everything you see here is
dynamically generated
In order to delete a route in the IP routing table you’ll type a command using the
following syntax

route delete destination_network

So, to delete the route with destination network 11.5.1.2, all we’d have to do is
type this command

route delete 11.5.1.2

To check whether route has been deleted or not check again using route print
command To add a static route to the table, you’ll type a command using the

route ADD destination_network MASK subnet_mask gateway_ip metric_cost interface

following syntax

So, for example, if you wanted to add a route specifying that all traffic bound for
the 11.5.1.2 subnet went to a gateway at 11.5.1.1

route ADD 11.5.1.2 MASK 255.255.0.0 11.5.1.1 METRIC 100 IF 2


If you were to use the route print command to look at the table now, you’d see your
new static route.
Figure 7-10: Route delete/ Route add
NOTE: Entry added in IP table by routing protocol continuously gets updated. If a user tries to remove a route via route delete
command, there is always a chance that routing protocol will re-enter this entry again. Users can use ACL / Static route to override
the routing protocol entry if required.

19.1.3 ACL Configuration

Commands to configure ACL

To view ACL syntax: acl print


Before using ACL, we must first verify whether ACL option enabled. A common
way to enable ACL is to use command: ACL Enable
Enter configuration mode of ACL: aclconfig
To view ACL Table: Print
To exit from ACL configuration: exit
To disable ACL: ACL Disable (use this command after exit from ACL Configuration)

To view ACL usage syntax use: acl print

[PERMIT, DENY] [INBOUND, OUTBOUND, BOTH] PROTO SRC DEST SPORT DPORT IFID

Step to Configure ACL

To create a new rule in the ACL use command as shown below to block UDP
packet in Interface 2 and Interface 3 of Router 3.
Application properties Transport Protocol UDP as shown Figure 7-11
Figure 7-11: Application properties window
Use the command as follows Figure 7-12.

NetSim>acl enable
ACL is enable
NetSim>aclconfig
ROUTER_3/ACLCONFIG>acl print
Usage: [PERMIT, DENY] [INBOUND, OUTBOUND, BOTH] PROTO SRC DEST SPORT
DPORT IFID
ROUTER_3/ACLCONFIG>DENY BOTH UDP ANY ANY 0 0 2
OK!
ROUTER_3/ACLCONFIG>DENY BOTH UDP ANY ANY 0 0 3
OK!
ROUTER_3/ACLCONFIG>prin
t
DENY BOTH UDP ANY/0 ANY/0 0 0 2
DENY BOTH UDP ANY/0 ANY/0 0 0 3
ROUTER_3/ACLCONFIG>exit
NetSim>acl disable
ACL is disable
NetSim>

Figure 7-12: ACL Configuration command

19.2 Ping Command


Results

Go to the Results Dashboard and click on “Open Packet Trace” option present in the
Left-Hand- Side of the window and do the following:

Filter Control Packet Type/App Name to ICMP EchoRequest and ICMP EchoReply as shown
Figure 7-13.

Figure 7-13: Packet Trace - ICMP Control Packets


In Wireshark, apply filter as ICMP. we can see the ping request and reply packets in
Wireshark as shown Figure 7-14.
Figure 7-14: ICMP Control packets in Wireshark

19.3 ACL
Results

The impact of ACL rule applied over the simulation traffic can be observed in the IP
Metrics Table in the simulation results window. In Router 3, the number of packets

blocked by firewall has been shown below Figure 7-15.

Figure 7-15: IP Metrics Table in result window


NOTE: Number of packets blocked may vary based on the time at which ACL is configured.

Users can also observe this in Packet Animation before and after the Packets are blocked
as shown below Figure 7-16/Figure 7-17.
Figure 7-16: In Animation Window before applying ACL rules see the packet flow

Figure 7-17: In Animation Window after applying ACL rules see the packet flow

Check Packet animation window whether packets has been blocked in Router_3
or not after entering ACL command to deny UDP traffic
Before applying ACL rule there is packet flow from Wired_Node_1 to
Wired_Node_2 After applying ACL rule Packet flows up to Router_3 only
8 Introduction to TCP connection

management

8.1 Introduction
When an application process in a client host seeks a reliable data connection with a
process in another host (say, server), the client-side TCP then proceeds to establish a
TCP connection with the TCP at the server side. A TCP connection is a point-to-point,
full-duplex logical connection with resources allocated only in the end hosts. The TCP
connection between the client and the server is established in the following manner and
is illustrated in Figure 8-1.
1. The TCP at the client side first sends a special TCP segment, called the SYN packet, to the TCP at the
server side.
2. Upon receiving the SYN packet, the server allocates TCP buffer and variables to the connection. Also,
the server sends a connection-granted segment, called the SYN-ACK packet, to the TCP at the client
side.
3. Upon receiving the SYN-ACK segment, the client also allocates buffers and variables to the
connection. The client then acknowledges the server's connection granted segment with an ACK of
its own.

This connection establishment procedure is often referred to as the three-way


handshake. The special TCP segments can be identified by the values in the fields SYN,
ACK and FIN in the TCP header (see Figure 8-2). We also note that the TCP
connection is uniquely identified by the source and destination port numbers (see
Figure 8-2) exchanged during TCP connection establishment and the source and
destination IP addresses.

Once a TCP connection is established, the application processes can send data to each
other. The TCP connection can be terminated by either of the two processes. Suppose
that the client application process seeks to terminate the connection. Then, the
following handshake ensures that the TCP connection is torn down.
1. The TCP at the client side sends a special TCP segment, called the FIN packet, to the TCP at the server
side.
2. When the server receives the FIN segment, it sends the client an acknowledgement segment in return
and its own FIN segment to terminate the full-duplex connection.
3. Finally, the client acknowledges the FIN-ACK segment (from the server) with an ACK of its own. At
this point, all the resources (i.e., buffers and variables) in the two hosts are deallocated.
During the life of a TCP connection, the TCP protocol running in each host makes transitions through various
TCP states. Figure 8-1 illustrates the typical TCP states visited by the client and the server during connection
establishment and data communication.

TCP is defined in RFCs 893, 1122, 8323 and, 2018. A recommended text book reference for TCP is Chapter 3:
Transport layer, of Computer Networking: A top-down approach, by James Kurose and Keith Ross (Pearson).

Figure 8-1: TCP connection establishment between a client and a server

Figure 8-2: TCP Header


20. 8.2 Network Setup

Open NetSim and click Examples > Experiments > Introduction-to-TCP-connection-


management » Sample-1 as shown below Figure 8-3.

Figure 8-3: Experiments List


NetSim UI displays the configuration file corresponding to this experiment as shown below Figure
8-4

Figure 8-4: An FTP application between a client and a server connected in a network

21. 8.3 Procedure

The following set of procedures were done to generate this sample.

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Wired Nodes and 2 Routers in the
“Internetworks” Network Library.
Step 2: In the General Properties of Wired Node 1 i.e. Source, Wireshark Capture is
set to Online. Transport Layer properties Congestion plot is set to true.
Note: Accept default properties for Routers as well as the Links.

Step 3: Right-click the link ID (of a wired link) and select Properties to access the link's
properties. Set Max Uplink Speed and Max Downlink Speed to 10 Mbps. Set Uplink
BER and Downlink BER to
0. Set Uplink Propagation Delay and Downlink Propagation Delay as 100 microseconds for the links
1 and 3 (between the Wired Node's and the routers). Set Uplink Propagation Delay and Downlink
Propagation Delay as 50000 microseconds for the backbone link connecting the routers, i.e., 2.

Step 4: Right click on the Application Flow App1 FTP and select Properties or
click on the Application icon present in the top ribbon/toolbar.

An FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size set to 14600 Bytes and File Inter Arrival Time set to 10
Seconds.

Step 5: Click on Display Settings > Device IP check box in the NetSim GUI to view
the network topology along with the IP address.

Step 6: Enable the plots and click on Run simulation. The simulation time is set to 10
seconds.

8.4 Output

We have enabled Wireshark capture in Wired Node 1. The PCAP file is generated at the
end of the simulation and is shown in Figure 8-5.
Figure 8-5: Wireshark Packet capture at Wired_Node_1
4. The 3-way handshake of TCP connection establishment and TCP connection termination is observed
in the packet capture (Figure 8-5).
5. Data is transferred only after the TCP connection is established.
6. We can access the packet header details of the TCP segments (SYN, SYN-ACK, FIN, FINACK) in
Wireshark.

9 Reliable data transfer with TCP

22. 9.1 Introduction

TCP provides reliable data transfer service to the application processes even when the
underlying network service (IP service) is unreliable (loses, corrupts, garbles or
duplicates packets). TCP uses checksum, sequence numbers, acknowledgements, timers
and retransmission to ensure correct and in order delivery of data to the application
processes.

TCP views the data stream from the client application process as an ordered stream of
bytes. TCP will grab chunks of this data (stored temporarily in the TCP send buffer),
add its own header and pass it on to the network layer. A key field of the TCP header is
the sequence number which indicates the position of the first byte of the TCP data
segment in the data stream. The sequence number will allow the TCP receiver to identify
segment losses, duplicate packets and to ensure correct delivery of the data stream to
the server application process.

When a server receives a TCP segment, it acknowledges the same with an ACK segment
(the segment carrying the acknowledgement has the ACK bit set to 1) and also conveys
the sequence number of the first missing byte in the application data stream, in the
acknowledgement number field of the TCP header. All acknowledgements are
cumulative, hence, all missing and out-of-order TCP segments will result in duplicate
acknowledgements for the corresponding TCP segments.

TCP sender relies on sequence numbering and acknowledgements to ensure reliable


transfer of the data stream. In the event of a timeout (no acknowledgement is received
before the timer expires) or triple duplicate acknowledgements (multiple ACK segments
indicate a lost or missing TCP segment) for a TCP segment, the TCP sender will
retransmit the segment until the TCP segment is acknowledged (at least cumulatively).
In Figure 9-1, we illustrate retransmission by the TCP sender after a timeout for
acknowledgement.
Figure 9-1: An illustration of TCP retransmission with timeout. The segment with sequence number 4391 is lost in the
network. The TCP client retransmits the segment after a timeout event.

23. 9.2 Network Setup

We will seek a simple file transfer with TCP over a lossy link to study reliable data
transfer with TCP. We will simulate the network setup illustrated in Figure 9-3 with the
configuration parameters listed in detail in Table 1 to study reliable data transfer with
TCP connection.

Open NetSim and click Examples > Experiments > Reliable-data-transfer-with-TCP > Sample-1
as shown below Figure 9-2.
Figure 9-2: Experiment List

NetSim UI displays the configuration file corresponding to this experiment as shown


below Figure 9-3.

Figure 9-3: FTP application between a client and a server

24. 9.3 Procedure

The following set of procedures were done to generate this sample.

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Wired Nodes


and 2 Routers in the “Internetworks” Network Library.

Step 2: In the General Properties of Wired Node 1 i.e. Source and Wired Node 2 i.e.
Destination, Wireshark Capture is set to Online. Transport Layer properties Congestion
plot is set to true.
Note: Accept default properties for Routers as well as the Links.

Step 3: Right-click the link ID (of a wired link) and select Properties to access the link’s
properties. Set Max Uplink Speed and Max Downlink Speed to 10 Mbps. Set Uplink
BER and Downlink BER to
0. Set Uplink Propagation Delay and Downlink Propagation Delay as 100 microseconds
for the links 1 and 3 (between the Wired Node’s and the routers). Set Uplink Propagation
Delay and Downlink Propagation Delay as 50000 microseconds and Uplink BER and
Downlink BER to 0.00001 for the backbone link connecting the routers, i.e., 2.

Step 4: Right click on the Application Flow App1 FTP and select Properties or click on
the Application icon present in the top ribbon/toolbar.
An FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size set to 14600 Bytes and File Inter Arrival Time set to 20
Seconds.

Step 5: Click on Display Settings > Device IP check box in the NetSim GUI to view the
network topology along with the IP address.

Step 6: Enable the plots and click on Run simulation. The simulation time is set to 20
seconds.
25. 9.4 Output

We aimed to transfer a file of size 14600 bytes (i.e., 10 packets, each of size 1460 bytes)
with TCP over a lossy link. In Figure 9-4, we report the application metrics data for FTP

which indicates that the complete file was transferred.

Figure 9-4: Application Metrics table for FTP

We have enabled Wireshark Capture in Wired Node 1 and Wired Node 2. The PCAP
files are generated at the end of the simulation and are shown in Figure 9-5 and Figure 9-6.

Figure 9-5: PCAP file at Wired Node 1. TCP ensures reliable data transfer using timeout, duplicate ACKs and
retransmissions
Figure 9-6: PCAP file at Wired Node 2

26. 9.5 Inference


1. From Figure 9-5 and Figure 9-6, we note that the packets with sequence number 2961, 5921, and 9991
are lost in the network.
2. After receiving three duplicate ACKs (in lines 13, 14 of Figure 9-5), TCP retransmits the lost packet
with sequence number 2691 (in line 15 of Figure 9-5). After a timeout (see lines 17, 21, 22 and 23,
lines 25 and 26), TCP retransmits the lost packet with sequence numbers 5921 and 9991.
3. TCP connection is terminated only after the complete file transfer is acknowledged.

10 TCP Congestion Control Algorithms

27. 10.1 Introduction

A key component of TCP is end-to-end congestion control algorithm. The TCP


congestion control algorithm limits the rate at which the sender sends traffic into the
network based on the perceived network congestion. The TCP congestion control
algorithm at the sender maintains a variable called congestion window, commonly
referred as cwnd, that limits the amount of unacknowledged data in the network. The
congestion window is adapted based on the network conditions and this affects the
sender’s transmission rate. The TCP sender reacts to congestion and other network
conditions based on new acknowledgements, duplicate acknowledgements and
timeouts. The TCP congestion control algorithms describe the precise manner in which
TCP adapts cwnd with the different events.

The TCP congestion control algorithm has three major phases (a) slow-start, (b)
congestion avoidance, and (c) fast recovery. In slow-start, TCP is aggressive and
increases cwnd by one MSS with every new acknowledgement. In congestion
avoidance, TCP is cautious and increases the cwnd by one MSS per round-trip time.
Slow-start and congestion avoidance are mandatory components of all TCP congestion
control algorithms. In the event of a packet loss (inferred by timeout or triple duplicate
acknowledgements), the TCP congestion control algorithm reduces the congestion
window to 1 (e.g., Old Tahoe, Tahoe) or by half (e.g., New Reno). In fast recovery,
TCP seeks to recover from intermittent packet losses while maintaining a high
congestion window. The new versions of TCP, including TCP New Reno, incorporate
fast recovery as well. Figure 10-1 presents a simplified view of the TCP New Reno
congestion control algorithm highlighting slow-start, congestion avoidance and fast
recovery phases.

TCP congestion control algorithm is often referred to as additive-increase


multiplicative-decrease (AIMD) form of congestion control. The AIMD congestion
control algorithm often leads to a “saw tooth” evolution of the congestion window
(with linear increase of the congestion window during bandwidth probing and a
multiplicative decrease in the event of packet losses), see Figure 10-6.
Figure 10-1: A simplified view of FSM of the TCP New Reno congestion control algorithm

28. 10.2 Network Setup

We will seek a large file transfer with TCP over a lossy link to study the TCP
congestion control algorithms. We will simulate the network setup illustrated in Figure

10-3 with the configuration parameters listed in detail in steps to study the working of
TCP congestion control algorithms.

Open NetSim and click Examples > Experiments > TCP-congestion-control-algorithms > Old -
Tahoe as shown below Figure 10-2.
Figure 10-2: Experiments list

NetSim UI displays the configuration file corresponding to this experiment as shown


below:
Figure 10-3: Network Topology in this experiment

29. 10.3 Procedure

29.1 Old -Tahoe

The following set of procedures were done to generate this sample.

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Wired Nodes


and 2 Routers in the “Internetworks” Network Library.

Step 2: In the Source Node, i.e. Wired Node 1, in the TRANSPORT LAYER Properties,
Congestion Control Algorithm is set to OLD TAHOE. Congestion plot is set to TRUE.

Step 3: In the General Properties of Wired Node 1 i.e. Source, Wireshark Capture is set
to Online.
Note: Accept default properties for Routers as well as the Links Properties should be changed.

Step 4: Right-click the link ID (of a wired link) and select Properties to access the
link’s properties. Set Max Uplink Speed and Max Downlink Speed to 10 Mbps. Set
Uplink BER and Downlink BER to
0. Set Uplink Propagation Delay and Downlink Propagation Delay as 100 microseconds
for the links 1 and 3 (between the Wired Node’s and the routers). Set Uplink
Propagation Delay and Downlink Propagation Delay as 50000 microseconds and
Uplink BER and Downlink BER to 0.0000001 for the backbone link connecting the
routers, i.e., 2.

Step 5: Right click on the Application Flow App1 CBR and select Properties or click
on the Application icon present in the top ribbon/toolbar.
An CBR Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with Packet Size set to 1460 Bytes and File Inter Arrival Time set to 1168
microseconds.

Step 6: Click on Display Settings > Device IP check box in the NetSim GUI to view
the network topology along with the IP address.

Step 7: Click on Plots icon and select the Enable Plots checkbox. This enables us to view the
throughput plot of the application App1 CBR.
Step 8: Click on Run simulation. The simulation time is set to 20 seconds. In the “Static ARP
Configuration” tab, Static ARP is set to disable.
29.2 Tahoe

Step 1: In the Source Node, i.e. Wired Node 1, in the TRANSPORT LAYER Properties,
Congestion Control Algorithm is set to TAHOE. Congestion plot is set to TRUE.

Step 2: Click on Run simulation. The simulation time is set to 20 seconds. In the “Static ARP
Configuration” tab, Static ARP is set to disable.
29.3 New Reno

Step 1: In the Source Node, i.e. Wired Node 1, in the TRANSPORT LAYER Properties,
Congestion Control Algorithm is set to NEW RENO. Congestion plot is set to TRUE.

Step 2: Click on Run simulation. The simulation time is set to 20 seconds. In the “Static ARP
Configuration” tab, Static ARP is set to disable.

30. 10.4 Output

We have enabled Wireshark Capture in the Wired Node 1. The PCAP file is generated
at the end of the simulation. From the PCAP file, the congestion window evolution
graph can be obtained as follows. In Wireshark, select any data packet with a left click,
then, go to Statistics > TCP Stream Graphs > Window Scaling > Select Switch
Direction.

The congestion window evolution for Old Tahoe, Tahoe and New Reno congestion
control algorithms are presented in Figure 10-4, Figure 10-5, and Figure 10-6,
respectively.

Table 10-1 shows the throughput values of different congestion control algorithms
(obtained from the Application Metrics).
Figure 10-4: Congestion window evolution with TCP Old Tahoe. We note that Old Tahoe infers packet loss only with
timeouts, and updates the slow-start threshold ssthresh and congestion window cwnd as ssthresh
= cwnd/2 and cwnd = 1

Figure 10-5: Congestion window evolution with TCP Tahoe. We note that Tahoe infers packet loss with timeout
and triple duplicate acknowledgements, and updates the slow-start threshold ssthresh and congestion window
cwnd as ssthresh = cwnd/2 and cwnd = 1
Figure 10-6: Congestion window evolution with TCP New Reno. We note that New Reno infers packet loss with
timeout and triple duplicate acknowledgements, and updates the slow-start threshold ssthresh and congestion window
cwnd as ssthresh = cwnd/2 and cwnd = ssthresh + 3MSS (in the event of triple duplicate acknowledgements).
Congestion Control Algorithm Throughput
Old Tahoe 3.52 Mbps
Tahoe 3.03 Mbps
New Reno 4.10 Mbps
Table 10-1: Long-term average throughput of the different TCP congestion control algorithms

31. 10.5 Observations and Inference

1. We can observe slow start, congestion avoidance, timeout, fast retransmit and recovery phases in
the Figure 10-4, Figure 10-5, and Figure 10-6. In Figure 10-4, we note that Old Tahoe employs timeout,
slow-start and congestion avoidance for congestion control. In Figure 10-5, we note that Tahoe
employs fast retransmit, slow-start and congestion avoidance for congestion control. In Figure 10-6,
we note that New Reno employs fast retransmit and recovery, congestion avoidance and slow-start
for congestion control.
2. We note that TCP New Reno reports a higher long term average throughput (in comparison with Old
Tahoe and Tahoe, see Table 10-1) as it employs fast retransmit and recovery to recover from packet
losses.

You might also like