Send an IP packet with Packet.Net and SharpPcap but generate ethernet frame

2.1k views Asked by At

I'm trying to send a raw UDP packet with Packet.Net but the device.SendPacket() function only seems to accept link level PDUs which means I have to figure out the source and destination MAC addresses myself. (Using ARP or something)

How can I create an IP packet with Packet.Net but have the correct Ethernet frame generated for me?

1

There are 1 answers

3
Chris Morgan On BEST ANSWER

You'll have to know the destination mac address. As you suggested the best approach is to use arp to discover the mac address. The source address you can get from the adapter itself. There are examples for both arp and building packets in the source releases of sharppcap and packet.net.

Chris

Author of sharppcap/packet.net