awesome-everything RU
↑ Back to the climb

Networking & Protocols

Connection IDs and network migration

Crux QUIC identifies connections by an opaque Connection ID rather than the 4-tuple, so connections survive IP address changes — WiFi to cellular — without reconnecting.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 10 min

You step outside the office and your phone switches from WiFi to LTE. Your TCP connections all die — every app reconnects, re-authenticates, re-loads. QUIC makes this switch invisible to the application.

Why TCP breaks on IP change

TCP connections are identified by the 4-tuple: client IP, client port, server IP, server port. When the client’s IP changes — WiFi to cellular, NAT rebind — the 4-tuple is broken. The server sees packets from an unknown source and ignores them. The client must start a new TCP handshake, re-negotiate TLS, and re-establish application state. This takes seconds and is visible to users.

Connection IDs decouple identity from address

QUIC introduces an opaque Connection ID (up to 20 bytes, typically 8) chosen by the server. The Connection ID is carried in every QUIC packet header. The server maps Connection IDs to connection state, not IP addresses.

When the client’s IP changes:

  1. The client sends a QUIC packet from the new address with the same Connection ID.
  2. The server recognizes the Connection ID, notes the new source address.
  3. The server sends a PATH_CHALLENGE frame — a random 8-byte token.
  4. The client echoes the token in a PATH_RESPONSE frame.
  5. Path validated — the server updates the connection’s current address and unlocks full send rate.

All stream state, flow-control windows, and congestion state survive the migration. The connection continues as if nothing happened.

WiFi-to-cellular migration timeline
t=0Client on WiFi: 192.168.1.100:54321, Connection ID 0x12345678
t=1sClient switches to LTE: 203.0.113.50:55555 (same Connection ID)
t=1sServer: sees Connection ID 0x12345678 from new address — sends PATH_CHALLENGE
t=1.1sClient: sends PATH_RESPONSE — path validated
t=1.1sAll streams resume at full bandwidth — no reconnect, no re-auth

Anti-amplification limit

Before validating the client’s new address, the server may send at most 3× the bytes it received from that address. This prevents UDP-based amplification attacks: an attacker cannot spoof the client’s address to make the server send large responses to a victim.

Clients must send Initial packets padded to at least 1200 bytes so servers have headroom for a ~3600-byte response burst. Once PATH_RESPONSE is verified, the server unlocks full send rate.

Trace it
1/5

Trace a client switching from WiFi to cellular mid-connection.

1
Step 1 of 5
Client on WiFi sends packets with Connection ID 0x12345678 from IP 192.168.1.100 port 54321.
2
Locked
Client steps outside, loses WiFi, switches to cellular with a new IP 203.0.113.50 port 55555.
3
Locked
Server receives packet from 203.0.113.50:55555 with Connection ID 0x12345678. What does it do?
4
Locked
Client responds with PATH_RESPONSE. Does the server immediately send at full bandwidth to the new address?
5
Locked
All stream states, flow-control windows, and congestion state survive the migration. Why?
Quiz

In QUIC, what does the anti-amplification limit (3x rule) prevent?

Quiz

Why can QUIC survive a client's IP change from WiFi to cellular while TCP cannot?

Edge cases

Connection ID rotation prevents an observer from linking a client’s old and new IP addresses via the Connection ID. The server periodically sends NEW_CONNECTION_ID frames offering fresh IDs; the client switches to a new one when migrating. This provides privacy — an observer cannot correlate a user’s WiFi session with their cellular session — without hiding the user’s IP from the server.

Recall before you leave
  1. 01
    Explain why QUIC can survive a client's IP address change from WiFi to cellular while TCP cannot, and what role the Connection ID plays.
  2. 02
    What is the anti-amplification limit in QUIC and why is it needed?
  3. 03
    What frames does QUIC use to validate a new client address after migration?
Recap

TCP’s fundamental assumption — that a connection equals a 4-tuple — breaks whenever a mobile client changes networks. QUIC sidesteps this by identifying connections with an opaque Connection ID that lives in the QUIC packet header, not in the IP or UDP header. When the client’s IP changes, the Connection ID remains constant and the server can detect the migration: it sends a PATH_CHALLENGE to verify the new address is reachable, waits for a PATH_RESPONSE, and then migrates the entire connection — all streams, all flow-control state — to the new path. During validation, the 3x anti-amplification limit prevents an attacker from exploiting the migration window as a reflection vector. Connection ID rotation further lets the client change IDs on migration so observers cannot link the two network identities.

Connected lessons
appears again in258
Continue the climb ↑Loss detection and congestion control
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.