Link to home
Start Free TrialLog in
Avatar of Kevin Dunning
Kevin Dunning

asked on

Need to build RARP Packet to resolve an IP

I have a task that requires me to receive a RARP request with  MAC address and then to send out a RARP Response mapping that MAC to an IP. I understand the concepts behind RARP but am simply having an issue finding examples for building RARP packets in C#. I was wondering if anybody can point me in the right direction for building the actual packet.
Avatar of David Favor
David Favor
Flag of United States of America image

Likely something like this...

# show all your IPs in ARP cache
arp -n

# grep for some specific MAC address
arp -n | grep $mac

Open in new window

Avatar of noci
noci

Check out the net-tools package:    http://net-tools.sourceforge.net/

Here is some C example code from it:
https://github.com/ecki/net-tools/blob/master/rarp.c

And the example i could find quickest  for building a socket based  tool for arp.
https://stackoverflow.com/questions/16710040/arp-request-and-reply-using-c-socket-programming

ARP & RARP are related and use the same packet structure.
you do know that RARP is obsolete about the only product that I know of that uses it is  Cisco's Overlay Transport Virtualization to update level 2 routing when a mac address moves to between datacenters
There are some devices that use RARP as a kind of poor-mans BOOTP...  (like ancient DHCP).
Avatar of Kevin Dunning

ASKER

Yes I am aware that it is an obsolete Protocol and that there are very few systems that still use it. I'd imagine this is the reason that I am having issues finding examples as a jumping point. Unfortunately the task I am working requires me to respond to a RARP request in C#.
the ietf has the definitive rules for RARP https://tools.ietf.org/html/rfc903
I gave links to RARP tools in C  (you should be able to read that and transform it to C#).
Or work from the specs (ietf RFC 903)
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.