I'm going to try and lower all the 300 and +300 stuff to 200 and +200 which should still get it out of the way and maybe work... we'll see.
Yes indeed, a quick :%s/300/200/g and life is better, at least it's building out the table correctly.
root@OpenWrt:~# ip rule show
0: from all lookup local
200: from all fwmark 0x1 lookup 200
210: from 1.2.3.4 lookup 210
211: from all fwmark 0x10 lookup 210
220: from 192.168.100.100 lookup 220
221: from all fwmark 0x20 lookup 220
32766: from all lookup main
32767: from all lookup default
I'm going to play around a little with regard to seeing how it behaves after a failover but I've been spot checking the connections and there is a lot less traffic from the wrong IP but still some. I have noticed that the ordering of the /tmp/resolv.conf.auto could be optimized a bit based on which connection is preferred.
For example, it wrote out wan's DNS servers first and then wan2's DNS servers, which means that all DNS traffic was going over wan, even though my default route was wan2. Fortunately it was all using the correct interface's IP, but still less than ideal. I think I could beat it by switching cables around and making wan the default route. Just something to think about...
Anyway, why is traffic still going out the wrong interface? I can only assume 256 is some magical boundary on the ip tables, which sort of makes sense.