Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TURN server configuration for TURN servers behind NAT gateways #588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BrentBaccala
Copy link
Contributor

Commit 1b19b0 (Updated for installing coturn on 20.04 - Jan 17 2021) added coturn configuration options (listening-ip, relay-ip, external-ip) that aren't properly set if the TURN server is behind a NAT gateway.

In the NAT case, both listening-ip (the address the TURN server binds to) and relay-ip (the address the TURN server transmits on) should be the private IP address.

If listening-ip and relay-ip are improperly set to the external IP address, then we get error messages (like those reported on Issue #577) that the TURN server can't bind to the public IP address.

Fixes and closes Issue #577.

Commit 1b19b0 (Updated for installing coturn on 20.04 - Jan 17 2021) added
coturn configuration options (listening-ip, relay-ip, external-ip) that
aren't properly set if the TURN server is behind a NAT gateway.

In the NAT case, both listening-ip (the address the TURN server binds to)
and relay-ip (the address the TURN server transmits on) should be the
private IP address.

If listening-ip and relay-ip are improperly set to the external IP address,
then we get error messages (like those reported on Issue bigbluebutton#577) that the
TURN server can't bind to the public IP address.

Fixes and closes Issue bigbluebutton#577.
@ffdixon
Copy link
Member

ffdixon commented Jan 6, 2023

Just testing this -- it seems that ${INTERNAL_IP:-$IP} will only put the first INTERNAL_IP.

# cat test.sh
#!/bin/bash

INTERNAL_IP=1.1.1.1
IP=2.2.2.2
echo "listening-ip=${INTERNAL_IP:-$IP}"

#./test.sh
listening-ip=1.1.1.1

@BrentBaccala
Copy link
Contributor Author

Just testing this -- it seems that ${INTERNAL_IP:-$IP} will only put the first INTERNAL_IP.

That's the desired behavior. It uses INTERNAL_IP in the NAT case, and IP in the non-NAT case.

listening-ip is the address that the TURN server actually binds to and listens for packets on, so it needs to be an address that is actually configured on the machine. In the NAT case, INTERNAL_IP is the private address and IP is the public address, while in the non-NAT case, INTERNAL_IP isn't set and IP is the public address, that is also the address actually configured on the machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants