Home

 / Blog / 

ICE Protocol - Everything You Need To Know

ICE Protocol - Everything You Need To Know

November 7, 20234 min read

Share

ICE Protocol | Cover Image.png

Definition

Interactive Connectivity Establishment, commonly known as ICE, is a technique developed to facilitate peer-to-peer communication on the Internet. It's particularly significant when there are barriers, such as NAT or firewalls, that make direct device communication a challenge. The essence of ICE is to find the optimal path for data to travel between two points, ensuring that data transfer is efficient, even in the face of these obstacles.

What does it really mean?

Imagine trying to deliver a letter to a friend in a massive apartment building. You're aware of the building, but not their exact flat number. ICE is like an intelligent postal service that determines the ideal delivery route and method. Similarly, on the internet, ICE aids your computer in identifying the best way to connect with another computer, especially when barriers like firewalls or NAT are in play.

History of Interactive Connectivity Establishment

What was before ICE?

Before ICE's inception, internet communication resembled navigating a maze with various challenges:

  • Manual Port Forwarding: Users manually set up how their NAT devices would handle incoming connections. It was effective but tedious and not user-friendly.
  • The Rise of STUN: A tool that helped devices uncover their public IP and the kind of NAT they were dealing with. Useful, but not the panacea for every NAT challenge.
  • TURN as the Helping Hand: When direct communication failed, TURN stepped in, relaying data between devices.
  • Application Level Gateways (ALG): Think of these as custom-made doors in our internet maze, specifically designed for certain protocols. They were helpful but didn't provide a blanket solution.
  • Middlebox Communications (MIDCOM): MIDCOM was the negotiator, enabling devices to communicate their requirements to middlemen like firewalls.
  • Proprietary Approaches: Individualized paths in the maze developed by various companies. Though functional, they lacked a standardized approach, leading to isolated pathways.

What challenges did it face?

The principal challenges arose from NATs and firewalls. These acted like security checkpoints and confusing crossroads in our maze. NAT, or Network Address Translation, serves to protect private IPs while conserving public IP addresses. However, NATs and firewalls made it tough to pinpoint peers' IP addresses, complicating direct communication.

How is ICE solving it?

ICE addressed these challenges by:

  • Gathering the Local IP Address: It starts by collecting the local (host) IP address and port pairs where the peer can receive media.
  • Utilizing STUN and TURN: ICE employs STUN to detect the public IP and port of the peer and reverts to TURN if necessary.
  • Candidate Exchange: ICE candidates are swapped via a separate signaling server.
  • Priority Scoring: Each pair of candidates is allotted a priority score, and the pair with the highest score is selected for media transmission.

However, ICE isn't without its drawbacks. The process of gathering all the ICE candidates can cause delays. But solutions like Trickle ICE have been developed to mitigate this by sending the candidates as soon as they're available.

How ICE Works?

At the core of ICE is the discovery and negotiation process, which ensures that devices find the most efficient path for the exchange of data. This process begins with candidate gathering, where each device compiles a list of potential IP addresses and ports—known as candidates—that can be used for communication. These include local network addresses as well as public IP addresses discernible through protocols like STUN (Session Traversal Utilities for NAT). STUN allows a device to determine its public-facing IP address and port, information that's critical when traversing NATs.

However, there are cases where STUN is not sufficient, such as when dealing with symmetric NATs or other restrictive network configurations. This is where TURN (Traversal Using Relays around NAT) comes into play. TURN servers act as intermediaries, relaying data between devices when no direct connection is possible. Although using TURN can result in higher latency and bandwidth costs, it's a crucial fallback mechanism that ensures connectivity when direct paths are not viable.

Once the candidates are gathered, the devices exchange their lists and perform connectivity checks using STUN binding requests. These checks are done in parallel, with priority given to candidates based on factors like network proximity and estimated connection speed. For instance, local LAN connections are typically tested before those that require relaying through TURN servers.

After testing each candidate pair, the devices nominate the one that provides a working connection with the best performance. This nomination process involves mutual agreement on which candidate pair to use, ensuring that both ends of the communication link are synchronized.

The data transmission then proceeds over the chosen candidate pair. If, at any point, the direct candidates fail, the devices can still rely on the TURN servers to relay their communication.

ICE's procedures are governed by standards set by the Internet Engineering Task Force (IETF), specifically RFC 8445, which ensures consistency and reliability in its operation. The protocol is designed to be modular, allowing for the integration of new techniques and improvements over time. This adaptability makes ICE a robust and future-proof solution for real-time internet communication challenges, such as those encountered in VoIP and WebRTC technologies.

How ICE Negotation Works

Frequently Asked Questions

What is ICE in telecom?

In telecommunications, ICE (Interactive Connectivity Establishment) is a protocol used to facilitate direct peer-to-peer communication across various network configurations, overcoming obstacles posed by NATs (Network Address Translators) and firewalls to ensure that data packets reach their intended destination efficiently.

Is ICE TCP or UDP?

ICE is a protocol that can use both TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) for establishing peer-to-peer communication, depending on which candidates are selected during the connectivity checking process. It prioritizes UDP for its speed but can fall back on TCP if necessary.

Is ICE part of WebRTC?

Yes, ICE is an integral part of WebRTC (Web Real-Time Communications). It is used within WebRTC to handle the negotiation of network information for direct peer-to-peer connections.

References

  • https://datatracker.ietf.org/doc/html/rfc5245
  • https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Protocols
  • https://webrtc.ventures/2022/04/ice-in-webrtc/

Glossary

Share

Related articles

See all articles