CN Lab Manual Edited 2017 Regulations
CN Lab Manual Edited 2017 Regulations
CN Lab Manual Edited 2017 Regulations
ALGORITHM
CODING
#include<stdio.h>
#include<math.h>
void main()
{
int i,a[4],c[3],r[7],clk[3],n,sum=0;
printf("Enter data bits\n");
for(i=3;i>=0;i--)
scanf("%d",&a[i]);
printf("\n");
c[0]=(a[0]+a[1]+a[2])%2;
c[1]=(a[1]+a[2]+a[3])%2;
c[2]=(a[1]+a[0]+a[3])%2;
printf("data bits after hamming code is\n");
for(i=3;i>=0;i--)
printf("%d",a[i]);
for(i=2;i>=0;i--)
printf("%d",c[i]);
printf("Enter recieved code\n");
for(i=0;i<7;i++)
scanf("%d",&r[i]);
clk[0]=(r[3]+r[1]+r[2]+r[6])%2;
clk[1]=(r[0]+r[2]+r[1]+r[5])%2;
clk[2]=(r[0]+r[2]+r[3]+r[4])%2;
sum=4*clk[2]+2*clk[1]+1*clk[0];
if(sum==0)
printf("\n u have recivedcoorrect code\n");
if(sum==1)
{
printf("Error in check bit 2\n");
printf("The correct code is");
r[6]=(r[6]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
if(sum==2)
{
printf("Error in check bit 1\n");
printf("The correct code is");
r[5]=(r[5]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
if(sum==3)
{
printf("\nError in data bit 1");
printf("The correct code is");
r[1]=(r[1]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
if(sum==4)
{
printf("\n Error in chect bit 0");
printf("The correct code is");
r[4]=(r[4]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
if(sum==5)
{
printf("\n Error in data bits 3");
printf("The correct code is");
r[3]=(r[3]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
if(sum==6)
{
printf("Error in data bits 0");
printf("The correct code");
r[0]=(r[0]+1)%2;
for(i=0;i<7;i++);
printf("%d",r[i]);
}
if(sum==7)
{
printf("Error in data bits 2");
printf("The correct code is");
r[2]=(r[2]+1)%2;
for(i=0;i<7;i++)
printf("%d",r[i]);
}
}
OUTPUT
Enter data bits
1111
Data bits after hamming code
1111111
Enter received code
1111111
You have received correct code
RESULT
Thus the C program for hamming code can be written and successfully implemented.
Ex.No: 2 IMPLEMENTATION OF STOP AND WAIT
PROTOCOL
AIM
ALGORITHM
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int i,j,noframes,x,x1=10,x2;
clrscr();
for(i=0;i<200;i++)
rand();
noframes=rand()/200;
i=1;j=1;
noframes = noframes / 8;
printf("\n number of frames is %d",noframes);
getch();
while(noframes>0)
{
printf("\nsending frame %d",i);
srand(x1++);
x = rand()%10;
if(x%2 == 0)
{
for (x2=1; x2<2; x2++)
{
printf("waiting for %d seconds\n", x2);
sleep(x2);
}
printf("\nsending frame %d",i);
srand(x1++);
x = rand()%10;
}
printf("\nack for frame %d",j);
noframes-=1;
i++;
j++;
}
printf("\n end of stop and wait protocol");
getch();
}
OUTPUT
No of frames is 6
Sending frame 1
Acknowledgement for frame 1
Sending frame 2
Acknowledgement for frame 2
Sending frame 3
Acknowledgement for frame 3
Sending frame 4
Acknowledgement for frame 4
Sending frame 5
Waiting for 1 second
Retransmitting frame 5
Acknowledgement for frame 5
Sending frame 6
Waiting for 1 second
Sending frame 6
Acknowledgement for frame 6
End of stop and wait protocol
RESULT
Thus the program for stop and wait protocol can be written and successfully implemented.
Ex.No: 3 IMPLEMENTATION AND STUDY OF GOBACK-N
PROTOCOLS AND SELECTIVE REPEAT PROTOCOL
AIM
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int temp1,temp2,temp3,temp4,i,winsize=8,noframes,moreframes;
char c;
intreciever(int);
int simulate(int);
clrscr();
temp4=0,temp1=0,temp2=0,temp3=0;
for(i=0;i<200;i++)
rand();
noframes=rand()/200;
printf("\n number of frames is %d",noframes);
getch();
moreframes=noframes;
while(moreframes>=0)
{
temp1=simulate(winsize);
winsize-=temp1;
temp4+=temp1;
if(temp4 >noframes)
temp4 = noframes;
for(i=temp3+1;i<=temp4;i++)
printf("\nsending frame %d",i);
getch();
temp2=reciever(temp1);
temp3+=temp2;
if(temp3 >noframes)
temp3 = noframes;
printf("\n acknowledgement for the frames up to %d",temp3);
getch();
moreframes-=temp2;
temp4=temp3;
if(winsize<=0)
winsize=8;
}
printf("\n end of sliding window protocol");
getch();
}
intreciever(int temp1)
{
inti;
for(i=1;i<100;i++)
rand();
i=rand()%temp1;
returni;
}
int simulate(intwinsize)
{
int temp1,i;
for(i=1;i<50;i++)
temp1=rand();
if(temp1==0)
temp1=simulate(winsize);
i = temp1%winsize;
if(i==0)
returnwinsize;
else
return temp1%winsize;
}
OUTPUT
Number of frames: 55
Sending frame 1
Sending frame 2
Sending frame 3
Acknowledgement for the frames upto 0
Sending frame 1
Acknowledgement for the frames upto 0
Sending frame 1
Sending frame 3Sending frame 4
Acknowledgement for the frames upto 4
Acknowledgement for the frames upto 54
Sending frame 55
Acknowledgement for the frames upto 55
End of sliding window protocol
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int temp1,temp2,temp3,temp4,temp5,i,winsize=8,noframes,moreframes;
char c;
intreciever(int);
int simulate(int);
intnack(int);
clrscr();
temp4=0,temp1=0,temp2=0,temp3=0,temp5 = 0;
for(i=0;i<200;i++)
rand();
noframes=rand()/200;
printf("\n number of frames is %d",noframes);
getch();
moreframes=noframes;
while(moreframes>=0)
{
temp1=simulate(winsize);
winsize-=temp1;
temp4+=temp1;
if(temp4 >noframes)
temp4 = noframes;
for(i=noframes - moreframes;i<=temp4;i++)
printf("\nsending frame %d",i);
getch();
temp2=reciever(temp1);
temp3+=temp2;
if(temp3 >noframes)
temp3 = noframes;
temp2 = nack(temp1);
temp5+=temp2;
if (temp5 !=0)
{
printf("\n No acknowledgement for the frame %d",temp5);
getch();
for(i=1;i<temp5;i++);
printf("\n Retransmitting frame %d",temp5);
getch();
}
moreframes-=temp1;
if(winsize<=0)
winsize=8;
}
printf("\n end of sliding window protocol Selective Reject");
getch();
}
intreciever(int temp1)
{
inti;
for(i=1;i<100;i++)
rand();
i=rand()%temp1;
returni;
}
intnack(int temp1)
{
inti;
for(i=1;i<100;i++)
rand();
i=rand()%temp1;
returni;
}
int simulate(intwinsize)
{
int temp1,i;
for(i=1;i<50;i++)
temp1=rand();
if(temp1==0)
temp1=simulate(winsize);
i = temp1%winsize;
if(i==0)
returnwinsize;
else
return temp1%winsize; }
OUTPUT
Number of frames: 55
Sending frame 1
Sending frame 2
Sending frame 3
Sending frame 4
No Acknowledgement for the frame 2
Retransmitting frame 2
Sending frame 5
Sending frame 6
No Acknowledgement for the frame 2
Retransmitting frame 2
Sending frame 3
Sending frame 4
No Acknowledgement for the frame 4
.
Sending frame 54
Sending frame 55
End of sliding window protocol
RESULT
Thus the program code to perform sliding window protocol can be implemented successfully.
Ex.No: 4 IMPLEMENTATION OF HIGH LEVEL
DATA LINK CONTROL
AIM
To implement high level data link Control using Cisco Packet Tracer 6.0.1.
INTRODUCTION
High level data link control (HDLC) is a bit oriented code transparent synchronous data link
layer protocol developed by the International Organization for Standardization (ISO).The
Original ISO standards for HDLC are:
The current standard fro HDLC is ISO 13239,which replaces all of those standards.
HDLC can be used for point to multipoint connections, but is now used almost exclusively to
connect one device to another, using what is known as Asynchronous Balanced Mode
(ABM).The Original master-slave modes Normal Response Mode (NRM) and Asynchronous
Response Mode (ARM) are rarely used.
HDLC is one of the most commonly, used protocols in what is layer 2 of the industry
communication reference model called Open Systems Interconnection(OSI).(Layer 1 is the
detailed physical level that involves actually generating and receiving the electronic signals.
Layer 3 is the higher level that has knowledge about the network, including access to router
tables that indicates where to forward or send data. On sending, programming in layer 3
creates a frame that usually contains source and destination network address. HDLC (Layer
2) encapsulated the layer 3 frame, adding data link control information to a new, larger
frame.)
PROCEDURE
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#show controllers s0/0/0
Interface Serial0/0/0
Hardware is PowerQUICC MPC860
DCE V.35, clock rate 2000000
idb at 0x81081AC4, driver data structure at 0x81084AC0
SCC Registers:
General [GSMR]=0x2:0x00000000, Protocol-specific [PSMR]=0x8
Events [SCCE]=0x0000, Mask [SCCM]=0x0000, Status [SCCS]=0x00
Transmit on Demand [TODR]=0x0, Data Sync [DSR]=0x7E7E
Interrupt Registers:
Config [CICR]=0x00367F80, Pending [CIPR]=0x0000C000
Mask [CIMR]=0x00200000, In-srv [CISR]=0x00000000
Command register [CR]=0x580
Port A [PADIR]=0x1030, [PAPAR]=0xFFFF
[PAODR]=0x0010, [PADAT]=0xCBFF
Port B [PBDIR]=0x09C0F, [PBPAR]=0x0800E
[PBODR]=0x00000, [PBDAT]=0x3FFFD
Port C [PCDIR]=0x00C, [PCPAR]=0x200
[PCSO]=0xC20, [PCDAT]=0xDF2, [PCINT]=0x00F
Receive Ring
rmd(68012830): status 9000 length 60C address 3B6DAC4
rmd(68012838): status B000 length 60C address 3B6D444
Transmit Ring
Router#
ROUTER – 2
STEP:2
Router>enable
Router#show controllers s0/0/0
Interface Serial0/0/0
Hardware is PowerQUICC MPC860
DTE V.35 TX and RX clocks detected
idb at 0x81081AC4, driver data structure at 0x81084AC0
SCC Registers:
General [GSMR]=0x2:0x00000000, Protocol-specific [PSMR]=0x8
Events [SCCE]=0x0000, Mask [SCCM]=0x0000, Status [SCCS]=0x00
Transmit on Demand [TODR]=0x0, Data Sync [DSR]=0x7E7E
Interrupt Registers:
Config [CICR]=0x00367F80, Pending [CIPR]=0x0000C000
Mask [CIMR]=0x00200000, In-srv [CISR]=0x00000000
Command register [CR]=0x580
Port A [PADIR]=0x1030, [PAPAR]=0xFFFF
[PAODR]=0x0010, [PADAT]=0xCBFF
Port B [PBDIR]=0x09C0F, [PBPAR]=0x0800E
[PBODR]=0x00000, [PBDAT]=0x3FFFD
Port C [PCDIR]=0x00C, [PCPAR]=0x200
[PCSO]=0xC20, [PCDAT]=0xDF2, [PCINT]=0x00F
Receive Ring
rmd(68012830): status 9000 length 60C address 3B6DAC4
rmd(68012838): status B000 length 60C address 3B6D444
Transmit Ring
tmd(680128B0): status 0 length 0 address 0
tmd(680128B8): status 0 length 0 address 0
tmd(680128C0): status 0 length 0 address 0
tmd(680128C8): status 0 length 0 address 0
tmd(680128D0): status 0 length 0 address 0
tmd(680128D8): status 0 length 0 address 0
tmd(680128E0): status 0 length 0 address 0
tmd(680128E8): status 0 length 0 address 0
tmd(680128F0): status 0 length 0 address 0
tmd(680128F8): status 0 length 0 address 0
tmd(68012900): status 0 length 0 address 0
tmd(68012908): status 0 length 0 address 0
tmd(68012910): status 0 length 0 address 0
tmd(68012918): status 0 length 0 address 0
tmd(68012920): status 0 length 0 address 0
tmd(68012928): status 2000 length 0 address 0
tx_limited=1(2)
Router#
ROUTER – 1
STEP: 3
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/0/0
Router(config-if)#clock rate ?
Speed (bits per second
1200
2400
4800
9600
19200
38400
56000
64000
72000
125000
128000
148000
250000
500000
800000
1000000
1300000
2000000
4000000
<300-4000000> Choose clockrate from list above
Router(config-if)#clock rate 56000
Router(config-if)#ip address 192.168.32.33 255.255.0.0
STEP: 4
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0/0/0
Router(config-if)#clock rate ?
Speed (bits per second
1200
2400
4800
9600
19200
38400
56000
64000
72000
125000
128000
148000
250000
500000
800000
1000000
1300000
2000000
4000000
<300-4000000> Choose clockrate from list above
Router(config-if)#clock rate 56000
This command applies only to DCE interfaces
Router(config-if)#ip address 192.168.32.34 255.255.0.0
Router(config-if)#no shut down
Router(config-if)#
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
Router(config-if)#do ping
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed stat
Router(config-if)#do ping 192.168.32.33
Router(config-if)#encapsulation hdlc
Router(config-if)#do sh int s0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.32.34/16
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/0/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 1158 kilobits/sec
5 minute input rate 5 bits/sec, 0 packets/sec
5 minute output rate 5 bits/sec, 0 packets/sec
5 packets input, 640 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
5 packets output, 640 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
Router(config-if)#
RESULT
Thus the above implementation of High Level Data Link Control using Cisco Packet Tracer
6.0.1 was created successfully.
Ex.No: 5 IMPLEMENTATION OF IP COMMAND SUCH AS PING,
TRACEROUTE, NSLOOKUP
AIM
To implement Ping, Traceroute using cisco packet tracer software and also implement
nslookup using command prompt.
PROCEDURE – PING
PING IMPLENTATION
TRACEROUTE IMPLEMENTATION
RESULT
Thus the implementation of Ping, Traceroute using cisco packet tracer software and then the
implementation of nslookup using command prompt has been done.
Ex.No: 6 IMPLEMENTATION OF IP ADDRESS CONFIGURATION
AIM
To implement IP address Configuration using network simulation software packet tracer
6.0.1.
PROCEDURE
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa 0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#ping 192.168.2.2
^
% Invalid input detected at '^' marker.
Router(config-if)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#int fa 0/1
^
% Invalid input detected at '^' marker.
Router#int fa 0/1
^
% Invalid input detected at '^' marker.
Router#enable
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa 0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa 0/1
Router(config-if)#ip add 192.168.2.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#^Z
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#ping 192.168.2.2
Router#ping 192.168.1.2
Router#ping 192.168.1.2
Router#ping 192.168.2.2
Router#
RESULT
Thus the implementation of IP address Configuration using cisco packet tracer software can
be done sucessfully.
Ex.No: 7 CREATE SCENARIO AND STUDY THE PERFORMANCE OF
NETWORK WITH CSMA / CA PROTOCOL AND COMPARISON
WITH CSMA/CD PROTOCOLS
AIM
To Create the scenario and study the performance of network with CSMA/CA PROTOCOL
using Ethernet LAN.
APPARATUS REQUIRED
LTS-01 trainer kit,3 or more computers with win-2k/XP and Ethernet port available on them,
RJ-45 to RJ-45 LAN connecting cables, L-SIM LAN Protocol analyzer and simulator
software.
PROCEDURE
1. Connect three or more computer LAN ports using RJ-45 to RJ-45 LAN connecting cables
provided with the system to LTS-01Star topology ports.
2. Switch on the LTS-01 & Computers.
3. Run L-SIM software on all the computers, one should be server and others should be
client.
4. On the server computer, select type of n/w as LAN
5. On the server computer, select the topology as STAR, select a protocol as CSMA-CA,
click on create network button
6. Remote computer detail will appear on the computer, connected in network, server will
able to see all the clients and all clients will able to see only server
7. Click on the Send RTS button to get your computer into transmitter mode.
8. Select the computer to whom data file is to be transferred, from the load button, previously
stored / selected file information can be loaded
9. File size will appear in the server window, select the packet size, inter packet delay and
click OK
10. Total packets formed for that file will be indicated on computers, same details of the file
will appear on the remote computer to which the file to be transmitted
11. Click on file transfer button to transfer the file
12. File transfer from one computer to another will take place
13. During file transfer process try to get access to transmit file by clicking on send RTS
button, you will be prompted with channel is busy message.
14. Thus collision of two packets transmitted simultaneously from two senders is avoided.
15. File transfer from one computer to another will take place.
16. Multiple file transfer b/w various server client combination should be performed to
observe throughput vs. packets size graph on transmitter computer.
17. Close file transfer window and click ON protocol analyzer and n/w analyzer buttons on
transmitted computer to view details of the log created
18. Under network analyzer window, Click ON graph analyzer button.
19. Calculate throughput and click ON plot graph button
20. Detailed graph of throughput vs. packet size for the total file transfer activity will appear
on graph window
21. The plot can be printed by clicking on print button.
CSMA/CD:
OBJECTIVE
APPARATUS REQUIRED
LTS-01 trainer kit,3 or more computers with win-2k/XP and Ethernet port available on them,
RJ-45 to RJ-45 LAN connecting cables, L-SIM LAN Protocol analyzer and simulator
software.
PROCEDURE
1. Connect three or more computer LAN ports using RJ-45 to RJ-45 LAN connecting cables
provided with the system to LTS-01Star topology ports.
2. Switch on the LTS-01 & Computers.
3. Run L-SIM software on all the computers, one should be server & others should be client.
4. On the server computer, select type of network as LAN.
5. On the server computer, select the topology as STAR, select a protocol as CSMA-CD,
click on create network button.
6. Remote computer detail will appear on the computer, connected in network, server will
able to see all the clients and all clients will able to see only server.
7. Select the computer to whom data file is to be transferred, from the load button, previously
stored / selected file information can be loaded.
8. File size will appear in the server window, select the packet size, inter packet delay and
click OK.
9. Total packets formed for that file will be indicated on computers, same details of the file
will appear on the remote computer to which the file to be transmitted.
10. Click on file transfer button to transfer the file.
11. File transfer from one computer to another will take place.
12. During file transfer process try to send file to same receiver from the computer, file
transfer from second transmitter will also get initiated.
13. When packet from second sender collides with first sender. It will be indicated as
collision packet on server and client1.
14. File from the first sender will resume after some time and second sender file will be kept
on hold till first file transfer gets completed.
15. Once first sender file reached to server, its display is refreshed and server will show
packet status for second sender.
16. Second sender file transfer will also completed and thus collision of two packets
transmitted simultaneously from two senders is detected and cleared.
17. Multiple file transfer between various server client combinations should be performed to
observe throughput Vs packets size graph on transmitter computer.
18. Close file transfer window and click ON protocol analyzer and network analyzer buttons
on transmitted computer to view details of the log created .
19. Under network analyzer window, Click ON graph analyzer button.
20. Calculate throughput and click ON plot graph button.
21. Detailed graph of throughput Vs packet size for the total file transfer activity will appear
on graph window.
22. The plot can be printed by clicking on print button.
PERFORMANCE
CSMA/CD
NETWORK ANALYSER-CSMA-CD
SerialNo FileName FileSize FileNumber
-------------- --------------
New Text
1 Document.txt 1234 1
PROTOCOL ANALYSER-CSMA-CD
WorkGrou
SerialNo FileName FileSize FileNumber ReceiverName p
-------------
-------------- - -------------- --------------
WORKGR
1 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
2 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
3 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
4 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
5 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
6 New Text Document.txt 1234 1 ECE-038 OUP
7 New Text Document.txt 1234 1 ECE-038 WORKGR
OUP
WORKGR
8 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
9 New Text Document.txt 1234 1 ECE-038 OUP
WORKGR
10 New Text Document.txt 1234 1 ECE-038 OUP
IPOfReceiv TotalPack
er CurrentPacket ets Packetlength Delay Protocol
-------------
-------------- - --------------
192.168.5.
38 1 10 128 1000 CSMA-CD
192.168.5.
38 2 10 128 1000 CSMA-CD
192.168.5.
38 3 10 128 1000 CSMA-CD
192.168.5.
38 4 10 128 1000 CSMA-CD
192.168.5.
38 5 10 128 1000 CSMA-CD
192.168.5.
38 6 10 128 1000 CSMA-CD
192.168.5.
38 7 10 128 1000 CSMA-CD
192.168.5.
38 8 10 128 1000 CSMA-CD
192.168.5.
38 9 10 128 1000 CSMA-CD
192.168.5.
38 10 10 128 1000 CSMA-CD
DataRate NoOfResendPacket
--------------
100 0
PROTOCOL ANALYSER-CSMA-CA
InterPacketDela
y DataRate NoOfResendPacket ACKValue WindowSize
-------------- -------------- -------------- --------------
2110 100 0 Success NA
RESULT
Thus CSMA/CD PROTOCOL is implemented successfully.
AIM
To implement star, bus and ring topologies using cisco packet tracer 6.0.1 software.
BUS
STAR
RESULT
Thus the implementation of star, bus and ring topologies using cisco packet tracer 6.0.1
software has been successfully done.
Ex.No: 9 IMPLEMENTATION OF DISTANCE VECTOR ROUTING
ALGORITHM
AIM
To implement the distance vector routing algorithm.
ALGORITHM
1. Start
2. By convention, the distance of the node to itself is assigned to zero and when a node
is unreachable the distance is accepted as 999.
3. Accept the input distance matrix from the user (dm[][]) that represents the distance
between each node in the network.
4. Store the distance between nodes in a suitable variable.
5. Calculate the minimum distance between two nodes by iterating.
o If the distance between two nodes is larger than the calculated alternate
available path, replace the existing distance with the calculated distance.
6. Print the shortest path calculated.
7. Stop.
IMPLEMENTATION
RESULT
Thus the distance vector routing algorithm has been implemented.
AIM
To implement the Link State Routing Algorithm.
ALGORITHM
1. Start the program
2. Declare the needed variables
3. Read number of nodes
4. Read the distance of each node in matrix .
5. Calculate minimum distance for each node
6. Print each node with its distance when cost !=0 and cost !=-1 for packet transmission.
7. Stop the program
IMPLEMENTATION
RESULT
Thus the Link State Routing Algorithm has been implemented.
AIM
To study about OPNET - Network Simulator
INTRODUCTION
USE
Network with several hundreds of nodes can be simulated, but it would take time for
the computation. OPNET is used by companies like Thomson-CSF or CNET which use it to
model ATM networks and validate various layers protocols, packet switched radio
networks. An example of use of OPNET is George Mason University (Quality of Service IP
Network Simulation).
THE PACKAGE
The software comprises several tools and is divided in several parts, OPNET
Modeler and OPNET Planner, the Model Library, and the Analysis tool. Features
included in this generic simulator are an event-driven scheduled simulation kernel,
integrated analysis tools for interpreting and synthesizing output data, graphical
specification of models and a hierarchical object-based modeling.
OPNET Modeler is intended for modeling, simulating and analyzing the performance
of large communications networks, computer systems and applications. Common uses are
assessing and feasibility of new designs, optimizing already developed communication
systems and predicting performance.
The Analysis Tool provides a graphical environment to view and manipulate data
collected during simulation runs. Results can be analyzed for any network element.
The modeling libraries are included with OPNET Modeler and OPNET Planner
and contains protocols and analysis environments, among them ATM, TCP, IP, Frame
Relay, FDDI, Ethernet, link models such as point-to-point or bus, queueing service
disciplines such as First-in-First-Out (FIFO), Last-In-First-Out (LIFO), priority non-
preemptive queueing, shortest first job, round-robin or preempt and resume.
OPNET Modeler is the industry's leading environment for network modeling and
simulation, allowing you to design and study communication networks, devices, protocols,
and applications with unmatched flexibility and scalability. Modeler is used by the world's
largest network equipment manufacturers to accelerate the R&D of network devices and
technologies such as VoIP, TCP, OSPFv3, MPLS, IPv6, and more.
Since 1986, OPNET Technologies Inc., has been the leader in developing predictive
software solutions for networking professionals. OPNET software enables its users to
optimize the performance and maximize the availability of communications networks and
applications.
OPNET is the state-of-art network simulation tool for modeling, simulating and analysing the
performance of
i. Communication Networks, Distributed Systems
OPNET MODULES:
Modeler
Terrain Modeling Module (TMM)
High Level Architecture (HLA)
MODELER:
OPNET Modeler is intended for modeling, simulating and analysing the performance
of large communications networks, computer systems and applications. Common uses are
assessing and feasibility of new designs, optimizing already developed communication
systems and predicting performance.
The modeling methodology of OPNET is organized in a hierarchical structure. At the
lowest level, Process models are structured as a finite state machine. State and transitions are
specified graphically using state-transition diagrams whereas conditions that specify what
happen within each state are programmed with a C-like language called Proto-C. Those
processes, and built-in modules in OPNET (source and destination modules, traffic
generators, queues, ...) are then configured with menus and organized into data flow
diagrams that represent nodes using the graphical Node Editor. Using a graphical Network
Editor, nodes and links are selected to build up the topology of a communication network.
RESULT
ALGORITHM
CODING: ENCRYPTION
#include<stdio.h>
int main()
{
FILE *fp1, *fp2;
charch;
fp1 = fopen("message.txt","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found\n");
}
fp2 = fopen("encypted.txt","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found\n");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf("\nEnd Of File\n");
break;
}
else
{
ch = ch - (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf("\n");
return 0;
}
CODING: DECRYPTION
#include<stdio.h>
int main()
{
FILE *fp1, *fp2;
charch;
fp1 = fopen("encypted.txt","r");
if(fp1 == NULL)
{
printf("File 1 Not Found\n");
}
fp2 = fopen("decrypted.txt","w");
if(fp1 == NULL)
{
printf("File 2 Not Found\n");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf("\nEnd Of File\n");
break;
}
else
{
ch = ch + (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf("\n");
return 0;
}
Output
Enter message
hello
Encrypted message is
lipps
Retrieved message is
hello
RESULT
Thus the implementation of encryption and decryption can be performed successfully.
The wireless networking model can be created using Tool Command Language
(TCL) script with fixed number of nodes. The sample code discussed below models the
wireless network with 2 nodes. Nodes are configured with the components of channel,
networking interface, radio propagation model, Medium Access Control (MAC) protocol,
adhoc routing protocol, interface queue, link layer, topography object, and antenna type.
The wireless network with 2 nodes can be viewed in the Network Animator (NAM)
window after executing the file sample1.tc
PROGRAM:
#Filename: sample1.tcl
# Node Creation
set node1 [$ns node]
# Initial color of the node
$node1 color black
#Starting scheduler
$ns run
#############################################################
Execution:
ns sample1.tcl
OUTPUT