TCP Anycast Shift
What happens when routing changes for a stateful network protocol and unexpectedly arrives at a device without a session?
Terminology
- TCP is a stateful network protocol.
- Anycast is a network addressing and routing method in which devices share a single destination IP address.
- Equal-cost multipath is a mechanism to increase bandwidth using parallel links.
Symptoms
tcpdump
from the origin illustrates the different behaviors when accessing the destination via regular and anycast IP address. The regular returned the expected flags [S][.][P.]...[F.]
while anycast returned [S][.][P.]...[R]
. Where [S] (Start Connection)
, [P] (Push Data)
, [R] (Reset Connection)
, and [F] (Finish Connection)
. Connection reset was reproducible with:
- Specific origins.
- Larger payloads.
- Persistent connections.
Explanation
Take the following interaction diagram illustrates the above and TCP’s stateful nature:
Let’s focus on “anycast shift” where a packet unexpectedly arrives at a device without a session. This can result from origins with routes using equal-cost multipath. The splitting of packets across links means the destination anycast IP may resolve to a different device resulting in reset.