in reply to Setting MAC addresses with Net::Frame::Simple

Hi, does this work ? https://metacpan.org/source/GOMOR/Net-Frame-1.16/examples/send-tcp-with-padding.pl

  • Comment on Re: Setting MAC addresses with Net::Frame::Simple

Replies are listed 'Best First'.
Re^2: Setting MAC addresses with Net::Frame::Simple
by iThunder (Beadle) on Nov 19, 2016 at 20:19 UTC

    Thanks. This example was useful but i am running into two ethernet headers issue. With that code, i can see that my client sends out the packet but it has one ethernet header (first one) that has src/dst MACs that machine inserts . After that are the src/dst mac addresses that i am inserting using the code. That is causing a bogus ip packet. Not sure if this is my client issue or code.

      I'm sorry I'm having a hard time understanding what you're trying to say

        The code doesn't seem to be changing the MAC addresses. Even if i specify some random MAC address for source and destinations, it looks like ethernet frame is sent out with source MAC of my interface and for destination MAC it is doing arp so basically its following the ARP table instead of the input that i am providing.

        Can we upload file or paste image on perlmonks forums? It will be much easier looking at it.

        FYI..this is the code i am trying to test
        #!/usr/bin/perl use Net::Frame::Simple; use Net::Frame::Layer::IPv4; use Net::Frame::Layer::TCP; use Net::Frame::Layer::ETH; use Net::Frame::Device; use Net::Write::Layer3; use Net::Frame::Dump::Online; use Net::Write::Layer2; my $src = '1.1.1.39'; my $target = '1.1.1.99'; my $port = 22; my $eth = Net::Frame::Layer::ETH->new(src => "00:0c:29:d1:03:06", dst +=> "03:03:03:03:03:03"); my $ip4 = Net::Frame::Layer::IPv4->new(src => $src,dst => $target); my $tcp = Net::Frame::Layer::TCP->new(dst => $port, options => "\x02\x +04\x54\x0b",payload => 'test'); my $oSimple = Net::Frame::Simple->new(layers => [$eth, $ip4,$tcp], pad +ding => 'G'x2); my $oWrite = Net::Write::Layer3->new(dst => $target); $oWrite->open; $oSimple->send($oWrite);