2

I need to spin up a TURN/STUN server in Cloud. I feel it a pretty common use case and there are hundreds of related posts in the internet. After several days of failed attempt, I still failed to spin it up.

Here is my current step. I keep it simple to be reproduced (only take ~10mins). I've no idea which part could go wrong.

1. Launch an (Amazon Linux 2.0 , t2.micro) host

  • allow ALL traffic in SecurityGroup (only for quick test, remember to delete the rule)
  • put it in public Subnet in default VPC grant it
  • public IP address.

2. ssh into the host run following commands

sudo yum -y update
sudo amazon-linux-extras install epel
sudo yum -y install coturn

3. start server

export PRIVATE_IP=172.31.28.133
export PUBLIC_IP=34.222.45.31
sudo turnserver -n --listening-port 3478 --listening-ip ${PRIVATE_IP} \
--relay-ip ${PRIVATE_IP} --external-ip ${PUBLIC_IP} \
--allow-loopback-peers --no-auth --no-tlsv1 --no-tlsv1_1 \
--log-file /tmp/turnserver.log --simple-log --fingerprint \
--min-port=49152 --max-port=65535 --verbose --no-cli

Now we will be able to see server up and running in 3478 port (default turn server port)


But this server is not running functional, there are a few problems with it:

  1. ssh the host in new tab, run curl localhost:3478, it will respond: curl: (56) Recv failure: Connection reset by peer (Expect to see default "TURN Server" html page)
  2. from random machine (not within the VPC), run curl <EC2ExternalIpAddress>:3478, it has no response, not even Recv failure message
  3. trickle ICE shows "TURN server not reachable"

What could be problem with it?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • You can use something like `ps aux | grep turn` to ensure coturn is actually running. Then something like `netstat -tunapl | grep turn` to verify what ports is coturn actually listening on. Then you can use https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ to verify basic connectivity from your computer to the server. You should take network traces on your machine while you do that. I wrote time ago a troubleshooting guide that maybe can be useful: https://www.giacomovacca.com/2022/05/troubleshooting-turn.html – giavac Aug 18 '22 at 15:34

0 Answers0