Iptables + TEE doesn’t work correctly

iptablesmirroringporttee

On my server, I want to duplicate all the traffic to an other host. I use iptables with TEE module:

iptables -t mangle -A PREROUTING -i eth0 -j TEE --gateway IP_SERVER2

I check the rule: iptables -t mangle -L

=> The rule is here but it doesn't work… The other server receive nothing.

When I do a tcpdump: tcpdump dst IP_SERVER2
=> 0 packets received by filter

I tried to enable /proc/sys/net/ipv4/ip_forward, /proc/sys/net/ipv4/conf/all/accept_redirects, and /proc/sys/net/ipv4/conf/all/send_redirects. I changed to 1 the net.ipv4.ip_forward option in /etc/sysctl.conf, it still doesn't work.

Have you got an idea what's wrong?

Best Answer

IP_SERVER2 needs to be on your local network according to iptables manpages.

Related Topic