Hello!
I've got 2 NIC and 2 gateways (associated with 2 channels).
eth0 (10.1.0.2) ==> gateway1 (10.1.0.1) ===> channel1 (bad)
eth1 (10.2.0.2) ==> gateway2 (10.2.0.1) ===> channel2 (good but
expensive)
My default gateway is "gateway1", but I want that some local user uses
"gateway2" by default.
Ok. Solution is simple:
Mark all users packets:
# iptables -t mangle -A OUTPUT -m owner --uid-owner 1000 -j MARK --set-mark
1
Add rule for marked packets:
# ip rule
0: from all lookup local
32764: from all lookup main
32765: from all fwmark 1 lookup 210
32767: from all lookup default
Here is my table "210":
# ip route show table 210
default via 10.2.0.1 dev eth2 src 10.2.0.2
And here table "default":
# ip route show table default
default via 10.1.0.1 dev eth0
Of course, in table "main" there is no default route.
But it does not work. User with UID 1000 can not connect at all.
When I tried to dump traffic on gateway2 I find out that my host
send packets to gateway2 with source address 10.1.0.2 (!!!)
It should be 10.2.0.2 (eth1's IP address).
How can I fix it?
Thanks for any help.
Yours sincerely,
Meledin Evgeny.