reTurn服务器(resiprocate)没有响应,配置错误?

问题描述:

我已经rhel7安装resiprocate返回服务器根据这些指令,确切地说,以下数2: https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.htmlreTurn服务器(resiprocate)没有响应,配置错误?

我已进行如下设置:

TurnAddress = 172.31.40.178 
AltStunAddress = 172.31.40.179 
TurnPort = 3478 
AltStunPort = 5349 

第一和第二IP都被配置和可以ping通,这是ifconfig的输出:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001 
     inet 172.31.40.178 netmask 255.255.240.0 broadcast 172.31.47.255 
     inet6 fe80::45e:20ff:fe6b:6869 prefixlen 64 scopeid 0x20<link> 
     ether 06:5e:20:6b:68:69 txqueuelen 1000 (Ethernet) 
     RX packets 5100789 bytes 890198603 (848.9 MiB) 
     RX errors 0 dropped 0 overruns 0 frame 0 
     TX packets 4742159 bytes 3984379336 (3.7 GiB) 
     TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

eth0:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001 
     inet 172.31.40.179 netmask 255.255.240.0 broadcast 172.31.47.255 
     ether 06:5e:20:6b:68:69 txqueuelen 1000 (Ethernet) 

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 
     inet 127.0.0.1 netmask 255.0.0.0 
     inet6 ::1 prefixlen 128 scopeid 0x10<host> 
     loop txqueuelen 0 (Local Loopback) 
     RX packets 460812 bytes 163626411 (156.0 MiB) 
     RX errors 0 dropped 0 overruns 0 frame 0 
     TX packets 460812 bytes 163626411 (156.0 MiB) 
     TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

和端口是开放的。

的netstat对返回输出是:

tcp  0  0 172.31.40.178:3478  0.0.0.0:* 
LISTEN  17177/reTurnServer 
tcp  0  0 172.31.40.178:5349  0.0.0.0:* 
LISTEN  17177/reTurnServer 
tcp6  0  0 :::3478     :::* 
LISTEN  17177/reTurnServer 
tcp6  0  0 :::5349     :::* 
LISTEN  17177/reTurnServer 
udp  0  0 172.31.40.179:3478  0.0.0.0:* 
     17177/reTurnServer 
udp  0  0 172.31.40.178:3478  0.0.0.0:* 
     17177/reTurnServer 
udp  0  0 172.31.40.179:3479  0.0.0.0:* 
     17177/reTurnServer 
udp  0  0 172.31.40.178:3479  0.0.0.0:* 
     17177/reTurnServer 
udp6  0  0 :::3478     :::* 
     17177/reTurnServer 

我已经设置了散列密码,并用我的域名如。 test.example.com作为领域。

当我尝试连接到转动服务器失败。我使用下面的代码来测试连接,使用正确的用户名和密码,它总是打印“不”:

function checkTURNServer(turnConfig, timeout){ 

    return new Promise(function(resolve, reject){ 

    setTimeout(function(){ 
     if(promiseResolved) return; 
     resolve(false); 
     promiseResolved = true; 
    }, timeout || 5000); 

    var promiseResolved = false 
     , myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection //compatibility for firefox and chrome 
     , pc = new myPeerConnection({iceServers:[turnConfig]}) 
     , noop = function(){}; 
    pc.createDataChannel(""); //create a bogus data channel 
    pc.createOffer(function(sdp){ 
     if(sdp.sdp.indexOf('typ relay') > -1){ // sometimes sdp contains the ice candidates... 
     promiseResolved = true; 
     resolve(true); 
     } 
     pc.setLocalDescription(sdp, noop, noop); 
    }, noop); // create offer and set local description 
    pc.onicecandidate = function(ice){ //listen for candidate events 
     if(promiseResolved || !ice || !ice.candidate || !ice.candidate.candidate || !(ice.candidate.candidate.indexOf('typ relay')>-1)) return; 
     promiseResolved = true; 
     resolve(true); 
    }; 
    }); 
} 

checkTURNServer({ 
      'url': 'turn:test.*****.com:3478', 
      'credential': 'password', 
      'username': 'username' 
}).then(function(bool){ 
    console.log('is TURN server active? ', bool? 'yes':'no'); 
}).catch(console.error.bind(console)); 

我将超出感谢任何帮助,我开始失去我的弹珠。

非常感谢。

172.31.40.178位于私有IP地址范围内。这意味着你从NAT后面运行STUN和TURN。如果您启用了端口3478,3489和5349(UDP和TCP)以适当地转发到您的服务器,那没什么问题。

您在问题中留下了足够的提示,建议您的服务器在Amazon EC2上运行。如果是这种情况,端口转发由EC2实例的security group配置。对于与此实例关联的安全组,为UDP和TCP启用一组允许端口3478,3479和5349用于IP范围0.0.0.0/0的入站规则。另外,请检查您的VPC安全组和netweork acl设置,但默认情况下通常会启用这些设置。否则,如果您不在亚马逊上,则应启用您的托管服务提供商或本地NAT以将这些端口端口转发到服务器的IP。

此外,仔细检查以确保您的IPTable规则(如果启用)不阻止流量。

+0

非常感谢,现在可以工作。它不是UDP。 –