I have http proxy, whitch has been developed in my company. Proxy uses TPROXY. Usually, installation of this proxy requires adding some routing rules and iptables rules (as for 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
Now i need proxying traffic from different vlans. I don't understand how i can write ip rules for routing traffic after proxy to suitable output interface. For "suitable" i mean virtual tagged output interface coinciding with input interface.
+---------+ +---------+
| | | |
| eth4.2 |--+ | eth5.2 |
| input | | +-->| output |
+---------+ | +----------+ | +---------+
| | | |
+---------+ +-->| |--+ +---------+
| | | TROXY | | |
| eth4.3 |----->| Magic |----->| eth5.3 |
| input | | | | output |
+---------+ +-->| |--+ +---------+
| | | |
+---------+ | +----------+ | +---------+
| | | | | |
| eth4.4 |--+ +-->| eth5.4 |
| input | | output |
+---------+ +---------+
Thanks for any help.