I’ve recently set up routing for two uplink providers. The advanced routing howto is a good guide for getting routing via several providers running. I’ve observed two points worth mentioning, though.
iptables -t mangle -A PREROUTING -i $IF1 -p tcp
-mstate –state NEW -j CONNMARK –set-mark 1/1
iptables -t mangle -A PREROUTING -i $IF2 -p tcp
-mstate –state NEW -j CONNMARK –set-mark 2/2
# mark packets with connection mark
# to be usable in routing
iptables -t mangle -A PREROUTING -p tcp
-j CONNMARK –restore-mark –mask 0x0F
ip rule add fwmark 1 T1
ip rule add fwmark 2 T2
/proc/sys/net/ipv4/conf/*/rp_filter
Documentation/networking/ip-sysctl.txt
say this about rp_filter
:
rp_filter – BOOLEAN
1 – do source validation by reversed path, as specified in RFC1812 Recommended option for single homed hosts and stub network routers. Could cause troubles for complicated (not loop free) networks running a slow unreliable protocol (sort of RIP), or using static routes.
0 – No source validation.
conf/all/rp_filter
must also be set toTRUE
to do source validation on the interface