Let's assume I have setup a pair of anycasted DNS servers on my internal network using bird and they're just talking OSPF to my core routers. I've found this on the internet and made it happen.
If I setup one to have a higher cost path than the other, sweet, I've just made a cute way to do fail-over without causing my clients any timeouts when switching from one host in their resolv.conf to the other resolver in their resolv.conf.
But that's not good enough for me. I want to distribute my load between my DNS servers. So I set the cost for both to be the same, so the routers now should be doing ECMP and sending 50% of the requests to one and 50% of the requests to the other.
But it turns out my enterprise uses TCP for a large fraction of our DNS -- let's say we've got enormous SRV records and we use DNSSEC because we're awesome.
Now, how do I setup my clever anycast setup to cope with the fact that the TCP requests need 3 or 4 packets to get a request done and now one of those 3 packets is always going to go to the wrong router and getting the tcp connection reset.
Well, in such a scheme you can just block RST responses for invalid session, can't you? :) or (what is even better), don't pass it into service:
— invalid state?
— no that way, try another!
P. S. Yes, I really like presentation "TCP Anycast - Don't believe the FUD - nanog" by the link I gave you in comments. ;)
Just use per-flow OSPF ECMP instead of per-packet and you'll be fine, just like the NANOG presentation says.
Anycast for TCP is only a potential problem for long-lived TCP sessions, and almost every DNS implementation I know of only uses very short-lived TCP sessions.