I have two gateway to access internet, somehow I want to load balancing it, so far its working, but some connection or service need persistent gateway IP to be used, so the client should never change its gateway once it have connected to dest., my current implementation seems to be round-robin or whatever it is.this is my iproute......default    nexthop via 192.168.1.1 dev eth0 weight 1    nexthop via 192.168.1.2 dev eth0 weight 1now i want to fix it somehow the gateway the client will use is predetermined, for example by using source port, if the source port is even number we use gw.1 and odd number go through gw.1, can we do that using ip route?*note that I only have one outbound interface : eth0 here.
multigateway routing for specific src port
linux;networking;iptables;routing;ip
Use policy routing with marking packets. I'm not sure what format of configuration it is but you should check it in your distro.In commandline it should look like (not tested but should work)iptables -A PREROUTING -t mangle -p tcp --dport 22 --set-mark 0x1 -j CONNMARKecho 200 ssh >> /etc/iproute2/rt_tablesip rule add fwmark 1 table sship route add default dev eth0 via 192.168.1.2 table sshEdit: linesecho 200 ssh >> /etc/iproute2/rt_tablesNames routing table 200 by name ssh. It is preserved between boots.