SlideShare a Scribd company logo
Yossi Zadah

NAT Traversal

October 2013
WebRTC is:

 WebRTC is a free, open project that
enables web browsers with Real-Time
Communications (RTC) capabilities via
simple Javascript APIs.
 WebRTC is a media engine with JavaScript
APIs.
 WebRTC Allows developers to add realtime voice calls, video chats and file
sharing to their web apps without the
need for plug-ins.
 The WebRTC initiative is a project
supported by Google, Mozilla and Opera.
How does it work?
Web Browser A
Java Script code calls
browser APIs to establish a
call
JavaScript
APIs
browser

1. HTML &
JavaScript

Web Server
Call signaling

2. HTML &
JavaScript

Web Browser B

WebRTC is a set of standardized browser APIs
WebRTC in Specs
APIs by W3C & Protocols by IETF
 Connectivity
 ICE, STUN and TRUN

 Signaling:
 Signaling protocol not determined
 WebSocket
 Must support SDP form to implement ICE

 Media
 DTLS for key exchange for SRTP
 SRTP
 Bundle and Media Multiplexing

 Coders
 Voice Coders: Opus and G.711
 Video Coder: VP8 (not final)
Nat traversal in WebRTC context
Network Address Translation

 Network Address Translation (NAT) is the process of modifying
network address information in datagram packet headers while
in transit across a traffic routing device for the purpose of
remapping a given address space into another.
 This mechanism is implemented in a routing device that uses
stateful translation tables to map the "hidden" addresses into a
single address and then rewrites the outgoing IP packets on exit
so that they appear to originate from the router.
 In the reverse communications path, responses are mapped
back to the originating IP address using the rules ("state")
stored in the translation tables.
 The translation table rules established in this fashion are
flushed after a short period without new traffic refreshing their
state.
STUN - Session Traversal Utilities for NAT

 STUN is a standardized set of
methods and a network protocol
to allow an end host to discover
its public IP address if it is located
behind a NAT.
 It is used to permit NAT
traversal for applications of realtime voice, video, messaging, and
other interactive IP
communications.
 STUN is intended to be a tool to
be used by other protocols, such
as ICE.

STUN Server

STUN Response
Your address is
192.168.10.10:5000

STUN Query
What’s my IP address
Different types of NAT

 Network address translation is implemented in a variety
of schemes of translating addresses and port
numbers, each affecting application communication
protocols differently.
 Different NAT implementations is classified as:
 Full cone NAT
 Restricted cone NAT
 Port restricted cone NAT
 Symmetric NAT
Non- Symmetric NAT

 Full cone, Restricted cone
and Port restricted cone
NATs are presenting a
“static” nature of the
mapping.
 The NAT mapping is
according the source only.
 A STUN query can predict
the mapping.

STUN Server 1

STUN Server 2

STUN Query
What’s my IP address
STUN Response
Your address is
200.200.1.1:1000

STUN Query
What’s my IP address

Static NAT
STUN Response
Your address is
200.200.1.1:1000
Symmetric NAT

 Each request from the
same internal IP address
and port to a specific
destination IP address and
port is mapped to a unique
external source IP address
and port.
 The mapping is done by a
combination of the source
and destination address.
 A STUN query is varies
according the destination.

STUN Server 1

STUN Server 2

STUN Query
What’s my IP address
STUN Response
Your address is
200.200.1.1:1000

STUN Query
What’s my IP address

Symmetric NAT
STUN Response
Your address is
200.200.1.1:2000

Identity Crisis
Why symmetric NAT is challenging for SIP ?

 For symmetric NAT the STUN query is irrelevant , since the
STUN answer is relevant only when communicating with the
STUN server, when communicating with other host the NAT
will map a new IP and port.
 In case that a VoIP client is located after a symmetric NAT, the
client can’t share it’s own address (media) with the other side
of the call.
 In case that two media devices located behind symmetric NAT
they can’t establish a call and must use an external media
relay server – TURN server.
SBC as a result of a standard mistake

 Probably the single biggest mistake in SIP design was
ignoring the existence of NATs.
 This error came from a belief in IETF leadership that IP
address space would be exhausted more rapidly and would
necessitate global upgrade to IPv6 and eliminate need for
NATs. The SIP standard has assumed that NATs do not exist.
 SIP simply didn't work for the majority of Internet users who
are behind NATs.
 At the same time it became apparent that the
standardization life-cycle is slower than how the market
ticks: SBCs were born, and began to fix what the standards
failed to do: NAT traversal.
How SBC solves the NAT traversal issue?
 An SBC is NOT located behind
symmetric NAT, therefore it always
knows its own signaling and media
addresses.
 When using an SBC to solve the
NAT traversal issues the most
common approach for SBC is to act
as the public interface of the
user agents.
 This is achieved by replacing the
user agent’s contact information
with those of the SBC.
 For remote user the SBC waits for
the 1st incoming media packet and
latches to its source IP.

Remote User
IP Phone 1

FW Symmetric NAT
SIP
SDP from IPP
includes wrong
IP:port

SIP
SIP
SDP from SBC
includes Correct
IP:port

SBC sends the
media to the
source IP
address of the
1st incoming
packet

SBC waits for The 1st
incoming packet

IP Phone 2
ICE in a nutshell
 ICE resolves the connectivity issue at the signaling stage, via SDP

negotiation.
 The caller gathers candidates, where each candidate is a potential
address for receiving media.
 Three different types of candidates
 Host candidate (local address)
 Server Reflexive candidates (NAT residing addresses)
 Relayed candidates (TURN server address –a host acting as a relay

towards the agent)

 The callee gathers its own three candidates and sends them to the

caller. And by using STUN it start checking connectivity toward the
caller local and NAT residing addressed.
 The caller checks connectivity towards the addresses provided by
the callee and chooses the best pair, LAN, NAT residing and for the
worst case scenario (both clients are behind symmetric NAT) TURN
allocation.
ICE How does it work?
STUN server

TURN server

NAT

Caller

WebRTC server

Callee
ICE – Session Flow
Gather Local
candidates

Gather Server
Reflexive
candidates using
STUN

Gather Relayed
candidates from
the TURN
server

Select the best
candidates

Perform Media
Check on all
peer candidates

Receive peer
candidates from
the SIP message

Exchange final
candidates with
the peer

Check the
connection type

Activate
UDP/TCP socket
Thank You!

More Related Content

What's hot (20)

PDF
Huawei GPON Fundamentals
ibrahimnabil17
 
PPTX
Gpon the technology --rev 1
guerrid
 
PDF
Overview of Spanning Tree Protocol (STP & RSTP)
Peter R. Egli
 
PDF
Cisco IPv6 Tutorial
kriz5
 
PPT
dokumen.tips_ericsson-lte-throughput-troubleshooting-techniques_SUPERRRRRRR.ppt
LibaBali
 
DOCX
Packet Tracer: Cisco, Spanning tree protocol
Rafat Khandaker
 
PPTX
Gpon the technology --rev 1
guerrid
 
PPTX
NR_Frame_Structure_and_Air_Interface_Resources.pptx
Bijoy Banerjee
 
PPTX
JUNOS: OSPF and BGP
Zenith Networks
 
PDF
Xpic implementation xpd alignment interference test
Khalil Al-Alami
 
PDF
Alphorm.com Formation Active Directory 2022 : Multi Sites et Services
Alphorm
 
PPTX
OSPF Fundamental
Reza Farahani
 
PDF
Tunnel vs VPN on Mikrotik
GLC Networks
 
PPTX
VPLS Fundamental
Reza Farahani
 
PPT
Routing and OSPF
arpit
 
PPT
Juniper Trouble Shooting
Mike(Haobin) Zheng
 
PPTX
DWDM Transmission System.pptx
MagarsaaQanaii
 
PDF
Spanning-Tree
Thomas Moegli
 
PPTX
Junos vs ios Troubleshooting comands
sandeep kumar
 
PDF
Firewall Best Practices for VoIP on pfSense - pfSense Hangout October 2017
Netgate
 
Huawei GPON Fundamentals
ibrahimnabil17
 
Gpon the technology --rev 1
guerrid
 
Overview of Spanning Tree Protocol (STP & RSTP)
Peter R. Egli
 
Cisco IPv6 Tutorial
kriz5
 
dokumen.tips_ericsson-lte-throughput-troubleshooting-techniques_SUPERRRRRRR.ppt
LibaBali
 
Packet Tracer: Cisco, Spanning tree protocol
Rafat Khandaker
 
Gpon the technology --rev 1
guerrid
 
NR_Frame_Structure_and_Air_Interface_Resources.pptx
Bijoy Banerjee
 
JUNOS: OSPF and BGP
Zenith Networks
 
Xpic implementation xpd alignment interference test
Khalil Al-Alami
 
Alphorm.com Formation Active Directory 2022 : Multi Sites et Services
Alphorm
 
OSPF Fundamental
Reza Farahani
 
Tunnel vs VPN on Mikrotik
GLC Networks
 
VPLS Fundamental
Reza Farahani
 
Routing and OSPF
arpit
 
Juniper Trouble Shooting
Mike(Haobin) Zheng
 
DWDM Transmission System.pptx
MagarsaaQanaii
 
Spanning-Tree
Thomas Moegli
 
Junos vs ios Troubleshooting comands
sandeep kumar
 
Firewall Best Practices for VoIP on pfSense - pfSense Hangout October 2017
Netgate
 

Similar to Nat traversal in WebRTC context (20)

PPTX
WebRTC Introduction & Basics
Muhammad Ali
 
PDF
WebRTC: Building plugin-free, real-time web applications
Timi Aiyemo
 
PPT
Sinnreich Henry Johnston Alan Pt 3
Carl Ford
 
PDF
NAT_Final
Pratik Bhide
 
PPT
NAT binding with STUN
playcarom
 
PPT
Web-RTC Based Conferencing Application
Onkar Kadam
 
PDF
Exploring the Possibilities of Sencha and WebRTC
Grgur Grisogono
 
PDF
Computer network (16)
NYversity
 
PPTX
WebRTC presentation
Veselin Pizurica
 
PDF
Stun turn poc_pilot
Mihály Mészáros
 
PPTX
Html5 rtc 2
George Orhewere
 
PDF
Real Time communication using WebRTC
maty zisserman
 
PDF
Module17 nat v2
Ratanang kabalano
 
PDF
STUN protocol
Giacomo Vacca
 
PDF
WebRTC Videobroadcasting
Ravi Kuril
 
PPTX
Network address translation
Karppinen Ngoc Anh
 
PPTX
Network address translation
Varsha Honde
 
KEY
SIP : Watch out - don't stay behind!
Olle E Johansson
 
PDF
GÉANT TURN pilot
Mihály Mészáros
 
WebRTC Introduction & Basics
Muhammad Ali
 
WebRTC: Building plugin-free, real-time web applications
Timi Aiyemo
 
Sinnreich Henry Johnston Alan Pt 3
Carl Ford
 
NAT_Final
Pratik Bhide
 
NAT binding with STUN
playcarom
 
Web-RTC Based Conferencing Application
Onkar Kadam
 
Exploring the Possibilities of Sencha and WebRTC
Grgur Grisogono
 
Computer network (16)
NYversity
 
WebRTC presentation
Veselin Pizurica
 
Stun turn poc_pilot
Mihály Mészáros
 
Html5 rtc 2
George Orhewere
 
Real Time communication using WebRTC
maty zisserman
 
Module17 nat v2
Ratanang kabalano
 
STUN protocol
Giacomo Vacca
 
WebRTC Videobroadcasting
Ravi Kuril
 
Network address translation
Karppinen Ngoc Anh
 
Network address translation
Varsha Honde
 
SIP : Watch out - don't stay behind!
Olle E Johansson
 
GÉANT TURN pilot
Mihály Mészáros
 
Ad

Recently uploaded (20)

PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Learn Computer Forensics, Second Edition
AnuraShantha7
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Q2 Leading a Tableau User Group - Onboarding
lward7
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Learn Computer Forensics, Second Edition
AnuraShantha7
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Q2 Leading a Tableau User Group - Onboarding
lward7
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Ad

Nat traversal in WebRTC context

  • 2. WebRTC is:  WebRTC is a free, open project that enables web browsers with Real-Time Communications (RTC) capabilities via simple Javascript APIs.  WebRTC is a media engine with JavaScript APIs.  WebRTC Allows developers to add realtime voice calls, video chats and file sharing to their web apps without the need for plug-ins.  The WebRTC initiative is a project supported by Google, Mozilla and Opera.
  • 3. How does it work? Web Browser A Java Script code calls browser APIs to establish a call JavaScript APIs browser 1. HTML & JavaScript Web Server Call signaling 2. HTML & JavaScript Web Browser B WebRTC is a set of standardized browser APIs
  • 4. WebRTC in Specs APIs by W3C & Protocols by IETF  Connectivity  ICE, STUN and TRUN  Signaling:  Signaling protocol not determined  WebSocket  Must support SDP form to implement ICE  Media  DTLS for key exchange for SRTP  SRTP  Bundle and Media Multiplexing  Coders  Voice Coders: Opus and G.711  Video Coder: VP8 (not final)
  • 6. Network Address Translation  Network Address Translation (NAT) is the process of modifying network address information in datagram packet headers while in transit across a traffic routing device for the purpose of remapping a given address space into another.  This mechanism is implemented in a routing device that uses stateful translation tables to map the "hidden" addresses into a single address and then rewrites the outgoing IP packets on exit so that they appear to originate from the router.  In the reverse communications path, responses are mapped back to the originating IP address using the rules ("state") stored in the translation tables.  The translation table rules established in this fashion are flushed after a short period without new traffic refreshing their state.
  • 7. STUN - Session Traversal Utilities for NAT  STUN is a standardized set of methods and a network protocol to allow an end host to discover its public IP address if it is located behind a NAT.  It is used to permit NAT traversal for applications of realtime voice, video, messaging, and other interactive IP communications.  STUN is intended to be a tool to be used by other protocols, such as ICE. STUN Server STUN Response Your address is 192.168.10.10:5000 STUN Query What’s my IP address
  • 8. Different types of NAT  Network address translation is implemented in a variety of schemes of translating addresses and port numbers, each affecting application communication protocols differently.  Different NAT implementations is classified as:  Full cone NAT  Restricted cone NAT  Port restricted cone NAT  Symmetric NAT
  • 9. Non- Symmetric NAT  Full cone, Restricted cone and Port restricted cone NATs are presenting a “static” nature of the mapping.  The NAT mapping is according the source only.  A STUN query can predict the mapping. STUN Server 1 STUN Server 2 STUN Query What’s my IP address STUN Response Your address is 200.200.1.1:1000 STUN Query What’s my IP address Static NAT STUN Response Your address is 200.200.1.1:1000
  • 10. Symmetric NAT  Each request from the same internal IP address and port to a specific destination IP address and port is mapped to a unique external source IP address and port.  The mapping is done by a combination of the source and destination address.  A STUN query is varies according the destination. STUN Server 1 STUN Server 2 STUN Query What’s my IP address STUN Response Your address is 200.200.1.1:1000 STUN Query What’s my IP address Symmetric NAT STUN Response Your address is 200.200.1.1:2000 Identity Crisis
  • 11. Why symmetric NAT is challenging for SIP ?  For symmetric NAT the STUN query is irrelevant , since the STUN answer is relevant only when communicating with the STUN server, when communicating with other host the NAT will map a new IP and port.  In case that a VoIP client is located after a symmetric NAT, the client can’t share it’s own address (media) with the other side of the call.  In case that two media devices located behind symmetric NAT they can’t establish a call and must use an external media relay server – TURN server.
  • 12. SBC as a result of a standard mistake  Probably the single biggest mistake in SIP design was ignoring the existence of NATs.  This error came from a belief in IETF leadership that IP address space would be exhausted more rapidly and would necessitate global upgrade to IPv6 and eliminate need for NATs. The SIP standard has assumed that NATs do not exist.  SIP simply didn't work for the majority of Internet users who are behind NATs.  At the same time it became apparent that the standardization life-cycle is slower than how the market ticks: SBCs were born, and began to fix what the standards failed to do: NAT traversal.
  • 13. How SBC solves the NAT traversal issue?  An SBC is NOT located behind symmetric NAT, therefore it always knows its own signaling and media addresses.  When using an SBC to solve the NAT traversal issues the most common approach for SBC is to act as the public interface of the user agents.  This is achieved by replacing the user agent’s contact information with those of the SBC.  For remote user the SBC waits for the 1st incoming media packet and latches to its source IP. Remote User IP Phone 1 FW Symmetric NAT SIP SDP from IPP includes wrong IP:port SIP SIP SDP from SBC includes Correct IP:port SBC sends the media to the source IP address of the 1st incoming packet SBC waits for The 1st incoming packet IP Phone 2
  • 14. ICE in a nutshell  ICE resolves the connectivity issue at the signaling stage, via SDP negotiation.  The caller gathers candidates, where each candidate is a potential address for receiving media.  Three different types of candidates  Host candidate (local address)  Server Reflexive candidates (NAT residing addresses)  Relayed candidates (TURN server address –a host acting as a relay towards the agent)  The callee gathers its own three candidates and sends them to the caller. And by using STUN it start checking connectivity toward the caller local and NAT residing addressed.  The caller checks connectivity towards the addresses provided by the callee and chooses the best pair, LAN, NAT residing and for the worst case scenario (both clients are behind symmetric NAT) TURN allocation.
  • 15. ICE How does it work? STUN server TURN server NAT Caller WebRTC server Callee
  • 16. ICE – Session Flow Gather Local candidates Gather Server Reflexive candidates using STUN Gather Relayed candidates from the TURN server Select the best candidates Perform Media Check on all peer candidates Receive peer candidates from the SIP message Exchange final candidates with the peer Check the connection type Activate UDP/TCP socket