Interactive Connectivity Establishment (ICE)
Prerequisite – Network Address Translation (NAT)
What is ICE ?
Interactive Connectivity Establishment (ICE) is used in problems where two nodes across the Internet must communicate as directly as possible, but presence of NATs and Firewalls make it difficult for nodes to communicate with each other. It is a Networking technique which makes use of STUN (Session Traversal Utilities for NAT) and TURN (Traversal Using Relays Around NAT) to establish a connection between two nodes which is as direct as possible.
How Does it Work ?
To understand how ICE works, we need to know the workings of STUN protocol and its extension TURN protocol.
- STUN (Session Traversal Utilities for NAT):
For an endpoint under a NAT which has a local address, it is not reachable for other endpoints outside the local network, Hence a connection cannot be established. When this occurs the endpoint can request it’s public IP address from a STUN server. This publicly reachable IP can be used by other endpoints to establish a connection. But this case fails when endpoints are under symmetric NAT, which happens in most of the practical cases.This is where a TURN server comes into picture.
- TURN (Traversal Using Relays Around NATs):
TURN server as the name suggests is used as a relay server or an intermediate server to exchange data. When any endpoint under Symmetric NAT can contact a TURN server which is on the public internet to establish a connection the endpoint is then called a TURN client. The disadvantage of using a TURN server is that it is required throughout the whole time span of the session unlike STUN server which no longer needed after the connection is established. Therefore in ICE technique STUN is used as default.
ICE is the technique which uses STUN and TURN protocols to establish a connection. At the beginning, the endpoints are unaware of their own network topologies whether they are under a single NAT or multiple levels of NATs and the type of NAT, ICE lets the endpoints discover this using a STUN server through which they may find a path establish a direct connection. If yes then the connection is established, else a TURN server is used as a relay to exchange information between endpoints.
ICE mandates that STUN should be used by default as a TURN communication requires continuous usage of a TURN server, connection is not peer to peer and more server resources are used. ICE was developed by the Internet Engineering Task Force as RFC 8445.
This protocol is used in the following cases:
- (SIP) Session Initiation Protocol
- (VoIP) Voice over Internet Protocol
- P2P Communications
Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation
Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation