0% found this document useful (0 votes)
290 views2 pages

ARP and RARP in C

The document describes the steps to implement ARP and RARP in C programming language. It includes initializing string arrays to store IP and MAC address mappings, functions to perform ARP and RARP lookups based on input IP or MAC address, and returning whether the address was found or not. The program prompts the user to choose ARP, RARP, or exit and performs the corresponding lookup and output.

Uploaded by

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

ARP and RARP in C

The document describes the steps to implement ARP and RARP in C programming language. It includes initializing string arrays to store IP and MAC address mappings, functions to perform ARP and RARP lookups based on input IP or MAC address, and returning whether the address was found or not. The program prompts the user to choose ARP, RARP, or exit and performs the corresponding lookup and output.

Uploaded by

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

ARP and RARP in C , C program to implement ARP

Algorithm:

Step 1: Initialize the string of ip addresses


Step 2: For every ip address, assign an ethernet address
Step 3: To Perform ARP, enter the ip address
Step 4: The equivalent ethernet address is displayedStep
Step 5: If the ethernet address is not found, then 'not found' message is displayeS
Step 6: To Perform RARP, enter the ethernet address
Step 7: The equivalent ip address is displayed
Step 8: If the ip address is not found, then 'not found' message is displayed
Step 9: Provide option to perform both ARP and RARP
Step 10:Choose Exit option to terminate the program

Program:

#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_17_3
1_8E_08"};
char ipaddr[20],etaddr[20];
int i,op;
int x=0,y=0;
clrscr();
while(1)
{
printf("\n\n 1.ARP 2.RARP 3.EXIT");
printf("\n enter the choice");
scanf("%d",&op);
switch(op)
{
case 1:
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("invalid ip address");
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("Invalid ethernet address");
y=0;
break;
case 3:
exit(0);
}}}

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