0% found this document useful (0 votes)
30 views4 pages

Computer Networks

This C program implements the Address Resolution Protocol (ARP) and Reverse Address Resolution Protocol (RARP). It contains an array storing IP and MAC address pairs. The user can choose to perform ARP or RARP lookup by entering an IP or MAC address. The program will search the array and output the corresponding MAC or IP if found, or indicate the address is invalid if not found. The code uses string comparison functions like strcmp() to match the input to values in the address arrays.

Uploaded by

Aeydap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Computer Networks

This C program implements the Address Resolution Protocol (ARP) and Reverse Address Resolution Protocol (RARP). It contains an array storing IP and MAC address pairs. The user can choose to perform ARP or RARP lookup by entering an IP or MAC address. The program will search the array and output the corresponding MAC or IP if found, or indicate the address is invalid if not found. The code uses string comparison functions like strcmp() to match the input to values in the address arrays.

Uploaded by

Aeydap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ROLL NO.

: 18CSR028

CN LAB /2020-21/ODD/A SECTION


ROLL NO.: 18CSR028
Ex.No. 8
: MPLEMENTATION OF ARP AND RARP
Date : 07.12.20
20

Aim :

To implement address resolution protocol and reverse address resolution protocol.

Coding :

#include<stdio.h>

#include<string.h>

#include<conio.h>

main()

char ip[10][20]={"192.168.0.64","192.168.0.60","192.168.0.68","132.147.3.3"};

char

et[10]
[20]={"00_A8_00_40_8E_FS","00_16_17_31_8e_22","00_16_17_31_8E_F7","00_16_1
7_31_8E_0

8"};

char ipaddr[20],etaddr[20];

int i,ch;

int x=0,y=0;

while(1)

printf("\n\n 1.ARP 2.RARP 3.EXIT");

printf("\n Enter the choice : ");

scanf("%d",&ch);

switch(ch)

case 1:

CN LAB /2020-21/ODD/A SECTION


ROLL NO.: 18CSR028
printf("\n Enter ip address : ");

scanf("%s",ipaddr);for(i=0;i<=20;i++)

if(strcmp(ipaddr,ip[i])==0)

printf("Ethernet address is : %s",et[i]);

x=1;

if(x==0)

printf("\nThe given ip address is INVALID ");

x=0;

break;

case 2:

printf("Enter ethernet address : ");

scanf("%s",etaddr);

for(i=0;i<=20;i++)

if(strcmp(etaddr,et[i])==0)

printf("IP address is : %s",ip[i]);

y=1;

}}

if(y==0)

printf("The give ethernet address INVALID ");

y=0;

break;

CN LAB /2020-21/ODD/A SECTION


ROLL NO.: 18CSR028
ROLL NO.: 18CSR023ROLL NO.: 18CSR023

case 3:

exit(0);

}}

Sample I/O:

ScreenshotROLL NO.: 18CSR023

Result:

The implementation of ARP and RARP are successfully compiled.

CN LAB /2020-21/ODD/A SECTION

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy