---
title: Quick Guide for STUN/TURN and WebRTC. – WebRTC.ventures
description: Why STUN/TURN? In order to do WebRTC across different networks, we need to bypass firewalls and we also have all kinds of restrictions set by ISPs, in order to bypass this restrictions and punch a hole in the receptors firewalls to get media through we need to […]
image: https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/2017-08-09-103616_497x294_scrot.png
---

[Skip to content](https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc#main-content)

![WebRTC.ventures](https://blog.webrtc.ventures/hubfs/logo-main-light.svg)

- [WebRTC Services](https://webrtc.ventures/webrtc-development-services/)
  
  Show submenu for WebRTC Services 
  
    - [Assess](https://webrtc.ventures/services/assess/)
    - [Build](https://webrtc.ventures/services/build/)
    - [Integrate](https://webrtc.ventures/services/integrate/)
    - [Test](https://webrtc.ventures/services/test/)
    - [Manage](https://webrtc.ventures/services/manage/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
- Our Partners
  
  Show submenu for Our Partners 
  
    - [Amazon Chime SDK](https://webrtc.ventures/partners/amazon-chime-sdk/)
- Stories of Success
  
  Show submenu for Stories of Success 
  
    - [Remote Video Interpreting Platform with Agent Routing](https://webrtc.ventures/successes/remote-video-translation-platform/)
    - [WebRTC to SIP Gateway for ASL Interpreters](https://webrtc.ventures/successes/webrtc-to-sip-gateway-for-asl-interpreters/)
    - [Audio Listening Device to Improve Surgical Outcomes](https://webrtc.ventures/successes/audio-listening-device-to-improve-surgical-outcomes/)
    - [Albania’s First Telemedicine Platform](https://webrtc.ventures/successes/albanias-first-telemedicine-platform/)
    - [Automated Video Storytelling with the Amazon Chime SDK](https://webrtc.ventures/successes/automated-video-storytelling-with-the-amazon-chime-sdk/)
    - [Large Scale Video Conferencing](https://webrtc.ventures/successes/large-scale-video-conferencing/)
    - [Broadcasting and Webcast Control Room](https://webrtc.ventures/successes/live-video-broadcasting-and-webcast-control-room/)
- WebRTC Resources
  
  Show submenu for WebRTC Resources 
  
    - [WebRTC Live](https://webrtc.ventures/webrtc-live/)
    - [WebRTC Tips](https://www.youtube.com/playlist?list=PLayYqdnyegt3QvxX-Rt6wbFIK8727Z5Oz)
    - [WebRTC.ventures Blog](https://webrtc.ventures/blog/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
    - [WebRTC.ventures Training Program](https://webrtc.ventures/webrtc-ventures-training-program/)
- [About Us](https://webrtc.ventures/our-team/)
  
  Show submenu for About Us 
  
    - [Blog](https://webrtc.ventures/blog/)
    - [Our Team](https://webrtc.ventures/our-team/)
    - [Jobs](https://webrtc.ventures/jobs/)

Open main navigation

Close main navigation

- [WebRTC Services](https://webrtc.ventures/webrtc-development-services/)
  
  Show submenu for WebRTC Services 
  
    - [Assess](https://webrtc.ventures/services/assess/)
    - [Build](https://webrtc.ventures/services/build/)
    - [Integrate](https://webrtc.ventures/services/integrate/)
    - [Test](https://webrtc.ventures/services/test/)
    - [Manage](https://webrtc.ventures/services/manage/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
- Our Partners
  
  Show submenu for Our Partners 
  
    - [Amazon Chime SDK](https://webrtc.ventures/partners/amazon-chime-sdk/)
- Stories of Success
  
  Show submenu for Stories of Success 
  
    - [Remote Video Interpreting Platform with Agent Routing](https://webrtc.ventures/successes/remote-video-translation-platform/)
    - [WebRTC to SIP Gateway for ASL Interpreters](https://webrtc.ventures/successes/webrtc-to-sip-gateway-for-asl-interpreters/)
    - [Audio Listening Device to Improve Surgical Outcomes](https://webrtc.ventures/successes/audio-listening-device-to-improve-surgical-outcomes/)
    - [Albania’s First Telemedicine Platform](https://webrtc.ventures/successes/albanias-first-telemedicine-platform/)
    - [Automated Video Storytelling with the Amazon Chime SDK](https://webrtc.ventures/successes/automated-video-storytelling-with-the-amazon-chime-sdk/)
    - [Large Scale Video Conferencing](https://webrtc.ventures/successes/large-scale-video-conferencing/)
    - [Broadcasting and Webcast Control Room](https://webrtc.ventures/successes/live-video-broadcasting-and-webcast-control-room/)
- WebRTC Resources
  
  Show submenu for WebRTC Resources 
  
    - [WebRTC Live](https://webrtc.ventures/webrtc-live/)
    - [WebRTC Tips](https://www.youtube.com/playlist?list=PLayYqdnyegt3QvxX-Rt6wbFIK8727Z5Oz)
    - [WebRTC.ventures Blog](https://webrtc.ventures/blog/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
    - [WebRTC.ventures Training Program](https://webrtc.ventures/webrtc-ventures-training-program/)
- [About Us](https://webrtc.ventures/our-team/)
  
  Show submenu for About Us 
  
    - [Blog](https://webrtc.ventures/blog/)
    - [Our Team](https://webrtc.ventures/our-team/)
    - [Jobs](https://webrtc.ventures/jobs/)
- [Contact us](https://webrtc.ventures/contact/)

[Contact us](https://webrtc.ventures/contact/)

 Apr 3, 2023 1:36:11 PM

# Quick Guide for STUN/TURN and WebRTC.

[Fernando Vasquez](https://blog.webrtc.ventures/author/fernando-vasquez)

Share: [linkedin-in icon](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc) [X Twitter icon](https://twitter.com/intent/tweet?url=https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc) [envelope icon](mailto:?body=https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc)

### Why STUN/TURN?

In order to do WebRTC across different networks, we need to bypass firewalls and we also have all kinds of restrictions set by ISPs, in order to bypass this restrictions and punch a hole in the receptors firewalls to get media through we need to rely on a STUN/TURN server, to either find the right route if possible (STUN), or act as a relay server for the media passing through (TURN), in this brief guide we setup a basic STUN/TURN server.

[We’ll use an open source implementation of a STUN/TURN server, ***Coturn.***](https://github.com/coturn/coturn)

### Installing Coturn.

Assuming you are on a Ubuntu 14.04 LTS server run the following commands:

 This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. [Learn more about bidirectional Unicode characters](https://github.co/hiddenchars)

 Show hidden characters

|  | # in ubuntu versions above 14.04 coturn is already on the base repositories |
| --- | --- |
|  | echo "deb http://ftp.us.debian.org/debian jessie main" >> /etc/apt/sources.list |
|  |  |
|  | gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 |
|  | gpg -a --export 8B48AD6246925553 \| apt-key add - |
|  |  |
|  | gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010 |
|  | gpg -a --export 7638D0442B90D010 \| apt-key add - |
|  |  |
|  | apt-get update |
|  | apt-get install coturn |

[view raw](https://gist.github.com/deviantfero/71a61b27423969fc1b810918c6f24940/raw/3b0a6cb416e40fef574be433f1cd7fad0bae7bbb/install_coturn.sh) [install\_coturn.sh](https://gist.github.com/deviantfero/71a61b27423969fc1b810918c6f24940#file-install_coturn-sh) hosted with ![❤](https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/2764-1.svg) by [GitHub](https://github.com) 

 View the code on [Gist](https://gist.github.com/deviantfero/71a61b27423969fc1b810918c6f24940).

When the installation is ready, run the following command in your terminal:

 This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. [Learn more about bidirectional Unicode characters](https://github.co/hiddenchars)

 Show hidden characters

|  | $ turnserver -avn -u user:password -r yourdomain.com |
| --- | --- |
|  | # “a” use long-term credentials, “v” verbose output, “n” do not load a configuration file. |
|  | # "u" Specify user and password credentials to be used. |
|  | # "r" Specify default realm, can be your domain. |
|  |  |
|  | # to check if coturn is running you can run |
|  | $ netstat -lnp \| grep 3478 |

[view raw](https://gist.github.com/deviantfero/d019769174fda4878b370f4a0d0e85f5/raw/c1105d655c4bf95b1519c84e3be53669ba3f9b3d/command.sh) [command.sh](https://gist.github.com/deviantfero/d019769174fda4878b370f4a0d0e85f5#file-command-sh) hosted with ![❤](https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/2764-1.svg) by [GitHub](https://github.com) 

 View the code on [Gist](https://gist.github.com/deviantfero/d019769174fda4878b370f4a0d0e85f5).

### Testing your STUN/TURN server.

In order to test your TURN server, you can make use of this tool provided by the WebRTC team: [https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/](https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/)

Input your server information like this:

![trickle-ice form](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/2017-08-09-103616_497x294_scrot.png?width=497&height=294&name=2017-08-09-103616_497x294_scrot.png) ![trickle-ice form](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/2017-08-09-103616_497x294_scrot.png?width=497&height=294&name=2017-08-09-103616_497x294_scrot.png)

 Fig. 1: trickle-ice form for the input of server credentials

A successful output from testing TURN should look like this:

![trickle ice test results](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/2017-08-09-112800_614x171_scrot.png?width=614&height=171&name=2017-08-09-112800_614x171_scrot.png) ![trickle ice test results](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/2017-08-09-112800_614x171_scrot.png?width=614&height=171&name=2017-08-09-112800_614x171_scrot.png)

 Fig. 2: successful results from a TURN server

You can see two rows that say ***relay***, this indicates that the TURN server is working correctly, if there’s nothing that says ***relay*** on this output, the TURN server is not working as expected.

Keep in mind, this is not a setup appropriate for production environments, it’s simply to have a way to test your WebRTC application without the need of purchasing a TURN server or getting it by other means.

**If you want to know more about WebRTC solutions, need assessment, or just want to have a quote on our services, [Contact us](https://webrtc.ventures/contact/?utm_source=wrtcv_blog&utm_medium=8_9_blog_post&utm_campaign=contact)!**

[CPaaS](https://blog.webrtc.ventures/tag/cpaas), [Managed Services](https://blog.webrtc.ventures/tag/managed-services), [Events](https://blog.webrtc.ventures/tag/events), [Video Conferencing](https://blog.webrtc.ventures/tag/video-conferencing), [Real Time Weekly](https://blog.webrtc.ventures/tag/real-time-weekly), [WebRTC Architecture](https://blog.webrtc.ventures/tag/webrtc-architecture), [Broadcasting](https://blog.webrtc.ventures/tag/broadcasting), [Medical](https://blog.webrtc.ventures/tag/medical), [WebRTC Live](https://blog.webrtc.ventures/tag/webrtc-live), [Showcase](https://blog.webrtc.ventures/tag/showcase), [Thoughts](https://blog.webrtc.ventures/tag/thoughts), [Vonage](https://blog.webrtc.ventures/tag/vonage), [Daily](https://blog.webrtc.ventures/tag/daily), [Jobs](https://blog.webrtc.ventures/tag/jobs), [Contact Centers](https://blog.webrtc.ventures/tag/contact-centers), [Telehealth](https://blog.webrtc.ventures/tag/telehealth), [Education](https://blog.webrtc.ventures/tag/education), [Technical](https://blog.webrtc.ventures/tag/technical), [General](https://blog.webrtc.ventures/tag/general), [Story of success](https://blog.webrtc.ventures/tag/story-of-success), [The WebRTC.ventures Blog](https://blog.webrtc.ventures/tag/the-webrtc-ventures-blog), [Testing](https://blog.webrtc.ventures/tag/testing), [Gaming](https://blog.webrtc.ventures/tag/gaming), [DevOps](https://blog.webrtc.ventures/tag/devops), [Symbl.ai](https://blog.webrtc.ventures/tag/symbl-ai)

## Related posts

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/ICE-in-WebRTC-Server-Setup-and-Relative-Performance.png?height=200&name=ICE-in-WebRTC-Server-Setup-and-Relative-Performance.png)](https://blog.webrtc.ventures/2022/04/ice-in-webrtc)

## [ICE in WebRTC: Server Setup and Relative Performance](https://blog.webrtc.ventures/2022/04/ice-in-webrtc)

![Picture of Jen Oppenheimer](https://blog.webrtc.ventures/hs-fs/hubfs/Our-Team-Jen.jpg?width=50&name=Our-Team-Jen.jpg) [Jen Oppenheimer](https://blog.webrtc.ventures/author/jen-oppenheimer) 

 Apr 19, 2022 12:00:00 AM

Private WebRTC endpoints are often shielded from the public internet by a network that does the...

[Read more](https://blog.webrtc.ventures/2022/04/ice-in-webrtc)

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/ICE-Issues-On-Restrictive-Networks-and-How-To-Alleviate-Them.png?height=200&name=ICE-Issues-On-Restrictive-Networks-and-How-To-Alleviate-Them.png)](https://blog.webrtc.ventures/2021/12/ice-issues-on-restrictive-networks-and-how-to-alleviate-them)

## [ICE Issues On Restrictive Networks and How To Alleviate Them](https://blog.webrtc.ventures/2021/12/ice-issues-on-restrictive-networks-and-how-to-alleviate-them)

[Alberto Gonzalez](https://blog.webrtc.ventures/author/alberto-gonzalez) 

 Dec 7, 2021 12:00:00 AM

Recently, we faced some issues with an on-premise telehealth platform related to connectivity. It...

[Read more](https://blog.webrtc.ventures/2021/12/ice-issues-on-restrictive-networks-and-how-to-alleviate-them)

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/Self-hosted-TURN-and-Our-Experience-Using-Subspace.png?height=200&name=Self-hosted-TURN-and-Our-Experience-Using-Subspace.png)](https://blog.webrtc.ventures/2022/03/self-hosted-turn-and-subspace)

## [Self-hosted TURN and Our Experience Using Subspace](https://blog.webrtc.ventures/2022/03/self-hosted-turn-and-subspace)

[Altanai Bisht](https://blog.webrtc.ventures/author/altanai-bisht) 

 Mar 30, 2022 12:00:00 AM

Subspace WebRTC-CDN not only delivers STUN and TURN based interconnectivity establishments, but...

[Read more](https://blog.webrtc.ventures/2022/03/self-hosted-turn-and-subspace)

### WebRTC.Ventures Services

...

- Assess
- Build
- Integrate
- Test
- Deploy & Manage

### Contact Us

...

**Video should be an opportunity, not a headache.**   
 We’re here to build, integrate, assess and optimize, test, and even deploy and manage your live video application. 

[Contact us](https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc#contact)

### WebRTC Live

...

 View [past episodes](https://blog.webrtc.ventures/webrtc-live/) of our webinar interview series about the latest webRTC use cases and technical updates. Join our mailing list to learn about upcoming episodes! 

![WebRTC Live](https://blog.webrtc.ventures/hs-fs/hubfs/Template%20Images/widged-bannet.webp?height=90&name=widged-bannet.webp)

![logo-main-light](https://blog.webrtc.ventures/hubfs/logo-main-light.svg "logo-main-light")

We’re one of the few agencies in the world dedicated to WebRTC development. This dedication and experience is why so many people trust us to help bring live video application dreams to life.

 

### Let's get started!

###### **[Contact us today](https://webrtc.ventures/contact/)**

**[info@webrtc.ventures](mailto:info@webrtc.ventures)**

<https://www.linkedin.com/company/webrtc-ventures> <https://www.youtube.com/@WebrtcVentures>

### Join our mailing list

We don't e-mail often (a few times a month max), and it will be worth it when we do! Of course, we respect your privacy and will not share your contact information.

© 2023 WebRTC.ventures, an [AgilityFeat](https://agilityfeat.com/) company / [Privacy Policy](https://webrtc.ventures/privacy-policy//)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Fernando Vasquez",
    "url" : "https://blog.webrtc.ventures/author/fernando-vasquez"
  },
  "dateModified" : "2024-04-03T18:07:52.029Z",
  "datePublished" : "2023-04-03T17:36:11.000Z",
  "headline" : "Quick Guide for STUN/TURN and WebRTC. – WebRTC.ventures",
  "image" : [ "https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/2017-08-09-103616_497x294_scrot.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.webrtc.ventures/2017/08/quick-guide-stunturn-webrtc",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.webrtc.ventures/hubfs/logo-main-light.svg"
    }
  }
}
```