What is ICE?

Interactive Connectivity Establishment (ICE) is a protocol for Network Address Translator (NAT) traversal for UDP-based multimedia sessions. ICE makes use of STUN and TURN protocols to establish connectivity between peers behind NATs and firewalls.

Key Components

Candidate Gathering

Discovers multiple network paths including host, server reflexive, and relay candidates.

Connectivity Checks

Tests all candidate pairs to find working communication paths.

Path Selection

Chooses the best available path based on priority and connectivity.

Keepalives

Maintains NAT bindings and detects path failures.

ICE Candidate Types

Host Candidates

Direct IP addresses of the local network interfaces.

Server Reflexive

Public IP addresses discovered via STUN servers.

Peer Reflexive

Addresses learned during connectivity checks.

Relay Candidates

Addresses allocated on TURN relay servers.

ICE Process Flow

  1. Gathering Phase: Collect all possible candidate addresses
  2. Prioritization: Assign priorities based on candidate type and network topology
  3. Exchange: Share candidates with remote peer via signaling
  4. Pairing: Form candidate pairs between local and remote candidates
  5. Connectivity Checks: Test each pair using STUN binding requests
  6. Nomination: Select the best working candidate pair
  7. Conclusion: Begin media flow on the selected path

NAT Traversal Scenarios

Direct Connection

Both peers on public internet or same local network.

One NAT

One peer behind NAT, other on public internet.

Both Behind NAT

Both peers behind different NATs requiring hole punching.

Symmetric NAT

Restrictive NATs requiring TURN relay servers.

Applications

  • WebRTC: Browser-to-browser real-time communication
  • VoIP: Voice over IP calls through NATs and firewalls
  • Video Conferencing: Multi-party video communication
  • P2P Gaming: Direct peer-to-peer game connections
  • File Sharing: Direct file transfers between peers
  • Remote Desktop: Direct connections for screen sharing

Additional Resources