#!/usr/bin/perl # program which send data from eth0 to lo # I call it eth0 use Socket 1.3; use Net::Pcap; use strict; no utf8; socket(RAW,17, 3, 255) || die $!; binmode (RAW); my $iface = 'eth0'; my $ifaceid = pack ('n',2); 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{ send(RAW,$ifaceid.$_[2],0,$flags) || die "Send :$!\n"; }