I would like to set up a routing scheme, that allows to route traffic generated by a special user through a different network/network card. I have two network cards (eth0 and eth1), both of which have access to the internet (through a router). The default route goes through eth1 and the traffic of the special user should be routed through eth0.
I have tried the following iptables/iproute2 rules:
iptables -A OUTPUT -t mangle -m owner --uid-owner 1000 -j MARK --set-mark 1
ip rule add fwmark 1 table user1000
ip route add default dev eth0 table user1000
ip route flush cache
This however does not work for me. I can ping the router of the network connected to eth0, but i cannot access the internet (through e.g. ping www.google.de
or a webbrowser).
I am a newbie to iptables and iproute2 and am kind of stuck at the moment. I would really appreciate any tips or hits.
Is there maybe another possibility to achieve per user (or per application) routing?