Linux – Copy/Mirror traffic to WAN interfaces without “iptables tee” support

iptableslinuxmirroringrouting

I want to copy every outgoing packet to others WAN interfaces but my iptables (v1.2.7) has not TEE target support. I wonder if there is another way (maybe using iproute2 or ebtables) to copy every outgoing packet to an selected interface. I prefer other way than getting xtables-addons because im working with a embedded device (an UClinux distribution) and i would prefer avoid new versions of iptables (I dont know if the syntax remains the same among versions), cross-compiling problems or changing Makefiles.

Best Answer

The ROUTE target from patch-o-matic should compile against your kernel and for the 1.2.7 version of iptables and has a --tee target option which should do what you want. This being said, iptables 1.2.7 is over 11 (!!) years old now, probably so is your kernel version. You really should consider using a more recent piece of code - a lot has changed in the meantime.

There also is the libpcap-based port-mirroring project originally started for the uClibc-backed OpenWRT. It might compile against your platform as well.

Another possible option is the mirred action to tc - but given the date of your codebase I doubt that it would be included out-of-the box, so it would be compiling Kernel modules again.