ottomated / CrewLink-server

Voice Relay server for CrewLink.
GNU General Public License v3.0
694 stars 444 forks source link

LAN users cant hear and talk to WAN users and same reversed #92

Open antipiot opened 3 years ago

antipiot commented 3 years ago

Hello!

I have installed my Crewlink server in a docker container and tested it with some friends but we encountered some troubles:

I was connected with another user from the same network where the server resides and some friends joined trough WAN.

LAN users could hear and talk between them but not with WAN users and WAN users could hear and talk between them but not with the LAN users.

Could see everybody connected correctly on the server and lobby.

There are no Port change - only straight port mapping WAN:9736 - LAN:9736 - Container:9736 Local address of server is 10.0.0.50 WAN address is xxx.xx.xxx.60

Tested with direct connection to server with http://10.0.0.50:9736 - same result - WAN and LAN users cant talk between them Tested with a NAT loop back on the WAN address which i expected to work but same result http://xxx.xx.xxx.60:9736

Users all shows connected an gree talk circle - webpage of server is reachable and users counter report correct number of connected users.

I tested this aswell with a revers proxy without success: no connection at all - no users shows connected but webpage can be reached.

Feel free to as for some tests.

Thanks for your great work on Crewlink!

VermontBlogger commented 3 years ago

This caused me hours of stress trying to figure out what it was, and this bug report gave me so much hope in my network not being setup incorrectly. Ran into this issue where no one could hear myself, but all my online friends could hear themselves just fine. Crewlink's voice/speaker settings were all good, showed I was connected, it even showed users in our Among Us lobby were connected to Crewlink as well!

Your configuration looks exactly as mine, I even put the IP to my server on a DMZ just to rule out local network configurations or some odd firewall changes on my pfSense.

chilis3for10 commented 3 years ago

Im having this same issue with a roommate. We share an ethernet port. Any updates on a fix for this?

Teo230 commented 3 years ago

My friend too, any updates?

OiYouYeahYou commented 3 years ago

This is due to CrewLink using peer to peer for voice connections. The server has nothing to do with this.

AntoineMary commented 3 years ago

So I was having the same kind of trouble as you have (person 1 -> VPS(Crewlink) <- person2). As @OiYouYeahYou said yes Crewlink code is not at fault, but there is a lack of explanation, Crewlink use WebRTC and is implemented by simple-peer in the client project and after looking https://www.npmjs.com/package/simple-peer#connection-does-not-work-on-some-networks some firewall config is also needed. I block everything by default. The following lines where the bare minimum to make it work with nftables :

table inet filter {
        chain input {
                tcp dport 9736 accept comment "Accept Crewlink Base"
                udp dport 9736 accept comment "Accept Crewlink Voice"
        }

        chain prerouting {
                type nat hook prerouting priority -100;
        }

        chain postrouting {
                type nat hook postrouting priority 100;
                masquerade
        }

}

You also need to enable forward on the linux server + interface

So in short : Forward must be enable, and Source NAT must be configured too