It's quite clear to me why NAT rules that rewrite the destination address have to happen before routing -- the kernel needs to do that to route the packets to their destination.
It's much less clear to me why the kernel insists on rewriting source addresses after routing. Certainly it makes rp_filter work better, but it makes policy routing very messy when NAT is in play. I have a system with two internet connections, and I use policy routing* to choose which outgoing connection to use based on source address. This is completely broken when the source address is rewritten by NAT *after* routing. Could we add some option to do SNAT and inverse DNAT before routing? * Grr, IPV6_SUBTREES is so much nicer than policy routing, but even IPV4_SUBTREES wouldn't help here. --Andy -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html