Internetworks

# Introduction#

The Internetworks library in NetSim supports various protocols across all the layers of the TCP/IP network stack. These include Ethernet, Address Resolution Protocol (ARP), Wireless LAN – 802.11 a / b / g / n / ac / p and e (EDCA), Internet Protocol (IP), Transmission Control Protocol (TCP), Virtual LAN (VLAN), User Datagram Protocol (UDP), and routing protocols such as Routing Information Protocol (RIP), Open Shortest Path First (OSPF) and Internet Group Management Protocol (IGMP).

An internetwork is generally a collection of two or more networks (typically LANs and WLANs) which are interconnected to form a larger network. All networks in an Internetwork have a unique network address. Routers interconnect different networks.

Users can use the following devices to design Internetworks: wireless node, wired node, switch, router, and access point (AP). Wired nodes (term for computers, servers etc.) connect via wired link to switches or routers, and wireless nodes connect via wireless links to Access Points (APs). Multiple links terminate at a switch/router, which enables connectivity between them. Many switches/routers are present in an internetwork to connect all the end-nodes. The end-nodes provide and consume useful information via applications like data, voice, video etc.

Figure 1‑1: A typical Internetworks scenario in NetSim

Figure 1‑2: The Result dashboard and the Plots window shown in NetSim after completion of a simulation

# Simulation GUI#

Open NetSim and click New Simulation à Internetworks as shown Figure 2‑1.

Figure 2‑1: NetSim Home Screen

## Create Scenario#

Internetworks come with a palette of various devices like L2 Switch, L3 Switch, Router, Wired Node, Wireless Node, and AP (Access Point).

## Devices specific to NetSim Internetworks Library#

• Wired node: A Wired node can be an end-node or for a server. It > is a 5-layer device that can be connected to a switch and router. > It supports only 1 Ethernet interface and has its own IP and MAC > Addresses.

• Wireless Nodes: A Wireless node can be an end-node or a server. > It is a 5-layer wireless device that can be connected to an Access > point. It supports only 1 Wireless interface and has its own IP > and MAC Addresses.

• L2 Switch: Switch is a layer-2 device that uses the devices MAC > address to make forwarding decisions. It does not have an IP > address.

• Router: Router is a layer-3 device and supports a maximum of 24 > interfaces each of which has its own IP address.

• Access point: Access point (AP) is a layer-2 wireless device > working per 802.11 Wi-Fi protocol.  It can be connected to > wireless nodes via wireless links and to a router or a switch via > a wired link.

Figure 2‑2: Internetworks Device Palette in GUI

### Click and drop into environment #

• Add a Wired Node or Wireless Node: In the toolbar, click the > Node > Wired_Node icon (or) Node >Wireless_Node icon, and place > the device in the grid.

• Add a Router: In the toolbar, click on the Router icon and place > the Router in the grid.

• Add a L2 Switch or L3 Switch: In the toolbar, click on Switch > > L2_Switch icon (or) Switch > L3_Switch icon and place the device > in the grid.

• Add an Access Point: In the toolbar, click on the Access Point > icon and place the Access Point in the grid

• Connect the devices by using Wired/Wireless Links present in the top > ribbon/toolbar. Click on the first device and then click on the > second device. A link will get formed between the two devices.

• Configure an application as follows:

• Click the application icon on the top ribbon/toolbar.

• Specify the source and destination devices.

• Specify other application parameters per your model

Figure 2‑3: Top Ribbon/Toolbar

• Multiple applications can be generated by using add button in > Application properties. Set the values and click on OK button. > Detailed information on Application properties is available in > section 6 of NetSim User Manual.

• Right-click on any device (Router, Access_Point, L2_Switch, > Wireless_Node, Wired_

Node etc) and set the parameters.

Figure 2‑4: Device Properties

• Interface_Wireless’ Physical Layer and DataLink Layer parameters are > local but in Physical layer Standerd parameter is global. To set > the same parameter value in all devices, ensure that you > accordingly update the parameter values in all other devices > (Access_Point or Wireless_Node) manually as the parameter change > does not propagate to the other devices since it is local.

Figure 2‑5: MAC properties of Access Point

Figure 2‑6: PHY Layer properties of Access Point

Right click on the link and click on properties to set link properties. Note that when simulating Internetworks if the link propagation delay is set too high then the applications may not see any throughput since it would take too long for OSPF to converge, and furthermore, TCP may also timeout (since max RTO is 3s).

## Enable Packet Trace, Event Trace & Plots (Optional)#

Click Packet Trace / Event Trace icon in the tool bar and click on OK button. For detailed help, please refer sections 8.1, 8.4 and 8.5 of the User Manual. Select Plots icon for enabling Plots and click on OK button see Figure 2‑8.

Figure 2‑8: Packet Trace, Event Trace & Plots options on top ribbon

## Run Simulation#

Click on Run Simulation icon on the top ribbon/toolbar. For detailed help, please refer sections 3.2.7 of the User Manual.

Figure 2‑9: Run Simulation on top ribbon

Set the Simulation Time and click on OK button.

Figure 2‑10: Run Simulation window

# Model Features#

## WLAN 802.11#

NetSim implements the 802.11 MAC and the 802.11 PHY abstracted at a packet-level. We start with the 3 types of nodes supported in 802.11 Wi-Fi.

• Wireless Nodes (Internetworks) or STAs. In Internetworks APs and > Wireless nodes (STAs) are associated based on the connecting > wireless link

• Wi-Fi Access Points (Internetworks) or APs. Every STA in the WLAN > associates with exactly one AP. Each AP, along with its associated > STAs, define a cell. Each cell operates on a specific channel.

• Standalone Wireless nodes (Mobile Adhoc networks).

The MAC Layer features:

• RTS/CTS/DATA/ACK transmissions.

• Packet queuing, aggregation, transmission, and retransmission.

• 802.11 EDCA.

The PHY layer implements:

• RF propagation (documented separately).

• Received power based on propagation model.

• Interference and signal to interference noise (SINR) calculation.

• MCS (and in turn PHY Rate) setting based on RSS and rate adaptation > algorithms.

• BER calculation and packet error modelling.

Figure 3‑1: NetSim’s Wi-Fi design window, the results dashboard and the plots window

### WLAN standards supported in NetSim#

802.11a, 802.11b, 802.11g, 802.11n, 802.11ac, 802.11e (EDCA) and 802.11p are the WLAN standards available in NetSim. The operating frequencies and bandwidths are given in the table below.

WLAN standard Frequency (GHz) Bandwidth (MHz)
802.11 a 5 20
802.11 b 2.4 20
802.11 g 2.4 20
802.11 n 2.4, 5 20, 40
802.11 ac 5 20, 40, 80, 160

Table 3‑1: WLAN standards supported in NetSim

802.11 p and WAVE are described in the VANET Technology library documentation.

### The 2.4 GHz Channels#

The following channel numbers are well-defined for 2.4GHz standards:

Channel Number Center Frequency (MHz)
1 2412
2 2417
3 2422
4 2427
5 2432
6 2437
7 2442
8 2447
9 2452
10 2457
11 2462
12 2467
13 2472
14 2484

Table 3‑2: 2.4 GHz Wi-Fi Channels per IEEE Std 802.11g-2003, 802.11-2012

Channels 1 through 14 are used in 802.11b, while channels 1 through 13 are used in 802.11g/n.

### The 5 GHz Channels#

The following channel numbers are defined for 802.11a/n/ac.

Channel Number Center Frequency (MHz)
36 5180
40 5200
44 5220
48 5240
52 5260
56 5280
60 5300
64 5320
100 5500
104 5520
108 5540
112 5560
116 5580
120 5600
124 5620
128 5640
132 5660
136 5680
140 5700
144 5720
149 5745
153 5765
157 5785
161 5805
165 5825
169 5845
173 5865
177 5885

Table 3‑3: 5GHz Wi-Fi Channels per IEEE Std 802.11a -1999, 802.11n -2009, 802.11ac -2013

### The 5.9 GHz Channels#

Channel Number Center Frequency (MHz)
100 5500
104 5520
108 5540
112 5560
116 5580
120 5600
124 5620
128 5640
132 5660
136 5680
140 5700
171 5855
172 5860
173 5865
174 5870
175 5875
176 5880
177 5885
178 5890
179 5895
180 5900
181 5905
182 5910
183 5915
184 5920

Table 3‑4: 5.9 GHz Wi-Fi Channels per IEEE Std 802.11p-2010

### Channel Numbering#

The standard method to denote 5 GHz channels has been to always use the 20 MHz center channel frequencies for both 20 MHz and 40 MHz wide channels.

The following are the channel numbers of the non-overlapping channels for 802.11ac in NetSim:

• 20MHz: 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, > 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, > 177

• 40MHz: 36, 44, 52, 60,100, 108, 116, 124, 132, 140, 149, 157, 165, > 173

• 80MHz: 36, 52, 100, 116, 132, 149, 165

• 160MHz: 36, 100, 149

### WLAN PHY Rate in NetSim#

WLAN Standard Frequency (GHz) Bandwidth (MHz) MIMO streams PHY rate (Mbps)
a 5 20 N/A 6, 9, 12, 18, 24, 36, 48, 54
b 2.4 22 N/A 1, 2, 5.5, 11
g 2.4 20 N/A 6, 9, 12, 18, 24, 36, 48, 54
n 2.4, 5 20 4 Up to 288.8
40 Up to 600
ac 5 20 8 Up to 346.8
40 Up to 800
80 Up to 1733.2
160 Up to 3466.8

Table 3‑5: WLAN PHY Rates in NetSim

### SIFS, Slot Time, CW Min, and CW Max settings#

Sub Std. b (20MHz)
SIFS 10
Slot Time 20
CW Min 31
CW Max 1023

Table 3‑6: DSSS PHY characteristics (IEEE-Std-802.11-2020 -Page no -2762)

Sub Std. a g p
Bandwidth 20MHz 20MHz 5MHz 10MHz 20MHz
SIFS 16 16 64 32 16
Slot Time 9 9 21 13 9
CW Min 15 15 15 15 15
CW Max 1023 1023 1023 1023 1023

Table 3‑7: OFDM PHY characteristics (IEEE-Std-802.11-2020 -Page no -2846)

Sub Std. n
Frequency Band 2.4MHz 5
SIFS 10 16
Slot Time 20 9
CW Min 15 15
CW Max 1023 1023

Table 3‑8: HT PHY characteristics (IEEE-Std-802.11-2020 -Page no -2951) and MIMO PHY characteristics (IEEE-Std-802.11n-2009 -Page no -335)

Sub Std. ac (5GHz)
SIFS 16
Slot Time 9
CW Min 15
CW Max 1023

Table 3‑9: Slot time in IEEE-Std-802.11-2020 -Page no -3094 and IEEE-Std-802.11ac-2013-Page no -297

### PHY Implementation#

NetSim is a packet level simulator for simulating the performance of end-to-end applications over various packet transport technologies. NetSim can scale to simulating networks with 100s of end-systems, routers, switches, etc. NetSim provides estimates of the statistics of application-level performance metrics such as throughput, delay, packet-loss, and statistics of network-level processes such as buffer occupancy, collision probabilities, etc.

In order to achieve scalable, network simulation, that can execute in reasonable time on desktop level computers, in all networking technologies the details of the physical layer techniques have been abstracted up to the point that bit-error probabilities can be obtained from which packet error probabilities are obtained.

NetSim does not implement any of the digital communication functionalities of the PHY layer. For the purpose of PHY layer simulation, the particular modulation and coding scheme, along with the transmit power, path loss, noise, and interference, yields the bit rate and the bit error rate by using well-known formulas or tables for the particular PHY layer being used. User would need to use a PHY Layer/RF/Link Level simulator for simulating various digital communication and link level functionalities. Typically, these simulators will simulate just one transmitter-receiver pair, rather than a network.

Generally, in NetSim, the PHY layer parameters available for the user to modify are Channel Bandwidth, Channel Centre Frequency, Transmit-power, Receiver-sensitivity, Antenna-gains, and the Modulation-and-Coding-Scheme. When simulating standard protocols, these parameters can only be chosen from a standard-defined set. NetSim also has standard models for radio pathloss; the parameters of these pathloss models can also be set.

### PHY States#

The PHY radio states implemented in NetSim 802.11 are RX_ON_IDLE, RX_ON_BUSY, TRX_ON_BUSY.

• RX_ON_IDLE: This is the default radio state

• RX_ON_BUSY: This state is set at receiver radio when the reception > of data begins. Upon completion of reception it changes to > RX_ON_IDLE

• TRX_ON_BUSY: This state is set at the transmitter radio at the start > of frame transmission. Upon completion of transmission, it changes > to RX_ON_IDLE

• A node in back off slots can be considered as equivalent to CCA > busy. In NetSim, the radio state continues to be in RX_ON_IDLE

• SLEEP state is not implemented since NetSim 802.11 does not > currently implement power save mode.

### 802.11 implementation details#

Packets arriving from the NETWORK Layer gets queued up in an access buffer from which they are sorted according to their priority per 802.11 EDCA. An event MAC_OUT with SubEvent CS (Carrier Sense – CSMA) is added to check if the medium is free

Figure 3‑2: Packets transmission form Network layer to Mac Layer and how queued up in an access buffer

During CS, if the medium is free, then the NAV is checked. This occurs if the RTS/CTS mechanism is enabled which can be done so by adjusting the RTS Threshold. If the Present_Time > NAV, then an Event MAC_OUT with SubEvent DIFS End added at the time Present_Time + DIFS time.

Figure 3‑3: Event and SubEvent in Mac layer

The medium is checked at the end of DIFS time period and a random time BackOff is calculated based on the Contention Window (CW). An Event MAC_OUT with SubEvent BackOff is added at time Present_Time + BackOff Time.

Once BackOff is successful, NetSim starts the transmission process wherein it gets the aggregated frames from the QOS buffer and stores it in the Retransmit buffer. If the A-MPDU size is > RTS Threshold, then it enables RTS/CTS mechanism which is an optional feature.

Figure 3‑4: Event and SubEvent in Mac layer and Phy layer

NetSim sends the packet by calling the PHY_OUT Event with SubEvent AMPDU_Frame. Note that the implementation of A-MPDU is in the form of a linked list.

Whenever a packet is transmitted, the medium is made busy and a Timer Event with SubEvent Update Device Status is added at the transmission end time to set the medium again as idle.

Figure 3‑5: Event and SubEvent in Phy layer

Events PHY_OUT SubEvent AMPDU_SubFrame, Timer Event SubEvent Update Device Status and Event PHY_IN SubEvent AMPDU_SubFrame are added in succession for each MPDU (Subframe of the aggregated frame). This is done for collision calculations. If two stations start transmission simultaneously, then some of the SubFrames may collide. Only those collided SubFrames will be retransmitted again. The same logic is followed for an Errored packet. However, if the PHY header (the first packet) is errored or collided, the entire A-MPDU is resent.

At the receiver, the device de-aggregates the frame in the MAC Layer and generates a block ACK which is sent to the transmitter. If the receiver is an intermediate node, the de-aggregated frames are added to the access buffer of the receiver in addition to the packets which arrive from Network layer. If the receiver is the destination, then the received packets are sent to the Network layer. At the transmitter side, when the device receives the block acknowledgement, it retransmits only those packets which are errored. The rest of the packets are deleted from the retransmit buffer. This is done till all packets are transmitted successfully or a retransmit limit is reached after which next set of frames are aggregated to be sent.

### 802.11ac MAC and PHY Layer Implementation#

Improvements in 802.11ac compared to 802.11n

Feature 802.11n 802.11ac
Spatial Streams Up to 4 streams Up to 8 streams
MIMO Single User MIMO Multi-User MIMO
Channel Bandwidth 20 and 40 MHz 20, 40, 80 and 160 MHz (optional)
Modulation BPSK, QPSK, 16QAM and 64QAM BPSK, QPSK, 16QAM, 64QAM and 256QAM (optional)
Max Aggregated Packet Size 65536 octets 1048576 octets

Table 3‑10: Feature Comparison between 802.11ac to 802.11n

MAC layer improvements include only the increment of number of aggregated frames from 1 to 64. The MCS index for different modulation and coding rates are as follows:

MCS index Modulation Code Rate
0 BPSK 1/2
1 QPSK 1/2
2 QPSK 3/4
3 16QAM 1/2
4 16QAM 3/4
5 64QAM 2/3
6 64QAM 3/4
7 64QAM 5/6
8 256QAM 3/4
9 256QAM 5/6

Table 3‑11: Different Modulation schemes and Code Rates

Receiver sensitivity for different modulation schemes in 802.11ac (for a 20MHz Channel bandwidth) are as follows.

MCS Index Receiver Sensitivity (in dBm)
0 -82
1 -79
2 -77
3 -74
4 -70
5 -66
6 -65
7 -64
8 -59
9 -57

Table 3‑12: MCS index vs. Receiver Sensitivity (Rx-sensitivity)

The Rx-sensitivity is then set per the above table in conjunction with Max Packet Error Rate (PER) as defined in the standard.

If users wish to apply just the Rx-sensitivity (also termed as rate dependent input level), then the calculate_rxpower_by_per() function call in the function

fn_NetSim_IEEE802_11_HTPhy_UpdateParameter() in the file IEEE802_11_HT_PHY.c can be commented.

Number of subcarriers for different channel bandwidths

PHY Standard Subcarriers Capacity relative to 20MHz in 802.11ac
802.11n/802.11ac 20MHz Total 56, 52 Usable (4 pilot) x1.0
802.11n/802.11ac 40MHz Total 114, 108 Usable (6 pilot) x2.1
802.11ac 80MHz Total 242, 234 Usable (8 pilot) x4.5
802.11ac 160MHz Total 484, 468 Usable (16 pilot) x9.0

Table 3‑13: Number of subcarriers for different channel bandwidths

With the knowledge of MCS index and bandwidth of the channel data rate is set in the following manner

• Get the number subcarriers that are usable for the given bandwidth of the medium.

• Get the Number of Bits per Sub Carrier (NBPSC) from selected MCS

• Number of Coded Bits Per Symbol (NCBPS) = NBPSC*Number of Subcarriers

• Number of Data Bits Per Symbol (NDBPS) = NCBPS*Coding Rate

• Physical level Data Rate = NDBPS/Symbol Time (4micro sec for long GI and 3.6 micro sec for short GI).

### MAC Aggregation in NetSim#

NetSim supports A-MPDU aggregation and does not support A-MSDU aggregation. MAC Aggregation is independent of MCS (PHY Rate) or BER. It is the PHY Rate that adapts to BER via Rate Adaptation algorithms.

In the aggregation scheme shown in Figure 3‑6, several MPDU’s (MAC Protocol Data Units) are aggregated into a single A-MPDU (Aggregated MPDU). The A-MPDUs are created before transfer to the PHY. The MAC does not wait for MPDUs to aggregate. It aggregates the frames already queued to form an A-MPDU. The maximum size of an A-MPDU is 65,535 bytes.

Figure 3‑6: Aggregation scheme

In 802.11n, a single block acknowledgement is sent for the entire A-MPDU. The block ack acknowledges each packet that is received. It consists of a bitmap (compressed bitmap) of 64bits or 8 bytes. This bitmap can acknowledge up to 64 packets, 1bit for each packet.

The value of a bitmap field is 1, if respective packet is received without error else it is 0. Only the error packets are resent until a retry limit is reached. The number of packets in an A-MPDU is restricted to 64 since the size of block ack bitmap is 64bits.

Figure 3‑7: Block Ack Control Packet

• NetSim uses the parameter, Number of frames to aggregate, while the > standard uses the parameter A-MPDU Length Exponent. Per standard > the A-MPDU length in defned by two parameters: Max AMPDU length > exponent and BLOCK ACK Bitmap. The AMPDU length in bytes is > 2(13+MaximumAMPDULengthExponent) − 1 .

• Since NetSim doesn't model A-MSDU, a design decision was made to > model A-MPDU based on Block ACK bitmap size (to indicate the > received status of up to 64 frames) and therefore the parameter - > Number of frames to aggregate - in the GUI

• When EDCA is enabled, packet aggregation is done separately for each > QoS class

• The MAC aggregates packets destined to the same receiver, > irrespective of the end destination. Receiver is to be understood > as the next hop in a wireless transmission.

• RTS threshold is compared against the total A-MPDU size.

• Aggregation functionality may be incorrectly executed if

NumberOfFramesToAggregate × PacketSize (B) > 65, 535 (B)

### Signal to interference and noise ratio (SINR)#

At each receiver, in the beginning when the first packet is transmitted and every time the transmitter or receiver moves, NetSim calculates the received signal level from transmitter. The received signal level would be equal to transmit power less propagation losses. Next, NetSim calculates the interference received (at the same receiver), from all the interfering transmissions. Only co-channel interference is accounted, and adjacent channel interference is not calculated. Finally, NetSim takes the ratio of the signal level, to the sum of the total interference from other transmissions plus the thermal noise. This ratio is SINR.

Once the SINR is calculated the BER is got from the SINR-BER tables for the applicable modulation scheme. This BER is then converted to Packet-Error-Rate. Packet error (Yes/No) is determined by drawing a random number in (0, 1) and comparing against PER1.

The same is explained diagrammatically below.

Figure 3‑8: Radio Tx-Rx for one transmission

* Propagation model covers path loss, fading and shadowing. The models are documented in a separate document named Propagation-Models.pdf

** Interference noise due to other transmissions within the network

### Transmit Power#

The user can set a fixed transmit power via the GUI. Transmit power is a local variable; each STA and AP can be set to have different transmit powers. The transmit power can be dynamically varied by modifying the underlying 802.11 source C code.

### Carrier Sense#

Transmit power less propagation losses is the received power. The propagation loss is the sum (in dB scale) of pathloss, shadowing loss and fading loss. Various propagation models are available and are detailed in the Propagation model manual. Pathloss, Fading, and Shadowing can be turned on/off in GUI.

If ReceiverSensitivity(Lowest MCS)≥ Receiver − Power ≥ ED − Threshold the medium is set to busy. Note that CSMA/CA algorithm operates according to the medium state (busy/idle).

If Received − Power > Reciver − Sensitivity (LowestMCS) then MCS is set depending on the Received power and signal is decoded. Packet error is decided by looking up the SINR-BER table for the given MCS.

These variables can also be dynamically by modifying the underlying 802.11 source C code.

### Transmission Range, Carrier Sense Range, and Interference Range#

• Transmission Range: The transmission range is the range within which > the receiver of a signal can decode the source’s transmission > correctly (when no other transmitting node’s signal interferes). > This is typically smaller than the carrier-sensing range of the > transmitter.

• Carrier Sense Range: The carrier-sense range is the range within > which the transmitter’s signal exceeds the Carrier Sense Threshold > of the receiver (or another transmitter). The receiver (or another > transmitter) detects the medium to be busy and does not transmit > at this time.

• Interference Range: The interference range (defined by the receiver) > is the range within which any signal transmitted by other sources > interfere with the transmission of the intended source, thereby > causing a loss (marked as a collision in NetSim) at the receiver.

These three ranges are affected by the power of the transmitter. The greater the transmission power, the further a node can receive the transmission, and also the more nodes whose communication with other nodes will be affected by this transmission. The transmission range is also affected by the MCS used by the transmitter. The higher the MCS the shorter the range, and vice versa

### Carrier Sense (CS) Threshold#

In NetSim (from v13.2 onwards) the Carrier sense (CS) threshold is set equal to Control rate receive sensitivity.

CSThreshold = RecieverSensitivity(ControlRate)

Users can modify the CS threshold using the variable CSRANGEDIFF which is set to 0 dB in code by default. This implies a 0 dB differential between the lowest MCS (Control rate) Receive sensitivity (which determines DecodeRange) and CS Threshold (which determines CarrierSenseRange). The value of CSRANGEDIFF can be modified by the user in NetSim Standard or Pro versions, which ship with source code. We believe the term EDThreshold used in literature is the same as CSThreshold.

If the interference signal power (sum of the Received-power from all other transmitters), measured at the transmitter, is greater than ED-Threshold, then the transmitter assumes the medium is busy. Carrier is sensed by the transmitter; all CS activity occurs at the transmitter, and not at the receiver

### Transmitter’s choice of MCS#

If the rate adaptation algorithm is turned off, then the transmitter chooses MCS by comparing the RSS (calculated per the equation below) against the Receiver-Sensitivity for different MCS (per the tables in the standards). The highest possible MCS is then chosen. This means the MCS is not fixed but adapts to the received signal strength, even with rate adaption turned off in the MAC layer.

NetSim exploits the AP-STA and the STA-AP channel reciprocity. Therefore, Pathloss plus Shadow loss is identical in both directions.

Note that when computing BER (from SINR) fading loss is added to this RSSI value. Thus, fading loss is not accounted when choosing MCS, but is accounted when computing BER.

NetSim has rate adaptation algorithms which take care of selecting the right MCS for a given SINR. In the simplest algorithm for every 20 successful transmissions the rate (MCS) goes up 1 step, and for every 3 continuous failures, the rate goes down one step.

### Hidden Node Behaviour#

Consider N1 and N3 transmitting to N2 whereby N1 and N3 are beyond Carrier sense (CS) range. N1 is said to be hidden from N3 and vice versa.

When N1 and N3 transmit, there are “likely” to be collisions at N2. However, collisions do not occur all the time. The CSMA/CA algorithm exponentially increases the backoff and hence after a few collisions it is possible that one of the nodes gets a low back-off number while the other draws a very high back-off number. Thus, the node with low back-off can complete transmissions (of one and even more than one packet) while the other node (with the large backoff) is still in backoff.

When N1 transmits to N2, N3 can’t hear the transmission since N3 is beyond CS. Therefore, N3 can attempt if its backoff counts down to 0. However, when N2 sends back the WLAN-ACK, N3 will hear it since N3 is within range of N2. Therefore, in NetSim, N3 will sense the medium as busy and freeze its back off when N2 is sending the WLAN ACK to N1.

In case of N2 to N1/N3 transmissions, then the reverse is true for the MAC-ACK from the nodes. When N2 sends a packet to N1 (or N3) it is within range of N3 (or N1), however, when N1 (or N3) sends back the MAC ACK there is a chance of collision with a data packet of N3 (or N1).

### IEEE 802.11 e QoS and EDCA#

Quality of Service (QoS) provides you with the ability to specify parameters on multiple queues for increased throughput and better performance of differentiated wireless traffic like Voice-over-IP (VoIP), other types of audio, video, and streaming media, as well as traditional IP data over the Access Point.

QoS was introduced in 802.11e and is achieved using enhanced distributed channel access functions (EDCAFs). EDCA provides differentiated priorities to transmitted traffic, using four different access categories (ACs). With EDCA, high-priority traffic has a higher chance of being sent than low-priority traffic: a station with high priority traffic waits a little less before it sends its packet, on average, than a station with low priority traffic. This differentiation is achieved through varying the channel contention parameters i.e., the amount of time a station would sense the channel to be idle, and the length of the contention window for a backoff.

In addition, EDCA provides contention-free access to the channel for a period called a Transmit Opportunity (TXOP). A TXOP is a bounded time interval during which a station can send as many frames as possible (as long as the duration of the transmissions does not extend beyond the maximum duration of the TXOP). If a frame is too large to be transmitted in a single TXOP, it should be fragmented into smaller frames. The use of TXOPs reduces the problem of low rate stations gaining an inordinate amount of channel time in the legacy 802.11 DCF MAC. A TXOP time interval of 0 means it is limited to a single MPDU.

Figure 3‑9: Enhanced Distributed Channel Access (EDCA) in 802.11

NetSim categorizes application packets based on QoS class set in application properties as follows

• VO: UGS and RTPS

• VI: NRTPS and ERTPS

• BE: BE and all control packets suck as TCP ACKs

• BK: Everything else

#### Default EDCA Parameters#

The following tables shows the default EDCA parameters. This default parameter set is per page 899, IEEE Std 802.11-2016

Access Category CWmin CWmax AIFSN Max TXOP (μs)
Background (AC_BK) 31 1023 7 3264
Best Effort (AC_BE) 31 1023 3 3264
Video (AC_VI) 15 31 2 6016
Voice (AC_VO) 7 15 2 3264

Table 3‑14: Default EDCA access parameters for 802.11 b for both AP and STA

Access Category CWmin CWmax AIFSN Max TXOP (μs)
Background (AC_BK) 15 1023 7 2528
Best Effort (AC_BE) 15 1023 3 2528
Video (AC_VI) 7 15 2 4096
Voice (AC_VO) 3 7 2 2080

Table 3‑15: Default EDCA access parameters for 802.11 a / g / n / ac for both AP and STA

Access Category CWmin CWmax AIFSN Max TXOP (μs)
Background (AC_BK) 15 1023 9 0
Best Effort (AC_BE) 15 1023 6 0
Video (AC_VI) 7 15 3 0
Voice (AC_VO) 3 7 2 0

Table 3‑16: Default EDCA access parameters for 802.11 p (dot11OCBActivated is true)

Note: The EDCA parameters can be configured by changing the Physical type parameter according to the different standard, IEEE802.11b (Medium Access Protocol à DSSS), IEEE802.11n (Medium Access Protocol à HT), IEEE802.11ac (Medium Access Protocol à VHT), IEEE802.11a and g (Medium Access Protocol à OFDMA and OCBA àFALSE), IEEE802.11p (Medium Access Protocol à OFDMA and OCBA àTRUE).

In NetSim (with default code), rate adaptation works as follows:

1. FALSE: This is similar to Receiver Based Auto Rate (RBAR) algorithm. In this, the PHY rate gets set based on the target PEP (packet error probability) for a given packet size, as given in the standard. The adaptation is termed as “FALSE” since the rate is pre-determined as per standard and there is no subsequent “adaptation”.
1. 802.11 n/ac: Target PEP = 0.1, Packet Size: 4096 B

2. 802.11 b: Target PEP = 0.08, Packet Size: 1024B

3. 802.11 a/g/p: Target PEP:0.1, Packet size1000B

1. GENERIC: This is similar to the Auto Rate Fall Back (ARF) algorithm. In this algorithm:
1. Rate goes up one step for 20 consecutive packet successes

2. Rate goes down one step for 3 consecutive packet failures

1. MINSTREL: Per the minstrel rate adaptation algorithm implemented in Linux

If users, wish to set the PHY rate (MCS) by comparing the received signal strength against the Receiver minimum input sensitivity tables provided in the standards, they should comment the following line (line #38) in IEEE802_11.h, and rebuild the code

//#define _RECALCULATE_RX_SENSITIVITY_BASED_ON_PEP_

NetSim then chooses the rate at the beginning of the simulation and the rate doesn’t subsequently adapt. The receiver minimum input sensitivity levels are provided in the files

• 802.11b: IEEE802_11_DSSSPhy.c

• 802.11a, 802.11g and 802.11p: IEEE802.11_OFDMPhy.c

• 802.11n and 802.11ac: IEEE802_11_HTPhy.c

Selecting the different rate adaptation options would have no impact when running this modified code.

### Model Limitations#

1. Mobility of Wireless nodes is not available in infrastructure mode (when connected via an Access Point) and is only available in Adhoc mode. Hence mobility for wireless nodes can only be set when running MANET simulations.

2. Authentication and encryption are not supported

3. While different APs can operate in different channels, all the Wireless nodes connected to one AP operate in the same channel.

4. No beacon generation, probing or association

5. RTS, CTS and ACK are always transmitted at the base rate (lowest MCS)

6. Roaming whereby a STA leaves serving AP to associate with target AP (usually based on RSSI/SNR)

### Wi-Fi GUI Parameters#

The WLAN parameters can be accessed by right clicking on a Access Point or Wireless Node and selecting Interface Wireless Properties ->Datalink and Physical Layers

Access Point and Wireless Node Properties
Parameter Scope Range Description
Rate Adaptation Cell False The algorithm is similar to Receiver Based Auto Rate (RBAR) algorithm. In this, the PHY rate gets set based on the target PEP (packet error probability) for a given packet size. The adaptation is termed as “FALSE” since the rate is pre-determined as per standard and there is no subsequent “adaptation”
Minstrel Rate adaptation algorithm implemented in Linux
Generic The algorithm is similar to the Auto Rate Fall Back (ARF) algorithm. In this algorithm (i) Rate goes up one step for 20 consecutive packet successes, and (ii) Rate goes down one step after 3 consecutive packet failures
Short Retry Limit Local 1 to 255 Determines the maximum number of transmission attempts of a frame. The length of MPDU is less than/ equal to Dot11 RTS Threshold value, made before a failure condition is indicated.
Long Retry Limit Local 1 to 255 Determines the maximum number of transmission attempts of a frame. The length of MPDU is greater than Dot11 RTS Threshold value, made before a failure condition is indicated.
Dot11 RTS Threshold Local 0 to 65535 The size of packets (or A-MPDU if applicable) above which RTS/CTS (Request to Send / Clear to Send) mechanism gets triggered.
MAC Address Fixed Auto Generated The MAC address is a unique value associated with a network adapter. This is also known as hardware address or physical address. This is a 12-digit hexadecimal number (48 bits in length).
Buffer Size Local 1 to 100 Buffer is the memory in a device which holds data packets temporarily. If incoming rate is higher than the outgoing rate, incoming packets are stored in the buffer. NetSim models the buffer as an egress buffer. Unit is MB.
Medium Access Protocol Local DCF DCF is the process by which CSMA/CA is applied to Wi-Fi networks. DCF defines four components to ensure devices share the medium equally: Physical Carrier Sense, Virtual Carrier Sense, Random Back-off timers, and Interframe Spaces (IFS). DCF is used in non-QoS WLANs.
EDCAF QoS was introduced in 802.11e and is achieved using enhanced distributed channel access functions (EDCAFs). EDCA provides differentiated priorities to transmitted traffic, using four different access categories (ACs). With EDCA, high-priority traffic has a higher chance of being sent than low-priority traffic: a station with high priority traffic waits a little less before it sends its packet, on average, than a station with low priority traffic.
Physical Type Local DSSS Direct Sequence Spread Spectrum. The physical type parameter is set to DSSS if the standard selected is IEEE802.11b.
OFDM Orthogonal Frequency Division Multiplexing is utilized as a digital multi-carrier modulation method. The physical type parameter is set to OFDM if the standard selected is IEEE802.11 a, g and p.
HT Operates in frequency bands 2.4GHz or 5GHz band. The physical type parameter is set to HT if the standard selected is IEEE802.11n.
VHT The physical type parameter is set to VHT if the standard selected is IEEE802.11ac.
OCBA Activated Local True or False

This parameter determines the type of standard to be chosen for the OFDM physical type.

• The standard is set to IEEE802.11p if OCBA is True.

• The standard is set to IEEE802.11a and g if OCBA is False.

BSS Type Fixed Auto Generated The BSS type is fixed to Infrastructure mode. The wireless device can communicate - with each other or with a wired network - through an Access Point.
CW min (Slots) Local 0 to 255 Specifies the initial Contention Window (CW) used by an Access Point (or STA) for a particular AC for generating a random number for the back-off.
CW max (Slots) Local 0 to 65535 At each collision the CW is doubled. CWMax specifies the final maximum CW values used by an Access Point (or STA) for a particular AC for generating a random number for the back-off.
AIFSN (Slot) Local 2 to 15 Specifies the number of slots after a SIFS duration.
Max TXOP Local 0 to 65535 Specifies the maximum number of microseconds of an EDCA TXOP for a given AC. Unit is microseconds.
MSDU Lifetime (TU) Local 0 to 500 Specifies the maximum duration an MSDU would be retained by the MAC before it is discarded, for a given AC. MSDU Lifetime is specified in TU.
Interface Wireless- Physical Layer
Protocol Fixed IEEE802.11 Defines the MAC and PHY specifications like IEEE802.11a/b/g/n/ac/p for wireless connectivity for fixed, portable and moving stations within a local area.
Connection Medium Fixed Auto Generated Defines how the devices are connected or linked to each other.
Standard Cell IEEE802.11 a/b/g/n/ac/p

Refers to a family of specifications developed by IEEE for WLAN technology. The IEEE standards supported in NetSim are IEEE 802.11 a, b, g, n, ac and p.

802.11a provides up to 54 Mbps in 5GHz band.

802.11b provides 11 Mbps in the 2.4GHz bands.

802.11gprovides 54 Mbps transmission over short distances in the 2.4 GHz band.

802.11ac provides support for wider channels and beamforming capabilities.

802.11p provides support to Intelligent Transportation Systems.

Transmission Type Fixed DSSS The transmission type parameter is DSSS if the standard selected is IEEE802.11b.
OFDM The transmission type parameter is OFDM if the standard selected is IEEE802.11a, g and p.
HT The transmission type parameter is HT if the standard selected is IEEE802.11n.
VHT The transmission type parameter is VHT if the standard selected is IEEE802.11ac.
Number of Frames to Aggregate Cell

1 to 1024 (11ac)

1 to 64

(11n)

Number of frame aggregated to form an A-MPDU. This is fixed and cannot be dynamically varied (except by modifying the code). See 3.1.12 for more information.
Transmit Power Local 0 to 1000 Transmitted signal power. Note that the transmit power is not split among the antennas. This value is applied to each antenna in a multi-antenna transmitter. Unit is mW.
Antenna Gain Local 0 to 1000 Unit is dBi.
Antenna Height Local 0 to 1000 The height of antenna above the ground. Unit is m.
SIFS Fixed Auto Generated The time interval required by a wireless device in between receiving a frame and responding to the frame. Unit is microseconds.
Frequency Band Cell

2.4, 5

(Depends on the standard chosen)

Range of frequencies at which the device operates. The frequency band depends on the standard selected. Unit is GHz.
Bandwidth Cell 20, 40, 60, 80, 160 (Depends on the standard chosen) The bandwidth depends on the standard and the frequency band selected. Unit is MHz
CCA Mode Fixed Auto Generated A mechanism to determine whether a medium is idle or not. It includes Carrier sensing and energy detection.
Slot Time Fixed Auto Generated Time is quantized as slots in Wi-Fi. Unit is microseconds.
Standard Channel Local Depends on the standard chosen The channel options defined in the standards. The options would also depend on the frequency band if the standard supports multiple bands.
CW Min Fixed Auto Generated The minimum size of the Contention Window in units of slot time. The CW min is used by the MAC to calculate the back off time for channel access during a carrier sense.
CW Max Fixed Auto Generated The maximum size of the Contention Window in units of slot time. The CW is doubled progressively when collisions occur.
Transmitting Antennas Local 1 to 8 The number of transmit antennas. Note that power is not split among the transmit antennas but is assigned to each antenna. (The pair of Tx and Rx antenna present only for 802.11ac and 802.11n)
Receiving Antennas Local 1 to 8 The number of receive antennas
Guard Interval Local 400 and 800 Guard Interval is intended to avoid signal loss from multipath effect. Unit is nanoseconds.
Reference Distance d0 Local 1 to 10 Unit is m.

### IEEE802.11 Results#

IEEE802.11 performance metrics will be displayed in the results dashboard if the network scenario simulated consisted of at least one device with WLAN protocol enabled.

Parameter Description
Device_Id It represents the Id’s of the wireless devices which supports 802.11 (WLAN)
Interface_Id It represents the interface Id’s of the wireless nodes
Frame Sent It is the Number of frames sent by Access Point
Frame Received It is the number of frames received by a wireless node
RTS Sent It is the number of Request to send (RTS) packets sent by a Wireless Node. RTS/CTS frames are sent prior to transmission when the packet size exceeds RTS threshold. The access point receives the RTS and responds with a CTS frame. The station must receive a CTS frame before sending the data frame. The CTS also contains a time value that alerts other stations to hold off from accessing the medium while the station initiating the RTS transmits its data.
RTS Received It is the number of RTS packets received by an Access Points
CTS Sent It is the number of Clear to send (CTS) packets sent by an Access Points
CTS Received It is the number of CTS packets received by Wireless Nodes
Successful BackOff It is the number of successful backoffs running at a wireless node. In the IEEE 802.11 Wireless Local Area Networks (WLANs), network nodes experiencing collisions on the shared channel need to BackOff for a random period of time, which is uniformly selected from the Contention Window (CW). BackOff is a timer which is decreased as long as the medium is sensed to be idle for a DIFS, and frozen when a transmission is detected on the medium, and resumed when the channel is detected as idle again for a DIFS interval
Failed BackOff It is the number of failed backoffs at wireless node

Table 3‑17: Description of IEEE 802.11 Metrics

## Layer 2 (L2) Ethernet Switching#

Layer 2 switches have a MAC address table that contains a MAC address and port number. Switches follow this simple algorithm for forwarding packets:

1. When a frame is received, the switch compares the SOURCE MAC address to the MAC address table. If the SOURCE is unknown, the switch adds it to the table along with the port number the packet was received on. In this way, the switch learns the MAC address and port of every transmitting device.

2. The switch then compares the DESTINATION MAC address with the table. If there is an entry, the switch forwards the frame out the associated port. If there is no entry, the switch sends the packet out all its ports, except the port that the frame was received on This is termed as Flooding.

3. It does not learn the destination MAC until it receives a frame from that device

### Spanning Tree Protocol#

NetSim ethernet switches implement Spanning tree protocol to build a loop-free logical topology. This is always enabled and cannot be disabled.

### Switch Port States#

All switch ports in switches can be in one of the following states:

• Blocking: A port that would cause a switching loop if it were > active. No user data is sent or received over a blocking port.

• Listening: The switch processes BPDUs and awaits possible new > information that would cause it to return to the blocking state. > It does not populate the MAC address table and it does not forward > frames.

• Learning: While the port does not yet forward frames, it does learn > source addresses from frames received and adds them to the > filtering database (switching database). It populates the MAC > address table but does not forward frames.

• Forwarding: A port receiving and sending data in Ethernet frames, > normal operation.

It is recommended that the application start time is set to a value that is greater than the time it takes for the spanning tree protocol to complete (of the order of a 100s of milliseconds).

### Model Limitations#

1. The spanning protocol is only run at the beginning of simulation. If a link fails, the spanning protocol is not re-run.

2. If applications are started prior to completion of spanning tree protocol, then the MAC table created is not updated per the spanning tree protocol.

3. Jumbo Frames are not supported in NetSim Ethernet Protocol

### Switch: GUI Parameters#

Switch properties can be set by right clicking on a switch --> Properties -->

Interface_1(ETHERNET)

Figure 3‑10: Data Link Layer Properties of a Switch

The properties that can be set are:

Parameter Type * Range Description
MAC ADDRESS Fixed Auto generated The MAC address is a unique value associated with a network adapter. This is also known as hardware address or physical address. This is a 12-digit hexadecimal number (48 bits in length).
Buffer Size (MB) Local 1-5 Buffer is the memory in a device which holds data packets temporarily. If the transmitting port is busy, incoming packets are stored in the buffer. NetSim models the buffer as an egress buffer and the range is 1 MB to 5MB per port of the switch.
STP Status Fixed TRUE Spanning Tree Protocol is set to “True” in the Switches by default.
Switch Priority Local 1-61440 This is the priority that can be assigned to the Switch. Priority is involved in deciding the root bridge for STP.
Switch ID Fixed Auto generated Each switch has a unique ID for spanning tree calculation. The ID is derived by combining the priority and MAC address. Since a switch has a MAC address for each port, the least of the MAC address of the connected ports is taken while forming the unique ID.
Spanning Tree Fixed IEEE802.1D The Spanning Tree Protocol (STP) ensures a loop-free topology for any bridged Ethernet local area network. The basic function of STP is to prevent bridge loops and the broadcast radiation that results from them. STP is standardized as IEEE 802.1D. As the name suggests, it creates a spanning tree within a network of connected layer-2 bridges (typically Ethernet switches) and disables those links that are not part of the spanning tree, leaving a single active path between any two network nodes.
STP Cost Local 0-1000 Cost used by the switch to calculate spanning tree. The cost assigned to each port is based on its data rate.
Switching Mode Local

Store Forward,

Cut Through

Store and Forward: Forwarding takes place only after receipt of complete frame. This technique buffers the incoming frame and checks for errors. If no error is found it forwards the frame to the outgoing port, otherwise it discards the frame.

Cut through: Switch forwards the incoming frames to its appropriate outgoing port immediately after receipt of destination address of the frame.

VLAN Status* Local TRUE, FALSE To enable/disable VLAN

Table 3‑18: Description of Datalink layer properties of switch parameter

## Open Shortest Path First (OSPF v2) Routing Protocol#

### OSPF Overview#

OSPF is a link-state routing protocol. It is designed to be run internal to a single Autonomous System. Each OSPF router maintains an identical database describing the Autonomous System's topology. From this database, a routing table is calculated by constructing a shortest-path tree.

OSPF routes IP packets based solely on the destination IP address found in the IP packet header. IP packets are routed "as is" -- they are not encapsulated in any further protocol headers as they transit the Autonomous System. OSPF is a dynamic routing protocol. In NetSim, OSPF can detect topological changes in the AS (such as router interface failures) and calculate new loop-free routes after a period of convergence.

Each router maintains a database describing the Autonomous System's topology. This database is referred to as the link-state database. Each participating router has an identical database. Each individual piece of this database is a particular router's local state (e.g., the router's usable interfaces and reachable neighbors). The router distributes its local state throughout the Autonomous System by flooding.

All routers run the exact same algorithm, in parallel. From the link-state database, each router constructs a tree of shortest paths with itself as root. This shortest-path tree gives the route to each destination in the Autonomous System. The cost of a route is described by a single dimensionless metric.

### OSPF Features#

1. OSPF Messages – Hello, DD, LS Request, LS Update, LS Ack

2. Router LSA

3. The Neighbor Data structure features the following

5. DB summary list

9. Inactivity timer

10. Routing table

11. Shortest path tree

12. The Interface data structure features

13. Neighbor router list

14. Flood timer

15. Update LS list

16. Network LS timer

17. Delayed ack list

18. The Protocol data structure features

19. Interface list

20. Area list

21. Max age removal timer

22. SPF timer

23. Routing table

24. The Area Data structure features

25. Associated interface list

26. Router LSA list

27. Network LSA list

28. Router summary LSA list

29. Network summary LSA list

30. Max age list

31. Router LS timer

32. Shortest path list

33. The following can be logged during simulation

34. Hello log

35. SPF log

36. Common log

37. Debug logs – LSDB, RXList, RLSA, RCVLSU, LSULIST, Route

### Excluded Features#

The following features in OSPF have not been implemented - Multiple Areas, Network LSA, Router summary LSA, Network summary LSA, Authentication, Equal cost multipath, External AS, External routing information, Interface type – Broadcast, NBMA, Virtual, Point to multi-point

### OSPF: GUI Parameters#

OSPF properties can be set by right clicking on Router --> Properties --> Application layer see Figure 3‑11.

Figure 3‑11: Routing protocol properties of router

The properties that can be set are:

Parameter Type * Range Description
Version Global Fixed OSPF Version 2 as per RFC 2328 for IPv4.
LSRefresh_Time (s) Global Fixed The maximum time between distinct originations of any particular Link State Advertisement (LSA). If the link state age field of one of the router’s self-originated LSAs reaches the value LSRefreshTime, a new instance of the LSA is originated, even though the contents of the LSA (apart from the LSA header) will be the same. The value of LSRefreshTime is set to 30 minutes.
LSA_Maxage (s) Global Fixed The maximum age that an LSA can attain. When an LSA's LS age field reaches MaxAge, it is reflooded in an attempt to flush the LSA from the routing domain. LSAs of age MaxAge are not used in the routing table calculation. The default value of MaxAge is set to 1 hour or 3600s
Increment_Age (s) Global 0 - 100 This is an internal variable of NetSim used for simulation purposes. This value decides how often to increase the age of the LSA in the OSPF LSA Lists. A small value will cause frequent updates and provide higher accuracy but may slow down simulation, and vice versa for a large value
Maxage_removal_Time (s) Global 0 - 9999 This variable decides the time when the LSA is removed from the MaxAgeLSA List
MinLS_Interval (s) Global Fixed The minimum time between distinct originations of any particular LSA. The value of MinLSInterval is set to 5 seconds
SPFCalc_Delay (ms) Global 0 - 9999 If SPF calculation is triggered, then the router will wait for this duration before starting the calculation. This can be used for the router to take multiple updates into account
Flood_Timer (ms) Global 0 - 9999 The amount of time to wait before initializing the flood procedure. A random number between 0 to the set value will be chosen. The flood timer on/off is per the ISSENDDELAYUPDATE variable setting
Advertise_Self_Interface Global True/False This is reserved for future use. As of NetSim v12, this should always be true. This will be used when a point-to-multipoint link is connected to the interface, and when such links are connected this should be set to false
Send_Delayed_Update Global True/False This variable can be set to true to delay sending the LSU. If set to true, then the delay would be per the flooding timer. Else the update is set immediately.

Table 3‑19: Description of Application layer Routing protocol properties

*Global – Changes in all devices of similar type. Local – Only changes in current device

## Transmission Control Protocol (TCP)#

### TCP overview#

TCP is a connection-oriented, end-to-end reliable protocol designed to fit into a layered hierarchy of protocols which support multi-network applications. The TCP provides for reliable communication between host computers connected computer communication networks. Very few assumptions are made as to the reliability of the communication protocols below the TCP layer. TCP assumes it can obtain a simple, potentially unreliable datagram service from the lower-level protocols. In principle, the TCP should be able to operate above a wide spectrum of communication systems ranging from wired to wireless to mobile communication.

The TCP fits into a layered protocol architecture just above a basic Internet Protocol which provides a way for the TCP to send and receive variable-length segments of information enclosed in IP packets. The IP packet provides a means for addressing source and destination TCPs in different networks. The IP protocol also deals with any fragmentation or reassembly of the TCP segments required to achieve transport and delivery through multiple networks and interconnecting gateways.

Application
TCP
IP
MAC
PHY

Figure 3‑12: Protocol Layering

### TCP Features#

The following features are implemented in TCP.

1. Three-way handshake (open/close)

2. Sequence Numbers

3. Slow start and congestion avoidance

4. Fast Retransmit/Fast Recovery

5. Selective Acknowledgement

### Congestion Control Algorithms in TCP#

The following congestion control algorithms are supported in NetSim.

1. Old Tahoe

2. Tahoe

3. Reno

4. New Reno

5. BIC

6. CUBIC

### Limitations of TCP#

1. Send and Receive buffers are infinite

### TCP: GUI parameters#

The TCP parameters can be accessed by right clicking on a node and selecting Properties -> Transport Layer

Figure 3‑13: Transport layer protocol properties of wired node

The properties that can be set are:

Parameter Type * Range Description
Congestion Control Algorithm Local OLD TAHOE, TAHOE, RENO, NEW RENO, BIC, CUBIC

Congestion control algorithm is used to control the network congestion.

Old Tahoe is the combination of slow start and congestion avoidance algorithm.

The Fast-retransmit algorithms operating with Old Tahoe is known as the Tahoe. This algorithm works based on duplicate ack. When it receives three duplicate ack, which is the indication of segment loss, that segment will be retransmitted immediately without waiting for timeout.

Reno implements fast recovery in case of three duplicate acknowledgements.

New Reno improves retransmission during the fast-recovery phase of TCP Reno.

BIC algorithm tries to find the maximum where to keep the window at for a long period of time, by using a binary search algorithm.

CUBIC is an implementation of TCP with an optimized congestion control algorithm for high bandwidth networks with high latency.

Congestion

plot enabled

Local FALSE, TRUE Congestion plot can enable or disable by selecting value as TRUE and FALSE
Max SYN Retries Local 1-10 Maximum number of TCP SYN ACK packets that can be retransmitted. The value should in the range of 1 to 10.
Acknowledgement Type Local Delayed, Undelayed If set to delayed, ACK response will be delayed improving network performance. If set to Un delayed, ACK will be sent immediately without delay.
MSS (bytes) Local 64-1460

The maximum amount of data that a single message may contain. The MSS is the maximum data size and does not include the size of the header.

MSS = MTU – (Network and Transport layer protocol headers).

Initial SSThreshold(bytes) Local 5840-65535 The server-initial–ss-threshold should be in the range between 5840 and 65535 bytes.
Time Wait Timer(s) Local 30-240 The Time wait timer default value is 120 seconds. The purpose of TIME-WAIT is to prevent delayed packets from one connection being accepted by a later connection.
Selective ACK Local TRUE, FALSE In Selective Acknowledgment (SACK) mechanism, the receiving TCP sends back SACK packets to the sender informing the sender of data that has been received. The sender can then retransmit only the missing data segments.
Window Scaling Local TRUE, FALSE The TCP window scaling option is to increase the receive window size allowed in Transmission Control Protocol above its former maximum value of 65,535 bytes.
Sack Permitted Local TRUE, FALSE The SACK-permitted option is offered to the remote end during TCP setup as an option to an opening SYN packet. The SACK option permits selective acknowledgment of permitted data.
Timestamp Option Local TRUE, FALSE TCP is a symmetric protocol, allowing data to be sent at any time in either direction. Therefore, timestamp echoing may occur in either direction. For simplicity and symmetry, we specify that timestamps always be sent and echoed in both directions. For efficiency, we combine the timestamp and timestamp reply fields into a single TCP Timestamps Option.

Table 3‑20: Description of Transport layer protocol properties

### TCP Performance Metrics#

TCP Metrics table will be available in the Simulation Results dashboard if TCP is enabled in at least one device in the network. It provides the following information specific to TCP.

Parameter Description
Source It displays the name with ID of the source device which generates TCP packets
Destination It displays the name with ID of the destination device which receives TCP packets
Local Address It displays the local IP address with port number of the device present in source column
Remote Address It represents the remote IP address with port number for the source and destination
Syn Sent It is the number of syn packets sent by the source
Syn-Ack Sent It is the number of syn ack packets sent by the destination
Segment Sent It is the number of segments sent by a source
Segment Received It is the number of segments received by a destination
Segment Retransmitted It is the number of segments retransmitted by the source
Ack Sent It is the number of acknowledgements sent by a source to destination in response to TCP syn ack and the number of acks sent by destination to source in response to the successful reception of data packet
Ack Received It is the number of acknowledgements received by source in response to data packets and the number of acks received by destination in response to syn ack packet
Duplicate segment received It is the number of duplicate segments received by destination
Out of order segment received It is the number of out of ordered packets received by destination
Duplicate ack received It is the number of duplicate acknowledgements received by source
Times RTO expired It is the number of times RTO timer expired at source

Table 3‑21: Parameter discerption of TCP Metrics table

### TCP Reference Documents#

1. RFC 793: TRANSMISSION CONTROL PROTOCOL

2. RFC 1122: Requirements for Internet Hosts -- Communication Layers

3. RFC 5681: TCP Congestion Control

4. RFC 3390: Increasing TCP's Initial Window

5. RFC 6298: Computing TCP's Retransmission Timer

6. RFC 2018: TCP Selective Acknowledgment Options

7. RFC 6582: The NewReno Modification to TCP's Fast Recovery Algorithm

8. RFC 6675: A Conservative Loss Recovery Algorithm Based on Selective Acknowledgment (SACK) for TCP

9. RFC 7323: TCP Extensions for High Performance

10. https://research.csc.ncsu.edu/netsrv/sites/default/files/cubic_a_new_tcp_2008.pdf

11. https://research.csc.ncsu.edu/netsrv/sites/default/files/bitcp.pdf

12. https://research.csc.ncsu.edu/netsrv/sites/default/files/hystart_techreport_2008.pdf

## User Datagram Protocol (UDP)#

### UDP Overview#

UDP (User Datagram Protocol) is a communication protocol that offers a limited amount of service when messages are exchanged between computers in a network that uses the Internet Protocol (IP). UDP uses the Internet Protocol to get a data unit (called a datagram) from one computer to another.

This protocol is transaction oriented, and delivery and duplicate protection are not guaranteed. Applications requiring ordered reliable delivery of streams of data should use the Transmission Control Protocol (TCP).

### UDP: GUI parameters#

The UDP protocol can be set for an application by clicking on the Applications Transport Protocol option as shown below see Figure 3‑14.

Figure 3‑14: Application configuration window

### UDP Performance Metrics#

UDP Metrics table will be available in the Simulation Results dashboard if UDP is enabled in at least one device in the network. It provides the following information specific to UDP see Table 3‑22.

Parameter Description
Device Id It is the Id of a device in which UDP is enabled
Local Address It represents the IP address with port number of the local device (either source or destination)
Foreign Address It represents the IP address with port number of the remote device (either source or destination)
Datagram sent It is the total number of datagrams sent from the source
Datagram received It is the total number of datagrams received at the destination

Table 3‑22: Parameter discerption of UDP Metrics table

### UDP Reference Documents#

1. RFC 768: User Datagram Protocol

## IP Protocol#

### IP Performance Metrics#

IP Metrics table will be available in the Simulation Results dashboard if IP is enabled in at least one device in the network. It provides the following information specific to IP protocol:

Parameter Description
Device_Id It displays the Id’s of the Layer_3 devices
Packet sent It is the number of packets sent by a source, intermediate devices (Router or L3 switch)
Packet forwarded It is the number of packets forwarded by intermediate devices (Router or L3 switch)
Packet received It is the number of data packets received by destination, intermediate devices (routing packets (OSPF, RIP etc.) received by Routers)
Packet discarded It is the number of data packets that are discarded after their TTL value is expired.
TTL expired Time-to-live (TTL) is a value in an Internet Protocol (IP) packet that tells a network router whether or not the packet has been in the network too long and should be discarded
Firewall blocked It is the number of packets blocked by firewall at routers

Table 3‑23: Parameter discerption of IP Metrics table

## Buffering, Queueing and Scheduling#

### Buffers#

Devices and their Interfaces with buffers that support queuing and scheduling algorithms are:

1. Router (WAN – Network Layer)

2. EPC (WAN – Network Layer)

3. 6LOWPAN (WAN – Network Layer)

4. Satellite Gateway (WAN – Network Layer)

Queuing and scheduling in NetSim, works as follows:

1. The scheduler schedules packet transmission from the head-of-queue per the scheduling algorithm. FIFO algorithm uses a single queue while Priority, RR and WFQ use 4 queues (1 queue for each priority)

2. The buffer size is a user input. This buffer is not split among the various queues. At any point in time the cumulative size of all queues is the buffer fill.

3. The way in which the individual queues are filled up, is per the queuing algorithm selected (implemented in version 12.1)

The buffer is an egress buffer. The buffer size in Mega Bytes (MB), for each interface mentioned above is a user input. The options 8, 16, 32, 64, 128, 256, 512, 1024, 2048 and 4096 MB

### Queuing#

Drop Tail: The queue is filled up till the buffer capacity. When the queue is full if any packet arrives, it is dropped. The buffer size is a user input.

Random Early Detection (RED):

1. The queue is filled up till the average queue size is equal to minimum threshold, without dropping any packet.

2. Randomly packets are dropped when average queue size is between minimum threshold and maximum threshold. The number of packets being dropped depends on the Max Probability value.

3. All packets are dropped when average queue size is above maximum threshold.

User Inputs - Maximum threshold, minimum threshold and maximum probability.

$$Avg\ = \frac{t_{n}}{t_{n + 1}}\ \left( Avg - x_{n} \right) + x_{n}$$

Avg – Average Queue Size. Avg is initially 0

tn – Time when nth packet was added to the queue

tn + 1 – Current time which is the time when the (n+1)th packet is added

xn Size of nth packet (B)

Packets are dropped if

$No\ of\ Dropped\ Packets > \frac{Rand\ (0,1)}{P}\$ where p = C1 × Avg + C2

$$C_{1} = \frac{Max\ Probability}{(Max\ Threshold - Min\ Threshold)}$$

$$C_{2} = \ \frac{Max\ Probability}{(Max\ Threshold - Min\ Threshold)} \times Min\ Threshold$$

Weighted Random Early Detection (WRED):

Please refer to RED explained earlier. This is modified as follows

1. There are different Max and Min threshold value for each type of priority, i.e. High, Medium, Normal, Low (The RED algorithm had only one set of Max and Min Threshold)

2. For the given threshold values of the packets, Random Early Detection (RED) algorithm is applied.

Reference Documents

1. Sally Floyd, Van Jacobson (1993). Random Early Detection Gateways for Congestion Avoidance. IEEE/ACM Transactions on Networking.

Queue Size: The queue depth can be obtained from the Event Trace or by modifying the protocol source code.  To obtain it from the event trace, an MS Excel script would need to be written to filter by node, and at different points of time, add the number of APP-OUT events and subtract the number of TRANSPORT-OUT events. Note that deeper issues such as segmentation etc. will need to be handled appropriately based on the way the application and transport layer interact.

### Scheduling#

First In First Out (FIFO): Packets are scheduled according to their arrival time in the queue. Hence, first in packet in queue is scheduled first.

Priority: NetSim supports 4 priority queues namely High, Medium, Normal and Low. With this scheduling, first all packets in the High priority queue are served, and then those in Medium, then in normal and finally those packets in the low priority queue. Note that this could lead to situations where only higher priority packets are served and lower priority packets are never served.

Round Robin: Packet from all the 4 priorities are served in circular order. When packet arrives, they are stored in the corresponding priority list

Weighted Fair Queuing (WFQ): When packet arrives, they are stored in corresponding list according to priority. Packets are served in order of maximum weight of the priority list. In NetSim WFQ is approximated as:

Weight = (Number of packets in Queue) × Priority  where

Priority = 1, 2, 3 or 4

1 - Low priority, 2 - Normal, 3 – Medium, 4 - High

Early Deadline First (EDF): Packets are added in the queue as they arrive. While dequeuing the packets with earliest deadline are served first. The packets which have exceeded deadline are dropped.

Deadline = Max Latency − Packet Creation Time

Max Latency with respect to quality of service (QoS) of the packet is a user input

The error rates in NetSim wired links are based on a standard error measurement unit called BER or Bit Error Rate. BER represents the ratio of errored bits to total bits.

The BER value can be set by the user. A typical value of BER, say 1 × 10−6, which equals 0.000001, means that 1 bit is in error for every one-million bits transmitted. It is important to note that Bit Error Rate is NOT equal to Packet error rate. (PER)

PER = 1 − (1−BER)L where L is the packet length in bits

For BER values less than 0.001, this is mathematically approximated in NetSim as

PER = BER * L

# Internetworks Experiments in NetSim#

Apart from examples, in-built experiments are also available in NetSim. Examples help the user understand the working of features in NetSim. Experiments are designed to help the user (usually students) learn networking concepts through simulation. The experiments contain objective, theory, set-up, results, and inference. The following experiments are available in the Experiments manual (pdf file).

1. Understand Measures of Network Performance: Throughput and Delay

2. Throughput and Bottleneck Server Analysis

3. Delay and Little’s Law

4. Understand working of ARP, and IP Forwarding within a LAN and across a router

5. Simulate and study the spanning tree protocol.

6. Introduction to TCP connection management

7. Reliable data transfer with TCP

8. Mathematical Modelling of TCP Throughput Performance

9. Study how throughput and error of a Wireless LAN network changes as the distance between the Access Point and the wireless nodes is varied.

12. TCP Congestion Control Algorithms

13. Multi-AP Wi-Fi Networks: Channel Allocation

14. Study the working and routing table formation of Interior routing protocols, i.e. Routing Information Protocol (RIP) and Open Shortest Path First (OSPF)

15. M/D/1 and M/G/1 Queues

16. Wi-Fi Multimedia Extension (IEEE 802.11 EDCA)

17. Understand the working of OSPF.

18. Understand the events involved in NetSim DES (Discrete Event Simulator) in simulating the flow of one packet from a Wired node to a Wireless node.

19. Understand the working of TCP BIC Congestion control algorithm, simulate and plot the TCP congestion window.

# Reference Documents#

1. IEEE 802.3 standard for Ethernet

2. IEEE 802.11 standards for Wireless LAN

3. RFCs 777, 760, 792 for Internet Control Message Protocol

4. IENs 108, 128 for Internet Control Message Protocol

5. RFC 2328 for Open Shortest Path First (OSPF)

# Latest FAQs#

Up to date FAQs on NetSim’s Internetworks library is available at

https://tetcos.freshdesk.com/support/solutions/folders/14000108665

https://tetcos.freshdesk.com/support/solutions/folders/14000113123

https://tetcos.freshdesk.com/support/solutions/folders/14000119396

1. In other words, the instantaneous PER is used in a Bernoulli trial to decide whether the current packet is successfully received or not