在 AWS EC2 免费套餐实例上安装 TURN 服务器
TURN server installation on AWS EC2 free-tier instance
我从安全组为我的实例上的 coturn 服务器启用了所有必要的端口。我也正确配置了 turnserver.conf 文件,但是当我在 trickleICE 上添加我的 turn 服务器时,它仍然显示错误 701.
这是我的turnserver.conf:
listening-port=3478
# and 5349 for TLS (secure)
tls-listening-port=5349
#alt-listening-port=80
# Require authentication
fingerprint
lt-cred-mech
# Specify the server name and the realm that will be used
# if is your first time configuring, just use the domain as name
server-name=mydomain.com
realm=mydomain.com
# Important:
# Create a test user if you want
# You can remove this user after testing
user=<myusername>:<mypassword>
#min-port=705
#max-port=1000
total-quota=100
stale-nonce=600
external-ip=<my public ip>/<my private ip>
listening-ip=<my private ip>
relay-ip=<my public ip>
ec2入站安全组截图:
security-groups
屏幕截图:
TRICLE ICE RESPONSE
有人可以帮我解决这个问题吗?当我输入命令
sudo systemctl status coturn
状态有效
screenshot of coturn status
我的建议是收集更多有关失败原因的信息。
我假设您正在使用 turn:IP:port
服务器 URL 配置 Trickle ICE 应用程序,它允许与 TURN 进行未加密的交换。
这意味着您可以在您的机器上进行跟踪,例如使用 Wireshark,并验证 STUN 绑定请求和 TURN 分配请求是否被发送到预期的 TURN 服务器的 public IP 和端口,以及浏览器是否收到对它们的响应。
您可以在 TURN 服务器端执行其他检查。使用 netstat -tunapl
之类的东西,您可以验证 coturn
不仅是 运行ning,而且还在监听预期的端口(应该是 3478,因为您没有指定它)。
如果一切看起来都符合预期,那么当您从 Trickle ICE 应用程序触发“收集候选人”时,运行 会在 coturn
的主机上进行追踪。您可以使用 ngrep -d any -lqtW byline port 3478
之类的东西来查看 activity 和交换的内容。
如果 coturn
没有收到任何东西,请再次检查 EC2 实例安全组并确保您允许流量流向端口 3478 UDP(和 TCP)。仔细检查 EC2 实例的 public IP 地址是您在 Trickle ICE 应用程序中使用的地址。
如果您为该 EC2 实例分配了多个网络接口,请确保您将 listening-ip
配置项设置为正确的 private IP 地址,和一个包含 PUBLIC_IP:PRIVATE_IP
的 external-ip
指令,其中 public IP 是您尝试使用的 IP,私有 IP 是 coturn
正在侦听的 IP。
例如:
listening-ip: 172.10.10.10
external-ip: 30.30.30.30/172.10.10.10
然后再试一次。无论如何,您可以通过这种方式收集到的信息可用于改进最初的问题并获得更有用的答案。
我从安全组为我的实例上的 coturn 服务器启用了所有必要的端口。我也正确配置了 turnserver.conf 文件,但是当我在 trickleICE 上添加我的 turn 服务器时,它仍然显示错误 701.
这是我的turnserver.conf:
listening-port=3478
# and 5349 for TLS (secure)
tls-listening-port=5349
#alt-listening-port=80
# Require authentication
fingerprint
lt-cred-mech
# Specify the server name and the realm that will be used
# if is your first time configuring, just use the domain as name
server-name=mydomain.com
realm=mydomain.com
# Important:
# Create a test user if you want
# You can remove this user after testing
user=<myusername>:<mypassword>
#min-port=705
#max-port=1000
total-quota=100
stale-nonce=600
external-ip=<my public ip>/<my private ip>
listening-ip=<my private ip>
relay-ip=<my public ip>
ec2入站安全组截图: security-groups
屏幕截图: TRICLE ICE RESPONSE
有人可以帮我解决这个问题吗?当我输入命令
sudo systemctl status coturn
状态有效 screenshot of coturn status
我的建议是收集更多有关失败原因的信息。
我假设您正在使用 turn:IP:port
服务器 URL 配置 Trickle ICE 应用程序,它允许与 TURN 进行未加密的交换。
这意味着您可以在您的机器上进行跟踪,例如使用 Wireshark,并验证 STUN 绑定请求和 TURN 分配请求是否被发送到预期的 TURN 服务器的 public IP 和端口,以及浏览器是否收到对它们的响应。
您可以在 TURN 服务器端执行其他检查。使用 netstat -tunapl
之类的东西,您可以验证 coturn
不仅是 运行ning,而且还在监听预期的端口(应该是 3478,因为您没有指定它)。
如果一切看起来都符合预期,那么当您从 Trickle ICE 应用程序触发“收集候选人”时,运行 会在 coturn
的主机上进行追踪。您可以使用 ngrep -d any -lqtW byline port 3478
之类的东西来查看 activity 和交换的内容。
如果 coturn
没有收到任何东西,请再次检查 EC2 实例安全组并确保您允许流量流向端口 3478 UDP(和 TCP)。仔细检查 EC2 实例的 public IP 地址是您在 Trickle ICE 应用程序中使用的地址。
如果您为该 EC2 实例分配了多个网络接口,请确保您将 listening-ip
配置项设置为正确的 private IP 地址,和一个包含 PUBLIC_IP:PRIVATE_IP
的 external-ip
指令,其中 public IP 是您尝试使用的 IP,私有 IP 是 coturn
正在侦听的 IP。
例如:
listening-ip: 172.10.10.10
external-ip: 30.30.30.30/172.10.10.10
然后再试一次。无论如何,您可以通过这种方式收集到的信息可用于改进最初的问题并获得更有用的答案。