Send an ARP Request

Oct 26, 2011 at 9:52 AM

Hello.

 

I'm trying to send a ARP Request packet. When I create an arp layer object, I found these troubles.

1 I need to specify SenderHardwareAddress of arp layer object. How to get the local mac address from a selected device (PacketDevice)? I cannot see any property about that. And MAC address is not listed in PacketDevice.Address.

2 What should be filled in SenderProtocolAddress? Arbitrary one of Local IP?

3 What should be filled in TargetProtocolAddress? I wanna send a broadcast request. 255.255.255.255?

 

Thanks.

Coordinator
Oct 29, 2011 at 8:02 AM

Hi scegg,

 

1. There is an extension method called GetMacAddress() in PcapDotNet.Core.Extensions.LivePacketDeviceExtensions class, which is in PcapDotNet.Core.Extensions assembly. I believe it will do what you need.

2. Yes, you need to put the local IP.

3. An ARP request usually means that you already have the destination IP and you want its MAC address. This means you should put the real IP of the target in TargetProtocolAddress and the brodcast should be done in the Ethernet level (the destination address of the Ethernet layer should be a brodcast address).

I hope this helps,

 

Boaz.

Oct 29, 2011 at 8:04 AM

Thanks a lot.