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:
- 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) - from random machine (not within the VPC), run
curl <EC2ExternalIpAddress>:3478
, it has no response, not even Recv failure message - trickle ICE shows "TURN server not reachable"
What could be problem with it?