通过TPROXY的几个VLAN的stream量redirect

我有我的公司开发的HTTP代理。 代理使用TPROXY。 通常,安装此代理需要添加一些路由规则和iptables规则(对于squid):

ip rule add fwmark 1 lookup 100 ip route add local 0.0.0.0/0 dev lo table 100 iptables -t mangle -N DIVERT iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port $PROXPORT --on-ip $PROXIP 

现在我需要代理来自不同vlan的stream量。 我不知道如何编写ip规则路由通信代理后适当的输出接口。 对于“合适的”我的意思是虚拟标记的输出接口与input接口一致。

 +---------+ +---------+ | | | | | eth4.2 |--+ | eth5.2 | | input | | +-->| output | +---------+ | +----------+ | +---------+ | | | | +---------+ +-->| |--+ +---------+ | | | TROXY | | | | eth4.3 |----->| Magic |----->| eth5.3 | | input | | | | output | +---------+ +-->| |--+ +---------+ | | | | +---------+ | +----------+ | +---------+ | | | | | | | eth4.4 |--+ +-->| eth5.4 | | input | | output | +---------+ +---------+ 

谢谢你的帮助。