#!/usr/bin/perl # This one sends packet from eth1 to lo # I call it eth1 use Socket 1.3; use Net::Pcap; use strict; no utf8; socket(RAW,17, 3, 255) || die $!; binmode (RAW); my $iface = 'eth1'; my $ifaceid = pack ('n',3); my $flags = pack("SniC12",17,0,1,0); my ($err); my $pcap_eth = Net::Pcap::open_live($iface, 1524, 1, 0, \$err); if (!defined($pcap_eth)) { die ("Error opening device eth0 returned error $err\n"); } Net::Pcap::loop ($pcap_eth,-1,\&process,undef); sub process{ #I add interface id to packe to identify source interface send(RAW,$ifaceid.$_[2],0,$flags) || die "Send :$!\n"; }