Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whether STUN server is needed within LAN for WebRTC?

Tags:

webrtc

stun

I have developed a p2p video chat using Webrtc. I am aware that STUN or TURN server is required to identify the public IP behind NAT. Currently am using Google's STUN server.

I have the application installed in the server connected to the LAN which will not have internet access, do I need to install the STUN server in my server to make Webrtc video chat work within the LAN?

like image 284
Mano Avatar asked Oct 30 '13 06:10

Mano


People also ask

Do I need a STUN server for WebRTC?

More generally, no, a STUN server is not strictly required. I know this because I successfully connected 2 WebRTC peers without a stun server. I used the example code from aiortc, a python WebRTC/ ORTC library where both clients were running locally on my laptop. The signalling channel used my manual copy-pasting.

What is the use of STUN server in WebRTC?

STUN. Session Traversal Utilities for NAT (STUN) is a protocol to discover your public address and determine any restrictions in your router that would prevent a direct connection with a peer.

When should I use STUN server?

The STUN server allows clients to find out their public address, the type of NAT they are behind and the Internet side port associated by the NAT with a particular local port. This information is used to set up UDP communication between the client and the VoIP provider to establish a call.

Do you need a server for WebRTC?

Does WebRTC Need a Server? WebRTC can easily connect two browsers on a local area network. However, WebRTC and browsers alone aren't capable of connecting through the internet. WebRTC needs a server to handle tasks like getting through firewalls and routing data outside of your local network.


2 Answers

Peers should be able to connect within a LAN (on the same side of a NAT) without STUN, i.e. using the host candidates. Try it out!

like image 166
Sam Dutton Avatar answered Sep 19 '22 10:09

Sam Dutton


In general, you won't need a STUN server. However, depending on the firewall configuration, you may actually need STUN (and even TURN). For example, at the SFHTML5 WebRTC Hackathon, we were on a corporate guest WiFi network that blocked local UDP and TCP traffic. Making successful calls required a TURN server in this case.

like image 37
tomtheengineer Avatar answered Sep 23 '22 10:09

tomtheengineer