I am using below code (copied from http://search.cpan.org/~gomor/Net-Frame-Simple-1.06/lib/Net/Frame/Simple.pm) to rewrite the ethernet src and dst mac information but its generating bad IP packet.
my $src = '188.8.131.52';
my $target = '184.108.40.206';
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\x04\x54\x0b",payload => 'test');
my $oSimple = Net::Frame::Simple->new(layers => [$eth,$ip4,$tcp],);
# Now, the frame is ready to be send to the network
# We open a sender object, and a retriever object
my $oWrite = Net::Write::Layer2->new(dev => 'eth0');
$oWrite = Net::Write::Layer3->new(dst => $target);
#my $oDump = Net::Frame::Dump::Online->new(dev => $oDevice->dev);
# We send the frame
I was able to make it work For anyone's reference, if remove the line "Net::Write::Layer3" and just do the writing at layer 2 (Net::Write::Layer2) in above code, you can change the src and dst MACs.