Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

ETHERNET LAN PROTOCOL

Aim:

To create a scenario and study the performance of Ethernet protocol through simulation.
Measure and plot the relation between

a. Transmitting node versus mean delay


b. Transmitting node versus throughput
c. Transmitting node versus response time
d. Transmitting node versus collision count

Consider star-switch, star-hub and bus topologies.

Theory:

Ethernet is the most popular LAN network technology. It is cost effective and
provides high throughput and low delays. It was standardised by IEEE as IEEE 802.3
standard. The physical layer specifies electrical and mechanical characteristics of the wiring
and the encoding of the bits. The topologies commonly followed are star and bus topology.
The data rate ranges from 10 Mbps to 1Gbps. The encoding method mostly used is
Manchester encoding. Twisted pair cables and fibre optic cables are used. The cable segment
length can be 200m or 500m. Maximum bus length is 2500m with 4 intermediate repeaters.

The MAC address of Ethernet is a 48 bit string. The size of the data frame format
ranges from 72 bytes to 1530 bytes. The access control method followed is Carrier Sense
Multiple Access / collision detection (CSMA/CD).

The LLC sublayer provides connection oriented and connectionless services. LLC can
also multiplex different transmissions that are differentiated by service access point field of
the data frame. LLC uses the CRC field of the data frame to detect errors. The upper layers
follow OSI model.

Procedure:

1. Click the simulation, select LAN and Ethernet protocol. Select the topology say, star
hub. The simulation environment is now open.
2. Drag and drop the hub on the environment.
3. Drag and drop the node on the hub. A minimum of two nodes are required and the
maximum number of nodes depend on the hub capacity.
4. Select the node and change the properties of the node.
5. Clicks configure and simulate.
6. The result of the current environment will be displayed. Click close and a save menu
will pop up. Save the file.
7. Repeat the same for number of times and save in different names.
8. For analysis, from the simulation menu open analysis.
9. In the analysis window, select LAN, Ethernet, Star-hub, and the different samples that
are already saved.
10. The tabulation will be displayed. Select bar char from the chart option and select the
required x-axis detail and Y-axis detail.
11. The bar chart will be displayed.
12. Save the tabulation by exporting it to excel. Save the bar charts.
13. Repeat the same for different topologies.

Result:
TOKEN RING AND TOKEN BUS LAN PROTOCOL
Aim

To create a scenario and study the performance of token ring and token bus protocol
through simulation. Measure and plot the relation between

a. Transmitting node versus mean delay


b. Transmitting node versus throughput
c. Transmitting node versus response time
d. Transmitting node versus collision count

Theory:

Token ring is an efficient LAN network technology for data rate of 4Mbps to 16Mbps
range. It was standardised by IEEE as IEEE 802.5 standard. The physical layer specifies
electrical and mechanical characteristics of the wiring and the encoding of the bits. The
commonly followed topology is ring topology. The encoding method mostly used is
Differential Manchester encoding. Shielded twisted pair cables are used for interconnecting
nodes. To have uninterrupted traffic automatic switches are used at each node.

The MAC address of token ring/bus is a 48 bit string. The size of the data frame
depends on the holding time of a token by a node. The access control method followed is
token passing.

The LLC sublayer provides connection oriented and connectionless services. LLC can
also multiplex different transmissions that are differentiated by service access point field of
the data frame. LLC uses the CRC field of the data frame to detect errors. The upper layers
follow OSI model.

Token bus (IEEE 802.4) combines the features of Ethernet and token ring. It
combines the physical characteristics (bus topology) of Ethernet and the collision free
(predictable delay) feature of token ring. It is used in factory automation and process control.

Procedure:

1. Click the simulation, select LAN and token ring protocol. Select the ring
topology. The simulation environment is now open.
2. Drag and drop the concentrate on the environment. To make a ring connection
click at the ends of the concentrate.
3. Drag and drop the node on the concentrate. A minimum of two nodes are required.
4. Select the node and change the properties of the node.
5. Clicks configure and simulate.
6. The result of the current environment will be displayed. Click close. a save menu
will pop up. Save the file.
7. Repeat the same for number of times and save in different names.
8. For analysis, from the simulation menu open analysis.
9. In the analysis window, select LAN, Ethernet, Star-hub, and the different samples
that are already saved.
10. The tabulation will be displayed. Select bar char from the chart option and select
the required x-axis detail and Y-axis detail.
11. The bar chart will be displayed.
12. Save the tabulation by exporting it to excel. Save the bar charts.
13. Repeat the same for token bus protocol.

Result:
Bit Stuffing

Aim

To write a program to perform bit stuffing.

Theory:

High level data link layer (HDLC) is a bit oriented protocol which uses bit stuffing to
differentiate between a data and a flag. Bit stuffing is the process of adding one extra zero
whenever there are 5 consecutive 1’s in the data so that the receiver does not mistake the data
for a flag. Every time a sender wants to transmit a bit sequence having more than five
consecutive ones it inserts one redundant 0after the fifth 1. For example, the sequence is
011111111000 becomes 0111110111000. The redundant zero is added regardless whether the
sixth bit is a 1or 0. It tells the receiver that the current sequence is not a flag. The receiver
drops the stuffed 0 and the originl sequence is restored. Te flag sequence is 01111110.

With three exceptions, bit stuffing is required whenever five 1’s occur consecutively.
The exceptions are when the bit is really a flag, when the transmission is being aborted and
when the channel is being put into idle. As the receiver reeds the incoming bits, it counts the
1’s. When it finds five consecutive 1’s after a 0, it checks the seventh bit, if the seventh bit is
0; the receiver recognizes it as a stuffed bit and discards it. If the seventh bit is a 1, the
receiver checks the eighth bit. If the eighth bit is a 0, it is a flag and treat accordingly. If the
eighth bit is another 1, the receiver continues counting. A total of 7 to 14 consecutive 1’s
indicate an abort. A total of 15 or more 1’s indicate an idle channel.

Program

#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
char a[25],b[25];
int alength,blength,c,i,j;
clrscr();
printf("\n Enter the binary number\t");
scanf("%s",a);
alength=strlen(a);
c=0;
j=0;
for(i=0;i<alength;i++)
{
if(a[i]=='1')
{
c++;
}
else
{
c=0;
}
b[j]=a[i];
j++;
if(c==5)
{
b[j]='(';
j++;
b[j]='0';
j++;
b[j]=')';
j++;
}
}
blength=j;
printf("\n\n The binary after bit stuffing\n\n\t");
for(i=0;i<blength;i++)
{
printf("%c",b[i]);
}
getch();
}

Result:
LONGITUDINAL REDUNDANCY CHECK
Aim

Write a C program to perform Longitudinal Redundancy Check

Theory

In logical redundancy check a block of data is organized as a table, say a 32 bit can be
organized as a table of 4 rows and 8 columns. A new row will be created with bits that are
the parity bits of the corresponding columns. In the output, the parity bit in the last row is
calculated based on all the bits in the corresponding columns. Then the parity bit is attached
to the original data and is transmitted to the receiver.

LRC increases the likelihood of detecting burst errors. An LRC of n bits can easily
detect a burst error of n bits. A burst error of more than n can also be detected by LRC with
very high probability. There is however one pattern of error that remains exclusive. If two
bits in one data unit are damaged and the two bits are in other data unit are also damaged at
the same position then LRC will not detect the error. For eg. Two data units 11110000 and
11000011 , if the first and last bit in each of them are changed making the data units as
01110001 and 01000010, the error cannot be detected by LRC.

Procedure:

1. Open the file in Turbo C


2. Type the LRC program
3. Compile the program and correct the errors if any
4. Save and run the program
5. Give the necessary inputs and obtain the output for LRC

Program

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
void main()
{
char string[10], bin[100],lrc[100][100],parity[6];
int length, binlength, e ,m,n,i, j, k, x, y, ascii[10];
clrscr();
printf("enter the string:\t");
scanf("%s",string);
length=strlen(string);
printf("\n the length of the string is %d\n",length);
printf(".......\n");
printf("\n ascii values\n");
for(i=0;i<length;i++)
{ ascii[i]=toascii(string[i]);
}
for(i=0;i<length;i++)
{ printf("\n the value of %c is %d",string[i],ascii[i]);
printf("\n");
}
printf(".......\n");
for (m=0;m<100;m++)
{ for(i=0;i<7;i++)
{ lrc[m][i]=0;
}
}
for(i=0;i<100;i++)
{ bin[i]=0;
}
for(k=0;k<length;k++)
{ x=ascii[k];
i=0;
while(x!=1||0)
{ y=x%2;
x=floor(x/2);
bin[i]=y;
i++;
}
bin[i]=x;
j=6;
for(n=0;n<7;n++)
{
lrc[k][n]=bin[j];
j--;
}
}
printf("\n The binary ascii value and the parity bits are\n");
for(m=0;m<length;m++)
{
printf("\n\t");
for(i=0;i<7;i++)
{
printf("%d",lrc[m][i]);
}
printf("\n");
}
k=0;
for(j=0;j<7;j++)
{ e=0;
for(i=0;i<length;i++)
{
if(lrc[i][j]==1)
{
e++;
}
}
if(e%2==1)
{
parity[k]=1;
k++;
}
else
{
parity[k]=0;
k++;
}
}
printf("\t.......\n\t");
for(i=0;i<7;i++)
{
printf("%d",parity[i]);
}
printf("\n.......");
getch();
}

Result
VERTICAL REDUNDANCY CHECK
Aim

Write a C program to perform Vertical Redundancy Check

Theory

The most common and less expensive mechanism for error detection is VRC; often
called as parity check. In this technique, a redundant bit called parity bit is appended to every
data unit. So that total number of 1’s in the data unit becomes even. To transmit a binary data
unit 1000011, the number of 1’s is counted to be 3 an odd number. The data unit is passed
through a parity generator; it counts the number of ones and appends a parity bit at the end of
the data unit, so that the total number of 1’s is even. Then the data unit together with the
appended bit is transmitted through the network. At the destination, the receiver puts the
entire data unit to an even parity checker. If the total number of 1’s is odd, the destination
finds that there is an error in the data and rejects the data.

Procedure:

1. Open the file in Turbo C


2. Type the VRC program
3. Compile the program and correct the errors if any
4. Save and run the program
5. Give the necessary inputs and obtain the output for LRC

Program

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
void main()
{
char string[10], bin[100],vrc[100][100],parity[6];
int length, binlength, e ,m, n,i, j, k, x, y, ascii[10];
clrscr();
printf("enter the string:\t");
scanf("%s",string);
length=strlen(string);
printf("\n the length of the string is %d\n",length);
printf(".......\n");
printf("\n ascii values\n");
for(i=0;i<length;i++)
{ ascii[i]=toascii(string[i]);
}
for(i=0;i<length;i++)
{ printf("\n the value of %c is %d",string[i],ascii[i]);
printf("\n");
}
printf(".......\n");
for (m=0;m<100;m++)
{ for(i=0;i<7;i++)
{ vrc[m][i]=0;
}
}
for(i=0;i<100;i++)
{ bin[i]=0;
}
for(k=0;k<length;k++)
{ x=ascii[k];
i=0;
c=0;
while(x!=1||0)
{
y=x%2;
x=floor(x/2);
bin[i]=y;
if (y==1)
{
c++;
}
i++;
}
bin[i]=x;
c++;
j=6;
for(n=0;n<7;n++)
{
vrc[k][n]=bin[j];
j--;
}
If (c%2==1)
{
i++;
vrc[i]=1;
}
else
{
i++;
vrc[i]=0;
}
for (i=0;i<8; i++)
{
printf(“%d”, vrc[i] );
}
printf(“\n”)
}
printf("\n.......");
getch();
}

Result

You might also like