Grabbing raw ethernet frames from eth0 and creating virtual net devices.

From: Daniel Shane (
Date: Tue May 23 2000 - 21:27:49 EST

Is is possible, for a kernel module, to grab raw ethernet
frames from a network device (like eth0)? Is there a hook
that can be used to intercept the ethernet frames at the
link layer?

I would like to write a small module that will grab
ethernet frames and duplicates them to other interfaces
(ie, ethertap devices) so as to simulate two network
cards that are on the same ethernet segment.

I tried doing this but it doesnt seem to work.

ifconfig eth0 netmask dev eth0
ifconfig tap0 netmask dev tap0

ping (another machine)....
tap0 gets the ping put it doesnt get redirected to eth0
(obviously since theres no route)

So I do a

route del -net netmask dev tap0
route add -net netmask dev eth0

Now everything works but nothing gets in tap0 so all
my applications that use tap0 directly at the ethernet
level are non-functional.

Should I use iproute2 to specify a different route
when the packets come in? It seems simpler just to
leave the default route to tap0 and write a small
module to link eth0 to tap0 directly at the link
layer (like a bridge, but where I can still use eth0
and tap0 instead of only one interface br0 as with
the current bridging code). This also would not
require to put the devices in promiscuous mode
as with the current bridging code.

The second solution seems better since both eth0
and tap0 would receive the ethernet frames
and therefore I could put 10.5.1.x ip addresses on
eth0:xx as well if I wanted to (although I dont know
why I would).

What do you all think about this problem of
creating a virtual network device thats
connected to some other real physical device
like the vmnet modules from vmware?

Daniel Shane


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:11 EST