What is a Connection ID
A connection ID is a random identifier that QUIC uses instead of the traditional IP address + port combination to identify a connection — allowing it to survive network changes without dropping.
Why can't TCP do this?
TCP identifies a connection by a four-tuple: source IP address, source port, destination IP address, destination port. If any of these change, the connection is dead. When your phone switches from WiFi to cellular, it gets a new IP address. TCP sees a completely different four-tuple and has no way to match it to the existing connection. The connection drops, and the application has to reconnect from scratch.
How do connection IDs work?
When a QUIC connection starts, both the client and server generate random connection IDs. These IDs are included in the header of every QUIC packet. When a packet arrives, the server looks up the connection by its ID — not by the source IP and port.
If the client's IP address changes (because it switched networks), the connection ID stays the same. The server recognizes the packet as belonging to an existing connection and continues without interruption.
Each side can also rotate connection IDs during the lifetime of a connection. This prevents network observers from tracking a user across different networks by watching for the same connection ID.
Why use random IDs?
A sequential or predictable ID would let an attacker guess valid connection IDs and inject packets. Random IDs make this practically impossible. They also prevent on-path observers from correlating connections after a migration, since the client can start using a new ID on the new network.
Why it matters
Connection IDs are the mechanism that makes connection migration possible. Without them, QUIC would be just as fragile as TCP when networks change. They are a foundational design decision that separates QUIC from every transport protocol that came before it.