14

iptables - Target to route packet to specific interface?

view full story
linux-howto

http://serverfault.com – My home server has two main interfaces, eth1 (a standard internet connection) and tun0 (an OpenVPN tunnel). I'd like to use iptables to force all packets generated by a local process owned by UID 1002 to exit through tun0, and all other packets to exit through eth1. I can easily mark matched packets: iptables -A OUTPUT -m owner --uid-owner 1002 -j CONNMARK --set-mark 11 Now, I'd like to put some rule in the POSTROUTING chain (probably of the mangle table) to match packets marked with 11 and send them to tun0, followed by a rule that matches all packets and send them to eth1. I found the (HowTos)