in reply to Building a UDP Ethernet header

Hello TorNZZ and welcome to the monastery and to the wonderful world of Perl

Disclaimer: my network-fu is very limited (read: google).

It seems to me that the MAC fe:ff:ff:ff:ff:ff must be something special, like a dummy MAC assigned to (virtual) interfaces. It is the last address of such used for Ipv4 Address Holder according to iana - ethernet numbers. It must be the broadcast address (see here)

If i understand it correctly the MAC part, in the ethernet frame, is modified at each net device the UDP packet traverse. The MAC is normally added by the driver at the source(?).

Anyway you might be interested in Re: transmit udp packets by VinsWorldcom that for sure has more experience than me. The post suggests Net::Pcap and Net::Filter Net::Frame as base resource.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Building a UDP Ethernet header
by TorNZZ (Novice) on Sep 18, 2017 at 10:57 UTC

    @VinsWorldcom, I found this: http://search.cpan.org/~gomor/Net-Frame-1.00/lib/Net/Frame/ETH.pm Can i add this to my code and then now i can change the source MAC? Can you write me example that suit my code?

    @Discipulus, So this Mac-Address is generated by my PC? (It's already Virtual Machine). My point is to add another layer to the code i have so i can control src mac address. Fix your Net::Filter link not works. And i need something that can be fitted to code i have.

    Thanks guys you are very helpful.

      You can't just add Net::Frame::Layer::ETH to your code. You need to properly install Net::Frame suite with 'cpan' client or other means (e.g., perl Makefile.PL; make; make install). You'll probably also need Net::Frame::Simple and Net::Pcap if you intend to send packets.

      Again, I go back to: "What are you trying to do?" There are much easier ways to send / receive UDP packets with Perl without crafting them from scratch. The only reasons *I* can think of for crafting raw packets is:

      • local network testing - which requires a very deep knowledge of protocols
      • something "nefarious"

      UPDATE: Reading your Stack Overflow post, your local and remote IP addresses are not in the same network, nevermind subnet. Sending crafted packets across the Internet reeks of malicious intent. Please explain what you're trying to do or I can't in good conscience offer more advice.

        I told you what i try to do simply need to control source mac-address on code i get. Yes there is other ways but i need to control the whole packet that's why i need this in that format.
          A reply falls below the community's threshold of quality. You may see it by logging in.