Hello,
(E-Mail Removed) a écrit :
> is it possible to route data to the same ip number through different
> gates and choose this gates by destination port?
Yes, with iptables MARK and advanced routing with iproute.
Sample :
iptables -t mangle -A PREROUTING -d <dest> -p tcp --dport <port1> \
-j MARK -set-mark 0x1
ip rule add fwmark 0x1 lookup 1
ip route add default via <gateway1> dev <interface1> table 1
iptables -t mangle -A PREROUTING -d <dest> -p tcp --dport <port2> \
-j MARK -set-mark 0x2
ip rule add fwmark 0x2 lookup 2
ip route add default via <gateway2> dev <interface2> table 2
And so on.
For locally generated traffic instead of forwarded traffic, replace
PREROUTING with OUTPUT.
If you use MASQUERADE with a kernel older that 2.6.10, be aware that it
may fail to select the correct source address ; SNAT is safer.