I am running a defederated local Matrix server, and I need to set up calls. From what I can tell, the "legacy" calls require a STUN and TURN server, and the new MatrixRTC standard seems to require them as well for Livekit to work. However, I do not want to expose anything out to the public internet, as I want everything to be behind NAT for local access only (all of the clients for the server will also be behind the NATted network). I also have Tailscale running on my servers, and it would be useful if I would be able to connect to the TURN server even when not in the network. Is there a way to get STUN/TURN to work in this situation? It seems that all the servers expect to have public network access.

all 21 comments

sorted by: hot top controversial new old
[–] 9 points 8 months ago (1 child)

The turn server must be able to access other nodes on the Internet and vice versa unless operating exclusively within your local matrix server.

  • source
  • hideshow 1 child comment
  • [–] [S] 1 point 8 months ago

    Oops, autocorrect seems to have messed up some of my words. All of the clients that connect to the servers are behind the same NATted network, and some are behind an additional level of NAT.

  • source
  • parent
  • [–] 5 points 8 months ago

    This looks like a really good explanation of how all the pieces work: What Are STUN, TURN, and ICE? | LiveSwitch Server Documentation https://share.google/PV7BKE7Q56vOE9lHl

    Based on what you wrote, it looks like you'll need ICE hosts, but no STUN / TURN.

  • source
  • [–] [B] 2 points 8 months ago* (last edited 8 months ago)

    Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

    Fewer Letters More Letters
    DNS Domain Name Service/System
    IP Internet Protocol
    NAT Network Address Translation
    VPN Virtual Private Network
    VPS Virtual Private Server (opposed to shared hosting)

    5 acronyms in this thread; the most compressed thread commented on today has 7 acronyms.

    [Thread #96 for this comm, first seen 15th Feb 2026, 16:10] [FAQ] [Full list] [Contact] [Source code]

  • source
  • [–] 2 points 8 months ago (11 children)

    Ipv6, get an ipv6. There is not nat in ipv6

  • source
  • hideshow 11 child comments
  • [–] 3 points 8 months ago* (last edited 8 months ago) (5 children)

    Have I got news for you. ☹️

    Edit: I'll just add an '/s' for good measure, as apparently I was too subtle. Be sensible, don't do NAT66.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 5 points 8 months ago (3 children)

    What a lot of nonsense. Of course the technology exists and of course it can be done. But in reality is not done because it simply doesn't bring any benefit.

    And in addition a address translation is not nat (tm) because the server can be hit from the outside.

    Today in ipv4 we have likely 2 Nats, 1 after your router and the other by the carrier (cgnat) and ipv6 those are non existent

  • source
  • parent
  • hideshow 3 child comments
  • [–] 5 points 8 months ago* (last edited 8 months ago) (2 children)

    It was meant tongue-in-cheek, you seem to be taking it much more seriously than I intended it to be. 🙂

    But in reality is not done because it simply doesn't bring any benefit.

    Fully agree that there is absolutely no benefit to NAT66, it only causes enormous headaches. I sincerely hope nobody uses it these days, this poor bastard however did manage to find a VPS provider that used NAT66 back in 2018: https://blog.apnic.net/2018/02/02/nat66-good-bad-ugly/ 🤢

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 8 months ago (4 children)

    Unfortunately my ISP doesn't support IPv6 yet, both for the public internet and for my local network.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 8 months ago (1 child)

    Seems like a very reasonable reason to switch to another isp well established in the 21st century

  • source
  • parent
  • hideshow 1 child comment
  • [–] [S] 2 points 8 months ago*

    I live in a rural area, so my only options are dealing with a mobile hotspot for everything or getting satellite internet for more than double the price.

    It's also not worth it for me to switch internet providers just to have calls on my Matrix server work

  • source
  • parent
  • [–] 1 point 8 months ago

    If you want a non-federating LAN-only Matrix server, then STUN/TURN can be behind the NAT. Since you have Tailscale, STUN/TURN can also expose itself on the Tailscale VPN too. Just configure proper DNS records per-interface and you should be fine.

    Since calls are p2p, the purpose of STUN is to determine a client's (usually public) IP address, and TURN is to relay the connection if they can't connect directly (i.e. behind NAT). If your clients are on the same LAN/VPN with unrestrictive firewalls then you might not even need any STUN/TURN altogether.

  • source
  • [–] 1 point 8 months ago* (1 child)

    I'm not qualified enough to answer that, but..

    I tried setting up calls and while STUN/TURN works in WAN, but not LAN, Element are supposed to be making a replacement that makes voice and video calls entirely E2EE, aka Livekit, which I've completely failed to get working. So far I've given up on improving my instance's features and stick to Element Classic. I hope you get it running well!

  • source
  • hideshow 1 child comment
  • [–] 1 point 8 months ago (1 child)

    What do you need STUN for? If anything you might want TURN but that is probably not needed everything is on the same network.

  • source
  • hideshow 1 child comment