我想在ubuntu上运行coturn服务器,我没有任何域,我想要在localhost上对其进行测试,因此我遵循了教程https://www.allerstorfer.at/install-coturn-on-ubuntu/ 这是我遵循的步骤
sudo apt-get install coturn
nano /etc/default/coturn
TURNSERVER_ENABLED=1
listening-port=3478
cli-port=5766
listening-ip=172.17.19.101
创建了一个秘密
openssl rand -hex 32
并添加到turnserver.conf文件
use-auth-secret
static-auth-secret=583bAAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDDEEEEEEEEEEFFFFFFFFFF
vi /etc/services
stun-turn 3478/tcp # Coturn
stun-turn 3478/udp # Coturn
stun-turn-tls 5349/tcp # Coturn
stun-turn-tls 5349/udp # Coturn
turnserver-cli 5766/tcp # Coturn
启动了coturn服务器
turnserver -o -v
0: log file opened: /var/tmp/turn_18181_2020-09-15.log
0:
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.0.7 'dan Eider'
0:
Max number of open files/sockets allowed for this process: 65535
0:
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 32500 (approximately)
0:
==== Show him the instruments, Practical Frost: ====
0: TLS supported
0: DTLS supported
0: DTLS 1.2 supported
0: TURN/STUN ALPN supported
0: Third-party authorization (oAuth) supported
0: GCM (AEAD) supported
0: OpenSSL compile-time version: OpenSSL 1.1.1 11 Sep 2018 (0x1010100f)
0:
0: SQLite supported, default database location is /var/lib/turn/turndb
0: Redis supported
0: PostgreSQL supported
0: MySQL supported
0: MongoDB is not supported
0:
0: Default Net Engine version: 3 (UDP thread per CPU core)
=====================================================
0: Config file found: /etc/turnserver.conf
0: Bad configuration format: TURNSERVER_ENABLED
0: Listener address to use: 172.17.19.101
0: Config file found: /etc/turnserver.conf
0: Bad configuration format: TURNSERVER_ENABLED
0: Domain name:
0: Default realm:
0: ERROR:
CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0:
CONFIGURATION ALERT: you did specify the long-term credentials usage
but you did not specify the default realm option (-r option).
Check your configuration.
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: Relay address to use: 0.0.0.0
netstat -npta | grep turnserver
8 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
tcp 0 0 0.0.0.0:3478 0.0.0.0:* LISTEN 18889 / turnserver
然后
service coturn stop
service coturn start
service coturn restart
service coturn status
service coturn status
● coturn.service - LSB: coturn TURN Server
Loaded: loaded (/etc/init.d/coturn; generated)
Active: active (running) since Tue 2020-09-15 17:02:05 PKT; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 18860 ExecStop=/etc/init.d/coturn stop (code=exited, status=0/SUCCESS)
Process: 18867 ExecStart=/etc/init.d/coturn start (code=exited, status=0/SUCCESS)
Tasks: 15 (limit: 4915)
CGroup: /system.slice/coturn.service
└─18889 /usr/bin/turnserver -c /etc/turnserver.conf -o -v
本教程中的步骤为
Add to DNS
turn.domain.xx → domain.xx
stun.domain.xx → domain.xx
我对此感到困惑,所以我 编辑/ etc / hosts文件并添加
127.0.0.1 turn.domain.xx
127.0.0.1 sturn.domain.xx
和
telnet localhost 5766
返回
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
但是在本教程中,它显示了输出,我唯一更改的是他们使用的Listening_ip
listening-ip=172.17.19.101
我用过
listening-ip=0.0.0.0
如果我使用->
listening-ip=172.17.19.101
然后命令->
netstat -npta | grep turnserver
一无所获
请指导我如何在本地主机上测试Coturn服务器
答案 0 :(得分:1)
即使看起来有点晚了;您的 turnserver.conf
文件包含无效的行 TURNSERVER_ENABLED=1
。此行损坏了您的 conf 文件,并且 turnserver 无法启动。正如您在日志文件中看到的:
0: Bad configuration format: TURNSERVER_ENABLED
您不能在 turnserver.conf
文件中使用此参数。此参数用于 /etc/default/coturn
文件。