200
Experiment Manual

Maharastra CCN NetSim Experiment Manual

Embed Size (px)

Citation preview

Page 1: Maharastra CCN  NetSim Experiment  Manual

Experiment Manual

Page 2: Maharastra CCN  NetSim Experiment  Manual

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 the accuracy of any information 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, 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 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, 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 9.0 (MAH CCN), October 2016 , 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

Page 3: Maharastra CCN  NetSim Experiment  Manual

Contents

1. Networking Architecture ....................................................................... 6

2. Configure and analyze the TCP versus UDP response Time With HTTP

Application ..................................................................................................... 6

3. Simulation of different types of internet traffic such as FTP, TELNET

over a network and analyzing the throughput .............................................. 10

4. Network Socket Programming ............................................................. 15

5. Simulating a three node point-to-point network and applying relevant

applications over TCP and UDP..................................................................... 23

6. Stop & Wait Protocol ........................................................................... 28

7. Go Back N Protocol .............................................................................. 33

8. Selective Repeat Protocol .................................................................... 40

9. Study the throughputs of Slow start + Congestion avoidance (Old

Tahoe) and Fast Retransmit (Tahoe) Congestion Control Algorithms ............ 47

10. Implementation of QoS in IEEE 802.11e Network ................................ 56

11. Study the working and routing table formation of Interior routing

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

First (OSPF) .................................................................................................. 61

12. Experiment on M/D/1 Queue: ............................................................. 69

13. Datagram network .............................................................................. 74

14. Distance Vector Routing ...................................................................... 74

15. IPV6 Addressing - EUI-64 Interface Identifier ....................................... 81

Page 4: Maharastra CCN  NetSim Experiment  Manual

16. IPV6 Host Addresses ............................................................................ 84

17. IPV6 Subnetting ................................................................................... 87

18. Link State Routing ............................................................................... 91

19. Study the working of BGP and formation of BGP Routing table ........... 98

20. Analyze the performance of a MANET, (running CSMA/CA (802.11b) in

MAC) with increasing node mobility. .......................................................... 103

21. Spanning Tree ................................................................................... 108

22. Analyzing the difference between Hub Vs Switch transmission ......... 115

23. Study the effect of Peak Cell Rate (per Sec) and Cell Delay Variation

Tolerance on the performance of an ATM Networks .................................... 56

24. Network performance analysis with an ATM switch implementing

different scheduling techniques like First in First out (FIFO), Priority, and

Round Robin ................................................................................................ 60

25. Understand IP forwarding within a LAN and across a router ................ 74

26. Study how the Data Rate of a Wireless LAN (IEEE 802.11b) network

varies as the distance between the Access Point and the wireless nodes is

varied. .......................................................................................................... 81

27. Analyze the performance of a MANET, (running CSMA/CA (802.11b) in

MAC) with increasing node density .............................................................. 86

28. Understand the impact of bit error rate on packet error and investigate

the impact of error of a simple hub based CSMA / CD network .................... 95

29. To determine the optimum persistence of a p-persistent CSMA / CD

network for a heavily loaded bus capacity. ................................................ 100

30. To study the working of Time Division Multiple Access technique ..... 104

Page 5: Maharastra CCN  NetSim Experiment  Manual

31. Orthogonal Frequency Division Multiple Access ................................ 107

32. Plot the characteristic curve throughput versus offered traffic for a

Slotted ALOHA system. .............................................................................. 112

33. Physical layer services and system .................................................... 117

34. Study how call blocking probability varies as the load on a GSM

network is continuously increased. ............................................................ 117

35. Analysis of GSM Handover ................................................................ 121

36. Study how the number of channels increases and the Call blocking

probability decreases as the Voice activity factor of a CDMA network is

decreased .................................................................................................. 124

37. Mobility Models in Wi-MAX (IEEE 802.16e/m) Network .................... 128

Page 6: Maharastra CCN  NetSim Experiment  Manual

1. Networking Architecture

1.1 OSI model, TCP-IP Model

Refer: Study theory from NetSim “Basic Menu Introduction Networking Architecture”

2. Configure and analyze the TCP versus UDP

response Time With HTTP Application

2.1 Theory

TCP provides connection-oriented service at the transport layer, and UDP provides

connectionless service. As a result, a data exchange using TCP can take longer than the same

exchange using UDP. TCP implementations require that the TCP source and destination

perform a three-way handshake in order to set up the connection prior to sending data, and a

four-way handshake when tearing down the connection. In addition, all data must be

acknowledged by the destination when it is received. UDP sources, on the other hand, do not

set up connections and so save the overhead in terms of delay and bandwidth usage. UDP is

often used when small amounts of data must be sent, for example, when doing credit card

verification. If large amounts of data are sent, however, the extra TCP overhead may be

negligible in comparison to the entire transaction completion time

Part-A – TCP

2.2 Procedure:

Sample 1

Step 1:

Go to Simulation New Internetworks

Page 7: Maharastra CCN  NetSim Experiment  Manual

Step 2:

Click & drop 2 Wired Nodes and 1

Router on the Simulation Environment

as shown and link them.

Application Properties

Application Type HTTP

Source_Id 2(Wired Node D)

Destination_Id 3(Wired Node C)

Page Property

Distribution Constant

Page Count 10

Page Size (bytes) 1000

Inter Arrival Time

Distribution Constant

Value ( secs) 1

Step 3:

Enable Packet Trace in Ribbon

Step 4:

Simulation Time - 10 sec

(Note: The Simulation Time can be selected only after the following two tasks,

Enable Packet Trace

Click on Run Simulation button.

After completion of the experiment, “Save” the experiment for future analysis of results.

Page 8: Maharastra CCN  NetSim Experiment  Manual

Part-B – UDP

2.3 Procedure:

Sample 2:

Open Sample 1 and Disable TCP in Transport Layer in both Wired Nodes and Router.

Simulation Time - 10 sec

(Note: The Simulation Time can be selected only after the following two tasks,

Enable Packet Trace

Click on Run Simulation button)

2.3.1 Output:

Open Packet Trace from performance metrics window

Apply filter option from Excel sheet, filter PACKET TYPE column: Select only HTTP

TCP Packet Trace

TCP Response Time: 1000385.28 - 1000054.56 = 330.72

Page 9: Maharastra CCN  NetSim Experiment  Manual

UDP Packet Trace

UDP Response Time: 1000321.12-1000000.96=320.16

Response Time

( micro. sec)

TCP 330.72

UDP 320.16

2.4 Inference:

Response time of TCP is greater than UDP. Since TCP performs three way handshake

mechanisms, for each packet it has to wait for an acknowledgement. But in case of UDP,

there is no acknowledgement. Hence compared to TCP, UDP has less Response

Page 10: Maharastra CCN  NetSim Experiment  Manual

3. Simulation of different types of internet

traffic such as FTP, TELNET over a network

and analyzing the throughput

3.1 Theory:

FTP is File Transfer Protocol that transfers the files from source to destination. It is an

application layer protocol. The file transfer takes place over TCP.

TELNET is Terminal 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.

3.2 Procedure:

3.2.1 How to Create Scenario & Generate Traffic:

Create Scenario: “Simulation New Internetworks”.

3.2.2 Sample Inputs:

FTP, Database, Voice, HTTP, Email, Peer to Peer and Video are the traffic types available as

options in NetSim. To model other applications the “Custom” option is available. TELNET

application has been modeled in NetSim by using custom traffic type. Packet Size and Packet

Inter Arrival Time for TELNET application is shown below:

Packet Size

Distribution Constant

Packet Size (Bytes) 1460

Packet Inter Arrival Time

Distribution Constant

Packet Inter Arrival Time (µs) 1500

Page 11: Maharastra CCN  NetSim Experiment  Manual

Fig 1: The Network Scenario

In this experiment, 8 Wired Nodes and 3 Routers need to be clicked & dropped onto the

Simulation environment. Wired Nodes A, B and C are connected to Router I. Wired Nodes E,

F, G and H are connected to Router K. Wired Node D is connected to Router J. Router I and

Router K are connected to Router J. The network scenario is shown in above fig 1.

Then follow these steps:

Sample 1: FTP Application from Wired Node D to Wired Node E.

Sample 2: FTP Application from Wired Node D to Wired Node E. TELNET Application

from Wired Node A to Wired Node F.

Sample 3: FTP Application from Wired Node D to Wired Node E. TELNET Application

from Wired Node A to Wired Node F. TELNET Application from Wired Node B to Wired

Node G.

Sample 4: FTP Application from Wired Node D to Wired Node E. TELNET Application

from Wired Node A to Wired Node F. TELNET Application from Wired Node B to Wired

Node G. TELNET Application from Wired Node C to Wired Node H.

Note: Select “custom” for “TELNET” application

TELNET

FTP

Page 12: Maharastra CCN  NetSim Experiment  Manual

Inputs for the Sample experiment are given below:

Set the following properties for all wired links.

Wired Node Properties:

Set the following properties for Wired Node D if application type is FTP and destination is

Wired Node E. Set the following properties for Wired Node A if application type is TELNET

and destination is Wired Node F.

Node Properties Wired Node D Wired Node A

Transport Layer Properties

TCP Enable Enable

Application Properties: (set the application property as per screenshot)

Application Type FTP Custom(for TELNET)

Source ID Wired Node D Wired Node A

Destination ID Wired Node E Wired Node F

Size

Distribution Constant Constant

Size (Bytes) 10000000 1460

Inter Arrival Time

Distribution Constant Constant

Inter Arrival Time 10 sec 1500 (µs)

Router Properties: Accept default properties for the Router.

Wired Link Properties: Set the following properties for all Wired Links.

Link Properties All Wired Links

Uplink Speed (Mbps) 1

Downlink Speed (Mbps) 1

Uplink BER No Error

Downlink BER No Error

Simulation Time - 100 Sec

Page 13: Maharastra CCN  NetSim Experiment  Manual

Upon completion of the experiment “Save” the experiments for comparisons which is carried

out in the “Analytics” section and export to .csv to save the results.

3.2.3 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

Source Destination Application Throughput

1 Wired Node D Wired Node E FTP 0.842595

2 Wired Node D Wired Node E FTP 0.662840

2 Wired Node A Wired Node F TELNET 0.257427

3 Wired Node D Wired Node E FTP 0.557720

3 Wired Node A Wired Node F TELNET 0.175550

3 Wired Node B Wired Node G TELNET 0.189917

4 Wired Node D Wired Node E FTP 0.486706

4 Wired Node A Wired Node F TELNET 0.146818

4 Wired Node B Wired Node G TELNET 0.142262

4 Wired Node C Wired Node H TELNET 0.144949

3.2.3.1 Graph I

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1 FTP 1 FTP + 1 TELNET 1 FTP + 2 TELNET 1 FTP + 3 TELNET

FTP

Th

rou

ghp

ut(

Mb

ps)

FTP Throughput

Page 14: Maharastra CCN  NetSim Experiment  Manual

3.2.3.2 Graph II

3.2.4 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 also used Wired Link 5. Hence as the TELNET

traffic over wired link 5 increases the FTP throughput decreases.

From Graph II 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 also used the wired link 5.

Hence as the overall TELNET traffic over wired link 5 increases, the TELNET throughput

of Wired Node 1 decreases.

0

0.05

0.1

0.15

0.2

0.25

0.3

1 FTP + 1 TELNET 1 FTP + 2 TELNET 1 FTP + 3 TELNET

TELN

ET T

hro

ugh

pu

t(M

bp

s)

TELNET Throughput of Wired Node 1

Page 15: Maharastra CCN  NetSim Experiment  Manual

4. Network Socket Programming

4.1 Objective

Study of Socket Programming and Client – Server model

4.2 Theory:

The socket is a fundamental concept to the operation of TCP/IP application software. It is

also an interface between the application and the network. The exchange of data between a

pair of devices consists of a series of messages sent from a socket on one device to a socket

on other.

Once the socket is configured, the application can send the data using sockets for network

transmission and receive the data using sockets from the other host. A socket communication

can be connection oriented (TCP sockets) or connectionless (UDP sockets).

There is a receiver (TCP) server, which listens to the sender (TCP) client communications.

There can be two-way communication.

4.3 Algorithm:

Server:

1. Create a socket using address family (AF_INET), type (SOCK_STREM) and protocol

(TCP)

2. Initialize the address family, port no and IP address to communicate using sockets

3. Bind a local address and port number with a socket

4. Listen for an incoming socket connection

5. Accept an incoming connection attempt on a socket

6. Receive an incoming message

7. Write that incoming message to Output.txt

8. Send ACK to received socket

9. Call step 5 to receive the message once again

10. Close file

11. Close socket

Page 16: Maharastra CCN  NetSim Experiment  Manual

Client:

1. Create a socket using address family (AF_INET), type (SOCK_STREM) and protocol

(TCP)

2. Initialize the address family, port no and IP address to communicate using sockets

3. Establish Connection with destination IP

4. Send the data using the socket id

5. Close the socket connection

4.4 Procedure:

Step:1

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

Under Input there are two things,

1. When Operation is Client, then the Server’s IP Address (Ex: 192.168.1.2) should

be given in the Server IP Address field.

Select Mode

Select Protocol

Select Operation

Click Run to start

transmission Click here to view Concept,

Algorithm, and Pseudo Code

& Flowchart

Page 17: Maharastra CCN  NetSim Experiment  Manual

2. When Operation is Server, then the Server’s IP Address (Ex: 192.168.1.2) would

be automatically filled in the Local IP Address field.

If the Operation is Server, the scenario will be obtained as shown below,

If the Operation is Client, the scenario will be obtained as shown below,

Server

Side

Client

Side

Page 18: Maharastra CCN  NetSim Experiment  Manual

Step:2

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.

If the Data is successfully transmitted then the Sent Data would be Received in the

Server System.

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.

Enter Destination

IP Address Enter data to be

transmitted

Page 19: Maharastra CCN  NetSim Experiment  Manual

4.4.1 Result:

User Mode (TCP)

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

In User Mode, the user needs to edit the Interface Source Code at the following location.

int fnTcpServer()

{

// Write your own code here

return 0;

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

int fnTcpServer()

{

/////* User code part start */

nSocketfd =(int) socket(AF_INET,SOCK_STREAM, 0);

serv_addr.sin_family = AF_INET;

serv_addr.sin_port = htons(SERVER_PORTNUMBER);

serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);

Received

data

Page 20: Maharastra CCN  NetSim Experiment  Manual

nBindfd = bind(nSocketfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr));

#ifndef _NETSIM_SAMPLE

nListenfd = listen(nSocketfd, 5);

#else

nListenfd = listen(nSocketfd, 1);

#endif

nServerLen = sizeof(serv_addr);

if (fnWriteOutput() == 1)

{ /*if socket creation,bind and listen failed function will terminate*/

closesocket(nSocketfd);

return 0;

}

#ifndef _NETSIM_SAMPLE

nNewsocketfd =(int) accept(nSocketfd, (struct sockaddr *) &cli_addr,

&nServerLen);

nLoopCount++;

memset(szData, 0, sizeof(szData)); /*Clear the array*/

nReceivedbytes =(int) recv(nNewsocketfd, szData, sizeof(szData), 0);

fnWriteOutput();

nSendbytes =(int) send(nNewsocketfd, pszBuffer, strlen(pszBuffer), 0);

#else

while (1)

{

nNewsocketfd =(int) accept(nSocketfd, (struct sockaddr *) &cli_addr,

&nServerLen);

nLoopCount++;

memset(szData, 0, sizeof(szData)); /*Clear the array*/

nReceivedbytes =(int) recv(nNewsocketfd, szData, sizeof(szData), 0);

fnWriteOutput();

nSendbytes =(int) send(nNewsocketfd, pszBuffer, strlen(pszBuffer), 0);

if( nTCPServerCloseFlag == 1) /*break the loop when user send close the

connection*/

break;

}

#endif

closesocket(nSocketfd);

////* User code part end */

return 0;

}

User Mode (UDP)

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

In User Mode, the user needs to edit the Interface Source Code at the following location.

int fnUdpServer()

{

// Write your own code here

Page 21: Maharastra CCN  NetSim Experiment  Manual

return 0;

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

int fnUdpServer()

{

/////* User code part start */

nSocketfd = (int)socket(AF_INET,SOCK_DGRAM, 0); /*Server side socket

creation*/

serv_addr.sin_family = AF_INET;

serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);

serv_addr.sin_port = htons(SERVER_PORTNUMBER); /* Server port number 6000*/

nServerLen = sizeof(serv_addr);

nBindfd = bind(nSocketfd, (struct sockaddr *) &serv_addr,

sizeof(serv_addr));

fnWriteOutput();

#ifndef _NETSIM_SAMPLE

memset(szData, 0, sizeof(szData)); //Clear the array

nReceivedbytes = recvfrom(nSocketfd, szData, sizeof(szData), 0,(struct

sockaddr *) &serv_addr, &nServerLen);

fnWriteOutput();

#else

while(1)

{

memset(szData, 0, sizeof(szData)); //Clear the array

nReceivedbytes = recvfrom(nSocketfd, szData, sizeof(szData), 0,(struct

sockaddr *) &serv_addr, &nServerLen);

fnWriteOutput();

}

#endif

closesocket(nSocketfd);

/////* User code part end */

return 0;

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Repeat the steps performed for Sample Mode and click Run.

So presently NetSim will execute code written by the user and will display the result

graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

Page 22: Maharastra CCN  NetSim Experiment  Manual

Note- How to practice this experiment without using NetSim

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code. User must run the exe at both client and server and use the respective

Input.txt file. Inside Input.txt file at Client system, use the server system IP address in

“Destination IP Address” and client system IP address instead of “192.168.0.147:-Hello

World”

For TCP

Input.txt file contents at Server system

Protocol=TCP

Operation=Server

Input.txt file contents at Client system

Protocol=TCP

Operation=Client

Destination IP Address=192.168.0.130

192.168.0.147:-Hello World

Output.txt file contents at Server system

Socket Created

Bind Succeed

Listen Succeed

For UDP

Input.txt file contents at Server system

Protocol=UDP

Operation=Server

Input.txt file contents at Client system

Protocol=UDP

Operation=Client

Destination IP Address=192.168.0.130

192.168.0.147:-Hello World

Output.txt file contents at Server

system

Socket Created

Bind Succeed

Page 23: Maharastra CCN  NetSim Experiment  Manual

5. Simulating a three node point-to-point

network and applying relevant applications

over TCP and UDP

5.1 Objective:

Simulate a three node point-to-point network with the links connected as follows:

n0 n2, n1 n2 and n2 n3. Apply TCP agent between n0-n3 and UDP between n1-n3.

Apply relevant applications over TCP and UDP agents changing the parameter and determine

the number of packets sent by TCP / UDP. (n0, n1 and n3 are nodes and n2 is router).

5.2 Theory:

TCP:

TCP recovers data that is damaged, lost, duplicated, or delivered out of order by the internet

communication system. This is achieved 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. 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 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.

5.3 Procedure:

To Create Scenario, goto Simulation New Internetworks.

Click & drop Router, Wired Nodes and Application onto the Simulation Environment

from tool bar as shown below.

Page 24: Maharastra CCN  NetSim Experiment  Manual

5.3.1 Sample Inputs:

Sample 1

Set the properties for the devices and links as shown below:

Wired Node Properties:

Wired Node Properties Wired Node B Wired Node C

Transport Layer Properties

TCP Enable Disable

UDP Disable Enable

Application Properties:

Application Type Custom Custom

Source ID 2(Wired Node B) 3(Wired Node C)

Destination ID 4(Wired Node D) 4(Wired Node D)

Packet Size

Distribution Constant Constant

Value(Bytes) 1460 1460

Inter Arrival Time

Distribution Constant Constant

Value(µs) 10000 10000

To add an application, click add button in application property

Page 25: Maharastra CCN  NetSim Experiment  Manual

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 and Application.

Then click on Run simulation).

Sample 1: Wired Node B and Wired Node C transmit data to Wired Node D with the Packet

Inter Arrival Time as 10000 µs.

Likewise do the Sample 2 and Sample 3 by decreasing the Packet Inter Arrival Time as

5000 µs and 2500 µs respectively.

(Note: “Packet Inter Arrival Time (µs)” field is available in Application 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 and Application.

Then click on Run simulation).

5.3.2 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)

5.3.2.1 Graph I

(Note: The “Packets transmitted successfully” for TCP is Segments Received and for UDP

is Datagram Received of the destination node i.e., Wired Node 3)

Page 26: Maharastra CCN  NetSim Experiment  Manual

Below Graph Shows Number of packets transmitted successfully in TCP and UDP

5.3.2.2 Graph II

(Note: To get the “No. of packet lost”, For TCP, get the difference between Segments Sent

and Segments Received and for UDP, get the difference between Datagram Sent and

Datagram Received)

Below Graph Shows Number of lost packets in TCP and UDP

0

5000

10000

15000

20000

25000

30000

35000

40000

45000

Exp 1 Exp 2 Exp 3

Pac

kets

Tra

nsm

itte

d S

ucc

essf

ully

Inter arrival time (Micro Sec)

TCP vs UDP

TCP

UDP

0

10

20

30

40

50

60

70

80

90

100

Exp 1 Exp 2 Exp 3

No

. of

Pac

ket

Lost

Experiment List

TCP

UDP

Page 27: Maharastra CCN  NetSim Experiment  Manual

5.3.3 Inference:

Graph I, shows that the number of successful packets transmitted in TCP is greater than (or

equal to) UDP. Because, when TCP transmits a packet containing data, it puts a copy on a

retransmission queue and starts a timer; when the acknowledgment for that data is received,

the segment is deleted from the queue. If the acknowledgment is not received before the

timer runs out, the segment is retransmitted. So even though a packet gets errored or dropped

that packet will be retransmitted in TCP, but UDP will not 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.

Page 28: Maharastra CCN  NetSim Experiment  Manual

6. Stop & Wait Protocol

Objective: Write a C/C++ program to implement stop & wait protocol.

6.1 Theory:

Stop and Wait is a reliable transmission flow control protocol. This protocol works only in

Connection Oriented (Point to Point) Transmission. The Source node has window size of

ONE. After transmission of a frame the transmitting (Source) node waits for an

Acknowledgement from the destination node. If the transmitted frame reaches the destination

without error, the destination transmits a positive acknowledgement. If the transmitted frame

reaches the Destination with error, the receiver destination does not transmit an

acknowledgement. If the transmitter receives a positive acknowledgement it transmits the

next frame if any. Else if its acknowledgement receive timer expires, it retransmits the same

frame.

6.2 Algorithm:

Start with the window size of 1 from the transmitting (Source) node.After transmission of a

frame the transmitting (Source) node waits for a reply (Acknowledgement) from the

receiving (Destination) node.

If the transmitted frame reaches the receiver (Destination) without error, the receiver

(Destination) transmits a Positive Acknowledgement.

If the transmitted frame reaches the receiver (Destination) with error, the receiver

(Destination) do not transmit acknowledgement.

If the transmitter receives a positive acknowledgement it transmits the next frame if any. Else

if the transmission timer expires, it retransmits the same frame again.

Page 29: Maharastra CCN  NetSim Experiment  Manual

If the transmitted acknowledgment reaches the Transmitter (Destination) without error, the

Transmitter (Destination) transmits the next frame if any.

If the transmitted frame reaches the Transmitter (Destination) with error, the Transmitter

(Destination) transmits the same frame.

This concept of the Transmitting (Source) node waiting after transmission for a reply from

the receiver is known as STOP and WAIT.

6.3 Procedure:

Step 1:

To begin with the experiment, open NetSim

Click on Programming from the menu bar and select Transmission Flow Control. The

scenario is as shown in the following two figures.

Next the following window appears and its description is given.

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) icon for details on how to

proceed with your own code.

Continue with the steps as given for sample mode. As soon as you begin to enter the input

data file the following window appears and you select the input data file from where you

have stored.

Click Run to execute program

Click here to view concept, algorithm,

pseudo Code & flow chart

Enter input & error rate

Stop & Wait

Select Mode

Page 30: Maharastra CCN  NetSim Experiment  Manual

6.4 Result:

Click Run button to view the output.

6.5 Inference:

Due to increase in the error rate, no of errored packets also increase. If errored packets

increase no of retransmitted packets also increase.

Step 2:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void stopandwait(int errrate)

{

Data file

that is added

Output table

Page 31: Maharastra CCN  NetSim Experiment  Manual

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void stopandwait(int errrate) { /////* User code part start */

// Repeat the loop until transmission list of the transmitting

// node becomes empty

while(nodelist_sw->txframe != NULL) { // Get the current transmitting frame reference

transframe_sw = ret_txframe_SW (); // Write the content into the output file. Data Value is written

//into the file

fprintf(fp_sw,"DT>%d>%s>%s>\n",transframe_sw->iframe,transframe_sw->szsrcaddr,transframe_sw->szdestaddr); /*

Call the default function defined in the header file main1.h

Store the return value to the local variable iret_sw.

The Passed arguments

1. errrate -- This is the variable passed to the function (got from

the function call of the retErrorrate)

2. transframe_sw -- This is Eth_frame_sw reference that has the

Transmitting frame got from the function call ret_txframe_SW

*/

iret_sw=intro_error_SW(errrate,transframe_sw); // Write the content into the output file. Error value is written

into

//the file

fprintf(fp_sw,"EV>%d>%s>%s>\n",iret_sw,transframe_sw->szsrcaddr,transframe_sw->szdestaddr); // Check if the frame is Positive or Negative

if(iret_sw == 0)// Positive acknowledgment in the network

{ // Form the Ack frame according to the iret_sw value

form_ack_SW (transframe_sw,1);// Positive Acknowledgement

// Call the ret_ackframe_sw function and get the

acknowledgement frame

//reference from the tranmitting list of the receiving node

ackframe_sw=ret_ackframe_sw (); // Write the content into the file. Positive Ack value

fprintf(fp_sw,"ACK>POS>%s>%s>\n",ackframe_sw->szsrcaddr,ackframe_sw->szdestaddr); // Acknowledgement frame is made so delete the transmitted

frame from

//the transmitting list of the source node

del_frame_SW(transframe_sw ->ipack,transframe_sw ->iframe); // User defined function call to delete the Acknowledgement

frame

del_ackframe_sw (); } } /////* User code part end */

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Page 32: Maharastra CCN  NetSim Experiment  Manual

Select Stop and Wait and the Bit Error Rate (No Error or Error). Create a small text file

(within 15000 bytes) and set it as input.

Click Run.

So presently NetSim will run Stop and Wait code which is written by the user and will

display the result graphically. In case of any error, “ERROR IN USER CODE” message will

be displayed.

NOTE: Please insert the correct code according to the algorithm selected. The codes for other

algorithm are provided in NetSim Installation CD.

Note- How to practice this experiment without using NetSim:

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code. The Output.txt file will vary based on the Data_file. In this case, the

Data_File file contains the text “a”.

Input.txt file contents

Algorithm=Stop_and_Wait

Data_File=C:\Users\Nirjhar\Desktop\data.txt>

BER=0

*Note- Create any file of size <15000 Byte. Type the location of the file in Data_File.

Output.txt file contents

DT>1>node1>node2>

EV>0>node1>node2>

ACK>POS>node2>node1>

*Note- Output.txt content will vary depending on the file contents.

Page 33: Maharastra CCN  NetSim Experiment  Manual

7. Go Back N Protocol

Objective: Write a C/C++ program to implement Go Back N protocol.

7.1 Theory:

Go Back N is a connection oriented transmission. The sender transmits the frames

continuously. Each frame in the buffer has a sequence number starting from 1 and increasing

up to the window size. The sender has a window i.e. a buffer to store the frames. This buffer

size is the number of frames to be transmitted continuously. The size of the window depends

on the protocol designer.

7.2 Operations:

A station may send multiple frames as allowed by the window size.

Receiver sends an negative ACK if frame i has an error. After that, the receiver discards all

incoming frames until the frame with error is correctly retransmitted.

If sender receives a negative ACK it will retransmit frame i and all packets i+1, i+2, ... which

have been sent, but not been acknowledged.

Page 34: Maharastra CCN  NetSim Experiment  Manual

7.3 Algorithm:

The source node transmits the frames continuously.

Each frame in the buffer has a sequence number starting from 1 and increasing up to the

window size.

The source node has a window i.e. a buffer to store the frames. This buffer size is the number

of frames to be transmitted continuously.

The size of the window depends on the protocol designer.

For the first frame, the receiving node forms a positive acknowledgement if the frame is

received without error.

If subsequent frames are received without error (up to window size) cumulative positive

acknowledgement is formed.

If the subsequent frame is received with error, the cumulative acknowledgment error-free

frames are transmitted. If in the same window two frames or more frames are received with

error, the second and the subsequent error frames are neglected. Similarly even the frames

received without error after the receipt of a frame with error are neglected.

The source node retransmits all frames of window from the first error frame.

If the frames are errorless in the next transmission and if the acknowledgment is error free,

the window slides by the number of error-free frames being transmitted.

If the acknowledgment is transmitted with error, all the frames of window at source are

retransmitted, and window doesn‟t slide.

This concept of repeating the transmission from the first error frame in the window is called

as GOBACKN transmission flow control protocol.

7.4 Procedure

Step 1:

To begin with the experiment, open NetSim.

Click on Programming from the menu bar and select Transmission Flow Control.

The scenario will be as shown in the following two figures.

Page 35: Maharastra CCN  NetSim Experiment  Manual

Next the following window appears and its description is given.

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 F1 (help) for details on how to proceed with

your own code.

Continue with the steps as given for sample mode. As soon as you begin to enter the input

data file the following window appears and you select the input data file from where you

have stored.

Click here to view Concept, Algorithm, Pseudo

Code and Flow chart

Click Run to

execute program

Enter input & bit error rate

Go Back N

Select Mode

Data file that is added

Page 36: Maharastra CCN  NetSim Experiment  Manual

7.5 Result:

Click Run to view the output.

Step 2:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void GoBackN(int derrValue)

{

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void GoBackN(int derrValue) { /////* User code part start */

// This szfilename variable has the output file path where the user has

to

// write his output

framelist = nodelist->txframe; // Store Transmission list of the source //node to the local Eth_frame variable.

// Repeat the loop until transmission list becomes empty

while (nodelist->txframe != NULL) { ialreadyerror = 0;// Already Error flag value as 0 // Call the default function defined in the main.h.

isliindex = slidingcount();// Returns the number of frames to be

Output table

Page 37: Maharastra CCN  NetSim Experiment  Manual

//transmitted in the current window.

// Write the content into the output file. Slinding Window count

// is written into the file.

fp = fopen(szfilename, "a+"); fprintf(fp, "CNT>%d>FRAMES>TRANSMIT>\n", isliindex); fclose(fp); // Get the first frame from the transmission list

transframe = rettxframe(-1, -1); // Make the looping for isliindex variable for (iloop = 0; iloop < isliindex; iloop++) { // Write the content into the output file. Data Value is

// written into the file.

fp = fopen(szfilename, "a+"); fprintf(fp, "DT>%d>%s>%s>\n", transframe->iframe, transframe->szsrcaddr, transframe->szdestaddr); fclose(fp); /*

Call the default function defined in the header file main1.h

Store the return value to the local variable iret.

The Passed arguments

1. derrValue -- This is the variable passed to the function

(got from the function call of the retErrorrate)

2. transframe -- This is Eth_frame reference that has the

Transmitting frame got from the function call ret_txframe

*/

iret = intro_error(derrValue, transframe); // Write the content into the output file. Error value is

// written into the file

fp = fopen(szfilename, "a+"); fprintf(fp, "EV>%d>%s>%s>\n", iret, transframe->szsrcaddr, transframe->szdestaddr); fclose(fp); if (iret == 0)//No Error condition { if (ialreadyerror == 0) // Check for the Error Flag is 0 { formack(transframe); // Means Cumulative

acknowledgement

// frame formation } else { } } else // Error Condition

ialreadyerror = 1; // Make the Already Error flag

value as 1.

// Call the user defined function to get the next

transmission

// frame of the transmitting node.

transframe = rettxframe(transframe->ipack, transframe->iframe); } // Call the user defined function to get the acknowledgement frame

ackframe = ret_ackframe(); // Store the current transmission list reference of the

transmitting

// node from the local variable framelist.

nodelist->txframe = framelist; if (ackframe != NULL)// There is some positive acknowledgement

formed

{ // Write the content into the file. Positive Ack value

Page 38: Maharastra CCN  NetSim Experiment  Manual

fp = fopen(szfilename, "a+"); fprintf(fp, "ACK>POS>%s>%s>\n", ackframe->szsrcaddr, ackframe->szdestaddr); fclose(fp); for (iloop = 0; iloop < ackframe->iseq; iloop++) { // Call the function to delete the frame from the

transmission

// list of the transmitting node.

framelist = deltxframe(); } // Write the content into the file. Number of frames

deleted

// from the source node.

fp = fopen(szfilename, "a+"); fprintf(fp, "DEL>%d>FRAME>DELETED>\n", ackframe->iseq); fclose(fp); } // Call the user defined function to delete the acknowledgement

frame

//from the transmission list of the destination node.

del_ackframe(); } /////* User code part end */

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Select Go Back N and the Bit Error Rate (No Error or Error). Create a small text file (within

15000 bytes) and set it as input.

Click Run.

So presently NetSim will run Go Back N code which is written by the user and will display

the result graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

NOTE: Please insert the correct code according to the algorithm selected. The codes for other

algorithm are provided in NetSim Installation CD.

Note- How to practice this experiment without using NetSim:

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Page 39: Maharastra CCN  NetSim Experiment  Manual

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code. The Output.txt file will vary based on the Data_file. In this case, the

Data_File file contains the text “a”.

Input.txt file contents

Algorithm=Go_Back_N

Data_File=C:\Users\Nirjhar\Desktop\data.txt>

BER=0

*Note- Create any file of size <15000 Byte. Type the location of the file in Data_File.

Output.txt file contents

CNT>1>FRAMES>TRANSMIT>

DT>1>node1>node2>

EV>0>node1>node2>

ACK>POS>node2>node1>

DEL>1>FRAME>DELETED>

*Note- Output.txt content will vary depending on the file contents

Page 40: Maharastra CCN  NetSim Experiment  Manual

8. Selective Repeat Protocol

Objective: Write a C/C++ program to implement Selective Repeat protocol.

8.1 Theory:

Selective repeat is Similar to Go Back N. However, the sender only retransmits that frame for

which a negative ACK is received

Advantage over Go Back N:

Fewer retransmissions.

Disadvantages:

More complexity at sender and receiver.

Receiver may receive frames out of sequence.

Operations:

A station may send multiple frames as allowed by the window size.

Receiver sends a negative ACK if frame i has an error. After that, the receiver does not

discard all incoming frames as in Go Back N.

If sender receives a negative ACK it will retransmit only frame i which is the error frame.

Page 41: Maharastra CCN  NetSim Experiment  Manual

8.2 Algorithm:

The source node transmits the frames continuously.

Each frame in the buffer has a sequence number starting from 1 and increasing up to the

window size.

The source node has a window i.e. a buffer to store the frames. This buffer size is the number

of frames to be transmitted continuously.

The receiver has a buffer to store the received frames. The size of the buffer depends upon

the window size defined by the protocol designer.

The size of the window depends according to the protocol designer.

The source node transmits frames continuously till the window size is exhausted. If any of

the frames are received with error only those frames are requested for retransmission (with a

negative acknowledgement)

If all the frames are received without error, a cumulative positive acknowledgement is sent.

If there is an error in frame 3, an acknowledgement for the frame 2 is sent and then only

Frame 3 is retransmitted. Now the window slides to get the next frames to the window.

If acknowledgment is transmitted with error, all the frames of window are retransmitted. Else

ordinary window sliding takes place. (* In implementation part, Acknowledgment error is not

considered)

If all the frames transmitted are errorless the next transmission is carried out for the new

window.

This concept of repeating the transmission for the error frames only is called Selective

Repeat transmission flow control protocol.

8.3 Procedure

Step 1:

To begin with the experiment, open NetSim.

Click on Programming from the menu bar and select Transmission Flow Control.

Next the following window appears and its description is given.

Page 42: Maharastra CCN  NetSim Experiment  Manual

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.

Continue with the steps as given for sample mode. As soon as you begin to enter the input

data file the following window appears and you select the input data file from where you

have stored.

Click here to view Concept, Algorithm, and

Pseudo Code & Flow chart

Click Run to execute

the program

Enter input & bit error rate

Selective Repeat

Select mode

Data file that is added

Page 43: Maharastra CCN  NetSim Experiment  Manual

8.4 Result:

Click Run to view the output.

Step 2:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void SelRepeat(int nErrValue) {

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void SelRepeat(int nErrValue) { /////* User code part start */

// This szfilename_SR variable has the output file path where the user

has to write his output

framelist_SR = nodelist_SR->txframe;// Store Transmission list of the

source node to the local Eth_frame_SR variable.

Output table

Page 44: Maharastra CCN  NetSim Experiment  Manual

for(iloop_SR=0;iloop_SR<7;iloop_SR++) { szBuffer_SR[iloop_SR] = 0; } // Make the nCurrentFrame_SR as 0, That is the first frame of the window

is going to be transmitted

nCurrentFrame_SR = 0; // Repeat the loop until all the frames has been transmitted in the

network

while(nodelist_SR->txframe != NULL) { icount_SR = 0; // Get the first frame for the transmission

transframe_SR=retseltxframe(-1,-1); isliindex_SR = fnFrameCount_SR();// Get the count of number of

frames to be transmitted in the medium

// Write the content into the file

fp_SR = fopen(szfilename_SR,"a+"); fprintf(fp_SR,"CNT>%d>FRAMES>TRANSMIT>\n",isliindex_SR); fclose(fp_SR); ialreadyerror_SR = 0; // A flag value to say the error has

been introduced in the network

for(iloop_SR=0;iloop_SR<isliindex_SR;iloop_SR++) { // Store the temporary packet number,frame number in the

local variable

ipackno_SR=transframe_SR->ipack; iframeno=transframe_SR->iframe; // Open the file in appending mode

fp_SR = fopen(szfilename_SR,"a+"); fprintf(fp_SR,"DT>%d>%s>%s>\n",transframe_SR->iframe,transframe_SR->szsrcaddr,transframe_SR->szdestaddr); fclose(fp_SR); // Call the inbuild function to make error in the frame

iret_SR = intro_error_SR(nErrValue,transframe_SR); fp_SR = fopen(szfilename_SR,"a+"); fprintf(fp_SR,"EV>%d>%s>%s>\n",iret_SR,transframe_SR->szsrcaddr,transframe_SR->szdestaddr); fclose(fp_SR); if(iret_SR == 0)// No Error in the frame

{ // Make the frame has been received.

szBuffer_SR[(transframe_SR->iseq) - 1] = 1; } // Call the function to get the next transmission frame

transframe_SR=retseltxframe(ipackno_SR,iframeno); } // Store the transmission back to the original position

nodelist_SR->txframe = framelist_SR; // Formation of the acknowledgement

formselack(); // Get the acknowledgement frame of the transmission

ackframe_SR = retselackframe_SR(); if(ackframe_SR == NULL) { } else// Some frames has been received { fp_SR = fopen(szfilename_SR,"a+"); fprintf(fp_SR,"ACK>POS>%s>%s>\n",ackframe_SR->szsrcaddr,ackframe_SR->szdestaddr); fclose(fp_SR); // Loop to delete the frames

for(iloop_SR=0;iloop_SR<ackframe_SR->iseq;iloop_SR++)

Page 45: Maharastra CCN  NetSim Experiment  Manual

{ framelist_SR=delseltxframe(); } fp_SR = fopen(szfilename_SR,"a+"); fprintf(fp_SR,"DEL>%d>FRAME>DELETED>\n",ackframe_SR->iseq); fclose(fp_SR); } } /////* User code part end */

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Select Selective Repeat and the Bit Error Rate (No Error or Error). Create a small text file

(within 15000 bytes) and set it as input.

Click Run.

So presently NetSim will run Selective Repeat code which is written by the user and will

display the result graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

NOTE: Please insert the correct code according to the algorithm selected. The codes for other

algorithm are provided in NetSim Installation CD.

Note- How to practice this experiment without using NetSim:

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: “Programming exercise - How to practice

without NetSim”.

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code. The Output.txt file will vary based on the Data_file. In this case, the

Data_File file contains the text “a”.

Page 46: Maharastra CCN  NetSim Experiment  Manual

Input.txt file contents

Algorithm=Selective_Repeat

Data_File=C:\Users\Nirjhar\Desktop\data.txt>

BER=0

*Note- Create any file of size <5000 Byte. Type the location of the file in Data_File.

Output.txt file contents

CNT>1>FRAMES>TRANSMIT>

DT>1>node1>node2>

EV>0>node1>node2>

ACK>POS>node2>node1>

DEL>1>FRAME>DELETED>

*Note- Output.txt content will vary depending on the file contents.

Page 47: Maharastra CCN  NetSim Experiment  Manual

9. Study the throughputs of Slow start +

Congestion avoidance (Old Tahoe) and Fast

Retransmit (Tahoe) Congestion Control

Algorithms

9.1 Theory:

One of the important functions of a TCP Protocol is congestion control in the network. Given

below is a description of how Old Tahoe and Tahoe variants (of TCP) control congestion.

Old Tahoe:

Congestion can occur when data arrives on a big pipe (i.e. a fast LAN) and gets sent out

through a smaller pipe (i.e. a slower WAN). Congestion can also occur when multiple input

streams arrive at a router whose output capacity is less than the sum of the inputs. Congestion

avoidance is a way to deal with lost packets.

The assumption of the algorithm is that the packet loss caused by damaged is very small

(much less than 1%), therefore the loss of a packet signals congestion somewhere in the

network between the source and destination. There are two indications of packets loss: a

timeout occurring and the receipt of duplicate ACKs

Congestion avoidance and slow start are independent algorithms with different objectives.

But when congestion occurs TCP must slow down its transmission rate and then invoke slow

start to get things going again. In practice they are implemented together.

Congestion avoidance and slow start requires two variables to be maintained for each

connection: a Congestion Window (i.e. cwnd) and a Slow Start Threshold Size (i.e. ssthresh).

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

combined algorithm operates as follows,

1. Initialization for a given connection sets cwnd to one segment and ssthresh to 65535

bytes.

2. When congestion occurs (indicated by a timeout or the reception of duplicate ACKs),

one-half of the current window size (the minimum of cwnd and the receiver‟s advertised

Page 48: Maharastra CCN  NetSim Experiment  Manual

window, but at least two segments) is saved in ssthresh. Additionally, if the congestion is

indicated by a timeout, cwnd is set to one segment (i.e. slow start).

3. When new data is acknowledged by the other end, increase cwnd, but the way it increases

depends on whether TCP is performing slow start or congestion avoidance.

If cwnd is less than or equal to ssthresh, TCP is in slow start. Else TCP is performing

congestion avoidance. Slow start continues until TCP is halfway to where it was when

congestion occurred (since it recorded half of the window size that caused the problem in

step 2). Then congestion avoidance takes over.

Slow start has cwnd begins at one segment and be incremented by one segment every time an

ACK is received. As mentioned earlier, this opens the window exponentially: send one

segment, then two, then four, and so on. Congestion avoidance dictates that cwnd be

incremented by 1/cwnd, compared to slow start‟s exponential growth. The increase in cwnd

should be at most one segment in each round trip time (regardless of how many ACKs are

received in that RTT), whereas slow start increments cwnd by the number of ACKs received

in a round-trip time.

Tahoe (Fast Retransmit):

The Fast retransmit algorithms operating with Old Tahoe is known as the Tahoe variant.

TCP may generate an immediate acknowledgement (a duplicate ACK) when an out-of-order

segment is received out-of-order, and to tell it what sequence number is expected.

Since TCP does not know whether a duplicate ACK is caused by a lost segment or just a re-

ordering of segments, it waits for a small number of duplicate ACKs to be received. It is

assumed that if there is just a reordering of the segments, there will be only one or two

duplicate ACKs before the re-ordered segment is processed, which will then generate a new

ACK. If three or more duplicate ACKs are received in a row, it is a strong indication that a

segment has been lost. TCP then performs a retransmission of what appears to be the missing

segment, without waiting for a re-transmission timer to expire.

9.2 Procedure:

Go to Simulation New Internetworks

Page 49: Maharastra CCN  NetSim Experiment  Manual

Sample Inputs:

Follow the steps given in the different samples to arrive at the objective.

Sample 1.a: Old Tahoe (1 client and 1 server)

In this Sample,

Total no of Node used: 2

Total no of Routers used: 2

The devices are inter connected as given below,

Wired Node C is connected with Router A by Link 1.

Router A and Router B are connected by Link 2.

Wired Node D is connected with Router B by Link 3.

Set the properties for each device by following the tables,

Application Properties

Application Type Custom

Source_Id 4(Wired Node D)

Destination_Id 3(Wired Node C)

Packet Size

Distribution Constant

Value (bytes) 1460

Inter Arrival Time

Distribution Constant

Value (micro secs) 1300

Page 50: Maharastra CCN  NetSim Experiment  Manual

Node Properties: In Transport Layer properties, set

TCP Properties

MSS(bytes) 1460

Congestion Control Algorithm Old Tahoe

Window size(MSS) 8

Router Properties: Accept default properties for Router.

Link Properties Link 1 Link 2 Link 3

Max Uplink Speed (Mbps) 8 10 8

Max Downlink Speed(Mbps) 8 10 8

Uplink BER 0.000001 0.000001 0.000001

Downlink BER 0.000001 0.000001 0.000001

Simulation Time - 10 Sec

Upon completion of simulation, “Save” the experiment.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Node, Router& Link

Then click on Run Simulation button).

Sample 1.b: Tahoe (1 client and 1 server)

Open sample 1.a, and change the TCP congestion control algorithm to Tahoe (in Node

Properties). Upon completion of simulation, “Save” the experiment as sample 1.b.

Sample 2.a: Old Tahoe (2 clients and 2 servers)

In this Sample,

Page 51: Maharastra CCN  NetSim Experiment  Manual

Total no of Wired Nodes used: 4

Total no of Routers used: 2

The devices are inter connected as given below,

Wired Node A and Wired Node B are connected with Router C by Link 1 and Link 2.

Router C and Router D are connected by Link 3.

Wired Node E and Wired Node F are connected with Router D by Link 4 and Link 5.

Wired Node A and Wired Node B are not transmitting data in this sample.

Set the properties for each device by following the tables,

Application Properties Application 1 Application 2

Application Type Custom

Source_Id 5 6

Destination_Id 1 2

Packet Size

Distribution Constant Constant

Value (bytes) 1460 1460

Inter Arrival Time

Distribution Constant Constant

Value (micro secs) 1300 1300

Node Properties: In Transport Layer properties, set

TCP Properties

MSS(bytes) 1460

Congestion Control Algorithm Old Tahoe

Window size(MSS) 8

Page 52: Maharastra CCN  NetSim Experiment  Manual

Router Properties: Accept default properties for Router.

Link Properties Link 1 Link 2 Link 3 Link 4 Link 5

Max Uplink Speed

(Mbps)

8 8 10 8 8

Max Downlink Speed

(Mbps)

8 8 10 8 8

Uplink BER 0.000001 0.000001 0.000001 0.000001 0.000001

Downlink BER 0.000001 0.000001 0.000001 0.000001 0.000001

Simulation Time - 10 Sec

Upon completion of simulation, “Save” the experiment.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Node , Router & Link

Then click on Run Simulation button).

Sample 2.b: Tahoe (2 clients and 2 servers)

Do the experiment as sample 2.a, and change the congestion control algorithm to Tahoe.

Upon completion of simulation, “Save” the experiment.

Sample 3.a: Old Tahoe (3 clients and 3 servers)

In this Sample,

Page 53: Maharastra CCN  NetSim Experiment  Manual

Total no of Nodes used: 6

Total no of Routers used: 2

The devices are inter connected as given below,

Wired Node A, Wired Node B & Wired Node C is connected with Router D by Link 1,

Link 2 & Link 3.

Router D and Router E are connected by Link 4.

Wired Node F, Wired Node G & Wired Node H is connected with Router E by Link 5,

Link 6 & Link 7.

Wired Node A, Wired Node B and Wired Node C are not transmitting data in this sample.

Set the properties for each device by following the tables,

Application

Properties

Application 1 Application 2 Application 3

Application Type Custom

Source_Id 6 7 8

Destination_Id 1 2 3

Packet Size

Distribution Constant Constant Constant

Value (bytes) 1460 1460 1460

Inter Arrival Time

Distribution Constant Constant Constant

Value (micro sec) 1300 1300 1300

Node Properties: In Transport Layer properties, set

TCP Properties

MSS(bytes) 1460 1460 1460

Congestion Control

Algorithm

Old Tahoe Old Tahoe Old Tahoe

Window size(MSS) 8 8 8

Page 54: Maharastra CCN  NetSim Experiment  Manual

Router Properties: Accept default properties for Router.

Link

Properties

Link 1 Link 2 Link 3 Link 4 Link 5 Link 6 Link 7

Max Uplink

Speed

(Mbps)

8 8 8 10 8 8 8

Max

Downlink

Speed(Mbps)

8 8 8 10 8 8 8

Uplink BER 0.000001 0.000001 0.000001 0.000001 0.000001 0.000001 0.000001

Downlink

BER 0.000001 0.000001 0.000001 0.000001 0.000001 0.000001 0.000001

Simulation Time- 10 Sec

Upon completion of simulation, “Save” the experiment.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Node, Router & Link

Then click on Run Simulation button).

Sample 3.b: Tahoe (3 clients and 3 servers)

Do the experiment as sample 3.a, and change the TCP congestion algorithm to Tahoe. Upon

completion of simulation, “Save” the experiment.

9.3 Output

Comparison Table:

TCP

Downloads Metrics

Slow start +

Congestion avoidance

Fast

Retransmit

1 client and 1

server

Throughput(Mbps) 5.926432 6.120320

Segments Retransmitted +

Seg Fast Retransmitted 195 200

2 clients and 2

servers

Throughput(Mbps) 8.796208 8.810224

Segments Retransmitted +

Seg Fast Retransmitted 343 378

3 clients and 3

servers

Throughput(Mbps) 9.144272 9.23304

Segments Retransmitted +

Seg Fast Retransmitted 401 434

Page 55: Maharastra CCN  NetSim Experiment  Manual

Note: To calculate the “Throughput (Mbps)” for more than one application, add the

individual application throughput which is available in Application Metrics (or Metrics.txt) of

Performance Metrics screen. In the same way calculate the metrics for “Segments

Retransmitted + Seg Fast Retransmitted” from TCP Metrics Connection Metrics.

9.4 Inference:

User lever throughput: User lever throughput of Fast Retransmit is higher when compared

then the Old Tahoe (SS + CA). This is because, if a segment is lost due to error, Old Tahoe

waits until the RTO Timer expires to retransmit the lost segment, whereas Tahoe (FR)

retransmits the lost segment immediately after getting three continuous duplicate ACK‟s.

This results in the increased segment transmissions, and therefore throughput is higher in the

case of Tahoe.

Page 56: Maharastra CCN  NetSim Experiment  Manual

10. Implementation of QoS in IEEE 802.11e

Network

10.1 Theory:

IEEE 802.11e Medium Access Control (MAC) is an emerging supplement to the IEEE

802.11 Wireless Local Area Network (WLAN) standard to support Quality-of-Service (QoS).

The 802.11e MAC is based on both centrally-controlled and contention-based channel

accesses. The standard is considered of critical importance for delay-sensitive applications. It

offers all subscribers high-speed Internet access with video, audio, and voice over IP.

10.2 Procedure:

Step 1:

Go to Simulation New Internetworks

Sample 1:

Step 2:

Create scenario as per the screen shot:

Devices Required:

2 Wireless Node, 1 Access point,

1 Router, 1 Wired Node

Step 3:

Access Point Properties AP C

Global Properties

X_Coordinate 250

Y_Coordinate 100

Page 57: Maharastra CCN  NetSim Experiment  Manual

Step 4:

Wireless Node Properties Wireless Node B Wireless Node C

Global Properties

X_Coordinate 300 250

Y_Coordinate 100 150

Step 5:

Node properties: Disable TCP in all nodes in Transport layer as follows:

Wireless Link Properties:

Right click on Wireless link and Change the channel characteristics as “No Path Loss”

Channel Characteristics No Path Loss

Wired Link Properties:

Right click on Wired link and Change the Bit Error Rate

Wired Link Properties

Bit Error Rate 0

Page 58: Maharastra CCN  NetSim Experiment  Manual

Access Point Properties:

Right click on access point properties. In interface1_Wireless, enable IEEE802.11e and set

the buffer size as 5 as shown in below figure:-

Wireless Node Properties:

Right click on Wireless Node and in Interface1_Wireless, enable IEEE802.11e.

Step 6:

Select the Application Button and click on the gap between the Grid Environment and the

ribbon. Now right click on Application and select Properties as shown below:

Application Type Voice (Codec -Custom) CBR

Source ID 1 (Wired Node E) 1(Wired Node E)

Destination ID 4 ( Wireless Node C) 5( Wireless Node B)

Packet Size

Distribution Constant Constant

Value(Bytes) 1000 1000

Inter Arrival Time

Distribution Constant Constant

Value(µs) 800 800

Page 59: Maharastra CCN  NetSim Experiment  Manual

NOTE: The procedure to create multiple applications are as follows:

Step 1: Click on the ADD button present in the bottom left corner to add a new

application.

Simulation Time – 10 sec

After completion of the experiment, “Save” the experiment as Sample 1.

Sample 2:

Open Sample 1, and disable IEEE_802.11e in both Access point and Wireless Node

properties and run the simulation for 10 seconds.

10.3 Output

Comparison Table:

IEEE 802.11e

Application Generation rate

(Mbps)

Throughput

(Mbps)

Delay

(Micro. Sec.)

Enable Voice 10 4.67 2782736.5

CBR 10 0.0 0

Disable Voice 10 2.28 4099938.2

CBR 10 2.28 4100423.3

Page 60: Maharastra CCN  NetSim Experiment  Manual

10.4 Inference

802.11e is a proposed enhancement to the 802.11a and 802.11b Wireless LAN (WLAN)

specifications. It offers quality of service including which prioritization of voice, video and

data transmissions. Hence Throughput is obtained for voice transmission.

Page 61: Maharastra CCN  NetSim Experiment  Manual

11. Study the working and routing table

formation of Interior routing protocols, i.e.

Routing Information Protocol (RIP) and Open

Shortest Path First (OSPF)

11.1 Theory:

RIP

RIP is intended to allow hosts and gateways to exchange information for computing routes

through an IP-based network. RIP is a distance vector protocol which is based on Bellman-

Ford algorithm. This algorithm has been used for routing computation in the network.

Distance vector algorithms are based on the exchange of only a small amount of information

using RIP messages.

Each entity (router or host) that participates in the routing protocol is assumed to keep

information about all of the destinations within the system. Generally, information about all

entities connected to one network is summarized by a single entry, which describes the route

to all destinations on that network. This summarization is possible because as far as IP is

concerned, routing within a network is invisible. Each entry in this routing database includes

the next router to which datagrams destined for the entity should be sent. In addition, it

includes a "metric" measuring the total distance to the entity.

Distance is a somewhat generalized concept, which may cover the time delay in getting

messages to the entity, the dollar cost of sending messages to it, etc. Distance vector

algorithms get their name from the fact that it is possible to compute optimal routes when the

only information exchanged is the list of these distances. Furthermore, information is only

exchanged among entities that are adjacent, that is, entities that share a common network.

OSPF

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

destination.

Shortest path:

OSPF allows administrator to assign a cost for passing through a link. The total cost of a

particular route is equal to the sum of the costs of all links that comprise the route. A router

chooses the route with the shortest (smallest) cost.

Page 62: Maharastra CCN  NetSim Experiment  Manual

In OSPF, each router has a link state database which is tabular representation of the topology

of the network (including cost). Using dijkstra algorithm each router finds the shortest path

between source and destination.

Formation of OSPF Routing Table

1. OSPF-speaking routers send Hello packets out all OSPF-enabled interfaces. If two

routers sharing a common data link agree on certain parameters specified in their

respective Hello packets, they will become neighbors.

2. Adjacencies, which can be thought of as virtual point-to-point links, are formed between

some neighbors. OSPF defines several network types and several router types. The

establishment of an adjacency is determined by the types of routers exchanging Hellos

and the type of network over which the Hellos are exchanged.

3. Each router sends link-state advertisements (LSAs) over all adjacencies. The LSAs

describe all of the router's links, or interfaces, the router's neighbors, and the state of the

links. These links might be to stub networks (networks with no other router attached), to

other OSPF routers, or to external networks (networks learned from another routing

process). Because of the varying types of link-state information, OSPF defines multiple

LSA types.

4. Each router receiving an LSA from a neighbor records the LSA in its link-state

database and sends a copy of the LSA to all of its other neighbors.

5. By flooding LSAs throughout an area, all routers will build identical link-state databases.

6. When the databases are complete, each router uses the SPF algorithm to calculate a loop-

free graph describing the shortest (lowest cost) path to every known destination, with

itself as the root. This graph is the SPF tree.

7. Each router builds its route table from its SPF tree

11.2 Procedure

Sample 1:

Step 1:

Go to Simulation New Internetworks

Page 63: Maharastra CCN  NetSim Experiment  Manual

Step 2:

Click & drop Routers, Switches and Nodes onto the Simulation Environment and link them

as shown:

Step 3:

These properties can be set only after devices are linked to each other as shown above.

Set the properties of the Router 1 as follows:

Node Properties: In Wired Node H, go to Transport Layer and set TCP as Disable

Switch Properties: Accept default properties for Switch.

Link Properties: Accept default properties for Link.

Application Properties: Click and drop the Application icon and set properties as follows:

Page 64: Maharastra CCN  NetSim Experiment  Manual

Simulation Time - 100 Sec

After Simulation is performed, save the experiment.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Node, Switch, Router& Application

Then click on Run Simulation button).

Sample 2:

To model a scenario, follow the same steps as given in Sample1 and set the Router A

properties as given below:

Page 65: Maharastra CCN  NetSim Experiment  Manual

Link Properties:

Link Properties Link 3 Link 4 Link 5 Link 6 Link 7

Uplink Speed 100 100 100 10 10

Downlink Speed 100 100 100 10 10

Node Properties: In Wired Node H, go to Transport Layer and set TCP as Disable

Switch Properties: Accept default properties for Switch.

Application Properties: Click and drop the Application icon and set properties as in Sample

1.

Simulation Time- 100 Sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Node, Switch, Router& Application

Then click on Run Simulation button).

11.3 Output and Inference:

RIP

In Distance vector routing, each router periodically shares its knowledge about the entire

network with its neighbors. The three keys for understanding the algorithm,

1. Knowledge about the whole network

Router sends all of its collected knowledge about the network to its neighbors

2. Routing only to neighbors

Each router periodically sends its knowledge about the network only to those routers to

which it has direct links. It sends whatever knowledge it has about the whole network

through all of its ports. This information is received and kept by each neighboring router and

used to update that router‟s own information about the network

3. Information sharing at regular intervals

For example, every 30 seconds, each router sends its information about the whole

network to its neighbors. This sharing occurs whether or not the network has changed

since the last time information was exchanged

Page 66: Maharastra CCN  NetSim Experiment  Manual

In NetSim the Routing table Formation has 3 stages

Initial Table: This table will show the direct connections made by each Router.

Intermediate Table: The Intermediate table will have the updates of the Network in every

30 seconds

Final Table: This table is formed when there is no update in the Network.

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

The RIP table in NetSim

After running Sample1, click RIP table in Performance Metrics screen. Then click the

respective router to view the Routing table.

We have shown the routing table for Router 1,

Shortest Path from Wired Node H to WiredNode I in RIP (Use Packet Animation to view) :

WiredNode HSwitch FRouter1Router4Router5Switch GWired Node I

OSPF

Page 67: Maharastra CCN  NetSim Experiment  Manual

The main operation of the OSPF protocol occurs in the following consecutive stages and

leads to the convergence of the internetworks:

1. Compiling the LSDB.

2. Calculating the Shortest Path First (SPF) Tree.

3. Creating the routing table entries.

Compiling the LSDB

The LSDB is a database of all OSPF router LSAs. The LSDB is compiled by an ongoing

exchange of LSAs between neighboring routers so that each router is synchronized with its

neighbor. When the Network converged, all routers have the appropriate entries in their

LSDB.

Calculating the SPF Tree Using Dijkstra's Algorithm

Once the LSDB is compiled, each OSPF router performs a least cost path calculation called

the Dijkstra algorithm on the information in the LSDB and creates a tree of shortest paths to

each other router and network with themselves as the root. This tree is known as the SPF

Tree and contains a single, least cost path to each router and in the Network. The least cost

path calculation is performed by each router with itself as the root of the tree

Calculating the Routing Table Entries from the SPF Tree

The OSPF routing table entries are created from the SPF tree and a single entry for each

network in the AS is produced. The metric for the routing table entry is the OSPF-calculated

cost, not a hop count.

The OSPF table in NetSim

After running Sample 2, click OSPF Metrics in Performance Metrics screen. Then click

the router to view the Routing table

We have shown the routing table for Router 1:

Page 68: Maharastra CCN  NetSim Experiment  Manual

Shortest Path from Wired Node H to WiredNode I in OSPF (Use Packet Animation to view):

WiredNode HSwitch FRouter1Router2Router3Router5Switch G

WiredNode I

Note: The Cost is calculated by using the following formula

Reference Bandwidth = 100 Mbps

For Example,

Let us take, Link Speed UP = 100 Mbps

Page 69: Maharastra CCN  NetSim Experiment  Manual

12. Experiment on M/D/1 Queue:

-To create an M/D/1 queue: a source to generate packets,

a queue to act as the buffer and server, a sink to dispose

of serviced packets.

-To study how the queuing delay of such a system varies.

12.1 Theory:

In systems where the service time is a constant, the M/D/1, single-server queue model, can be

used. Following Kendall's notation, M/D/1 indicates a system where:

Arrivals are a Poisson process with parameter λ

Service time(s) is deterministic or constant

There is one server

For an M/D/1 model, the total expected queuing time is

Where µ = Service Rate = 1/Service time and is the utilization given as follows,

To model an M/D/1 system in NetSim, we use the following model

Traffic flow from Node 1 to Node 2 (Node 1: Source, Node 2: Sink)

Inter-arrival time: Exponential Distribution with mean 2000 µs

Packet size: Constant Distribution with mean of 1250 bytes

Page 70: Maharastra CCN  NetSim Experiment  Manual

Note:

1. Exponentially distributed inter-arrivals times give us a Poisson arrival process.

Different mean values are chosen as explained in the section Sample Inputs.

(Dropping the devices in different order may change the result because the random

number generator will get initialized differently)

2. To get constant service times, we use constant distribution for packet sizes. Since, the

service (which in our case is link transmission) times are directly proportional to

packet size (greater the packet size, greater the time for transmission through a link), a

constant packet size leads to a constant service time.

Procedure:

Create Scenario: “Simulation New Internetworks”.

Nodes 1 and Node 2 are connected with Router 1 by Link 1 and Link 2 respectively. Set the

properties for each device as given below,

Sample 1:

Application Properties: Click and drop the Application icon and set following properties:

Application Type Custom

Source_Id 1

Destination_Id 2

Packet Size Distribution Constant

Value (bytes) 1250

Inter Arrival Time

Distribution Exponential

Packet Inter Arrival

Time (µs)

2000

Disable TCP in the Transport Layer in Node Properties as follows:

Page 71: Maharastra CCN  NetSim Experiment  Manual

Link Properties Link 1 Link 2

Uplink Speed (Mbps) 10 10

Downlink Speed (Mbps) 10 10

Uplink BER 0 0

Downlink BER 0 0

Uplink Propagation Delay (ms) 0 0

Downlink Propagation Delay

(ms)

0 0

Router Properties: Accept the default properties for Router.

Simulation Time: 100 Sec

Observation:

Even though the packet size at the application layer is 1250 bytes, as the packet moves down

the layers, some overhead is added which results in a greater packet size. This is the actual

payload that is transmitted by the physical layer. The overheads added in different layers are

shown in the table:

Therefore, the payload size = Packet Size + Overhead

= 1250 + 54

= 1304 bytes

Theoretical Calculation:

By formula,

µ = Service Rate, i.e., the time taken to service each packet

Layer Overhead

(Bytes)

Transport Layer 8

Network Layer 20

MAC layer 26

Physical Layer 0

Total 54

Page 72: Maharastra CCN  NetSim Experiment  Manual

= Link capacity (bps) / (Payload Size (Bytes) * 8)

= (10×106) / (1304*8)

= 958.59 packets / sec

λ = Arrival rate, i.e., the rate at which packets arrive (Packets per second)

Inter-arrival time = 2,000 micro sec

Arrival rate λ = 1/ Inter Arrival time

= 1/2000 micro sec

= 500 packets / sec

ρ = Utilization

= λ/µ

= 500/958.59

= 0.522

By formula, Queuing Time =

= 569.61 micro sec

12.2 Output:

After running the simulation, check the “Delay” in the Application Metrics.

Delay = 2656.855 micro sec

This Delay (also known as Mean Delay) is the sum of Queuing Delay, Total Transmission

time and Routing Delay.

(

) (

) (

) (

)

Total Transmission Time is the sum of transmission time through Link 1 and Link 2.

Transmission time through each link is the same and is given by:

Transmission time through each link =

=

= 1043.2 micro sec

Routing Delay is approximately 1 micro sec and can be found from the Event Trace. It is the

difference between “Physical In” and “Physical Out” time for the Router.

Page 73: Maharastra CCN  NetSim Experiment  Manual

Therefore, for simulation

Queuing Delay = 2656.855– (2 × 1043.2) – 1 = 569.455 micro sec

Sample 2

Keeping all the other parameters same as in previous example, if Packet Inter Arrival Time is

taken as 1500 micro sec, then

λ = 666.67 packets per sec

Utilization ρ = λ/µ = 666.67/958.59 = 0.695

And Queuing Time T = 1188.56 micro sec

From NetSim,

Delay = 3279.297 micro sec

Therefore, Queuing Time = 3279.298 - (2×1043.2) – 1

= 1191.898 micro sec

Note: Obtained value is slightly higher than the theoretical value because of initial delays in

forming ARP table, Switch table and Routing table etc.

A Note on M/M/1 queuing in NetSim

M/M/1 queue can be generated similarly by setting the “Packet Size Distribution” as

“Exponential” instead of “Constant”. However, the results obtained from simulation deviate

from the theoretical value because of the effect of packet fragmentation. Whenever a packet

with size greater than Transport Layer MSS and / or MAC Layer MTU (which is 1500 bytes

in NetSim) is generated, it gets fragmented in the application layer. Then the packet is sent as

multiple frames, and makes it impossible to calculate the exact queuing time.

Page 74: Maharastra CCN  NetSim Experiment  Manual

13. Datagram network Study theory from NetSim “Basic Menu Introductiondatagram”

14. Distance Vector Routing

Objective: Write a C/C++ program to verify the distance vector routing algorithm

14.1 Theory:

Distance Vector Routing is one of the routing algorithms used in a Wide Area Network for

computing shortest path between source and destination. The router is one of the main

devices used in a wide area network. The main task of the router is routing. It forms the

routing table and delivers the packets depending upon the routes in the table – either directly

or via an intermediate device (perhaps another router).

Each router initially has information about its all neighbors (i.e., it is directly connected).

After a period of time, each router exchanges its routing table among its neighbors. After

certain number of exchanges, all routers will have the full routing information about the area

of the network. After each table exchange, router re-computes the shortest path between the

routers. The algorithm used for this routing is called Distance Vector Routing.

14.2 Algorithm:

Repeat the following steps until there is no change in the routing table for all routers.

Take the Next Router routing table and its neighbor routing table.

Add the router entry that is not in your own routing table, but exists in any one of the

other routing tables. If the new router entry exists in more than one neighbor, then find

the minimum cost among them. The minimum cost value details are taken as a new entry:

such as source router, intermediate router, destination router and cost value, etc.

Update the source router routing table cost value if both the destination router and the

intermediate router field value have the same value as any one of the neighbors‟ routing

entry.

Update the source router‟s routing table entry with the new advertised one if the

intermediate router value in the source table is not same, but the cost value is greater than

the its neighbor‟s entry.

Write the next stage of routing table into the file.

Page 75: Maharastra CCN  NetSim Experiment  Manual

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.

14.3 Procedure:

To begin with the experiment, open NetSim

Click on Programming from the menu bar and select Distance Vector Routing

Step 1:

The scenario will be obtained as shown below. Follow the steps.

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.

Select the Mode

Click Run to execute the Program

Connect the Routers

.

Page 76: Maharastra CCN  NetSim Experiment  Manual

14.4 Results (to be filled up by the students):

Step 2:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void fnDistVectAlgorithm()

{

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void fnDistVectAlgorithm()

{

/////* User code part start */

Output Table

Page 77: Maharastra CCN  NetSim Experiment  Manual

do// This do while... loop is to update the table information till it

knows all the router's information present in the network.

{

// I for//To go to No of router

for(nRouterTable=1;nRouterTable<=g_nNoOfRouters;nRouterTable++)

{// II for //Select the source router

for(nNeighbour=1;nNeighbour<=g_nNoOfRouters;nNeighbour++)

{// III for//move to all router

if(Table[nRouterTable].nCostID[nNeighbour]==1)

{// I if //select the neigh router

int nDestID=1;

for(nDestID=1;nDestID<=g_nNoOfRouters;nDestID++)

{// IV for //select the routing table of

neigh

if(nDestID!=nRouterTable)

{// II if

if((Table[nRouterTable].nDestID[nDestID] == 0) &&

(Table[nNeighbour].nDestID[nDestID]!=0))// ||

{// III if //This loop is to

check whether the neighbour router is DESTINATION or not.

Table[nRouterTable].nDestID[nDestID] = nDestID;

Table[nRouterTable].nNextHop[nDestID] = nNeighbour;

Table[nRouterTable].nCostID[nDestID]=(Table[nNeighbour].nCostID[nDestID]+1);

}

else

if((Table[nRouterTable].nNextHop[nDestID]!=nDestID||Table[nRouterTable].nCostID[nDe

stID]!=1)&&(Table[nNeighbour].nDestID[nDestID]!=0))

{// else if

// This loop is to check

whether the neighbour router is the destination or not and also check whether the

cost ID is 1 or not.

if(Table[nRouterTable].nCostID[nDestID]>Table[nNeighbour].nCostID[nDestID])

{//IV if

//This loop is to find

the least cost path

Table[nRouterTable].nDestID[nDestID] = nDestID;

Table[nRouterTable].nNextHop[nDestID] = nNeighbour;

Table[nRouterTable].nCostID[nDestID]=(Table[nNeighbour].nCostID[nDestID]+1);

}//end IV if

}//end else if

}// end II if

}//end IV for

}// end I if

}//end III for

}// end II for

nStage++;

fnDisplay(nStage);

}while(nStage<2);

/////* User code part end */

}

Page 78: Maharastra CCN  NetSim Experiment  Manual

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Click on 1 router and another router consecutively to connect them. Click Run.

So presently NetSim will run Distance Vector Routing code which is written by the user and

will display the result graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

Note- How to practice this experiment without using NetSim

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code

Input.txt file contents

Router_ID=1>Router_Name=Router_1>No_Of_Neighbour=1>Neighbours_ID=2

Router_ID=2>Router_Name=Router_2>No_Of_Neighbour=4>Neighbours_ID=1>3>6>5

Router_ID=3>Router_Name=Router_3>No_Of_Neighbour=2>Neighbours_ID=2>4

Router_ID=4>Router_Name=Router_4>No_Of_Neighbour=2>Neighbours_ID=3>6

Router_ID=5>Router_Name=Router_5>No_Of_Neighbour=1>Neighbours_ID=2

Router_ID=6>Router_Name=Router_6>No_Of_Neighbour=2>Neighbours_ID=4>2

Output.txt file contents

0>1>2>1>0

0>2>1>1>0

0>2>3>1>0

0>2>5>1>0

0>2>6>1>0

0>3>2>1>0

0>3>4>1>0

0>4>3>1>0

0>4>6>1>0

Page 79: Maharastra CCN  NetSim Experiment  Manual

0>5>2>1>0

0>6>2>1>0

0>6>4>1>0

1>1>2>1>0

1>1>3>2>2

1>1>5>2>2

1>1>6>2>2

1>2>1>1>0

1>2>3>1>0

1>2>4>2>6

1>2>5>1>0

1>2>6>1>0

1>3>1>2>2

1>3>2>1>0

1>3>4>1>0

1>3>5>2>2

1>3>6>2>4

1>4>1>3>3

1>4>2>2>6

1>4>3>1>0

1>4>5>3>3

1>4>6>1>0

1>5>1>2>2

1>5>2>1>0

1>5>3>2>2

1>5>4>3>2

1>5>6>2>2

1>6>1>2>2

1>6>2>1>0

1>6>3>2>4

1>6>4>1>0

1>6>5>2>2

2>1>2>1>0

2>1>3>2>2

2>1>4>3>2

2>1>5>2>2

2>1>6>2>2

2>2>1>1>0

2>2>3>1>0

2>2>4>2>6

2>2>5>1>0

2>2>6>1>0

2>3>1>2>2

2>3>2>1>0

2>3>4>1>0

2>3>5>2>2

2>3>6>2>4

2>4>1>3>6

2>4>2>2>6

2>4>3>1>0

2>4>5>3>6

2>4>6>1>0

Page 80: Maharastra CCN  NetSim Experiment  Manual

2>5>1>2>2

2>5>2>1>0

2>5>3>2>2

2>5>4>3>2

2>5>6>2>2

2>6>1>2>2

2>6>2>1>0

2>6>3>2>4

2>6>4>1>0

2>6>5>2>2

Page 81: Maharastra CCN  NetSim Experiment  Manual

15. IPV6 Addressing - EUI-64 Interface

Identifier

Programming Guidelines

This section guides the user to link his/her own code for EUI 64 Interface Identifier to

NetSim.

Pre - Conditions

The user program should read the inputted scenario from text file named „Input‟ with

extension txt.

The user program after executing the concept should write the required output to a file named

„Output’ with extension txt.

Note:The temporary directory is navigated through the following step.

Run Type "%temp%" NetSim "Input.txt" and "Output.txt"

(Note : To open Run Press Windows+R)

General Program Flow

The program begins with the Reading of the Inputs from the input file Input.txt.

Executing the required concept and,

The results of the program should be written into the output file Output.txt.

File Format

Input File Output File

IPV6_Network_Id=2000:FE21:5931:72

C3

MAC_Address=11-11-FF-FF-12-34

The Output File format

MAC Address>

First part of MAC Address>Second part of MAC

Address

FF-EE appended Address>

First byte value>Binary value of First byte>

7th bit value>Complement value of 7th bit

Complemented binary value of First byte>Hexa

decimal value of complemented binary value>

Page 82: Maharastra CCN  NetSim Experiment  Manual

Interface Id value> Interface Id in colon notation>

IPV6 prefix value>

IPV6 Address>

Sample Output text Format

11-11-FF-FF-12-34>

11-11-FF>FF-12-34>

11-11-FF-FF-FE-FF-12-34>

11>00010001>

0>1>

00010011>13>

13-11-FF-FF-FE-FF-12-

34>1311:FFFF:FEFF:1234>

2000:FE21:5931:72C3>

2000:FE21:5931:72C3:1311:FFFF:FEFF:1234>

Interface Source Code

Interface source code written in C is given using this the user can write only the fnEUI64 ()

function using the variables already declared. To view the interface source code, go to

NetSim Installation path / src / Programming/ IPV6EUI64.c

To find NetSim‟s Installation path right click NetSim icon and select

Open file location in Windows 7

Open file location in Windows Vista

Properties find target in Windows XP.

Sample Scenarios:

Objective - To understand the concept of EUI 64 Interface Identifier through programming.

How to Proceed? - The objective can be executed in NetSim using the programming

exercise available, under programming user has to select IPV6 Addressing EUI 64

Interface Identifier,

Sample Inputs - In the Input panel the following steps need to be done,

SampleMode should be selected.

Select the IPV6 Network Id (IPV6 Prefix)

Enter the MAC Address.

Page 83: Maharastra CCN  NetSim Experiment  Manual

Then Run button need to be clicked. Refresh button can be used if new

Inputs have to be given.

Output - The following steps are under gone internally,

MAC Address is divided into two parts

FF-FE value is appended between the two parts

Interface Identifier is found by complementing 7th

bit of firs byte

IPV6 Network Id (IPV6 prefix) and Interface Identifier are combined to

produce IPV6 address

Once the sample experiment is done, then Refresh button can be clicked to

create New Samples.

Page 84: Maharastra CCN  NetSim Experiment  Manual

16. IPV6 Host Addresses

Programming Guidelines

This section guides the user to link his/her own code for IPV6 Host Addresses to NetSim.

Pre - Conditions

The user program should read the inputted scenario from text file named „Input‟ with

extension txt.

The user program after executing the concept should write the required output to a file named

„Output’ with extension txt.

Note:The temporary directory is navigated through the following step.

Run Type "%temp%" NetSim "Input.txt" and "Output.txt"

(Note : To open Run Press Windows+R)

General Program Flow

The program begins with the Reading of the Inputs from the input file Input.txt.

Executing the required concept and,

The results of the program should be written into the output file Output.txt.

File Format

Input File Format Output File Format

IPV6_Address=1111:2222:

3333:4444:AAAA:BBBB:

CCCC:DDDD

Prefix_Length=12

The Output File format

IPV6 Address>

Binary value of IPV6 Address>

Prefix part of IPV6 Address>Suffix part of IPV6 Address>

Prefix part of Starting Address>Suffix part of Starting

Address>

Starting Address in hexa decimal notation>

Prefix part of Ending Address>Suffix part of Ending

Address>

Ending Address in hexa decimal notation>

Sample Output text Format

1111:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>

Page 85: Maharastra CCN  NetSim Experiment  Manual

000100010001000100100010001000100011001100110011

010001000100010010101010101010101011101110111011

11001100110011001101110111011101>12>116>

000100010001>00010010001000100010001100110011001

101000100010001001010101010101010101110111011101

111001100110011001101110111011101>

000100010001>00000000000000000000000000000000000

000000000000000000000000000000000000000000000000

000000000000000000000000000000000>

1110:0000:0000:0000:0000:0000:0000:0000>

000100010001>11111111111111111111111111111111111

111111111111111111111111111111111111111111111111

111111111111111111111111111111111>

111F:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF>

Interface Source Code

Interface source code written in C is given using this the user can write only the

fnHostAddresses () function using the variables already declared. To view the interface

source code, go to

NetSim Installation path / src / Programming/ IPV6HostAddress.c

To find NetSim‟s Installation path right click NetSim icon and select

Open file location in Windows 7

Open file location in Windows Vista

Properties find target in Windows XP.

Sample Scenarios:

Objective - To understand the concept of IPV6 Host Addresses through programming.

How to Proceed? - The objective can be executed in NetSim using the programming

exercise available, under programming user has to select IPV6 Addressing IPV6 Host

Addresses,

Sample Inputs - In the Input panel the following steps need to be done,

SampleMode should be selected.

Enter the IPV6 Address.

Select the Prefix length.

Then Run button need to be clicked. Refresh button can be used if new

Inputs have to be given.

Page 86: Maharastra CCN  NetSim Experiment  Manual

Output - The following steps are under gone internally,

IPV6 is separated into two parts: Network Id bits (prefix) and Host Id bits

(suffix)

Starting address of the network is found by replacing each bits of suffix part

with zero

Ending address of the network is found by replacing each bits of suffix part

with one

Once the sample experiment is done, then Refresh button can be clicked to

create New Samples.

Page 87: Maharastra CCN  NetSim Experiment  Manual

17. IPV6 Subnetting

Programming Guidelines

This section guides the user to link his/her own code for IPV6 Subnetting to NetSim.

Pre - Conditions

The user program should read the inputted scenario from text file named „Input‟ with

extension txt.

The user program after executing the concept should write the required output to a file named

„Output’ with extension txt.

Note:The temporary directory is navigated through the following step.

Run Type "%temp%" NetSim "Input.txt" and "Output.txt"

(Note : To open Run Press Windows+R)

General Program Flow

The program begins with the Reading of the Inputs from the input file Input.txt.

Executing the required concept and,

The results of the program should be written into the output file Output.txt.

File Format

Input File Format Output File Format

IPV6_Address=1111:2222:3

333:4444:AAAA:BBBB:CC

CC:DDDD

Prefix_Length=12

Number_of_Subnets=2

Number_of_Level=2

Subnets_in_Level1=2

Subnets_in_Level2=4

The Output File format

Binary value of IPV6 Address>

Prefix part of IPV6 Address>Suffix part of IPV6 Address>

Number of subnets>number of subnet msk bit>

Prefix part of IPV6 Address>Subnet Id part of IPV6

address>Suffix part of IPV6 Address>

Prefix part of IPV6 Address>Subnet Id part of IPV6

address>Suffix part of IPV6 Address>

Prefix part of Level 1 „s first subnet Address> Subnet Id part

of Level 1 „s first subnet Address> Suffix part of Level 1 „s

first subnet Address> Hexa decimal value of Level 1 „s first

Page 88: Maharastra CCN  NetSim Experiment  Manual

subnet address>prefix length of Level 1 „s first subnet>

.

.

until number of subnet reached in the first level

First level‟s subnet number>Prefix part of Level 2 „s first

subnet Address> Subnet Id part of Level 2 „s first subnet

Address> Suffix part of Level 2 „s first subnet Address>

Hexa decimal value of Level 2 „s first subnet address>prefix

length of Level 2 „s first subnet>

.

.

until the number of subnets reached in the second level of

first level‟s subnet

.

.

until the number of subnets reached in the first level

Sample Output text Format

1111:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>

0001000100011001001000100010001000110011001100110

1000100010001001010101010101010101110111011101111

001100110011001101110111011101>

000100010001>000100100010001000100011001100110011

0100010001000100101010101010101010111011101110111

1001100110011001101110111011101>2>1>

000100010001>0>001001000100010001000110011001100

1101000100010001001010101010101010101110111011101

111001100110011001101110111011101>

000100010001>0>001001000100010001000110011001100

1101000100010001001010101010101010101110111011101

111001100110011001101110111011101>1111:2222:3333:4

444:AAAA:BBBB:CCCC:DDDD>13>

000100010001>1>001001000100010001000110011001100

1101000100010001001010101010101010101110111011101

111001100110011001101110111011101>1119:2222:3333:4

444:AAAA:BBBB:CCCC:DDDD>13>

0>1111:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

0>1113:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

0>1115:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

0>1117:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

1>1119:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

1>111B:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

Page 89: Maharastra CCN  NetSim Experiment  Manual

1>111D:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

1>111F:2222:3333:4444:AAAA:BBBB:CCCC:DDDD>15>

Interface Source Code

Interface source code written in C is given using this the user can write only the

fnIPV6Subnetting () function using the variables already declared. To view the interface

source code, go to

NetSim Installation path / src / Programming/ IPV6Subnetting.c

To find NetSim‟s Installation path right click NetSim icon and select

Open file location in Windows 7

Open file location in Windows Vista

Properties find target in Windows XP.

Sample Scenarios:

Objective - To understand the concept of IPV6 Subnetting through programming.

How to Proceed? - The objective can be executed in NetSim using the programming

exercise available, under programming user has to select IPV6 Addressing IPV6

Subnetting,

Sample Inputs - In the Input panel the following steps need to be done,

SampleMode should be selected.

Enter the IPV6 Address.

Select the Prefix length.

Select the number of subnets value

Click the Add value button to add the levels

Then Run button need to be clicked. Refresh button can be used if new

Inputs have to be given.

Output - The following steps are under gone internally,

IPV6 is separated into two parts: prefix and suffix

Number of subnet mask id is calculated

Page 90: Maharastra CCN  NetSim Experiment  Manual

Then Subnet Id portion is derived from suffix part

Using the subnet id portion, subnets are calculated

Like that, subnets in the all levels are calculates by using the above steps

Once the sample experiment is done, then Refresh button can be clicked to

create New Samples.

Page 91: Maharastra CCN  NetSim Experiment  Manual

18. Link State Routing

Objective: Write a C/C++ program to verify the Link state routing Algorithm.

18.1 Theory:

The router is one of the main devices used in a wide area network. The main task of the

router is routing. It forms the routing table and delivers the packets depending upon the

routes in the table – either directly or via an intermediate device (perhaps another router).

Link state algorithm is a method used to find the shortest path between a source router and a

destination router based on the distance and route the packets through that route.

18.2 Algorithm:

1. Start with the router: the root of the tree

2. Assign a cost of 0 to this router and make it the first permanent router.

3. Examine each neighbor router of the router that was the last permanent router.

4. Assign a cumulative cost to each router and make it temporary.

5. Among the list of temporary routers

5. a. Find the router with the smallest cumulative cost and make it permanent.

5. b. If a router can be reached from more than one direction

5. b. 1. Select the direction with the shortest cumulative cost.

6. Repeat steps 3 to 5 until every router becomes permanent.

18.3 Procedure:

Step 1:

To begin with the experiment, open NetSim

Click on Programming from the menu bar and select Shortest Path. In shortest path select

Link State Routing algorithm.

The scenario will be obtained as shown below. Follow the steps.

Page 92: Maharastra CCN  NetSim Experiment  Manual

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 F1 (Help) link for details on how to proceed

with your own code.

18.4 Results (to be filled up by the students):

Inference (to be filled up by the students):

Here, Router 1 is taken as the source and Router 3 as the destination. The paths are connected

with input as the distance. The figure indicated in green line shows the shortest path.

Connect the Routers

Click Run to execute the Program

Select Link State

Select Mode

Output

table

Page 93: Maharastra CCN  NetSim Experiment  Manual

Step 2:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void fnDijkstra()

{

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void fnDijkstra() { /////* User code part start */

//Write your own code for Link State Algorithm HERE

int i, j; // Temporary loop variables char szString[_MEM_BUFFER2]; char* szToken; int iNo; //total number of nodes used in the graph. pszFile = (char*) malloc(sizeof(char) * _MEM_BUFFER2); szInput_path = (char*) malloc(_MEM_BUFFER2 * sizeof(char)); strcpy(szInput_path, szTempPath); strcat(szInput_path, "/Input.txt"); strcpy(pszFile, szInput_path); fp = fopen(pszFile, "r"); szToken = (char*) malloc(sizeof(_MEM_BUFFER2)); fgets(szString, _MEM_BUFFER2, fp);//skip the first line fgets(szString, _MEM_BUFFER2, fp); szToken = strtok(szString, "="); szToken = strtok(NULL, "="); iNo = atoi(szToken); strcpy(pszFile, ""); strcpy(pszFile, szOutput_path); fpOutput = fopen(pszFile, "w+"); if (iNo <= 11) { fnInitialize(iNo); } else { fclose(fp); } for (i = 0; i < iNo; i++) { for (j = 0; j < iNo; j++) { distanceMatrix[i][j] = 999;

Page 94: Maharastra CCN  NetSim Experiment  Manual

} } strcpy(pszFile, szInput_path); fp = fopen(pszFile, "r"); fgets(szString, _MEM_BUFFER2, fp); fgets(szString, _MEM_BUFFER2, fp); fgets(szString, _MEM_BUFFER2, fp);//skip first three line from input.txt //parsing the input file and storing the values into distance matrix for (i = 0; i < iNo; i++) { fgets(szString, _MEM_BUFFER2, fp); szToken = strtok(szString, ">"); j = 0; while (szToken != NULL) { /* While there are tokens in "string" */ if (atoi(szToken) == 999) { // Do Nothing } else // To make a Adjacency Matrix { distanceMatrix[i][j] = atoi(szToken); //distanceMatrix[j][i]=atoi(szToken); } /* Get next token: */ j++; szToken = strtok(NULL, ">"); } } // Tokenizing next two line for storing the source and destination node.

// Tokenizing for the source node

fgets(szString, _MEM_BUFFER2, fp); szToken = strtok(szString, "="); szToken = strtok(NULL, "="); source = atoi(szToken); --source; // Tokenizing for the destination node

fgets(szString, _MEM_BUFFER2, fp); szToken = strtok(szString, "="); szToken = strtok(NULL, "="); destination = atoi(szToken); --destination; fclose(fp); // Initializing the Path Array and The Include Array

// For Include Array

for (i = 0; i < iNo; i++) { if (i == source) include[i] = 1; else include[i] = 0; }//end of for loop // For Distance Array for (i = 0; i < iNo; i++) { if (i == source) distance[i] = 0; else { if (distanceMatrix[source][i] == 999) { distance[i] = 999; } else { distance[i] = distanceMatrix[source][i]; }

Page 95: Maharastra CCN  NetSim Experiment  Manual

} }//end of for loop // For Initialising Path Array for (i = 0; i < iNo; i++) { if (distanceMatrix[source][i] == 999) { path[i] = 999; } else { path[i] = source; } }//end of for loop iFlag = 0; //main iteration phase for Dijkstra's Algorithm while (iFlag == 0) { //find out the minimum distance from the availabe nodes not included

min = 999; node = 999; for (i = 0; i < iNo; i++) { if (include[i] == 0) { if (min == 999) { min = distance[i]; node = i; } else { if ((distance[i] < min) && (distance[i] != 999)) { min = distance[i]; node = i; } } } } if (node != 999) include[node] = 1;

// Checking if node exists which has an edge to the source node

if (min != 999) { for (i = 0; i < iNo; i++) { // for nodes not included, we proceed

if (include[i] == 0) { // to check if Edge exists between 'i' and 'node'

if (distanceMatrix[i][node] == 999) { //do nothing } else { if ((distance[node] == 999) && (distance[i] == 999)) {//do nothing } else if (distance[i] == 999) // For

inifinity

{ distance[i] = distance[node] + distanceMatrix[i][node]; path[i] = node; } else if ((distance[node] + distanceMatrix[i][node]) < distance[i]) { distance[i] = distance[node] + distanceMatrix[i][node]; path[i] = node; } } } }//end of for loop }

Page 96: Maharastra CCN  NetSim Experiment  Manual

//Checking if all the nodes has been included.

for (i = 0; i < iNo; i++) { iFlag = 1; if (include[i] == 0) { iFlag = 0; break; } } }//end of while (!0) // To generate the output file into 'output.txt

fprintf(fpOutput, ">>>\n"); // Print the distance Array

fprintf(fpOutput, "Distance>"); for (i = 0; i < iNo; i++) fprintf(fpOutput, "%d>", distance[i]); // Print the Path Arrray

fprintf(fpOutput, "\nPath>"); for (i = 0; i < iNo; i++) fprintf(fpOutput, "%d>", path[i] + 1); fclose(fpOutput); /////* User code part end */

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Select Algorithm as Link State and the remaining input parameters and click Run.

So presently NetSim will run Link State Routing code which is written by the user and will

display the result graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

NOTE: Please insert the correct code according to the algorithm selected. The codes for other

algorithm are provided in NetSim Installation CD.

Note- How to practice this experiment without using NetSim:

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Page 97: Maharastra CCN  NetSim Experiment  Manual

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code.

Input.txt file contents

Algorithm=Link_State

No_of_Router=3

Distance:

999>10>10>

10>999>10>

10>10>999>

Source_Router=1

Destination_Router=2

Output.txt file contents

1>2>

1>3>2>

1>3>

1>

>>>

Distance>0>10>10>

Path>1000>1>1>

*Note- Output.txt content will vary depending on the file contents.

Page 98: Maharastra CCN  NetSim Experiment  Manual

19. Study the working of BGP and formation of

BGP Routing table

19.1 Theory

In BGP, the Packets are transmitted between the Autonomous system using Path vector

Routing.

Path Vector Routing:

Path vector routing is used for inter-domain routing. It is similar to distance vector routing. In

path vector routing we assume that there is one Router (there can be many) in each

autonomous system which acts on behalf of the entire autonomous system. This Router is

called the Border Router. The Border Router in one Autonomous System creates a routing

table and advertises it to neighboring Border Router which belongs to neighboring

autonomous systems. The idea is same as distance vector routing except that only Border

Routers in each autonomous system can communicate with each other. The Border Routers

advertises the path, not the metric, in its autonomous system or other autonomous systems.

19.2 Procedure:

Step 1:

Go to Simulation New BGP Networks

Sample Inputs:

Follow the steps given in the different samples to arrive

at the objective.

Total no of nodes used: 4

Total number of Internal Routers used: 2

Total number of Border Routers used: 2

The devices are interconnected as given below,

Wired Node E and Wired Node F are connected by Link 1 and Link 2 to Router C.

Internal Router C and Border Router A are connected by Link 3.

Border Router A and Border Router B are connected by Link4.

Border Router B and Router D are connected by Link 5.

Page 99: Maharastra CCN  NetSim Experiment  Manual

Router D is connected by Link 6 and Link 7to Wired Node G and Wired Node H

respectively.

Set the properties for each device by following the tables,

Sample 1:

If selected internal gateway protocol is RIP then Router properties are as follows:

Application Properties Application 1 Application 2

Application_Type CUSTOM CUSTOM

Source_Id 5 6

Destination_Id 7 8

Application Data size

Distribution Constant Constant

Application Data size (bytes) 1472 1472

Inter Arrival Time

Distribution Constant Constant

Mean Inter Arrival Time (µs) 20000 20000

Link Properties Link 1 Link 2 Link 3 Link 4 Link 5 Link 6 Link 7

Bit Error Rate

(BER) 0 0 0 0 0 0 0

Downlink Speed

(Mbps) 8.448 8.448 10 1000 10 8.448 8.448

Uplink Speed

(Mbps) 8.448 8.448 10 1000 10 8.448 8.448

Router Properties Border_ Router A Border_ Router B

Interior

Routing

table

Exterior

Routing

table

Interior

Routing

table

Exterior Routing

table

Protocol Type RIP BGP RIP BGP

Update Timer 30 - 30 -

Page 100: Maharastra CCN  NetSim Experiment  Manual

Simulation Time - 10 Sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Routers

Then click on Run Simulation button)

After simulation save the experiment.

Sample 2:

If you want to select your internal gateway protocol as OSPF then here is the information you

need to fill in for Router properties:

Router Properties Border_ Router A Border_ Router B

Interior

Routing

table

Exterior

Routing

table

Interior

Routing

table

Exterior Routing

table

Protocol Type OSPF BGP OSPF BGP

LSRefreshTime 1800 - 1800 -

MaxAge 3600 - 3600 -

Timeout Timer 180 - 180 -

Garbage

Collection Timer 120 - 120 -

Router Properties Router C Router D

Routing Protocol RIP RIP

Update Timer 30 30

Timeout Timer 180 180

Garbage Collection Timer 120 120

Router Properties Router C Router D

Routing Protocol OSPF OSPF

LSRefreshTime 1800 1800

MaxAge 3600 3600

Page 101: Maharastra CCN  NetSim Experiment  Manual

Simulation Time - 10 Sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Routers

Then click on Run Simulation button).

19.3 Output:

After running this scenario, in Performance Metrics screen, routing tables are obtained in

BGP table and RIP metrics.

If you click over the RIP metrics, you will get the RIP routing table for internal routers. If

you click over the BGP table, you will get the routing table for Border routers. We have

shown the routing tables for Border Router 1 and 2.

The Border Routers stores the node‟s remote address in its Routing Table as shown in the

above Tables under “PeerRemoteAddr” column.

Page 102: Maharastra CCN  NetSim Experiment  Manual

Output: (Sample 2)

After running this scenario, in Performance Metrics screen, routing tables are obtained in

BGP table and OSPF metrics.

If you click over the OSPF metrics, you will get the OSPF routing table for internal routers.

If you click over the BGP table, you will get the routing table for Border routers. We have

shown the routing tables for Border Router 1 and 2.

19.4 Inference

First the internal Routing tables (RIP/OSPF table) are formed among all the Routers. The

Border Routers contains the network address of the next hop and the destination nodes as

represented in the routing table. Border Routers communicate with each other by passing

their Routing tables resulting in the formation of external Routing tables (BGP table). Then

actual packet transmission takes place from Source to Destination.

Page 103: Maharastra CCN  NetSim Experiment  Manual

20. Analyze the performance of a MANET,

(running CSMA/CA (802.11b) in MAC) with

increasing node mobility.

20.1 Theory:

Mobile Ad-Hoc Network (MANET) is a self-configuring network of mobile nodes connected

by wireless links to form an arbitrary topology without the use of existing infrastructure. The

nodes are free to move randomly. Thus the network's wireless topology may be unpredictable

and may change rapidly.

Mobility and node density are the two major factors which influences the performance of any

routing protocol of mobile ad hoc network. The mobility of the nodes affects the number of

connected paths, which in turn affect the performance of the routing algorithm.

20.2 Performance metrics:

The different parameters used to analyze the performance are explained as follows:

Throughput: It is the rate of successfully transmitted data packets in unit time in the

network during the simulation.

20.3 Procedure:

In NetSim, Select “Simulation New Advanced Wireless Networks MANET”.

Step 1: Create /Design the Network

Devices Required: 6 Wireless Nodes

Step 2: Configure the Network (Sample 1)

Wireless Node Properties:

Click & drop 6 Wireless Nodes onto the Simulation Environment.

Page 104: Maharastra CCN  NetSim Experiment  Manual

Arrange the positions of the nodes as per the following table:

Wireless Node X-Coordinate Y-Coordinate

1 250 100

2 200 150

3 300 150

4 250 200

5 225 125

6 275 175

Disable TCP in all Wireless Nodes.

Change Mobility model to RANDOM_WALK and set velocity 10 m/s for all nodes.

Wireless Link Properties:

Right Click anywhere on the Grid EnvironmentProperties

Channel Characteristics Line of Sight

Path Loss Exponent (n) 2

NOTE: To change Mobility Model, go to Global Properties Mobility Model

Page 105: Maharastra CCN  NetSim Experiment  Manual

Step 3: Model Traffic in the Network (Sample 1)

Select the Application Button and click on the gap between the Grid Environment and the

ribbon. Now right click on Application and select Properties.

Application Properties:

NOTE: The procedure to create multiple applications are as follows:

Step 1: Click on the ADD button present in the bottom left corner to add a new

application.

Step 4: Simulate

Simulation Time - 100 Sec

Application Type Custom Custom Custom

Source ID 1 (Wireless Node A) 2 ( Wireless Node B) 5 ( Wireless Node E)

Destination ID 4 ( Wireless Node D) 3 ( Wireless Node C) 6 ( Wireless Node F)

Packet Size

Distribution Constant Constant Constant

Value(Bytes) 1460 1460 1460

Inter Arrival Time

Distribution Constant Constant Constant

Value(µs) 20000 20000 20000

Page 106: Maharastra CCN  NetSim Experiment  Manual

After completion of the experiment, “Save” the experiment for future analysis of results.

Steps to save an experiment:

Step 1: After simulation of the

network, on the top left corner

of Performance metrics screen,

click on the “Save Network

and Metric as” button

Step 2: Specify the Experiment Name and Save Path and click on OK

Step 5: Configure the Network (Sample 2)

Wireless Node Properties:

Change Mobility model to RANDOM_WALK and set velocity 30 m/s for all nodes.

The remaining properties are same as Sample 1.

Step 6: Simulate

Simulation Time - 100 Sec

After completion of the experiment, “Save” the experiment for future analysis of results.

Step 7: Configure the Network (Sample 3)

Wireless Node Properties:

Change Mobility model to RANDOM_WALK and set velocity 50 m/s for all nodes.

The remaining properties are same as Sample 1.

Page 107: Maharastra CCN  NetSim Experiment  Manual

Simulation Time - 100 Sec

After completion of experiment, “Save” the experiment, for future analysis of results.

20.4 Analysis of Result

Go to Simulation Open Metrics menu to open the results of saved experiments.

Go to Application metrics and compute the sum of all column wise values of throughput.

Throughput = Sum of throughputs obtained from all Applications

20.5 Inference

As the mobility of nodes increases, the throughput decreases. This is because as the velocity

increases, more packets get lost in lieu of ad hoc movement of the nodes. The packet delivery

ratio decreases as the sum of total packets received decreases with increased mobility.

NOTE: The results are highly dependent on position/velocity/ traffic etc given the inherent

characteristics of MANET protocols. Any modifications with the above mentioned input

parameters will change the final output result.

0

50

100

150

200

250

300

350

400

450

500

0 10 20 30 40 50 60

Thro

ugh

pu

t (M

bp

s)

Mobility Velocity (m/sec)

Page 108: Maharastra CCN  NetSim Experiment  Manual

21. Spanning Tree

Objective: Write a C/C++ program to implement minimum spanning tree using Kruskal‟s

algorithm

21.1 Theory:

The spanning tree algorithm is used to prevent loop formation in a Local Area Network,

while ensuring connectivity to all network segments.

To convert a network as a mathematical graph, nodes are viewed as vertices of the graph,

while connecting links are viewed as edges of the graph.

If the original graph has n vertices, then the tree formed has n-1 edges. The connecting lines

involved in the spanning tree can transfer data. Others are blocked for data transfer.

Kruskal algorithm calculates a spanning tree by sorting out the edges in the increasing order

of weights.

The working of Kruskal‟s algorithm is as follows,

Consider a graph with 6 Switches.

The edges are sorted in the ascending order of the weights.

The smallest edge from the list is selected and if the addition of the edge in the

spanning tree doesn‟t form a cycle, then the edge is added in the spanning tree. If it

forms a cycle, then that edge is discarded.

Note: Initially the spanning tree is empty.

The above step is repeated until there are no edges in the list, or there are n-1 edges in

spanning tree where n is number of nodes.

If there are n-1 edges in the spanning tree, the spanning tree for the graph is formed.

If there are no edges in the list and there are less than n-1 edges in the spanning tree,

then no spanning tree can be formed for the graph.

Page 109: Maharastra CCN  NetSim Experiment  Manual

Edge Weight Status

Switch3-Switch 6 20 Selected

Switch3-Switch4 20 Selected

Switch5-Switch6 40 Selected

Switch1-Switch2 50 Selected

Switch6-Switch1 50 Selected

Switch2-Switch3 60 Not Selected

Switch4-switch5 80 Not selected

Sorted list showing selected/deselected edges

21.2 Algorithm:

Read the number of nodes, input edges from the „Input.txt‟.

List all the edges of the graph in the ascending order of weight.

Pick the smallest edge from the list and check if the addition of the edge in the

spanning tree doesn‟t form a cycle. Then add the edge in the spanning tree. If it forms

a cycle, then discard that edge. Note: Initially the spanning tree is empty.

Repeat the above step until there are no edges in the list, or there are n-1 edges in

spanning tree where n is number of nodes.

If there are n-1 edges in the spanning tree, the spanning tree for the graph is formed

If there are no edges in the list and there are less than n-1 edges in the spanning tree,

then no spanning tree can be formed for the graph.

21.3 Procedure:

To begin with the experiment, open NetSim

Click on Programming from the menu bar, select Spanning tree.

The scenario will be obtained as shown below. Follow the steps.

Page 110: Maharastra CCN  NetSim Experiment  Manual

Step 1:

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.

Continue with the steps as given for Sample mode.

Step 2:

Click on the one switch followed by the other to have a connection between them and

then click Run button to execute the program.

Click here to view

concept, algorithm,

pseudo Code & flow

Click Run to execute

Select Mode

Select No. of Switches

Select Algorithm

Page 111: Maharastra CCN  NetSim Experiment  Manual

21.3.1 Results (to be filled up by the students):

The lines in green color show the spanning tree path and the lines in red color shows the

blocked path.

Step 3:

For user to write their own C Code in NetSim and check the result, click on Interface

Source Code (present in Help in the left pane).

Open Dev C++ or any GNU C compiler based IDK and copy the code from the Interface

Source Code.

The user needs to edit the Interface Source Code at the following location.

void fnKruskal()

{

// Write your own code here

}

So the user needs to add the user code, create exe and attach it with NetSim to run.

The User code which is to be added is given below

void fnKruskal() { /////* User code part start */

// Initializing the Graph matrix ( used for storing the Tree List for

Each Node )

Output Table

Page 112: Maharastra CCN  NetSim Experiment  Manual

for(nLoop1_krus = 0; nLoop1_krus<nNoNodes_krus+1;nLoop1_krus++) { for(nLoop2_krus = 0;nLoop2_krus<nNoNodes_krus+1;nLoop2_krus++) { nGraph_krus[nLoop1_krus][nLoop2_krus] = 0; } } //Write here the code for Kruskal algorithm for(nLoop1_krus=0; nLoop1_krus <= nNoEdges_krus-2; nLoop1_krus++) { for(nLoop2_krus = nLoop1_krus+1; nLoop2_krus <= nNoEdges_krus-1; nLoop2_krus++) { if ( nEdge_krus[nLoop1_krus][2] > nEdge_krus[nLoop2_krus][2] ) { ntemp_krus = nEdge_krus[nLoop1_krus][0]; nEdge_krus[nLoop1_krus][0] = nEdge_krus[nLoop2_krus][0]; nEdge_krus[nLoop2_krus][0] = ntemp_krus; ntemp_krus = nEdge_krus[nLoop1_krus][1]; nEdge_krus[nLoop1_krus][1] = nEdge_krus[nLoop2_krus][1]; nEdge_krus[nLoop2_krus][1] = ntemp_krus; ntemp_krus = nEdge_krus[nLoop1_krus][2]; nEdge_krus[nLoop1_krus][2] = nEdge_krus[nLoop2_krus][2]; nEdge_krus[nLoop2_krus][2] = ntemp_krus; } } } // Main Iteration for forming the Spanning Tree starts from here nLoop1_krus = 0; nLoop2_krus = 0; // ManLoop1n Process

while( (nLoop1_krus < nNoNodes_krus-1 ) && (nLoop2_krus < nNoEdges_krus) ) { nsource_krus = nEdge_krus[nLoop2_krus][0]; nstatus_krus = 0; // calling the function to Check if the Edges in the Tree list form a loop

or not

fnCyclecheck_krus( nEdge_krus[nLoop2_krus][1] , nNoNodes_krus); if (nstatus_krus != 1 ) { nSelected_krus[nLoop1_krus][0] = nEdge_krus[nLoop2_krus][0]; nSelected_krus[nLoop1_krus][1] = nEdge_krus[nLoop2_krus][1]; nSelected_krus[nLoop1_krus][2] = nEdge_krus[nLoop2_krus][2]; nCost_krus = nCost_krus + nEdge_krus[nLoop2_krus][2]; nGraph_krus[nEdge_krus[nLoop2_krus][0]][nEdge_krus[nLoop2_krus][1]] = 1; nGraph_krus[nEdge_krus[nLoop2_krus][1]][nEdge_krus[nLoop2_krus][0]] = 1; nLoop1_krus++; } nLoop2_krus ++;

Page 113: Maharastra CCN  NetSim Experiment  Manual

} /////* User code part end */

}

Create .exe file (Appendix 2: Creating .exe file using Dev C++)

In the left panel, select the Mode as User. Select the .exe file created above.

Select the Algorithm as Kruskal, No. of Switches to 5. Click Run.

So presently NetSim will run Kruskal code which is written by the user and will display the

result graphically.

In case of any error, “ERROR IN USER CODE” message will be displayed.

NOTE: Please insert the correct code according to the algorithm selected. The codes for other

algorithm are provided in NetSim Installation CD.

Note- How to practice this experiment without using NetSim:

Users who do not have a licensed version of NetSim in their PC's, can practice as explained

below.

First, run the exercise in sample mode. The user would see that an Input.txt file is created in

Win OS temp folder (this can be reached by typing %temp%/NetSim in Windows run

window). This input file should be read by the user code and it should generate an Output.txt.

This Output.txt file is read by NetSim and shown graphically to the user.

User can follow the steps provided in Appendix 1: Programming exercise - How to practice

without NetSim.

Given below are sample Input.txt and Output.txt files for this experiment for users to verify

& validate their code.

Input.txt file contents

Algorithm=Kruskal's

No_of_Switches=5

No_of_Edges=5

Source_Switch=4,Destination_Switch=5,Distance=10,

Source_Switch=4,Destination_Switch=3,Distance=10,

Source_Switch=3,Destination_Switch=2,Distance=10,

Source_Switch=2,Destination_Switch=1,Distance=10,

Source_Switch=5,Destination_Switch=1,Distance=10,

Page 114: Maharastra CCN  NetSim Experiment  Manual

Output.txt file contents

4>5>10>

4>3>10>

3>2>10>

2>1>10>

*Note- Output.txt content will vary depending on the file contents.

Page 115: Maharastra CCN  NetSim Experiment  Manual

22. Analyzing the difference between Hub

Vs Switch transmission

22.1 Introduction:

Hubs are commonly used to connect segments of a LAN and contains multiple ports.

When a packet arrives at one port, it is copied to the other ports so that all segments of the

LAN can see all packets. In a hub, a frame is passed along or "broadcast" to every one of its

ports. It doesn't matter that the frame is only destined for one port. The hub has no way of

distinguishing which port a frame should be sent to. Passing it along to every port ensures

that it will reach its intended destination. This places a lot of traffic on the network and can

lead to poor network response times.

Additionally, a hub must share its bandwidth with each and every one of its ports. So

when only one PC is broadcasting, it will have access to the maximum available

bandwidth. If, however, multiple PCs are broadcasting, then that bandwidth will need to

be divided among all of those systems, which will degrade performance.

Switch is point-to-point connection. In networks, Switches filters and

forwards packets between LAN segments. Unlike a hub, a switch will allocate a full data

rate to each of its ports. So regardless of the number of PCs transmitting, users will always

have access to the maximum amount of bandwidth. It's for these reasons a switch is

considered to be a much better choice than a hub.

Part-A – HUB

22.2 Description:

To begin with the experiment, open NetSim

Click on Simulation New Legacy network Token Bus from the sub menu. The

simulation environment is now open.

i. Drag and drop the hub on the environment

ii. Drag and drop 6 wired nodes over the hub.

Page 116: Maharastra CCN  NetSim Experiment  Manual

Set the properties in all the wired nodes as follows:-

Right click on node and set the transmission to Point to Point. Select Traffic type as Data.

On Selecting Data option, you will get the window shown below. Set the Distribution value

as Constant, Application Data as 1000 and set Mean interval time as 3200, so that Generation

Rate will be 2.5 Mbps exactly.

Set Transmission Type as Point to

Point

Set Traffic type as data

Page 117: Maharastra CCN  NetSim Experiment  Manual

50

Simulation Time- 10 Seconds

Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Nodes

Then click on the Run Simulation icon

Then, you will see the performance metrics screen.

Set Distribution as

Constant

Data size 1000

Constant

Distribution

Set Mean

interval time

as 3200

Click here to Save

experiment

Click here to go to

NetSim Analytics

Click here to

export data to

Page 118: Maharastra CCN  NetSim Experiment  Manual

51

Here click Save button to save the experiment.

Save:

Give any name of your choice to save it and if you want to give any comments you can

give or else click No for comments and proceed to save your experiment by clicking OK

button.

Part-B – Switch

22.3 Procedure:

How to Create Scenario & Generate Traffic:

Please navigate through the below given path to,

Create Scenario: New Internetworks”.

22.3.1 Sample Inputs:

Follow the steps given in the different samples to arrive at the objective.

Click and drop 1 switch on the environment

Click and drop 6 Wired Nodes on the environment

Establish the connection between Switch and Wired node using wired link.

Click Ok

Page 119: Maharastra CCN  NetSim Experiment  Manual

52

Disable TCP in all Wired nodes and set the wired link properties as follows:-

Link Properties

Max Uplink Speed (Mbps) 10

Max Downlink Speed(Mbps) 10

Application Properties:

Select the Application Button and click on the gap between the Grid Environment and

the ribbon. Now right click on Application and select Properties.

NOTE: The procedure to create multiple applications are as follows:

Step 1: Click on the ADD button present in the bottom left corner to add a new

application.

Page 120: Maharastra CCN  NetSim Experiment  Manual

53

Application

Properties

Application

1

Application

2

Application

3

Application

4

Application

5

Application

6

Application

Type Custom Custom Custom Custom Custom Custom

Source ID 2(Wired

Node B)

3(Wired

Node C)

4(Wired

Node D)

5(Wired

Node E)

6(Wired

Node F)

7(Wired

Node G)

Destination

ID

3(Wired

Node C)

4(Wired

Node D)

5(Wired

Node E)

6(Wired

Node F)

7(Wired

Node G)

2(Wired

Node B)

Packet Size

Distribution Constant Constant Constant Constant Constant Constant

Value(Bytes) 1000 1000 1000 1000 1000 1000

Inter Arrival Time

Distribution Constant Constant Constant Constant Constant Constant

Value(µs) 3200 3200 3200 3200 3200 3200

Simulation Time - 10 Sec

(Note: The Simulation Time can be selected only after the following two tasks,

Set the properties for the Wired Link and Application.

Click on Run Simulation button.

Page 121: Maharastra CCN  NetSim Experiment  Manual

54

Then, you will see the performance metrics screen.

Save the experiment for future analysis.

22.4 Result:

The Graph shows the Difference in Throughput and Delay for Hub and Switch.

Throughput

Page 122: Maharastra CCN  NetSim Experiment  Manual

55

Delay 2000000

1800000

1600000

1400000

1200000

1000000

22.5 Inference

Since hub is a broadcast domain, there are collisions during transmission. As

per CSMA / CA algorithm there is node back off per the truncated binary back

off algorithm. Due to collisions and backing off the throughput of a hub based

network is much lower than a switch based network, while the delay

experienced in much higher.

Page 123: Maharastra CCN  NetSim Experiment  Manual

56

23. Study the effect of Peak Cell Rate (per Sec)

and Cell Delay Variation Tolerance on the

performance of an ATM Networks

23.1 Theory:

QoS Parameters

Primary objective of ATM is to provide QoS guarantees while transferring cells across the

network. The three main QoS parameters specified for ATM which indicate the performance

of the network are:

Cell Transfer Delay (CTD): The delay experienced by a cell between the first bit of

the cell is transmitted by the source and the last bit of the cell is received by the

destination.

Peak to Peak Cell Delay Variation (CDV): The difference of the maximum and

minimum CTD experienced during the connection.

Cell Loss Ratio (CLR): The percentage of cells lost in the network due to error or

congestion that are not received by the destination.

Peak Cell Rate (PCR) specifies the rate in cells per sec that a source is never allowed to

exceed.

Procedure:

How to Create Scenario & Generate Traffic:

Please navigate through the below given path to,

Create Scenario: “Simulation New Legacy Networks ATM”.

Inputs

Follow the steps given in the different samples to arrive at the objective.

In this Sample,

Page 124: Maharastra CCN  NetSim Experiment  Manual

57

Total no of CPEs used: 2

Total no of Switches used: 2

The devices are inter connected as given below,

CPE 1 and CPE 2 are connected via Link 1 and Link 3 to Switch 1 and Switch 2

respectively.

Switch 1 is connected to Switch 2 by Link 2.

Set the properties of Switch and CPE by following the tables for each sample,

Switch Properties Switch 1 Switch 2

Scheduling Technique

Priority Priority

Buffer Size (KB) 8 8

Link Properties Link 1 Link 2 Link 3

Bit Error Rate No Error No Error No Error

Physical Medium E0 E0 E0

Distance (km) 1 1 1

Inputs for Sample 1

CPE Properties:

Page 125: Maharastra CCN  NetSim Experiment  Manual

58

Inputs for Sample 2, Sample 3, Sample 4 and Sample 5:

The following properties are changed for Sample 2, Sample 3, Sample 4 and Sample 5: (rest

is same as in Sample 1)

CPE Properties Sample 2 Sample 3 Sample 4 Sample 5

Peak Cell Rate

(cells/second)

2000 3000 4000 5000

Cell Delay Variation

Tolerance (µs)

2000 3000 4000 5000

Simulation Time – 10 sec

23.2 Output

To view the output by using NetSim Sample experiments need to be added onto the Analytics

interface.Given below is the navigation for analytics -

“SimulationAnalytics”

Select the experiments by selecting

Legacy Networks

Select the Experiments (Note: Click one experiment after another to compare the

experiments in the Analytics interface).

Select the Metric: Queuing Delay (ms)

Comparison Charts:

Page 126: Maharastra CCN  NetSim Experiment  Manual

59

23.3 Inference

When the Peak Cell Rate and Cell Delay Variation Tolerance are changed from 1000 to 5000,

the Number of Cells transmitted increases. This is because the conformance of the traffic

depends on the Peak Cell Rate and the Cell Delay Variation Tolerance. As the number of

cells transmitted increases, queuing delay also increases.

Page 127: Maharastra CCN  NetSim Experiment  Manual

60

24. Network performance analysis with an ATM

switch implementing different scheduling

techniques like First in First out (FIFO),

Priority, and Round Robin

24.1 Theory

In an ATM network, scheduling of cells is the major task of any ATM switch. Scheduling is

the process by which the ATM switch determines the sequence of flow of the cells in

network. The scheduling is done on various properties like service type, cell category, queue

length, arrival time etc.

First In First out (FIFO): FIFO is the simplest way of scheduling. As the name suggests, in

this technique, the preference is given to that cell which comes first in the queue irrespective

of its priority value. The one which comes next waits until the first finishes. The drawback of

this technique is that some cells of very high priority like audio service encounter extra delay

that is not ignorable.

Priority: In this technique, each cell is assigned a certain priority value based on its traffic

parameters. The scheduler checks the availability of highest priority cells and schedules them

before going for the lower priority cells. The drawback of this algorithm is that cells of

lowest priority starve for the resources when there are a large number of higher priority cells.

Round Robin: In this technique, the scheduler gives equal preference for all priority types.

Therefore, scheduler processes one cell of each priority type (If available) before going for

the next cell and cycles through them. Here starvation never occurs because no priority is

given. Round robin scheduling may not be desirable if QoS of the different priority type are

highly variable.

Page 128: Maharastra CCN  NetSim Experiment  Manual

61

24.2 Procedure:

In this experiment, we are going to analyze the link Utilization (%) of the outgoing link from

an ATM switch

First in First out (FIFO):

In NetSim, Select “SimulationNewLegacy Networks ATM”

How to Create Scenario & Generate Traffic:

Inputs

Follow the steps given in the different samples to arrive at the objective.

In all Samples,

Total no of CPEs used: 4

Total no of ATM switches used: 2

The devices are interconnected as given below

CPE 1 is connected to Switch 1 by Link 1.

CPE 2 is connected to Switch 1 by Link 2.

CPE 3 is connected to Switch 2 by Link 4.

CPE 4 is connected to switch 2 by Link 5.

Switch 1 and Switch 2 are connected via Link 3.

Page 129: Maharastra CCN  NetSim Experiment  Manual

62

Set the properties for each device by following the tables,

Switch Properties Switch 1 Switch 2

Scheduling technique FIFO FIFO

Buffer size 4096 KB 4096 KB

CPE 1 Properties CPE 1

Destination CPE 3

Transmission Type Point to Point

Traffic Type Data

Scheduling FIFO

Peak cell rate (cells/sec) 99999

Cell delay Variation tolerance (µs) 99999

GCRA type VSA

Data Input Configuration for CPE 1:

Application Data Size

Distribution Constant

Mean Application Data Size (bytes) 10000

Inter arrival time

Distribution Constant

Mean Inter-arrival time (µs) 10000

Generation rate (Mbps) 8

CPE 2 Properties CPE 2

Destination CPE 4

Transmission Type Point to Point

Traffic Type Voice

Scheduling FIFO

Peak cell rate (cells/sec) 99999

Cell delay Variation tolerance (µs) 99999

GCRA type VSA

Page 130: Maharastra CCN  NetSim Experiment  Manual

63

Voice Input Configuration for CPE 2:

Codec Constant

Application Data Size (bytes) 10000

Inter-arrival time (µs) 20000

Service Type CBR

Generation rate (Mbps) 4

Link Properties Link 1 Link 2 Link 3 Link 4 Link 5

Bit Error Rate

(BER)

No Error No Error No Error No Error No Error

Physical medium E2 E2 E0 T1 T1

Data Rate (Mbps) 8.448 8.448 0.064 1.54 1.54

Distance 1 1 1 1 1

Simulation Time –10 sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of CPE and Switch,

Then click on Run Simulation button).

“Save” it, upon completion of the experiment.

24.3 Output:

Select the metrics Utilization and Delay report (Link). Note down the link utilization of Link

4 and Link 5.

Page 131: Maharastra CCN  NetSim Experiment  Manual

64

Priority:

Follow the same steps as above in First in First out (FIFO) to create scenario and set the

properties of all devices.

Edit the properties of Switch as follows:

Switch Properties Switch 1 Switch 2

Scheduling technique Priority FIFO

Buffer size 4096 KB 4096 KB

Simulation Time –10 sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of CPE and Switch,

Then click on Run Simulation button).

“Save” it, upon completion of the experiment.

24.4 Output

Select the metrics Utilization and Delay report (Link). Note down the link utilization of Link

4 and Link 5.

Page 132: Maharastra CCN  NetSim Experiment  Manual

65

Round Robin:

Follow the same steps as above in First in First out (FIFO) to create scenario and set the

properties of all devices.

Edit the properties of Switch as follows:

Switch Properties Switch 1 Switch 2

Scheduling technique Round Robin FIFO

Buffer size 4096 KB 4096 KB

Simulation Time –10 Sec.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of CPE and Switch,

Then click on Run Simulation button).

“Save” it, upon completion of the experiment.

Output:

Select the metrics Utilization and Delay report (Link). Note down the link utilization of Link

4 and Link 5.

Page 133: Maharastra CCN  NetSim Experiment  Manual

66

Comparison:

Traffic analysis:

CPE 1 is transmitting Data traffic (being generated at 8 Mbps) to CPE 3 through links 1, 3,

and 4. CPE2 transmitting voice traffic (being generated at 4 Mbps) to CPE4 through link 2, 3,

and 5. Here, voice traffic has priority over data traffic.

Page 134: Maharastra CCN  NetSim Experiment  Manual

67

Link speed of link 1 and 2 is high (8.448 mbps) as compared to data rate and also the PCR

and CDVT of CPE1 and CPE 2 are high. So there is a low probability that these cells will be

dropped. Therefore, all the cells reach switch1 where scheduling will happens.

Link speed of link 3 is very low (0.064 mbps) which means it does not have enough resources

to handle the cells. Hence, it will only pass those cells that have high priority (based on

Scheduling technique). Link speed of 4 and 5 is high compared to link 3 and so there is no

queue is buildup on switch 2. Based on what type of cells pass through link 3, determines the

utilization of the link 4 and link 5.

24.5 Inference:

As we see in chart 1 and table 1, the utilization of link 4 is double of link 5 in case of FIFO.

Because, in case of FIFO, scheduler gives preference to which cell comes first. Note that the

data rate of CPE1 is double than CPE2 data rate and link speed is same hence switch 1 gets

two cells from CPE 1 and one cell from CPE2 and schedules two packets of CPE1 and one

packet of CPE2. Therefore, the number of packet transmitted through link 4 is double than

link 5 and hence utilization is also double.

In case of priority, the utilization of the link 4 is 0.006 % and link 5 is 4.138%. This is

because the ATM scheduler gives priority to the voice traffic (generated by CPE2 to CPE4

via link 2, 3 and 5) over data traffic (generated by CPE 1 to CPE 3 via link 1, 3 and 4). The

generation rate of voice traffic is 4 Mbps which is much greater than the link speed of link 3

(0.064 Mbps). Hence, scheduler only schedules voice traffic and data traffic keeps waiting in

the queue.

In case of round robin the utilization of both the links is the same. Because, in case of Round

robin, scheduler schedules the packet in circular fashion implying one packet from CPE1 and

one packet from CPE2. Note that the data rate of CPE1 and CPE2 is sufficiently high to

ensure presence of a packet in the buffer from both the CPEs. Therefore, the number of

packets transmitted through link 4 is same as link 5 and hence utilization is also same.

Page 135: Maharastra CCN  NetSim Experiment  Manual

68

24.6 Study how the LSP varies for different traffic in MPLS -

TE (Traffic Engineering)

24.7 Theory:

Traffic Engineering is the process of controlling how traffic flows through one‟s network so

as to optimize resource utilization and network performance. Traffic Engineering is needed in

the Internet mainly because current IGPs (Interior Gateway Protocols – RIP, OSPF) always

use the shortest paths to forward all traffics. But MPLS with traffic engineering use different

paths to forward different traffics.

24.8 Procedure:

Create Scenario: “Simulation New Legacy Networks MPLS”.

Sample Inputs:

Follow the steps given in the different samples to arrive at the objective.

Sample 1:

In this Sample,

Total no of CPEs used: 4

Total no of Routers used: 4

The devices are inter connected as given below,

CPE 1, 2 and Router 2, 3 are connected to Router 1 by Link 1, 2, 3, 4 respectively.

Router 2,3 and CPE 3,4 are connected to Router 4 by Link 5,6 7, 8 respectively

Page 136: Maharastra CCN  NetSim Experiment  Manual

69

Set the properties for each device by following the tables:

CPE Properties CPE 1 CPE2

Destination CPE 3 CPE 4

Priority Low Low

Data Input Configuration Properties

Traffic Type Data Data

Application Data Size (bytes) 1472 1472

Distribution Constant Constant

Inter Arrival Time (µs) 1963 1963

Router Properties Router1 Router2 Router3 Router4

Buffer Size (KB) 8 8 8 8

Scheduling Type Priority Priority Priority Priority

Routing Properties

Protocol Type OSPF OSPF OSPF OSPF

Router Priority 255 255 255 255

MPLS Properties

Traffic Engineering Enable Enable Enable Enable

Link Properties Link 1 Link 2 Link 3 Link 4

Distance (km) 1 1 1 1

Bit Error Rate (BER) No Error No Error No Error No Error

Physical Medium E2 E2 CAT5 (10 Mbps) CAT5 (10 Mbps)

Simulation Time –10 Sec.

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of CPE & Router, &

Link Properties Link 5 Link 6 Link 7 Link 8

Distance (km) 1 1 1 1

Bit Error Rate (BER) No Error No Error No Error No Error

Physical Medium CAT5 (10 Mbps) CAT5 (10 Mbps) E2 E2

Page 137: Maharastra CCN  NetSim Experiment  Manual

70

Then click on Run Simulation button).

Upon completion of the experiment “Save” it for comparison

24.9 Output -I:

After running this scenario, in Network Performance metrics screen, click View LSP link.

Then the following screen would appear. Click 10.1.7.2(CPE1) to view the LSP for CPE 1‟s

traffic.

Reserved Bandwidth of CPE1‟s traffic is 6 Mbps. CPE 1‟s traffic is sent through 4 and 6

links. So Remaining Bandwidth of 4 and 6 links is 10Mbps-6Mbps = 4Mbps.

Click 10.1.8.2(CPE-2) to view the LSP for CPE 2‟s traffic.

Page 138: Maharastra CCN  NetSim Experiment  Manual

71

Reserved Bandwidth of CPE 2‟s traffic is also 6 Mbps. Since Links 4 and 6 have remaining

bandwidth less than the Reserved Bandwidth of CPE 2‟s traffic, CPE 2‟s traffic is sent

through the another path through 3 and 5 links.

Sample 2:

In this Sample,

Total no of CPEs used: 4

Total no of Routers used: 4

The devices are inter connected as given below,

CPE 1, 2 and Router 2, 3 are connected with Router 1 by Link 1, 2, 3, 4 respectively.

Router 2,3 and CPE 3,4 are connected with Router 4 by Link 5,6 7, 8 respectively

Set the properties for each device by following the tables:

CPE Properties CPE 1 CPE2

Destination CPE 3 CPE 4

Priority Low Low

Data Input Configuration Properties

Traffic Type Data Data

Application Data Size (bytes) 1472 1472

Distribution Constant Constant

Inter Arrival Time (µs) 1963 1963

Reserved Bandwidth (Mbps) 5.999 5.999

Link Properties Link 5 Link 6 Link 7 Link 8

Distance (km) 1 1 1 1

Bit Error Rate (BER) No Error No Error No Error No Error

Physical Medium CAT5 (10 Mbps) CAT5 (10 Mbps) E2 E2

Link Properties Link 1 Link 2 Link 3 Link 4

Distance (km) 1 1 1 1

Bit Error Rate (BER) No Error No Error No Error No Error

Physical Medium E2 E2 CAT5 (10 Mbps) CAT5 (10 Mbps)

Page 139: Maharastra CCN  NetSim Experiment  Manual

72

Router Properties Router1 Router2 Router3 Router4

Buffer Size (KB) 8 8 8 8

Scheduling Type Priority Priority Priority Priority

Routing Properties

Protocol Type OSPF OSPF OSPF OSPF

Router Priority 255 255 255 255

MPLS Properties

Traffic

Engineering

Disable Disable Disable Disable

Simulation Time –10 Sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of CPE& Router, &

Then click on Run Simulation button).

Upon completion of the experiment “Save” it for comparison

24.10 Output-II:

After running this scenario, in Network performance screen, click View LSP link. Then the

following screen would appear.

Click 10.1.7.2(CPE-1) to view the LSP for CPE 1‟s traffic.

CPE 1‟s traffic is sent through 4 and 6 links

Page 140: Maharastra CCN  NetSim Experiment  Manual

73

Click 10.1.8.2(CPE 2) to view the LSP for CPE 2‟s traffic

CPE 2‟s traffic is also sent through 4 and 6 links

When traffic engineering is disabled, entire traffic will be sent through the same shortest path.

24.11 Inference:

In Traffic Engineered MPLS network, according to the traffic constraint different traffics will

be sent through different paths. But without any Traffic Engineering, traffic will be routed

through the same shortest path.

Page 141: Maharastra CCN  NetSim Experiment  Manual

74

25. Understand IP forwarding within a LAN and

across a router

Note: NetSim Standard Version is required to run this experiment

25.1 Theory:

Nodes in network need MAC Addresses in addition to IP address for communicating with

other nodes. In this experiment we will see how IP-forwarding is done when a node wants to

send data within a subnet and also when the destination node is outside the subnet.

25.2 Procedure

Step 1:

Go to Simulation New Internetworks

Step 2:

Click & drop Wired Nodes, Switches and

Router onto the Simulation Environment as

shown and link them.

Node properties: Disable TCP in all nodes in Transport layer as follows:

Page 142: Maharastra CCN  NetSim Experiment  Manual

75

Step 3: Create the Sample as follows:

Sample 1:

To run the simulation, drop the Application icon and set the Source_Id and Destination_Id as

1 and 2 respectively.

Enabling the packet trace:

Click Packet Trace icon in the tool bar. This is used to log the packet details.

Check “All the Attributes” button for Common Attributes, TCP and WLAN.

And Click on Ok button. Once the simulation is completed, the file gets stored in the

location specified.

Step 4:

Simulation Time- 10 Seconds

Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Nodes

Then click on the Run Simulation icon:

After clicking on Run Simulation, edit IP and ARP Configuration tab by setting Static ARP

as Disable. Click on OK button to simulate.

Page 143: Maharastra CCN  NetSim Experiment  Manual

76

25.3 Output - I

Open Packet Trace for performing Packet Trace analysis

PACKET TRACE Analysis

25.4 Inference - I

Intra-LAN-IP-forwarding:

ARP PROTOCOL- WORKING

Source Switch

ARP REQUEST

Destination

ARP Response

ARP REQUEST

ARP Response

Page 144: Maharastra CCN  NetSim Experiment  Manual

77

A Brief Explanation:

NODE-1 broadcasts ARP_Request which is then broadcasted by SWITCH-4. NODE -2 sends

the ARP_Reply to NODE-1 via SWITCH-4. After this step, data is transmitted from NODE-

1 to NODE-2. Notice the DESTINATION_ID column for ARP_Request type packets.

Step 5: Follow all the steps till Step 2 and perform the following sample:

Sample 2:

To run the simulation, drop the Application icon and set Application as Custom and the

Source_Id and Destination_Id as 1 and 3 respectively.

Enabling the packet trace:

Click Packet Trace icon in the tool bar. This is used to log the packet details.

Give a file name and check “All the Attributes” button for Common Attributes, TCP and

WLAN.

And Click on Ok button. Once the simulation is completed, the file gets stored in the

specified location.

Page 145: Maharastra CCN  NetSim Experiment  Manual

78

Step 6:

Simulation Time- 10 Seconds

Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Nodes

Then click on the Run Simulation icon:

After clicking on Run Simulation, edit IP and ARP Configuration tab by setting Static ARP

as Disable. Click on OK button to simulate.

25.5 Output - II

PACKET TRACE Analysis

Page 146: Maharastra CCN  NetSim Experiment  Manual

79

Across-Router-IP-forwarding:

25.6 Inference -II

NODE-1 transmits ARP_Request which is further broadcasted by SWITCH-4. ROUTER-6

sends ARP_Reply to NODE-1 which goes through SWITCH-4. Then NODE-1 starts to send

data to NODE-3.

If the router has the address of NODE-3 in its routing table, ARP protocol ends here and data

transfer starts that is PACKET_ID 1 is being sent from NODE-1 to NODE-3. In other case,

Router sends ARP_Request to appropriate subnet and after getting the MAC ADDRESS of

the NODE-3, it forwards the packet which it has received from NODE-1.

When a node has to send data to a node with known IP address but unknown MAC address, it

sends an ARP request. If destination is in same subnet as the source (found through subnet

mask) then it sends the ARP (broadcast ARP message) request. Otherwise it forwards it to

default gateway. Former case happens in case of intra-LAN communication. The destination

node sends an ARP response which is then forwarded by the switch to the initial node. Then

data transmission starts.

Data Packet

ARP request for

Destination’s MAC

address

ARP

Response

Source

Default Gateway

ARP request for

Default Gateway’s

MAC address

ARP response for

Default Gateway’s

MAC address

Source

Default Gateway

Destination

STEP-1 STEP-2

Data Packet

Page 147: Maharastra CCN  NetSim Experiment  Manual

80

In latter case, a totally different approach is followed. Source sends the ARP request to the

default gateway and gets back the MAC address of default gateway. (If it knows which router

to send then it sends ARP request to the corresponding router and not to Default gateway)

When source sends data to default gateway (a router in this case), the router broadcasts ARP

request for the destined IP address in the appropriate subnet. On getting the ARP response

from destination, router then sends the data packet to destination node.

PART 2: - Changing default Gateway

Do Sample 2 in PART 1 with the difference that in the properties of NODE-1, change the

default gateway to some other value, for ex. “192.168.2.76” and click on Simulate button.

You will get error. Because NODE-1 will check the IP address of NODE-3 and then realize

that it isn‟t in the same subnet. So it will forward it to default gateway. Since the default

gateway‟s address doesn‟t exist in the network, error occurs.

Page 148: Maharastra CCN  NetSim Experiment  Manual

81

26. Study how the Data Rate of a Wireless LAN

(IEEE 802.11b) network varies as the distance

between the Access Point and the wireless

nodes is varied.

26.1 Theory:

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 system

implements various modulation modes for every transmission rate, which are Different

Binary Phase Shift Keying (DPSK) for 1 Mbps, Different Quaternary Phase Shift Keying

(DQPSK) for 2 Mbps and Complementary Code Keying (CCK) for 5.5 Mbps and 11 Mbps.

Large Scale Fading represents Receiver Signal Strength or path loss over a large area as a

function of distance. The statistics of large scale fading provides a way of computing

estimated signal power or path loss as a function of distance and modulation modes vary

depends on the Receiver Signal Strength.

26.2 Procedure:

Please navigate through the below given path to,

Go to Simulation New Internetworks

Sample Inputs:

Follow the steps given in the different samples to arrive at the objective.

In Sample 1,

Total no of APs (Access Points) used: 1

Total no of Wireless Nodes used: 1

Total no of Routers used: 1

Page 149: Maharastra CCN  NetSim Experiment  Manual

82

Total no of Switches used: 1

Total no of Wired Nodes used: 1

The AP, Wireless Nodes, Router, Switch and Wired Nodes are interconnected as shown:

Also edit the following properties of Wireless Node E:

Wireless Node E Properties

X/Lat 355

Y/Lon 150

Interface_Wireless properties

RTS Threshold(bytes) 2347

Retry Limit(DataLink_Layer) 7

Rate _Adaptation true

Edit all link properties as shown:

Wireless Link Properties

Channel Characteristics Fading only

Path Loss Exponent 2.5

Fading Figure 1.0

Wired Link Properties

Uplink Speed (Mbps) 100

Downlink Speed (Mbps) 100

Uplink BER 0

Downlink BER 0

Page 150: Maharastra CCN  NetSim Experiment  Manual

83

Also edit the following properties of Wired Node A:

Wired Node A Properties

TCP Disabled

Set the properties of Access Point as follows:

Access Point Properties

X/Lat 350

Y/Lon 150

Interface_Wireless properties

Buffer Size(MB) 5

RTS Threshold(bytes) 2347

Retry Limit 7

Click and drop the Application, set properties and run the simulation.

Application Properties

Application Type Custom

Source_Id 1

Destination_Id 5

Packet Size

Distribution Constant

Value (bytes) 1460

Packet Inter Arrival Time

Distribution Constant

Value (micro secs) 900

Simulation Time - 10 Sec

(Note: The Simulation Time can be selected only after the following two tasks,

Set the properties for all the devices and links.

Click on Run Simulation button.

Page 151: Maharastra CCN  NetSim Experiment  Manual

84

Upon completion of the experiment, “Save” the metrics result for comparison by using

Export to Excel . Save the excel file in any user defined location.

Sample 2: Distance from Wireless Node E to Access Point is 10m.

Sample 3: Distance from Wireless Node E to Access Point is 15m.

……. and so on till 55 meter distance.

26.3 Output:

Go to Application Metrics and obtain Throughput value for all the samples from the saved

Excel files and make a comparison chart as shown. Use Excel “Insert Chart” option and

then select chart type as “Line chart”.

Comparison Chart:

Distance (m) Throughput (Mbps)

5 5.558512

10 5.538656

15 5.105328

20 2.869776

25 0.790736

30 0.712480

35 0.619040

40 0.515088

45 0.401792

50 0.288496

55 0.094608

26.4 Inference

0

1

2

3

4

5

6

0 10 20 30 40 50 60

Thro

ugh

pu

t (M

bp

s)

Distance

Page 152: Maharastra CCN  NetSim Experiment  Manual

85

*** All the above plots highly depend upon the placement of nodes in the simulation

environment. So, note that even if the placement is slightly different, the same set of values

will not be got but one would notice a similar trend.

We notice that as the distance increases, the throughput decreases. This is because the

underlying data rate depends on the received power at the receiver. Received power is

directly proportional to (1 / distance).

In 802.11b, four data rates, 1 Mbps, 2 Mbps, 5.5 Mbps, and 11 Mbps, are supported. The rate

is decided based on the received power and the errors in the channel. Note a higher data rate

does not necessarily yield a higher throughput since packets may get errored. Only when the

channel conditions are good, does a higher data rate give a higher throughput. In a realistic

WLAN environment, the channel condition can vary due to pathloss, fading, and shadowing.

In NetSim to accommodate different channel conditions, rate adaptation is commonly

employed. The rate adaptation algorithms dynamically adjusts the modulation mode

and data rate to optimize performance when channel condition changes. So, when

NetSim detects that the number of errors in the channels are high, it automatically drops

down to a lower rate.

In addition, one must note that WLAN involves ACK packets after data transmission.. These

additional packet transmission lead to reduced Application throughput of 5.5 Mbps (at 1 – 20

mts range) even though the PHY layer data rate is 11 Mbps.

Page 153: Maharastra CCN  NetSim Experiment  Manual

86

27. Analyze the performance of a MANET,

(running CSMA/CA (802.11b) in MAC) with

increasing node density

27.1 Theory:

Mobile Ad-Hoc Network (MANET) is a self-configuring network of mobile nodes connected

by wireless links to form an arbitrary topology without the use of existing infrastructure. The

nodes are free to move randomly. Thus the network's wireless topology may be unpredictable

and may change rapidly.

The node density also has an impact on the routing performance. With very sparsely

populated network the number of possible connection between any two nodes is very less and

hence the performance is poor. It is expected that if the node density is increased the

throughput of the network shall increase, but beyond a certain level if density is increased the

performance degrades.

27.2 Performance metrics:

The different parameters used to analyze the performance are explained as follows:

Throughput: It is the rate of successfully transmitted data packets in unit time in the

network during the simulation.

Average Delay: It is defined as the average time taken by the data packets to propagate

from source to destination across a MANET. This includes all possible delays caused by

routing discovery latency, queuing at the interface queue, and retransmission delays at the

MAC, propagation and transfer times.

27.3 Procedure:

In NetSim, Select “Simulation New Advanced Wireless Networks MANET”.

Step 1: Create /Design the Network

Devices Required: 2 Wireless Nodes

Page 154: Maharastra CCN  NetSim Experiment  Manual

87

Step 2: Configure the Network (Sample 1)

Wireless Node Properties:

Click & drop 4 Wireless Nodes onto the Simulation Environment.

Arrange the positions of the nodes as per the following table:

Wireless Node X-Coordinate Y-Coordinate

1 50 100

2 100 150

NOTE: To edit the position, change the (x, y) co-ordinates in Global Properties as shown:

Disable TCP in all Wireless Nodes.

Right Click on any Wireless Node Properties

Wireless Link Properties:

Right Click anywhere on the Grid EnvironmentProperties

To change

Co-ordinates,

click & edit

Page 155: Maharastra CCN  NetSim Experiment  Manual

88

Channel Characteristics Line of Sight

Path Loss Exponent (n) 2

Step 3: Model Traffic in the Network (Sample 1)

Select the Application Button and click on the gap between the Grid Environment and the

ribbon. Now right click on Application and select Properties.

Page 156: Maharastra CCN  NetSim Experiment  Manual

89

Application Properties:

Step 4: Simulate

Simulation Time - 100 Sec

After completion of the experiment, “Save” the experiment for future analysis of results.

Steps to save an experiment:

Step 1: After simulation of the

network, on the top left corner

of Performance metrics screen,

click on the “Save Network and

Metric as” button

Step 2: Specify the Experiment Name and Save Path and click on OK

Application Type Custom

Source ID 1 (Wireless Node A)

Destination ID 2 ( Wireless Node B)

Packet Size

Distribution Constant

Value(Bytes) 1460

Inter Arrival Time

Distribution Constant

Value(µs) 60000

Page 157: Maharastra CCN  NetSim Experiment  Manual

90

Step 5: Configure the Network (Sample 2)

Wireless Node Properties:

Click & drop 2 more Wireless Nodes onto the Simulation Environment.

Arrange the positions of the nodes as per the following table:

Wireless Node X-Coordinate Y-Coordinate

1 50 100

2 100 150

3 75 75

4 125 125

Disable TCP in all Wireless Nodes.

Right Click on any Wireless Node Properties

The remaining properties are same as Sample 1.

Step 6: Model Traffic in the Network (Sample 2)

Select the Application Button and click on the gap between the Grid Environment and the

ribbon. Now right click on Application and select Properties.

Application Properties:

Application Type Custom Custom

Source ID 1 ( Wireless Node A) 3 ( Wireless Node C)

Destination ID 2 ( Wireless Node B) 4 ( Wireless Node D)

Packet Size

Distribution Constant Constant

Value(Bytes) 1460 1460

Inter Arrival Time

Distribution Constant Constant

Value(µs) 60000 60000

Page 158: Maharastra CCN  NetSim Experiment  Manual

91

NOTE: The procedure to create multiple applications are as follows:

Step 1: Click on the ADD button present in the bottom left corner to add a new

application.

Step 7: Simulate

Simulation Time - 100 Sec

After completion of the experiment, “Save” the experiment for future analysis of results.

Step 8: Configure the Network (Sample 3)

Wireless Node Properties:

Click & drop 2 more Wireless Nodes onto the Simulation Environment.

Arrange the positions of the nodes as per the following table:

Wireless Node X-Coordinate Y-Coordinate

1 50 100

2 100 150

3 80 70

4 140 130

5 110 40

6 160 90

Disable TCP in all Wireless Nodes.

Page 159: Maharastra CCN  NetSim Experiment  Manual

92

The remaining properties are same as Sample 2.

Step 9: Model Traffic in the Network (Sample 3)

Select the Application Button and click on the gap between the Grid Environment and

the ribbon. Now right click on Application and select Properties.

Application Properties:

Step 10: Simulate

Simulation Time - 100 Sec

After completion of the experiment, “Save” the experiment for future analysis of results.

27.4 Output

Go to Simulation Open Metrics menu to open the results of saved experiments.

Go to Application metrics and compute the sum of all column wise values of throughput.

Throughput = Sum of throughputs obtained from all Applications

Go to Application metrics and compute the Average delay by taking average of all row

wise values of Delay.

Application Type Custom Custom Custom

Source ID 1 ( Wireless Node A) 3 ( Wireless Node C) 5 ( Wireless Node E)

Destination ID 2 ( Wireless Node B) 4 ( Wireless Node D) 6 ( Wireless Node F)

Packet Size

Distribution Constant Constant Constant

Value(Bytes) 1460 1460 1460

Inter Arrival Time

Distribution Constant Constant Constant

Value(µs) 60000 60000 60000

Page 160: Maharastra CCN  NetSim Experiment  Manual

93

Delay = Average delay obtained from all Applications

Plotting the Throughput obtained from the above 3 samples with respect to Number of Nodes

and the graph which is obtained, follows the pattern as below:

Plot the Average Delay obtained from the above 3 samples with respect to Number of Nodes

and the graph obtained is similar to:

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0 2 4 6 8

Thro

ugh

pu

t (M

bp

s)

No. of Nodes

NOTE – To create Graph in Excel 2010, follow the steps

1. Copy the data in an Excel sheet.

2. Select the data. Go to Insert Scatter (under Charts) Scatter with Straight

lines and Markers.

Page 161: Maharastra CCN  NetSim Experiment  Manual

94

27.5 Inference

As the number of nodes increases (4 6 8) the throughput of the network increases

because the channel is able to handle additional network traffic. However, if the number of

nodes is increased further, the throughput may decreases as the network traffic is too high,

and this leads to collisions.

0

2

4

6

8

10

12

14

16

18

20

0 2 4 6 8

Ave

rage

Del

ay (

Seco

nd

s)

No. of Nodes

Page 162: Maharastra CCN  NetSim Experiment  Manual

95

28. Understand the impact of bit error rate on

packet error and investigate the impact of

error of a simple hub based CSMA / CD

network

28.1 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.

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 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.

Bit error probability (pe): The bit error probability is the expectation value of the BER. The

BER can be considered as an approximate estimate of the bit error probability. This estimate

is accurate for a long time interval and a high number of bit errors.

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.

The expectation of the PER is denoted as packet error probability pp, which for a data packet

length of N bits can be expressed as,

It is based on the assumption that the bit errors are independent of each other.

Page 163: Maharastra CCN  NetSim Experiment  Manual

96

Derivation of the packet error probability:

Suppose packet size is N bits.

is the bit error probability then probability of no bit error=1-

As packet size is N bits and it is the assumption that the bit errors are independent. Hence,

Probability of a packet with no errors =

A packet is erroneous if at least there is one bit error, hence

Probability of packet error=1-

28.2 Procedure:

How to create a scenario and generate traffic:

Create Scenario: “Simulation New Legacy Networks Traditional Ethernet”.

Example 1:

Create samples by varying the bit error rate (10-6

, 10-7

, 10-8

, 10-9

, No error) and check

whether packet error output matches the PER formula.

Sample Inputs:

To perform this sample experiment, two nodes and one hub are considered.

Page 164: Maharastra CCN  NetSim Experiment  Manual

97

Click and drop Hub on the environment builder.

Click and drop Node1 over the hub.

Click and drop Node2 over the hub.

The properties of Node 1 and Hub are as follows: (Node 2 has default properties)

Hub Properties Sample 1 Sample 2 Sample 3 Sample 4 Sample 5

Data rate (Mbps) 10 10 10 10 10

Error Rate (BER) No Error 10-9

10-8

10-7

10-6

Physical Medium Twisted

Pair

Twisted

Pair

Twisted

Pair

Twisted

Pair

Twisted Pair

The properties of Node 1 is shown below:

Simulation Time - 100 Sec

(Note: The Simulation Time can be selected only after the following two tasks,

Set the properties for the Nodes& The Hub

Click on the Simulate button).

Page 165: Maharastra CCN  NetSim Experiment  Manual

98

Example 2:

Sample Inputs:

In this sample experiment, four nodes and one hub are considered.

Click and drop Hub on the environment builder.

Click and drop Node1 over the hub.

Click and drop Node2 over the hub.

Click and drop Node3 over the hub

Click and drop Node4 over the hub

Hub Properties Sample 1 Sample 2 Sample 3 Sample 4 Sample 5

Data rate (Mbps) 10 10 10 10 10

Error Rate (BER) No Error 10-9

10-8

10-7

10-6

Physical Medium Twisted

Pair

Twisted

Pair

Twisted

Pair

Twisted

Pair

Twisted

Pair

The properties of Node 1 are same as in Example 1 and Node 2 properties are shown below:

(Node 3 and Node 4 have default properties)

Simulation Time - 100 Sec

(Note: The Simulation Time can be selected only after the following two tasks,

Set the properties for the Nodes& The Hub

Click on the Simulate button).

Page 166: Maharastra CCN  NetSim Experiment  Manual

99

NetSim simulation output:

Example 1: One node transmission

BER Frames

Errored

Frames

Generated

0

1E-09

1E-08

1E-07

1E-06

0

0

0

2

41

4000

4000

4000

4000

4000

Example 2: Two nodes transmission

Packet size for the calculation of the output table=1500 bytes or 12000 bits

Comparing Packets errored with Bit error rate:

28.3 Inference:

From the Graph, 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.

0

10

20

30

40

50

60

70

80

90

No Error 10^-9 10^-8 10^-7 10^-6

Pack

ets

Erro

red

Bit Error Rate

One Node Transmission

Two Nodes Transmission

BER Frames

Errored

Frames

Generated

0

1E-09

1E-08

1E-07

1E-06

0

0

0

5

79

8000

8000

8000

8000

8000

Page 167: Maharastra CCN  NetSim Experiment  Manual

100

29. To determine the optimum persistence of a

p-persistent CSMA / CD network for a heavily

loaded bus capacity.

29.1 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. 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 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 in the meantime.

There are mainly three theoretical versions of the CSMA /CD protocol:

1-persistent CSMA / CD: When a station has data to send, it first listens to the channel to

see if anyone else is transmitting at that moment. If the channel is busy, the station waits until

it becomes idle. When station detects an idle channel, it transmits a frame. If a collision

occurs, the station waits a random amount of time and starts all over again. The protocol is

called 1-persistent because the station transmits with a probability of 1 whenever it finds the

channel idle.

Ethernet, which is used in real-life, uses 1-persistence. A consequence of 1-persistence is

that, if more than one station is waiting for the channel to get idle, and when the channel gets

idle, a collision is certain. Ethernet then handles the resulting collision via the usual

exponential back off. If N stations are waiting to transmit, the time required for one station to

win the back off is linear in N.

Non-persistent CSMA /CD: In this protocol, before sending, a station senses the channel. If

no one else is sending, the station begins doing so itself. However, if the channel is already in

use, the channel does not continually sense it for the purpose of seizing it immediately upon

detecting the end of the previous transmission. Instead, it waits a random period of time and

then repeats the algorithm. Intuitively this algorithm should lead to better channel utilization

and longer delays than 1-persistent CSMA

p-persistent CSMA / CD: This protocol applies to slotted channels. When a station

becomes ready to send, it senses the channel. If it is idle, it transmits with a probability of p.

Page 168: Maharastra CCN  NetSim Experiment  Manual

101

With a probability q=1-p it defers until the next slot. If that slot is also idle, it either transmits

or defers again, with probabilities p and q respectively. This process is repeated until either

the frame has been transmitted or another station has begun transmitting. In the latter case, it

acts as if there had been a collision (i.e., it waits a random time and starts again). If the station

initially senses the channel busy, it waits until the next slot and applies the above algorithm.

How does the performance of LAN (throughput) that uses CSMA/CD protocol gets

affected as the numbers of logged in user varies:

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 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 collide with the newly arriving packets.

29.2 Procedure:

How to create a scenario and generate traffic:

Create Scenario: “Simulation New Legacy Networks Traditional Ethernet”.

Scenario:

Sample Input:

In this Sample experiment 12 Nodes and 2 Hubs need to be clicked and dropped onto the

Environment Builder.

Input for the Sample experiments (i.e. Totally 11 Samples) are given below,

Page 169: Maharastra CCN  NetSim Experiment  Manual

102

Sample Input 1:

In the first sample for each Node the following properties have to be set,

Node Properties Values to be Selected

Transmission Type Broadcast

Traffic Type Data

No. of Nodes Transmitting 12

Persistence 1

MTU Size(bytes) 1500

Vary persistence from 1/2, 1/3, 1/4, 1/5… 1/11, 1/12 to generate other experiments.

Data Input Configuration: (This window is obtained when Data is selected in Traffic

Type):

Packet Size Distribution Constant

Application Data Size (bytes) 1472

Inter Arrival Time Distribution Exponential

Mean Inter Arrival Time(µs) 1000

Hub Properties common for Hub1 and Hub2:

Hub Properties Values to be

Selected

Data Rate(Mbps) 10

Error Rate (bit error rate) No error

Physical Medium Twisted Pair

Simulation Time - 10 Sec

(Note: The Simulation Time can be selected only after the following two tasks,

Set the properties for the Nodes & The Hub

Click on Run Simulation button).

Page 170: Maharastra CCN  NetSim Experiment  Manual

103

29.3 Output:

After simulation of each experiment, click on the network statistics and note down the user

level throughput values. Open an excel sheet and plot a graph for these noted values against

their respective persistence values.

Comparison Chart:

29.4 Inference:

As the number of logged in users is quite large in this experiment, the performance of a p-

persistent CSMA/CD network with large p, is not optimal because of a large number of

collisions. Therefore, we have minimum throughput when the persistence was 1/2. But as

persistence is decreased (lower and lower probabilities), the likelihood of collisions reduce

and hence throughput starts to increase. However, beyond a certain limit, in this case 1/11 the

probability of transmitting packets becomes very low and hence there aren‟t many

transmissions. Therefore, throughput starts to decline. In this experiment with 12 nodes

generating traffic, we notice that the maximum throughput is at a persistence value lying

between 1/9 and 1/11.

Optimum

Page 171: Maharastra CCN  NetSim Experiment  Manual

104

30. To study the working of Time Division

Multiple Access technique

30.1 How to Proceed:

The objective can be executed in NetSim using the programming exercise available, under

programming user has to select Multiple Access Technology Time Division Multiple

Access.

30.2 Sample Inputs:

In the Input panel the following steps need to be done,

Sample Mode should be selected.

Enter the Value of the Bandwidth.

Enter the Value of the No. of Time Slots.

Enter the Value of the TimeSlotLength.

Enter the Value of the GuardInterval

Note: The Values entered should be within the range.

Bandwidth(kHz) 200

No. of TimeSlots 3

TimeSlotLength(µs) 100

GuardInterval(µs) 10

Then Run button need to be clicked. Refresh button can be used, if new

Inputs have to be given.

Page 172: Maharastra CCN  NetSim Experiment  Manual

105

30.3 Output:

The Output for the above sample is as follows,

Bandwidth is divided into Time slots called channel.

The first channel is allocated to first mobile station, second channel is

allocated to second mobile station and so on.

The first Mobile Station will access the medium in first channel time slot.

The Second Mobile Station will access the medium in second channel

time slot, and so on.

During the guard interval, No mobile station will access the medium. This

is used to avoid the collision or interference.

Finally the table will be showed as follows,

Channel no. is obtained.

Bandwidth value is obtained.

Start Time and End Time of the Guard Interval is obtained

Start Time and End Time of the channel is obtained.

Which Mobile Station is accessing the allocated time slot is obtained.

Page 173: Maharastra CCN  NetSim Experiment  Manual

106

Channel number Bandwidth(kHz) Time(µs) Mobile Station

0 200 0.0 – 5.0 0

1 200 5.0 – 95.0 1

0 200 95.0 – 100.0 0

0 200 100.0 – 105.0 0

2 200 105.0 – 195.0 2

0 200 195.0 – 200.0 0

0 200 200.0 – 205.0 0

3 200 205.0 – 295.0 3

0 200 295.0 – 300.0 0

0 200 300.0 – 305.0 0

1 200 305.0 – 395.0 1

Page 174: Maharastra CCN  NetSim Experiment  Manual

107

31. Orthogonal Frequency Division Multiple

Access

Programming Guidelines

This section guides the user to link his/her own code for Orthogonal Frequency Division

Multiple Access to NetSim.

Pre-conditions

The user program should read the input scenario from text file named „Input‟ with extension

txtwhich is in Temporary Directory.

The user program after executing the concept should write the required output to a file named

„Output’ with extension txtin Temporary Directory.

Note:The temporary directory is navigated through the following step.

Run Type "%temp%" NetSim "Input.txt" and "Output.txt"

General Program Flow

The program begins with the Reading of the Inputs from the input file Input.txt.

Executing the required concept and, the results of the program should be written into the

output file Output.txt.

Input File Format Output File Format

The following lines will be

in Input.txt file.

Number of users = Value

User1 =Value

User2 =Value

User3 =Value

User4 =Value

Number of sub carrier per

user = Value

Example:

Number of users = 4

User1 =111111111111

Parallel Data Conversion

User 1

Value

User 2

Value

User 3

Value

User 4

Value

Bit Mapping

User 1

Value

Page 175: Maharastra CCN  NetSim Experiment  Manual

108

User2 =010101010101

User3 =101010101010

User4 =000000000000

Number of sub carrier per

user = 4

User 2

Value

User 3

Value

User 4

Value

SubCarrier Mapping

User 1

Value

User 2

-Value

User 3

Value

User 4

Value

SubCarrier Addition

User 1

Value

User 2

Value

User 3

Value

User 4

Value

Example:

Parallel Data Conversion

User 1

1 1 1 1

1 1 1 1

1 1 1 1

User 2

0 1 0 1

0 1 0 1

0 1 0 1

Page 176: Maharastra CCN  NetSim Experiment  Manual

109

User 3

1 0 1 0

1 0 1 0

1 0 1 0

User 4

0 0 0 0

0 0 0 0

0 0 0 0

Bit Mapping

User 1

1 1 1 1

1 1 1 1

1 1 1 1

User 2

-1 1 -1 1

-1 1 -1 1

-1 1 -1 1

User 3

1 -1 1 -1

1 -1 1 -1

1 -1 1 -1

User 4

-1 -1 -1 -1

-1 -1 -1 -1

-1 -1 -1 -1

SubCarrier Mapping

User 1

sin(2PIf0t) sin(2PIf1t) sin(2PIf2t) sin(2PIf3t)

sin(2PIf0t) sin(2PIf1t) sin(2PIf2t) sin(2PIf3t)

sin(2PIf0t) sin(2PIf1t) sin(2PIf2t) sin(2PIf3t)

User 2

-sin(2PIf4t) sin(2PIf5t) -sin(2PIf6t) sin(2PIf7t)

-sin(2PIf4t) sin(2PIf5t) -sin(2PIf6t) sin(2PIf7t)

-sin(2PIf4t) sin(2PIf5t) -sin(2PIf6t) sin(2PIf7t)

User 3

Page 177: Maharastra CCN  NetSim Experiment  Manual

110

sin(2PIf8t) -sin(2PIf9t) sin(2PIf10t) -sin(2PIf11t)

sin(2PIf8t) -sin(2PIf9t) sin(2PIf10t) -sin(2PIf11t)

sin(2PIf8t) -sin(2PIf9t) sin(2PIf10t) -sin(2PIf11t)

User 4

-sin(2PIf12t) -sin(2PIf13t) -sin(2PIf14t) -sin(2PIf15t)

-sin(2PIf12t) -sin(2PIf13t) -sin(2PIf14t) -sin(2PIf15t)

-sin(2PIf12t) -sin(2PIf13t) -sin(2PIf14t) -sin(2PIf15t)

SubCarrier Addition

User 1

sin 2PI(f0+f1+f2+f3)t

sin 2PI(f0+f1+f2+f3)t

sin 2PI(f0+f1+f2+f3)t

User 2

sin 2PI(-f4+f5-f6+f7)t

sin 2PI(-f4+f5-f6+f7)t

sin 2PI(-f4+f5-f6+f7)t

User 3

sin 2PI(f8-f9+f10-f11)t

sin 2PI(f8-f9+f10-f11)t

sin 2PI(f8-f9+f10-f11)t

User 4

sin 2PI(-f12-f13-f14-f15)t

sin 2PI(-f12-f13-f14-f15)t

sin 2PI(-f12-f13-f14-f15)t

Interface Source Code

Interface Source code written in C is given. Using this, the user can writeonly the

fnOFDMA() and fnSubcarrierAddition() functions, using the variables already declared.To

view the interface source code, go to

NetSim Installation path/src/Programming/OFDMA.c

To find NetSim‟s Installation path right click NetSim icon and select

Open file location in Windows 7

Open file location in Windows Vista

Page 178: Maharastra CCN  NetSim Experiment  Manual

111

Properties find target in Windows XP.

Sample Scenarios:

Objective - To study the working of Orthogonal Frequency Division Multiple Access

technique

How to Proceed? - The objective can be executed in NetSim using the programming

exercise available. Under programming select Multiple Access Technology OFDMA

Sample Inputs - In the Input panel,

Sample Mode should be selected.

The value of Number of Users needs to be selected.

Enter the Binary Datafor each user.

Number of SubCarriers per User needs to be selected.

Then Run button needs to be clicked. Refresh button can be used if new Inputs have to

be given.

Output - The following steps are done internally by NetSim

The values of each userBinary Data, Parallel Conversion, Bit Mapping, SubCarrier

Mapping&SubCarrier Addition and Transmission will be shown in the right hand side

of the screen by animation.

Once the sample experiment is done Refresh button can be clicked to create new

samples.

Page 179: Maharastra CCN  NetSim Experiment  Manual

112

32. Plot the characteristic curve throughput

versus offered traffic for a Slotted ALOHA

system.

32.1 Theory:

ALOHA provides a wireless data network. It is a multiple access protocol (this protocol is for

allocating a multiple access channel). There are two main versions of ALOHA: pure and

slotted. They differ with respect to whether or not time is divided up into discrete slots into

which all frames must fit.

Slotted ALOHA:

In slotted Aloha, time is divided up into discrete intervals, each interval corresponding to one

frame. In Slotted ALOHA, a computer is required to wait for the beginning of the next slot in

order to send the next packet. The probability of no other traffic being initiated during the

entire vulnerable period is given by which leads to where, S (frames per

frame time) is the mean of the Poisson distribution with which frames are being generated.

For reasonable throughput S should lie between 0 and 1.

G is the mean of the Poisson distribution followed by the transmission attempts per frame

time, old and new combined. Old frames mean those frames that have previously suffered

collisions.

It is easy to note that Slotted ALOHA peaks at G=1, with a throughput of or about

0.368. It means that if the system is operating at G=1, the probability of an empty slot is

0.368

Calculations used in NetSim to obtain the plot between S and G:

Using NetSim, the attempts per packet time (G) can be calculated as follows;

Where, G = Attempts per packet time

TA = Total Attempt

PT = Packet time (in seconds)

Page 180: Maharastra CCN  NetSim Experiment  Manual

113

ST = Simulation time (in seconds)

The throughput (in Mbps) per packet time can be obtained as follows:

Where, S = Throughput per packet time

PT = Packet time (in milliseconds)

PS = Packet size (in bytes)

Calculations for the packet time:

In the following experiment, we have taken packet size=1472 (Data Size) + 26 (Overheads) =

1498 bytes

Bandwidth is 10 Mbps and hence, packet time comes as 1.198 milliseconds.

32.2 Procedure:

Step 1:

How to Create Scenario:

Create Scenario: “Simulation New Legacy Networks Slotted Aloha”.

Click and drop two nodes as shown in the screen

shot.

Page 181: Maharastra CCN  NetSim Experiment  Manual

114

Sample Inputs:

Input for Sample 1: Node 1 generates traffic. The properties of Node 1 which transmits data

to Node 2 are selected as follows:

Page 182: Maharastra CCN  NetSim Experiment  Manual

115

Simulation Time- 10 Seconds

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Nodes

Then click on Run Simulation button).

Obtain the values of Throughput and Total Attempts from the statistics of NetSim

simulation for various numbers of traffic generators.

Input for Sample 2: Node 1 and Node 2 both generates traffic. Node 1 transmits data to

Node 2 & Node 2 transmits data to Node 1.The properties of Node 1 and Node 2 are set as

shown in Sample 1.

Input for Sample 3: 3 Nodes are generating traffic. Node 1 transmits data to Node 2, Node 2

transmits data to Node 3 and Node 3 transmits data to Node 1.

And so on continue the experiment by increasing the number of nodes generating traffic as 4,

5, 7, 9, 10, 15, 20 22 and 24 nodes.

Comparison Table:

The values of Throughput and Total Attempts obtained from the network statistics after

running NetSim simulation are as follows. Throughput per packet time and Attempts per

packet time calculated from the above mentioned formulae are tabulated as below:

Number of

nodes

generating

traffic

Throughput

(in Mbps)

Total

attempts

Throughput

per packet

time

Attempts per

packet time

1 0.59 499 0.06 0.06

2 1.2 3308 0.12 0.39

3 1.8 4953 0.18 0.59

4 2.4 6691 0.24 0.80

5 2.9 9180 0.29 1.09

7 2.8 14012 0.28 1.67

9 2.7 14868 0.27 1.78

Page 183: Maharastra CCN  NetSim Experiment  Manual

116

10 2.7 15078 0.27 1.80

15 2.6 16037 0.26 1.92

20 2.5 16437 0.25 1.96

22 2.4 16496 0.24 1.97

24 2.4 16755 0.24 2.00

Thus the following characteristic plot for the Slotted ALOHA is obtained, which matches the

theoretical result.

Note: The optimum value is slightly less than the theoretical maximum of 0.368 because

NetSim‟s simulation is per real-world and includes overheads, inter-frame gaps etc.

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.06 0.39 0.59 0.8 1.09 1.67 1.78 1.8 1.92 1.96 1.97 2

Th

roug

hp

ut

per

pac

ket

tim

e

Attempt per packet time

Slotted Aloha

Page 184: Maharastra CCN  NetSim Experiment  Manual

117

33. Physical layer services and system

33.1 DSL

Study theory from NetSim Basic Menu “Introduction:Network Access technology

DSL”

34. Study how call blocking probability varies

as the load on a GSM network is continuously

increased.

34.1 Procedure:

In NetSim, Select “Simulation New Cellular Networks GSM”

Follow the steps given in the different samples to arrive at the objective.

In this Experiment,

One BTS (BTS A) and one MSC (MSC B) is used

Total no of MS used: Vary from 4 to 20 in steps of 2.

The devices are inter connected as given below,

All the MS are placed in the range of BTS A

Set the properties by following the tables for each sample,

Inputs for Sample 1

Number of MS = 4

Page 185: Maharastra CCN  NetSim Experiment  Manual

118

Accept default properties for BTS.

Edit Uplink Bandwidth Min to 890 MHz and Uplink Bandwidth Max to 890.2

MHz in MSC properties.

In the Sample 1, two Applications are run. After dropping Application on the

Environment menu, add application 2 from the left pane and change the following

properties:

Application Properties Application 1 Application2

Application type Erlang_call Erlang_call

Source_Id 3 5

Destination_Id 4 6

Call

Duration_ Distribution Exponential Exponential

Duration(s) 60 60

Inter Arrival Time (sec) 10 10

IAT_ Distribution Exponential Exponential

Codec

Codec Custom Custom

Service Type CBR CBR

Packet Size 33 33

Inter Arrival Time (µs) 20000 20000

Simulation Time – 100 sec

Inputs for Sample 2

Page 186: Maharastra CCN  NetSim Experiment  Manual

119

Number of MS = 6

Add one more Application and set the properties as above with Source_Id as 7 and

Destination_Id as 8.

Likewise, increase the number of MS by 2 upto 20 and set properties for different

Samples by adding an application every time and changing Source_Id and Destination_Id.

Simulation Time – 100 sec

34.2 Output

To view the output, go to the Cellular Metrics.

In MS metrics, add the call blocked and call generated column. Call blocking probability

is calculated as ratio of Total call blocked to Total call generated.

Comparison Charts:

*** All the above plots highly depend upon the placement of Mobile station in the simulation

environment. So, note that even if the placement is slightly different the same set of values

will not be got but one would notice a similar trend.

34.3 Inference:

When the number of MS is increased from 4 to 20 the call blocking probability increases

from 0 to 0.88. As we increase the number of mobile stations more calls are generated. This

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

1 2 3 4 5 6 7 8 9

Cal

l Blo

ckin

g P

rob

abili

ty

Sample Number

Page 187: Maharastra CCN  NetSim Experiment  Manual

120

increases the traffic load on the system & more calls generated implies more channel requests

arrive at the base station but the number of channels is fixed. So when the base station does

not find any free channel the call is blocked.

An additional observation is that the call blocking is zero until 8 MS. This is because the

number of channels is sufficient to handle all call that 6 MS may generate. Only after this the

base station does not find free channels and blocks calls.

Page 188: Maharastra CCN  NetSim Experiment  Manual

121

35. Analysis of GSM Handover

35.1 Theory

GSM (Global System for Mobile communications) is an open, digital cellular technology

used for transmitting mobile voice and data services.

35.2 Procedure

Step 1:

In NetSim, Select “Simulation New

Cellular Networks GSM

Step 2:

Click & drop 2 Base Station, 1 MSC and 2 Mobile

Station on the Simulation Environment as shown and

link them.

Step 3:

Arrange the positions of the Base Station as per the following table:

Base Station X-Coordinate Y-Coordinate

2 1000 1000

3 2000 1000

Arrange the positions of Mobile Station as per the following table:

Mobile Station X-Coordinate Y-Coordinate

4 500 1000

5 1500 1000

Page 189: Maharastra CCN  NetSim Experiment  Manual

122

Step 4:

Mobile Station Properties: Right click on the Mobile Station 4 set Velocity 1 m/s and for

Mobile Station 5 set Velocity 100m/s

Application Properties

Application Type ERLANG_CALL

Source_Id 4(Mobile Station D)

Destination_Id 5(Mobile Station E)

Call

Call Duration 1000 Sec

Inter Arrival Time 1 Sec

Step 4:

Simulation Time - 250 sec

(Note: The Simulation Time can be selected only after doing the following two tasks,

Set the properties of Mobile Station

Then click on Run Simulation button).

Page 190: Maharastra CCN  NetSim Experiment  Manual

123

35.3 Output

Open Packet Animation:

Due to Mobility Mobile Stations can move from one cell to another. In the below figure,

users can see the handover packet flow in packet animation

As shown in the above packet animation, MS D connected to BTS B and MS E

connected to BTS C

MS E is moving from BTS C to BTS B due to mobility Which Causes Handover

Then MS E Sends GSM_Channel_Request_For_Handover to BTS B

In Response, The BTS B checks for resource availability and sends a

GSM_Channel_Granted to the MS E

35.4 Inference

Firstly MS E is communicating with BTS C. Due to mobility MS E moves from one cell to

another. So Handover occurs. Now MS E starts communicating with BTS B.

Page 191: Maharastra CCN  NetSim Experiment  Manual

124

36. Study how the number of channels increases

and the Call blocking probability decreases as

the Voice activity factor of a CDMA network is

decreased

36.1 Procedure:

How to Create Scenario & Generate Traffic:

In NetSim, Select “Simulation New Cellular Networks CDMA”

Please navigate through the below given path to understand,

Inputs

Follow the steps given in the different samples to arrive at the objective.

In all Samples,

Total no of BTS used: 1

Total no of MSC used: 1

Total no of MS used: 60

The devices are interconnected as given below,

All the MS are placed in the range of BTS A ( default 1 Km)

BTS A is connected via Wired Link to MSC B

Sample 1: Drop 1 BTS, 1 MSC and 60 MS and interconnect them in no specific order.

Page 192: Maharastra CCN  NetSim Experiment  Manual

125

Application

Properties

Application

1

Application

2

Application

3

Application

4

Application

5

Source_Id 3 5 7 9 11

Destination_Id 4 6 8 10 12

All other

Properties Default Default Default Default Default

Likewise add 25 more applications (total 30 application) with above properties and

Source_Id13 to Destination_Id 14 for application 6… and Source_Id 61 to Destination_Id 62

for application 30.

We have considered MSC to be device ID 1, and BTS as device ID 2.

Simulation Time – 500 sec

Set Packet Animation to Don’t play/record animation (Simulation will run fast) and click

OK. If record animation option is selected, the simulation may take a long time to complete.

Upon completion of the experiment “Save” the experiment

Sample 2:

Keep all properties same as Sample 1 and in the BTS properties, change the voice activity

factor to 0.9 as shown:

Page 193: Maharastra CCN  NetSim Experiment  Manual

126

Sample 3 and so on: Change the voice activity factor to 0.8 in sample 3, 0.7 in sample 4….

and to 0.1 in sample 10 in BTS properties.

36.2 Output

To view the output, go to the Cellular Metrics.

In Channel metrics, the channel count is mentioned.

For every sample plot the graph.

Comparison Charts and Inference:

When the system Voice activity factor decreases from 1.0 to 0.1, the number of channels

increases from 3 to 30.

0

50

100

150

200

250

300

350

400

450

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1

Ch

ann

el C

ou

nt

Voice Activity Factor

Page 194: Maharastra CCN  NetSim Experiment  Manual

127

In CDMA network, the number of channels is inversely proportional to the voice activity

factor.

Chart 1 is a mirrored form of graph. (This is because VAF is decreasing along +ve X)

In MS metrics, the call generated and call blocked is shown for each MS. Add all the calls

generated to obtain Total call generated, and add calls blocked for all MS Ids to obtain Total

call blocked.

Calculate call blocking probability as ratio of Total call blocked to Total call generated.

When voice activity factor is decreased the number of channels available increases. Thus the

system has more number of channels to handle the same number of calls (Note - Number of

MS is constant and their properties are same across all experiments. So, they generate

approximately same number of calls throughout). As the number of channels increase the

call blocking probability decreases.

xy

1

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1

Cal

l Blo

ckin

g P

rob

abili

ty

Voice Activity Factor

Page 195: Maharastra CCN  NetSim Experiment  Manual

128

37. Mobility Models in Wi-MAX (IEEE 802.16e/m)

Network

37.1 Theory:

Random walk: In this mobility model, a mobile node moves from its current location to a

new location by randomly choosing a direction and speed in which to travel. Each movement

in the Random Walk Mobility Model occurs in either a constant time interval t or a constant

traveled d distance, at the end of which a new direction and speed are calculated.

Random way point: The Random Way Point Mobility Model includes pauses between

changes in direction and/or speed. A Mobile node begins by staying in one location for a

certain period of time (i.e pause). Once this time expires, the mobile node chooses a random

destination in the simulation area. The mobile node then travels toward the newly chosen

destination at the selected speed. Upon arrival, the mobile node pauses for a specified period

of time starting the process again.

37.2 Procedure:

Sample 1(Random Walk):

Step 1:

In NetSim, Select “Simulation New Advanced Wireless Networks Wi-Max”.

Page 196: Maharastra CCN  NetSim Experiment  Manual

129

Step 2:

Drop 1 Base Station and 2 Wi-Max Subscriber as shown below:

Step 3:

BS Properties BS A

Global Properties

X_Coordinate 200

Y_Coordinate 50

Step 4:

Subscriber Node Properties Subscriber Node B Subscriber Node C

Global Properties

X_Coordinate 150 250

Y_Coordinate 100 100

Subscriber Node Properties: Right click on the Subscriber Node and set the Mobility

Model as RANDOM_WALK and Velocity(m/s) as 10 in all the Subscriber Nodes.

Page 197: Maharastra CCN  NetSim Experiment  Manual

130

Step 4: Select the Application Button and click on the gap between the Grid Environment

and the ribbon. Now right click on Application and select Properties as shown below:

Step 5:

Simulation Time - 10 Sec

After completion of the experiment, “Save” the experiment for future analysis of results.

Sample 1.b:

Open Sample 1.a, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WALK and Velocity(m/s) as 30 in all the Subscriber Nodes.

Application Properties

Application Type Custom

Source ID 2 (Subscriber Node B)

Destination ID 3 (Subscriber Node C)

Packet Size

Distribution Constant

Value(Bytes) 1460

Inter Arrival Time

Distribution Constant

Value(µs) 2336

Page 198: Maharastra CCN  NetSim Experiment  Manual

131

Sample 1.c:

Open Sample 1.b, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WALK and Velocity(m/s) as 60 in all the Subscriber Nodes.

Sample 1.d:

Open Sample 1.c, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WALK and Velocity(m/s) as 90 in all the Subscriber Nodes.

Sample 2(Random Way Point):

Sample 2.a:

Open Sample 1a, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WAY_POINT and Velocity(m/s) as 10 in all the Subscriber Nodes.

The remaining properties are same as Sample 1a.

Sample 2.b:

Open Sample 2.a, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WAY_POINT and Velocity(m/s) as 30 in all the Subscriber Nodes.

Sample 2.c:

Open Sample 2.b, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WAY_POINT and Velocity(m/s) as 60 in all the Subscriber Nodes.

Sample 2.d:

Open Sample 2.c, Right click on the Subscriber Node and set the Mobility Model as

RANDOM_WAY_POINT and Velocity(m/s) as 90 in all the Subscriber Nodes.

Page 199: Maharastra CCN  NetSim Experiment  Manual

132

37.3 Output

Velocity

(m/s)

Random Walk Random Way Point

Throughput

(Mbps)

Delay

(Second)

Throughput

(Mbps)

Delay

(Second)

10

30

60

90

2.62

2.57

2.53

2.30

1.78

1.89

1.85

1.96

2.57

2.49

2.37

2.29

1.78

1.99

2.08

2.03

37.4 Inference

As the mobility model is changed (Random Walk Random Waypoint) the throughput of

the network decreases because the relative change in location of the devices increases.

Throughput of Random Waypoint is less compared to Random walk as the relative velocity

among the nodes is zero only during pause time.

The packet delivery ratio decreases as collisions are higher for higher relative velocity

leading to lower number of packets successfully reaching the destination.

Page 200: Maharastra CCN  NetSim Experiment  Manual

133