wenlong1423
6/28/2014 - 5:21 PM

traffic mirroring(Openwrt).md

1.用iptables的TEE模块

iptables -t mangle -A PREROUTING -s 192.168.8.0/24 -j TEE --gateway 192.168.8.161
iptables -t mangle -A POSTROUTING -d 192.168.8.0/24 -j TEE --gateway 192.168.8.161
iptables -t mangle -A PREROUTING  -j TEE --gateway 192.168.8.161

涉及自己的包会重复,可在规则中指定

iptables -t mangle -A PREROUTING  ! -s 192.168.8.161 -j TEE --gateway 192.168.8.161

2.用port mirroring

https://code.google.com/p/port-mirroring/

nano /etc/config/port-mirroring

config 'port-mirroring'
       option "target" '192.168.8.161'
       option 'source_ports' 'eth0'
       option filter 'ether host ! xx-xx-xx-xx-xx-xx'
       option 'protocol' 'TZSP'