VTU Network Lab Experiment Manual - NetSim
VTU Network Lab Experiment Manual - NetSim
-1-
The information contained in this document represents the current view of TETCOS on the issues discussed as of the date of publication. Because TETCOS must respond to changing market conditions, it should not be interpreted to be a commitment on the part of TETCOS, and TETCOS cannot guarantee guarantee the accuracy of any information informati presented after the date of publication. This manual is for informational purposes only. TETCOS MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Warning! DO NOT COPY Copyright in the whole and every part of this manual belongs to TETCOS and may not be used, sold, transferred, ansferred, copied or reproduced in whole or in part in any manner or in any media to any person, without the prior written consent of TETCOS. If you use this manual you do so at your own risk and on the understanding that TETCOS shall not be liable for any loss or damage of any kind. TETCOS may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from TETCOS, the the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, ces, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred. Rev 7.0.9 (V), Sep 2013, TETCOS. All rights reserved. All trademarks are property of their respective owner. Contact us at TETCOS 214, 39th A Cross, 7th Main, 5th Block Jayanagar, Bangalore - 560 041, Karnataka, INDIA. Phone: +91 80 26630624 E-Mail: [email protected] Visit: www.tetcos.com
-2-
List of Experiments
Introduction
1. Introduce students to network simulation through the NetSim simulation package, Create a simple network model with multiple scenarios, Collect statistics on network performance through the use of NetSim tools, Analyze statistics and draw conclusions ns on network performance. ..Page (5)
5. Simulate the transmission of ping messages over a network topology consisting of 6 nodes and find the number of packets dropped due to congestion ..Page (25) 6. Simulate an Ethernet LAN using n nodes (6-10), (6 10), change error rate and data rate and compare throughput ..Page (31)
7. Simulate an Ethernet LAN using n nodes and set multiple traffic nodes and determine collision across different nodes ..Page (41)
8. Simulate an Ethernet LAN using n nodes and set multiple traffic nodes and plot congestion window for different source / destination ..Page (45)
9. Simulate simple ESS and with transmitting nodes in wire-less wire s LAN by simulation and determine the performance with respect to transmission of packets ..Page (50) NetSim Experiment Manual -3-
Programming Exercises: Write a C program for the following exercises and link
your code to NetSim How to De-bug bug your code linked to NetSims Programming Exercise (Important: If you are opening the source code via Interface Source Code link available under Programming Exercise, then dont make modifications in the opened file directly. Save the file in different location and do the modifications to ensure that the original source file is not modified) modified 10. Write a program for error detecting code using CRC-CCITT CRC (16- bits) ..Page (61) 11. Write a program for frame sorting technique used in buffers ..Page (67)
12. Write a program for distance vector algorithm to find suitable path for transmission. ..Page (70)
13. Using TCP/IP sockets, write a client server program to make the client send the file name and to make the server send back the contents of the requested requested file if present ..Page (73)
14. Implement the above program using as message queues or FIFOs as IPC channels (Note: This experiment is not available in NetSim)
15. Write a program for simple RSA algorithm to encrypt and decrypt the data ..Page (78) 16. Write a program for Hamming code generation for error detection and correction ..Page (81)
17. Write a program for congestion control using leaky bucket algorithm ..Page (86)
-4-
Experiment 1
Objective: Introduce students to network simulation through the NetSim simulation package. Create a simple network model with multiple scenarios, Collect statistics on network performance through the use of NetSim tools and Analyze statistics and draw conclusions on network performance. Part A: Introduce students to network simulation through the NetSim simulation package. Theory: What is NetSim?
NetSim is a network simulation tool that allows you to create network scenarios, model traffic, and study performance metrics. metr What is a network?
A network is a set of hardware devices connected together, either physically or logically. This allows them to exchange information. A network is a system that provides its users with unique capabilities, above and beyond what the individual ndividual machines and their software applications can provide. What is simulation?
A simulation is the imitation of the operation of a real-world real world process or system over time. Network simulation is a technique where a program models the behavior of a network either by calculating the interaction between the different network entities (hosts/routers, data links, packets, packets, etc) using mathematical formulae, or actually capturing and playing back observations from a production network. The behavior of the network and the various applications and services it supports can then be observed in a test lab; various attributes of the environment can also be modified in a controlled manner to assess how the network would behave under different conditions.
-5-
Simulation: NetSim provides simulation of various protocols working in various networks as follows: Internetworks, Legacy Networks, BGP Networks, Networks MPLS Networks, Advanced Wireless ireless Networks, Cellular Networks, Wireless ireless Sensor Networks, Personal Area Networks and Cognitive Radio Networks. Users can open, save, and delete experiments as desired. The different experiments can also be analyzed using the analytics option in the simulation menu. Programming: NetSim covers vers various programming exercises along with concepts, algorithms, pseudo code and flowcharts. Users can also write write their own source codes in C/C++ and can link them to NetSim. Some of the programming concepts are Address resolution protocol (ARP), Classless inter domain routing (CIDR), Cryptography, Distance vector routing, shortest path, Subnetting etc. Real time: Frame capture is covered in this section. It is used to capture packets when there is an active data transfer taking place and also provides provides performance metrics. Basics: NetSim basics, gives a brief introduction and theoretical knowledge on different Internetworks, Legacy Networks, BGP Networks, , MPLS Networks, Advanced wireless Networks, Cellular Networks and devices. Basics also provide more than 200 animations for better understandability of networking concepts. Utilities: This section handles the user management section used for adding/deleting users, setting passwords etc.
-6-
Part B: Create a Simple network model with multiple scenarios. Collect statistics on network performance through the use of NetSim. Analyze statistics and draw conclusion on network performance. Theory: Network model: A Network model is a flexible way of representing devices and their relationships. Networking ing devices like hubs, switches, routers, nodes, connecting wires etc. are used to create a network model.
Drag and drop the node Drag and drop the hub
Click here to enable the trace Click here to simulate Right click on node to set properties
Scenario: A Scenario is a narrative describing foreseeable interactions of types of input data and its respective output data in the system.
Network performance: The fundamental parameters that measure the performance of a network are:Utilization is the fraction of the available bandwidth used for transmission of data expressed as a percentage (%). Delay is the amount of time taken for a packet to travel from one end of the network to the other.
-7-
Delay= queuing delay (ms) + transmission transmission time (ms) + medium access time (ms). Where queuing delay is the time the packet/frame waits in the queue prior to transmission, transmission time is the time taken by a packet/frame to travel across one hop, and medium access time is the time the data waits waits in the head of the queue to access the medium. What are network statistics? Network statistics are network performance related metrics collected at the end of a simulation run. The report at the end of the completion of an simulation experiment include metrics like throughput, simulation time, frames generated, frames dropped, frames errored, collision counts etc, and their respective values.
What is NetSim analytics used for? It is used to compare and analyze various protocols scenarios under Internetworks, Legacy Networks, BGP Networks, Networks, MPLS Networks, Advanced wireless Networks, Cellular Networks, Wireless Sensor Networks, Personal Area Networks and Cognitive Radio Networks. . Parameters like utilization, loss, queuing delay, transmission time etc of different sample experiments are compared with help of graphs.
-8-
Click on protocols to select the experiments Click to select the metrics Plot the chart here
-9-
Experiment 2
Objective: Simulate a three nodes point to point network with duplex links between them. Set the queue size and vary the bandwidth and find the number of packets dropped. dropped Theory: Router forwards packets from one o network to another network. When arrival rate of packets is greater than the service (departure) ( rate, packets get buffered (que queued). Once the buffer (queue) is completely filled, f , all arriving packets will be dropped. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks Sample Inputs: In this experiment, xperiment, 1 Router and 3 Wired Nodes need to be clicked & dropped onto the Simulation environment as shown below, NetSim Help F1 Running Simulation via GUI
Create Scenario.
- 10 -
Sample 1: Wired Node Properties: Node Properties Destination Traffic Type Wired Node 1 Wired Node 2 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) (m Constant 1200
Router Properties: Set buffer size to 8 MB. Accept default values for remaining parameters. Wired Link Properties: Link Properties Medium Type Uplink Speed (Mbps) Downlink Speed peed (Mbps) Uplink BER Downlink BER Wired Link 1 CAT-5 10 10 No Error No Error Wired Link 2 CAT-5 10 10 No Error No Error
- 11 -
Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after the following two tasks, Set the properties ies for the Wired Nodes, Router and Wired Links. Click on the Simulate button).
Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel Sample 2: Wired Node Properties: Node Properties Destination Traffic Type Wired Node 1 Wired Node 2 Custom Packet Size Distribution File Size (Bytes) Constant 1460
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) (m Constant 1200
Router Properties: Set buffer size to 8 MB. Accept default values for remaining parameters.
- 12 -
Wired Link Properties: Link Properties Medium Type Uplink Speed (Mbps) Downlink Speed peed (Mbps) Uplink BER Downlink BER Wired Link 1 CAT-5 10 10 No Error No Error Wired Link 2 E2 8.448 8.448 No Error No Error
Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after the following two tasks, Set the properties for the Wired Nodes, Routers and Wired Links. Click on the Simulate button).
Change the medium type of Wired Link 2 to T2, E1, T1 and E0 to get Samples 3, 4, 5 and 6 respectively. The remaining properties for these samples are same as that of Samples 1 and 2. Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after the following two tasks, Set the properties for the Wired Nodes, Routers and Wired Links. Click on the Simulate button).
Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel Output: Open the Excel file and note down the number of packets dropped as shown in below table. These values are available under queue metrics in the metrics screen of NetSim also.
- 13 -
Dropped Packets
80000 70000 60000 Dropped Packets 50000 40000 30000 20000 10000 0 0.064 Mbps 1.54 Mbps 2.048 Mbps 6.312 Mbps 8.448 Mbps Link speed of Wired Link 2 10 Mbps
Inference The number of packets dropped decreases as the link speed of wired link increases. Hence from the Graph ph I it can be inferred that as as the link speed of second link decreases, packets arrival rate is higher than the rate at which packets are forwarded by the Router via link 2. As a result queue size increases quickly and the buffer gets filled. Hence the newly arrive packets at the queue will be dropped.
- 14 -
Experiment 3
Objective: Simulate a four node point-to to-point network with the links connected as follows: n0 n2, n1 n2 and n2 n3. Apply TCP agent between n0-n3 n0 n3 and UDP between n1-n3. n1 Apply relevant applications over TCP and UDP agents changing the parameter and determine the number of packets sent by TCP / UDP. Theory: TCP: TCP recovers data that is damaged, lost, duplicated, or delivered out of order by the internet communication system. This is achieved chieved by assigning a sequence number to each octet transmitted, and requiring a positive acknowledgment (ACK) from the receiving TCP. If the ACK is not received within a timeout interval, the data is retransmitted. At the receiver side sequence number is used to eliminate the duplicates as well as to order the segments in correct order since there is a chance of out of order reception. reception Therefore, in TCP no transmission errors will affect the correct delivery of data. UDP: UDP uses a simple transmission model with a minimum of protocol mechanism. It has no handshaking dialogues, and thus exposes any unreliability of the the underlying network protocol to the user's program. As this is normally IP over unreliable media, there is no guarantee of delivery, ordering or duplicate protection.
Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Click & drop Router and Wired Nodes onto the Simulation Environment as shown below.
- 15 -
Sample Inputs: Sample 1: Set the properties for the devices and links as shown below: Wired Node Properties: Wired Node Properties Wired Node 1 Destination Traffic Type Wired Node 3 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460 Packet Inter Arrival Time Distribution Constant Constant 10000 Constant 1460 Wired Node 2 Wired Node 3 Custom
Packet Inter Arrival 10000 Time (ms) TCP Properties TCP Enable UDP Properties UDP Disable
Disable
Enable
- 16 -
Router Properties: Accept the default properties for Router. Wired Link Properties: Accept the default properties for all Wired Links. Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
Sample 1: Wired Node 1 and Wired Node 2 transmit data to Wired Node 3 with the Packet Inter Arrival Time as 10000 ms. Likewise do the Sample 2 and Sample 3 by decreasing the Packet Inter Arrival Time as 5000 ms and 2500 ms respectively. (Note: Packet Inter Arrival Time (ms) field is available in Wired Node Properties) Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Router &Wired Links Then click on the Simulate button).
Comparison Chart: (Note: The Number of Segments Sent, Segments Received and Datagram Sent, Datagram Received will be available in the TCP Metrics and UDP Metrics of Performance Metrics screen of NetSim) NetSim
- 17 -
Graph I (Note: The he Packets transmitted successfully for TCP is Segments Received and for UDP is Datagram Received of the destination node i.e., Wired Node 3) Number of packets transmitted successfully in TCP and UDP
TCP vs UDP
45000 Packets transmitted successfully 40000 35000 30000 25000 20000 15000 10000 5000 0 10000 5000 Inter arrival time (Micro Sec) 2500 TCP UDP
Graph II Number of lost packets in TCP and UDP (Note: To get the No. of packet acket lost, For TCP, get the difference between Segments Sent and Segments Received and for UDP, get the difference between Datagram Sent and Datagram Received)
- 18 -
TCP vs UDP
1000 900 800 No.of packet lost 700 600 500 400 300 200 100 0 Exp1 Exp2 Experiment list Exp3 TCP UDP
Inference: Graph I, shows that the number of successful packets transmitted in TCP is greater than (or equal to) UDP. Because, when w TCP transmits a packet containing data, it puts a copy on a retransmission queue and starts a timer; when the acknowledgment for that data d is received, the segment is deleted from the queue. If the acknowledgment is not received before the timer runs out, t, the segment is retransmitted. So even though a packet gets errored or dropped that packet will be retransmitted in TCP, but UDP will not n retransmit such packets. As per the theory given and the explanation provided in the above paragraph, we see in Graph 2, that there is no packet loss in TCP but UDP has packet loss.
- 19 -
Experiment 4
Objective: Simulate the different types of internet traffic such as FTP, TELNET over a network and analyze the throughput. Theory: FTP is File Transfer Protocol that transfers the files from source to destination. It is an application plication layer protocol. The file transfer takes place over TCP. TELNET is Terminal l Network Protocol that is used to access the data in the remote machine. It is also an Application layer protocol. It establishes connection to the remote machine over TCP. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks Sample Inputs: FTP, Database, Voice and Video V are e the traffic types available as options in NetSim. To model other applications cations the Custom option is available. TELNET application has been modeled in NetSim by using custom custom traffic type. Packet Size and Packet Inter I Arrival Time for TELNET application is shown below: Packet Size Distribution Packet Size (Bytes) Constant 1460 NetSim Help F1 Running Simulation via GUI
Create Scenario.
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) (m Constant 15000
- 20 -
xperiment, 3 Routers and 8 Wired Nodes need to be clicked & dropped onto the In this experiment, Simulation environment. Wired Nodes 1, 2 and 3 are connected to Router 1. Wired Nodes 5, 6, 7 and 8 are connected to Router 3. Wired Node 4 is connected to Router 2. Router 1 and Router 3 are connected to Router 2. The network scenario is shown in fig 1. Then follow these steps: Sample 1: FTP Application from Wired Node 4 to Wired Node 5. Sample 2: FTP Application cation from Wired Node 4 to Wired Node 5. TELNET Application from Wired Node 1 to Wired Node 6.
Sample 3: FTP Application from Wired Node 4 to Wired Node 5. TELNET Application from Wired Node 1 to Wired Node 6. TELNET Application from Wired Node 2 to Wired Node 7. Sample 4: FTP Application from Wired Node 4 to Wired Node 5. TELNET Application from Wired Node 1 to Wired Node 6. TELNET Application from Wired Node 2 to Wired Node 7. TELNET Application from Wired Node 3 to Wired Node 8.
TELNET
FTP
Fig 1: The Network Scenario Inputs for the Sample experiment are given below: Set the following properties for all wired links.
- 21 -
Wired Node Properties: Set the following properties for Wired Node X if application a type is FTP and destination is Wired Node Y. Set the following properties for Wired Node A if application application type is TELNET and destination is Wired Node B. Node Properties Destination Traffic Type Wired Node X Wired Node Y FTP Size Distribution Size (Bytes) Constant 10000000 Inter Arrival Time Distribution Inter Arrival Time Constant 10 sec TCP Properties TCP Enable Enable Constant 15000 ms Constant 1460 Wired Node A Wired Node B Custom (for TELNET)
Router Properties: Accept default properties for the Router. Wired Link Properties: Set t the following foll properties for all Wired Links. inks. Link Properties Medium Type Uplink Speed peed (Mbps) Downlink Speed peed (Mbps) Uplink BER Downlink BER Simulation Time - 100 Sec Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel All Wired Links Link CAT-5 1 1 No Error No Error
- 22 -
Output:Open the Excel Sheet and note down the various throughputs as shown in the table below. These throughput values are available under application metrics in the metrics screen of NetSim. Experiment Number 1 2 2 3 3 3 4 4 4 4 Graph I Source Wired Node 4 Wired Node 4 Wired Node 1 Wired Node 4 Wired Node 1 Wired Node 2 Wired Node 4 Wired Node 1 Wired Node 2 Wired Node 3 Destination Wired Node 5 Wired Node 5 Wired Node 6 Wired Node 5 Wired Node 6 Wired Node 7 Wired Node 5 Wired Node 6 Wired Node 7 Wired Node 8 Application FTP FTP TELNET FTP TELNET TELNET FTP TELNET TELNET TELNET Throughput 0.799846 0.464397 0.487757 0.306483 0.330778 0.330778 0.228928 0.245747 0.246682 0.242944
FTP Throughput
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1FTP 1FTP + 1 TELNET 1FTP + 2 TELNET 1FTP + 3 TELNET Experiments FTP Throughput (Mbps)
- 23 -
Graph II
Inference From Graph I it can be inferred that FTP throughput decreases as the number of transmitting nodes of TELNET application increases. Wired link 5 is used for FTP traffic. All TELNET applications in this experiment exper also used Wired Link ink 5. Hence as the TELNET traffic over wired link 5 increases the FTP FTP throughput decreases.
From Graph II I it can be inferred that TELNET throughput of Wired Node 1 decreases as the number of transmitting nodes of TELNET application increases. TELNET traffic of wired node 1 flows through wired link 5. Other TELNET applications applications also used the wired link 5. Hence as the overall TELNET traffic over wired link 5 increases, increases the TELNET throughput of Wired Node 1 decreases.
- 24 -
Experiment 5
Objective: Simulate the transmission of ping messages over a network topology consisting of 6 nodes and find the number of packets dropped due to congestion. Theory: Ping is a computer network administration utility used to test the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time for messages sent from the originating host to a destination computer. Ping operates by sending Internet Control Message Protocol (ICMP) echo request packets to the target host and waiting for an ICMP response. In the process it measures the time from transmission to reception (round-trip time) and records any packet loss. Congestion occurs when the amount of incoming traffic is more than what the network can handle. In such cases, routers r store these packets in the buffer. All the packets that arrive after the buffer is filled are dropped. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks Sample Inputs: FTP, Database, Voice and Video are the traffic types available as options in NetSim. To model other applications the Custom option is available. Ping application has been modeled in NetSim by using custom traffic type. Packet Size and Packet Inter Arrival Arriva Time for Ping application is shown below: Packet Size Distribution Packet Size (Bytes) Constant 32 NetSim Help F1 Running Simulation via GUI
Create Scenario.
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) (m NetSim Experiment Manual Constant 100000 - 25 -
xperiment, 1 Router and 6 Wired Nodes need to be clicked& & dropped onto the In this experiment, Simulation environment. Wired Nodes are connected to Router as shown below.
Sample 1: Wired Node Properties: Node Properties Destination Traffic Type Codec Wired Node 1 (Application 1) Wired Node 6 Voice Constant Packet Size Distribution Packet Size (Bytes) Constant 160 Constant 32 Wired Node 1 (Application 2) Wired Node 6 Custom ---
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Service Type Constant 10000 CBR TCP Properties TCP Disable Disable Constant 100000 ---
- 26 -
Router Properties: Set buffer size to 8 MB. Set scheduling type of interface connected to Wired Node 6 to FIFO. Wired Link Properties: Link Properties Medium Type Uplink Speed (Mbps) Downlink (Mbps) Uplink BER Downlink BER Sample 2: Wired Node Properties: Node Properties Destination Traffic Type Codec Wired Node 1 (Application 1) Wired Node 6 Voice Constant Packet Size Distribution Packet Size (Bytes) Constant 160 Constant 32 Wired Node 1 (Application 2) Wired Node 6 Custom --Wired Link 1 T1 1.54 Wired Link 6 E0 0.064 0.064 10-6 10-6
Packet Inter Arrival Time Distribution Packet Inter Time (ms) Service Type Constant Arrival 10000 CBR TCP Properties TCP Disable Disable Constant 100000 ---
- 27 -
Router Properties: Set buffer size to 8 MB. Set scheduling type of interface connected to Wired Node 6 to Priority. Wired Link Properties: Link Properties Medium Type Uplink Speed peed (Mbps) Downlink (Mbps) Uplink BER Downlink BER Wired Link 1 T1 1.54 Wired Link 6 E0 0.064 0.064 10-6 10-6
Follow these steps to get remaining samples. 1. Add one more voice application to Sample 1 with source as Wired Node 2 and destination as Wired Node 6. Set the properties of Wired Link 2 (Medium Type: T1, Uplink Speed (Mbps): 1.54, Downlink Speed (Mbps): 1.54, Uplink BER: 10-6, Downlink BER: 10-6). In router properties, set scheduling type of interface connected to Wired Node 6 to FIFO and Priority to get Sample 3 and Sample 4 respectively. 2. Add one more voice application to Sample 3 with source as Wired Node 3 and destination as Wired Node 6. Set the properties of Wired Link 3 (Medium Type: T1, Uplink Speed (Mbps): 1.54, Downlink Speed (Mbps): 1.54, Uplink BER: 10-6, Downlink BER: 10-6). In router properties, set scheduling type of interface connected to Wired Node 6 to FIFO and Priority to get Sample 5 and Sample 6 respectively. res 3. Similarly, add one more voice application to Sample 5 and set router and Wired Link 4 properties to get Sample 7 and Sample 8. 4. Then add another voice application to Sample 7 and set properties to get Sample 9 and Sample 10.
- 28 -
Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after the following two tasks, Set the properties for the Wired Nodes, Router and Wired Links. Click on the Simulate button).
Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel Output: Open the Excel Sheet and note down the number of packets dropped and number of ping messages (Packets Received) received as shown in below table. These values are available under queue metrics and application metrics in the metrics screen of NetSim. Sample Number 1 2 3 4 5 6 7 8 9 10 No. of voice applications 1 1 2 2 3 3 4 4 5 5 Ping messages received 359 0 183 0 123 0 92 0 74 0 Total no. of dropped packets 0 0 0 0 0 0 0 0 7413 7409
Scheduling type
FIFO Priority FIFO Priority FIFO Priority FIFO Priority FIFO Priority
- 29 -
Inference From the table we can observe that number of ping messages received when scheduling type is Priority is less than number of ping messages received when scheduling type is FIFO. In NetSim, Voice messages have higher priority compared to ping messages. Hence when scheduling type is Priority, higher preference is given to voice messages. As a result, the number of ping messages received is lower when priority based scheduling is considered. From the table we can observe that packets are dropped when there are five voice applications. The number of packets that arrive at the router increases when there are more number of voice applications. As a result the buffer gets filled. All the packets that arrive after the buffer is filled will be dropped.
- 30 -
Experiment 6
Objective: Simulate imulate an Ethernet LAN using n nodes (6-10), (6 10), change error rate and data rate and compare throughput. Part A: To simulate an Ethernet LAN using n nodes (6-10), (6 10), change error rate and compare throughput. Theory: Bit error rate (BER): The bit error rate or bit error ratio is the number of bit errors divided by the total number of transferred bits during a studied time interval i.e. BER=Bit errors/Total number of bits For example, a transmission might have a BER of 10-5, meaning that on average, 1 out of every of 100,000 bits transmitted exhibits an error. The BER is an indication of how often a packet or other data unit has to be retransmitted because of an error. Unlike many other forms of assessment, bit error rate, BER assesses the full full end to end performance of a system including the transmitter, receiver and the medium between the two. In this way, bit error rate, BER enables the actual performance of a system in operation to be tested. Packet Error Rate (PER): The PER is the number of incorrectly received data packets divided by the total number of received packets. A packet is declared incorrect if at least one bit is erroneous. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Click & drop Wired Nodes and Switches onto the Simulation Environment as shown below. NetSim Experiment Manual - 31 -
Sample Inputs: Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel Sample 1: Set the properties for the devices and links as shown below: Wired Node Properties: Wired Node Properties Wired Node 1 Destination Traffic Type Wired Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460
Packet Inter Arrival 2500 Time (ms) TCP Properties TCP Disable
- 32 -
Switch Properties: Accept the default properties for Switches. Wired Link Properties: Wired Link Properties Uplink Speed (Mbps) Downlink Speed(Mbps) Uplink BER Downlink BER Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button). Link 1 10 10 No Error No Error Link 4 10 10 No Error No Error Link 5 10 10 No Error No Error
Sample 2: Set the properties for the devices and links as shown below: Wired Node Properties: Wired Node Properties Wired Node 1 Destination Traffic Type Wired Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460
Packet Inter Arrival 2500 Time (ms) TCP Properties TCP Disable
- 33 -
Switch Properties: Accept the default properties for Switches. Wired Link Properties: Wired Link Properties Uplink Speed (Mbps) Downlink Speed(Mbps) Uplink BER Downlink BER Link 1 10 10 10-9 10-9 Link 4 10 10 10-9 10-9 Link 5 10 10 10-9 10-9
Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
Sample 1: Wired Node 1 transmits data to Wired Node 4 with Uplink BER and Downlink BER as No Error Sample 2: Wired Node 1 transmits data to Wired Node 4 with Uplink BER and Downlink BER as 10-9 And so on do the Sample 3, Sample 4 and Sample 5 by increasing the Uplink BER and Downlink BER as 10-8, 10-7 and 10-6 accordingly. Simulation Time - 100 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel
- 34 -
Inference: From Graph I, we see that as the error rate is increased the number of errored packets increase. The increase is exponential since the error rate is increased in powers of 10. Obviously, errored packets are not delivered to the destination. And therefore when more packets get errored throughput decreases in Graph II.
- 35 -
Part B: Objective: To simulate an Ethernet LAN using n nodes (6-10), (6 10), change data rate and compare throughput. Theory: Data Rate: Data Rate is the speed at which data can be transmitted from one device to another. It is often measured in megabits (million bits) per second. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Click & drop Wired Nodes and Switches onto the Simulation Environment as shown below.
Sample Inputs: Upon completion of the experiment Save the experiments for comparisons that can be carried out in the Analytics section by using export to Excel. Excel
- 36 -
Sample 1: Set the properties for the devices and links as shown below: Wired Node Properties: Wired Node Properties Wired Node 1 Destination Traffic Type Wired Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 10000
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 1000
Switch Properties: Accept the default properties for Switches. Wired Link Properties: Wired Link Properties Uplink Speed (Mbps) Downlink Speed(Mbps) Uplink BER Downlink BER Link 1 20 20 No Error No Error Link 4 20 20 No Error No Error Link 5 20 20 No Error No Error
- 37 -
Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
Sample 2: Set the properties for the devices and links as shown below: Wired Node Properties: Wired Node Properties Wired Node 1 Destination Traffic Type Wired Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 10000
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 1000
- 38 -
Wired Link Properties: Wired Link Properties Uplink Speed (Mbps) Downlink Speed(Mbps) Uplink BER Downlink BER Link 1 40 40 No Error No Error Link 4 40 40 No Error No Error Link 5 40 40 No Error No Error
Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
Sample 1: Wired Node 1 transmits data to Wired Node 4 with Uplink Speed (Mbps) and Downlink Speed (Mbps) as 20 Sample 2: Wired Node 1 transmits data to Wired Node 4 with Uplink Speed (Mbps) and Downlink Speed (Mbps) as 40 And so on do the Sample 3 and Sample 4 by increasing the Uplink Speed (Mbps) and Downlink Speed (Mbps) as 60 and 80 accordingly. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Wired Nodes , Switches, &Wired Links Then click on the Simulate button).
- 39 -
Inference: The number of packets transmitted to the destination is based on the network links link speed. So when link is forwarding more packets, the number of packets transmitted to the destination is more. Because of this throughput linearly increases when data rate (link speed) increases in Graph I.
- 40 -
Experiment 7
Objective: To Simulate an Ethernet LAN using n nodes and set multiple traffic nodes and determine collision across different nodes. Theory: Carrier Sense Multiple Access Collision Detection (CSMA / CD) This protocol includes the improvements for stations to abort their transmissions as soon as they detect a collision. n. Quickly terminating damaged frames saves time and bandwidth. This protocol is widely used on LANs in the MAC sub layer. If two or more stations decide to transmit simultaneously, there will be a collision. Collisions can be detected by looking at the power wer or pulse width of the received signal and comparing it to the transmitted signal. After a station detects a collision, it aborts its transmission, waits a random period of time and then tries again, assuming that no other station has started transmitting ng in the meantime. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Legacy Networks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Drag & drop Hub and Wired Nodes onto the Simulation Environment as shown below.
Sample Input: Set the properties for the devices as shown below:
- 41 -
Wired Node NODE 1 Properties Transmission Point to Point Destination Traffic Type Node 2 Data
NODE 2
NODE 3
NODE 4
NODE 5
Application Data Size Distribution Application Data Size (Bytes) Inter Arrival Time Distribution Inter Arrival Time Constant 1000 Constant 1000 Constant 1000 Constant 1000 Constant 1000 Constant 1472 Constant 1472 Constant 1472 Constant 1472 Constant 1472
Hub Properties:
Values to be Selected 10
Error Rate (bit error rate) No error Physical Medium Twisted Pair
Simulation Time - 10 Seconds (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties of Wired Nodes and Hub Then click on the Simulate button). butto
- 42 -
Output: Collision Determination: Once the simulation is completed CollisionCount.txt file will be written in the temp path of the operating system. To reach re the temp folder Click Start then type %temp%/NetSim
Run and
Open the file in Excel. (Note: Please refer, Help Packet Trace
NetSim Help F1
Generating
In Excel go to Data and select Filter option then filter will be applied to all columns. And then click on the Source_ ource_ID Filter and select Sort Smallest to Largest to view the Collision_Count for the particular source together as shown in the figure.
- 43 -
Comparison Table: If collision occurs, the entry will be added in the table by incrementing the Collision _Count field value by 1. So the last entry of the particular Source_ID will consist of Total Collision_Count. Likewise note down the Collision_Count for all the Sources as shown below. Source_ID 1 2 3 4 5 Collision_Count 1146 1175 1188 1179 1184
Inference: As expected we see a large number of collisions in each node. Further, we notice that the number of collided packets in each node is approximately the same showing the inherent fairness of CSMA / CD. Performance studies indicate that CSMA/CD performs better at light network loads. With the increase in the number of stations sending data, it is expected that heavier traffic have to be carried on CSMA/CD LANs (IEEE 802.3). Different studies have shown that CSMA/CD performance tends to degrade rapidly as the load exceeds about 40% of the bus capacity. Above ve this load value, the number of packet collision raise rapidly due to the interaction among repeated transmissions and new packet arrivals. Collided packets will back off based on the truncated binary back off algorithm as defined in IEEE 802.3 standards. . These retransmitted packets also collided with the newly arriving packets.
- 44 -
Experiment 8
Objective: To Simulate an Ethernet LAN using n nodes and set multiple traffic nodes and plot contention window for different source/destination. Theory: Carrier Sense Multiple Access Acc Collision Detection (CSMA/CD) - Working of the truncated binary back off algorithm In Ethernet networks, the CSMA/CD is commonly used to schedule retransmissions after collisions. The retransmission is delayed by an amount of time derived from the slot time and the number of attempts to retransmit. retransmi After c collisions, a random number of slot times between 0 and 2c - 1 is chosen. For the first collision, each sender will wait 0 or 1 slot times. After the second collision, the senders will wait anywhere from 0 to 3 slot times (inclusive). ( ). After the third collision, the senders will wait anywhere from 0 to 7 slot times (inclusive), and so forth. As the number of retransmission attempts increases, the number of of possibilities for delay increases exponentially. The 'truncated' simply means that after a certain number of increases, the exponentiation stops; i.e. the retransmission n timeout reaches a ceiling, and thereafter does not increase any further. For example, if the ceiling is set at i = 10 (as it is in the IEEE 802.3 CSMA/CD standard), then the maximum delay de is 1023 slot times. Because these delays cause other stations that are sending to collide as well, there is a possibility that, on a busy network, hundreds of people may be caught in a single collision set. Because of this possibility, after 16 attempts attempts at transmission, the process is aborted. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Drag & drop Hub and Wired Nodes onto the Simulation Environment as shown below.
- 45 -
Sample Input: Set properties for the devices as shown below: Wired Node Properties: Wired Node Properties Transmission Destination Traffic Type Point to Point Node 2 Data Application Data Size Distribution Application Data Size (Bytes) Inter Arrival Time Distribution Inter Arrival Time Hub Properties: Hub Properties Data Rate(Mbps) Values to be Selected 10 Constant 2000 Constant 2000 Constant 1472 Constant 1472 Point to Point Node 1 Data NODE 1 NODE 4
Error Rate (bit error rate) No error Physical Medium Twisted Pair
- 46 -
Simulation Time - 10 Seconds (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties of Wired Nodes and Hub Then click on the Simulate button). butto
Output: Once the simulation is completed ContentionWindow.txt file will be written in the temp path of the operating system. To reach the temp folder Click Start then type %temp%/NetSim
Run and
NetSim Help F1
Generating
Packet Trace How to import Packet Trace to Excel?) In Excel go to Data and select Filter option then filter will be applied to all columns. And then click on the Source_ID Source_ Filter and select Sort Smallest to Largest to view the Contention_Window for the particular source together as shown in the figure.
- 47 -
Graph I
Comparison Chart:
Time(micro sec)
2035 49936 217696 417837 734801 982772 1361098 1797151 2104063 2402516 2731780 3162962 3670630 4046240 4386336 4671168 4974440 5357534 5823236 6245646 6614060 6981364 7475318 8039537 8440062 8881213 9291503 9718864
- 48 -
Graph II (Note: This graph is plotted for the first 200 collisions) Time vs. Contention Window Size
Inference: As explained above in the theory part, whenever a collision occurs the contention content window size is calculated and a random number is generated. With more number of transmitting nodes, the contention for the medium increases, causing more collisions and more retransmission attempts. . Hence the average contention window increases. From the above graph it can be observed that, that for each collision the contention window size increases, and at any time the maximum contention window size is 1023 (210-1). The maximum retry limit for a packet is 16, after which the packet is dropped.
- 49 -
Experiment 9
Objective: To simulate simple ESS and with transmitting nodes in wireless LAN by simulation and determine the performance with respect to transmission of packets. Theory: Wireless LAN is basically a LAN that transmits data over air, without any physical connection between devices. The transmission medium is a form of electromagnetic radiation. Wireless LAN is ratified by IEEE in the IEEE 802.11 standard. In most of the WLAN products on the market based on the IEEE 802.11b technology the transmitter is designed as a Direct Sequence Spread Spectrum Phase Shift Keying (DSSS PSK) modulator, which is capable of handling data rates of up to 11 Mbps. The underlying algorithm used in n Wireless LAN is known as the CSMA/CA Carrier Sense Multiple Access/Collision Avoidance algorithm. Procedure: How to Create Scenario & Generate Traffic: o Create Scenario: Help Internetworks NetSim Help F1 Running Simulation via GUI
Create Scenario.
Click & drop Switch, Access Points and Wireless Nodes onto the Simulation Environment as shown below.
- 50 -
Sample Inputs: Sample 1: Set the properties for the devices and links as shown below: Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties rties for Switch, Wireless Nodes ,Access points &Wired/Wireless Links Then click on the Simulate button).
- 51 -
Sample 2: Set the properties for the devices and links as shown below: Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Packet Size Distribution Packet Size (Bytes) Constant 1460 Constant 1460 Wireless Node 2 Wireless Node 5 Custom
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 2336 Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Switch, Wireless Nodes ,Access points &Wired/Wireless Wired/Wireless Links Then click on the Simulate button).
- 52 -
Sample 3: Set the properties for the devices and links as shown below: Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Packet Size Distribution Constant Constant 1460 Constant 1460 Wireless Node 2 Wireless Node 5 Custom Wireless Node 3 Wireless Node 6 Custom
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 2336 Constant 2336 Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Switch, Wireless Nodes ,Access points &Wired/Wireless Links Then click on the Simulate button).
- 53 -
Sample 4: Set the properties for the devices and links as shown below: Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Wireless Node 2 Wireless Node 5 Custom Packet Size Distribution Constant Constant 1460 Constant 1460 Constant 1460 Wireless Node 3 Wireless Node 6 Custom Wireless Node 4 Wireless Node 3 Custom
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 2336 Constant 2336 TCP Properties TCP Disable Disable Disable Disable Constant 2336 Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Switch, Wireless Nodes ,Access points &Wired/Wireless Links Then click on the Simulate button).
Sample 5: Set the properties for the devices and links as shown below: NetSim Experiment Manual - 54 -
Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Wireless Node 2 Wireless Node 5 Custom Packet Size Distribution Constant Constant 1460 Constant 1460 Constant 1460 Constant 1460 Wireless Node 3 Wireless Node 6 Custom Wireless Node 4 Wireless Node 3 Custom Wireless Node 5 Wireless Node 2 Custom
Packet Inter Arrival Time Distribution Packet Inter Arrival Time (ms) Constant 2336 Constant 2336 Constant 2336 Constant 2336 Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Switch, Wireless Nodes ,Access points &Wired/Wireless Links Then click on the Simulate button).
Sample 6: Set the properties for the devices and links as shown below:
- 55 -
Wireless Node Properties: Wireless Node Properties Destination Traffic Type Wireless Node 1 Wireless Node 4 Custom Wireless Node 2 Wireless Node 5 Custom Wireless Node 3 Wireless Node 6 Custom Packet Size Distribution Packet (Bytes) Constant Constant 1460 Constant 1460 Constant 1460 Constant 1460 Constant 1460 Wireless Node 4 Wireless Node 3 Custom Wireless Node 5 Wireless Node 2 Custom Wireless Node 6 Wireless Node 1 Custom
Size 1460
Packet Inter Arrival Time Distribution Constant Constant 2336 Constant 2336 TCP Properties TCP Disable Disable Disable Disable Disable Disable Constant 2336 Constant 2336 Constant 2336
AP Properties: Accept the default properties for APs. Switch Properties: Accept the default properties for Switches. Link Properties: Accept the default properties for Wired and Wireless Links. Simulation Time - 10 Sec (Note: The Simulation Time can be selected only after doing the following two tasks, Set the properties for Switch, Wireless Nodes ,Access points &Wired/Wireless Links Then click on the Simulate button).
- 56 -
- 57 -
Inference: If the number of nodes generating data increases then the number of packets transmitted in the network also increases. increases Hence there is a gradual increase in number of packets transmitted when the transmitting nodes increases in Graph I.If If more than one node is accessing the medium at the same time, time the particular node has to wait until the completion of packet transmission in the medium. medium Hence Node #1s throughput decreases decrease when number of transmitting nodes increases in Graph II.
- 58 -
4. Inside the properties window select Debugging and edit the Command Arguments as shown NetSim Experiment Manual - 59 -
5. Inside command argument add the following two paths a. Path to where NetSim is installed installed within double quotes . This is usually C:\Program Program Files\NetSim Files NetSim Standard. This can be got by right clicking on the NetSim icon and selecting selecting Find target or open file location. b. The windows temporary path which has the NetSim folder for temporary data. This can be got by Start->Run Start >Run and typing %temp%/NetSim
c. On clicking this, you will get a path similar to C:\Documents C: Documents and Settings\George George\Local Settings\Temp\NetSim. NetSim. As mentioned above, this should uld also be in double quotes , , and there should be a single space between the first path and the second path. For example: "C:\Program "C: Files\NetSim_Standard_SW_7 NetSim_Standard_SW_7.0" "C:\Documents and Settings\George George\Local Settings\Temp\NetSim 6. Now add a breakpoint to your code in your function or in the main ( ), and proceed with de-bugging bugging 7. At the end check if the output.txt present in the %temp%\NetSim %temp% NetSim path and the temp.txt present in the %temp%\NetSim %temp% path are exactly similar. Exact similarity would indicate that your code will work fine when you run it in user use mode the next time. NetSim Experiment Manual - 60 -
- 61 -
1. Get ASCII value of the first character. 2. Divide the ASCII value by 2 and append the remainder to a string. The quotient is taken as the next number for the division. 3. Repeat the above division until the quotient of the number is less than 2. 4. Finally a remainder string having 1s and 0s is obtained. This reminder is the binary representation of that character. 5. Continue the above process for all the characters in the data string (szcrc). Append 16 0s to the final binary string formed by the above step. Divide the binary converted data string using the Generator Polynomial (as given above in Concept). 1. Take the MSB 17 bits from the binary data string, 2. If the leading bit of the binary data string is 0, do an XOR operation with the 17 bits of 0s and get the remainder which is also 17 bits. 3. Else, if the leading bit of the binary data string is 1, do an XOR operation with the 17 bits with binary converted CRC - CCITT polynomial and get the remainder which is also 17 bits. 4. The first bit of the remainder remainder is left out and the remainder is made to 16 bits. 5. If there are successive bits in the data, make the previous remainder bit to 17 bits by bringing down the next bit into the data Convert the final remainder into HEXA equivalent character. 1. Divide the final remainder at the end of step 5.4 into blocks of 4 bits. 2. Convert each block into equivalent HEXA character. 3. Thus the output of this whole process will be a 4 - nibble checksum that is attached to the transmitting frame.
- 62 -
Receiver side CRC Coding Repeat the Steps 1 to 4 of the Sender side CRC coding and get the szcrc value for the data. Convert the HEXA equivalent string szSender to its binary format. This is the Hexadecimal to binary conversion process. Append the binary format of the above step to the szcrc variable. Then append 16 0s to the szcrc variable. Repeat the Steps 5 and 6 of the Sender Side CRC coding to calculate the CRC value for the receiver side. The output is stored in the variable szReceive szReceiv (array of characters with size 10).
Error Case Sender side Get the input from "Input.txt". Parse the file content. Call the In-built built function readFile (szfilename). It returns the stored value to the local variable szcrc . Convert the data string (szcrc ) to be transmitted into binary representation. representation 1. Get ASCII value of the first character. 2. Divide the ASCII value by 2 and append the remainder to a string. The quotient is taken as the next number for the division. 3. Repeat the above division until the quotient of the number is less than 2. 4. Finally we get the remainder string having 1s and 0s, which is the binary representation of that character. character 5. Continue above process for all the characters in the data string (szcrc ). ) Append 16 0s to the final binary string formed by the above step. Divide the binary converted data string using the Generator Polynomial (as given above in Concept).
- 63 -
1. Take the MSB 17 bits from the binary data string, 2. If the leading bit of the binary data string is 0, do an XOR operation with the 17 bits of 0s and get the remainder which is also 17 bits. 3. Else if the leading bit of the binary data string is 1, do an XOR operation with the 17 bits with binary converted CRC - CCITT polynomial and get g the remainder which is also 17 bits. 4. The first bit of the remainder is left out and the remainder is made to 16 bits. 5. If there are successive bits in the data, make the previous remainder bit to 17 bits by bringing down the next bit in the data Convert rt the final remainder into HEXA equivalent character. 1. Divide the final remainder at the end of step 5.4 into blocks of 4 bits. 2. Convert each block into equivalent HEXA character. 3. Thus the output of this whole process will be a 4-nibble 4 nibble checksum that is attached to the transmitting frame. Receiver side Repeat the Steps 1 to 4 of the Sender side CRC coding and get the szcrc szcr value for the data. Make some errors in the string szcrc by changing certain characters. The error string is stored in the variable szcrc . Write the Error string szcrc into the file Input.txt. The file path for the file Input.txt" is the path where you have installed insta the NetSim application. (Compulsory). Convert the HEXA equivalent string szSender to its binary format. This is the Hexadecimal to binary conversion process. Append the binary format of the above step to the szcrc variable. Then append 16 0s to the szcrc variable. Repeat the Steps 5 and 6 of the Sender Side CRC coding to calculate the CRC value for the receiver side.
- 64 -
Procedure: To begin with the experiment, open NetSim Click on Programming in the menu bar, select Error Detecting Codes and nd then select Cyclic Redundancy Check. The scenario will be obtained as shown below. Follow the steps. Step 1: Select the User mode to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1(Help) for details on how to proceed with your own code.
Select Mode
Click here to add the input text file Click Run to execute Click here to view concept, algorithm, pseudo Code & flow Click chart here to interface source
- 65 -
- 66 -
- 67 -
The process is then reapplied to the remaining n 1 items of the array. For n data items, the method requires n (n 1)/2 comparisons and, on the average, almost one-half one as many swaps. The bubble sort, therefore, theref is inefficient in large sorting jobs. Procedure: To begin with the experiment, open NetSim Click on Programming in the menu bar, select Sorting Techniques and then select Bubble. The scenario will be obtained as shown below. Follow the steps. Step 1: Select the User mode to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1(Help) for details on how to proceed with your own code.
Select Mode Select Type Select Order Select the value for how many numbers to be sort Give the value After give the value, click Add Click run to execute Click here ere to view concept, algorithm, pseudo Code & flow chart Click here to interface source code
- 68 -
Results:
Output table
- 69 -
Repeat steps 1 to 5 for all routers. Check whether any changes are made in any of the routers. If yes, then repeat the above steps, otherwise, quit the process. Procedure: To begin with the experiment, open NetSim Click on Programming from the menu bar and select Distance Vector Routing When you select the User mode, you have to write your own program in C/C++, compile and link to NetSim software for validation. Click Click on the F1 (Help) for details on how to proceed with your own code.
Click here to view Concept, Algorithm, pseudo Code & Flowchart Click here to interface source code
- 71 -
Results:
Output Table
- 72 -
Procedure: To begin with the experiment, open NetSim Click on Programming from the menu bar and select PC to PC Communication and then select Socket Programming When you select the User mode, you have to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1 (Help) for details on how to proceed with your own code. The scenario will be obtained as shown below. Follow the steps
Select Mode
Click Run to start Click here to view Concept, Algorithm, and Pseudo Code & Flowchart
Under Input there are two things, 1. When Operation is Client, then the Servers IP Address (Ex: 192.168.1.2) should be given in the Server IP Address field. 2. When Operation is Server, then the Servers IP Address (Ex: 192.168.1.2) would be automatically filled in the Local IP Address field.
- 74 -
Server Side
If the Operation is Client, the he scenario will be obtained as shown below, below
Client Side
- 75 -
Procedure: TCP First the Server should click on the Run button after which the Client should click on the Run button to Create the socket Client should click on the Connect button to establish the connection with server. The Client should click on the Send button to transmit the data to the Server. The Client should click on the Close button to terminate the Connection with Server. UDP First the Server should click on the Run button after which the Client should click on the Run button to Create the socket The Client should click on the Send button to transmit the data to the Server. The Client should click on the Close button to terminate the Connection with Server. If the Data is successfully transmitted then the Sent Data would be Received in the Server System. If the Data is successfully transmitted then the Sent Data would be Received in the Server System.
- 76 -
Results:
Received data
- 77 -
Experiment 15 - RSA
Objective: Write a program for simple RSA algorithm to encrypt and decrypt the data Theory: The Application Layer takes care of network security. Different encryption and decryption techniques are used to provide security to the data that is to be transmitted. Among these, is the public-key key cryptography. Public-key Public key cryptography requires each user to have two keys: a public key, used by the entire world for encrypting messages to be sent to the user; and a private key which the user needs needs for decrypting messages. RSA algorithm was discovered at the Massachusetts Institute of Technology (MIT). RSA stands for the initials of the three who discovered the algorithm: Rivest, Shamir and Adleman. Algorithm: The technique followed is: 1. Choose e two large primes, p and q, (typically greater than 10100). 2. Compute n = p * q and z = ( p - 1 ) * ( q - 1 ). 3. Choose a number relatively prime to z and call it Kp. 4. Find Ks such that (Ks * Kp) mod z = 1. To encrypt a message, P, compute C = PKs (mod n). To decrypt C, compute P = CKp (mod n). It can be proven that for all P in the specified range, the encryption and decryption functions are inversed. To perform the encryption, we need Ks and n. To perform the decryption, we need Kp and n. Therefore, the public ublic key consist of the pair (Ks,n) and the private key consist of (Kp,n). Procedure: To begin with the experiment, open NetSim Click on Programming from the menu bar and select Cryptography and then select Advanced RSA
- 78 -
When you select the User mode, you have to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1 (Help) for details on how to proceed with your own code. The scenario will be obtained as shown below. Follow the steps
Click Run to execute Click here to view Concept, Algorithm, and Pseudo Code & Flowchart Click here to Interface Source
- 79 -
Results:
Output
- 80 -
the Error Data 4. Compare the Check Bits values of the Original Input Data and the values. Keep a note of the Check Bit Position where the value differs. 5. Add all the position of the Check Bits where the values differ. The resultant value gives the position of the error bit in the Error Data of length ( m + r ) i.e. the total tot length which includes the length of the Input Data Bits and the Check Bits. Procedure: To begin with the experiment, open NetSim Click on Programming from the menu bar and select Error Correcting Code and then select Hamming Code When you select the User mode, you have to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1 (Help) for details on how to proceed with your own code. The scenario will be obtained as shown below. Follow the steps Step 1:
- 82 -
Step 2: After that you can type the input in the Textbox and Select the error position which is shown below
Click run to execute Click here to view the Concept, Algorithm, Pseudo code and Flow chart
- 83 -
Results: After you click RUN button you can see the Hamming string, Original data and Error data in binary format as shown in the following screen shots
- 84 -
Output
- 85 -
7. If the input rate is less than the output rate, no packet is stored in the buffer. (Store the input rate as output rate, discard packet as zero, for the corresponding correspon second). Increment timer. 8. Follow the steps outlined below until buffer capacity is zero. 9. If the buffer value is non-zero, non zero, reduce the buffer capacity by the output rate if the buffer value is more than the output rate. (Store the output rate, discard disca packet as zero, for the corresponding second). Increment timer. 10. If the buffer value is non-zero, non zero, reduce the buffer capacity to 0 if the buffer value is less than or equal to the output rate. (Store the buffer capacity; discard the packet as zero for the e corresponding second). Increment timer. 11. Store the total time value. 12. Write the required values to the output file Output.txt. Procedure: To begin with the experiment, open NetSim Click on Programming from the menu bar and select Leaky Bucket Algorithm. When you select the User mode, you have to write your own program in C/C++, compile and link to NetSim software for validation. Click on the F1 (Help) for details on how to proceed with your own code. The scenario will be obtained as shown below. below Follow the steps
- 87 -
Select Mode
Give Output capacity Give Buffer capacity Give Input capacity Click run to execute Click here to Concept, Algorithm, and Pseudo Code & Flow Chart
- 88 -
Results:
Output
- 89 -