How do I redirect a subdomain to ts3 server using apache2?

Hi there!

I have a small group of friends who would like to communicate trough TeamSpeak. I own a VPS that I rent out for my web project and for hosting I use Apache2 service. I have a domain and I can freely create A records for my subdomains. The only problem is - I cant make the apache to redirect voice.mydomain.com to 1.1.1.1 (aka. example IP). I tried with Proxies, but apache doesn’t recognize ts3server://1.1.1.1 as a valid handler.

Is there any other way I can achieve this with apache?

1st:
ts3server:// is only used for sharinf connection information between clients.
It is NOT used for connecting to a server.
A server uses UDP for the voice connection.
UDP does not use those protocols known for TCP.

2nd:
If you host your TS server on the same host as the Apache server there is neither need for a subdomain, nor for a (reverse) proxy.

3rd:
If the TS ans Apache server run on different hosts with different IPs you will need either a reverse proxy for the default domain, OR a subdomain leading to the different host.

So how does it work then?

Assuming both your apache and TS server runs on 1.1.1.1 .
You simply need to open the TS server port UDP (default 9987/udp) through the firewall.

Assuming apache runs on 1.1.1.1 and TS on 2.2.2.2 and you want to use a subdomain.
Simply set the A record for the subdomain to point to 2.2.2.2 and allow 9987/udp through the firewall of 2.2.2.2 .

Assuming apache runs on 1.1.1.1 and TS on 2.2.2.2 and you want to use the same domain.
Set up a reverse proxy in apache to listen to port 9987/udp and redirect / stream the traffic to the same port on 1.1.1.1 . Both machines need to have port 9987/udp opened in the firewall.

Even if port 9987/udp is technically enough, it is recommended to also allow / forward the ports found here: https://support.teamspeak.com/hc/en-us/articles/360002712257-Which-ports-does-the-TeamSpeak-3-server-use-

3 Likes

Thank you for your answer!

My goal here is to have users use my domain instead of IP. I am not sure how to do it. I tried to create a virtual host with proxy but upon inputting domain name in TS3 client, it did not connect. With IP, however, it connected.

My question is: How to create a subdomain that ts3 can actually connect to?

Ok, let’s look at how the client handles a new (basic) connection:
In this example the domain is ya[...].ha[...].TLD
The A record for ya[...].ha[...].TLD points to 61.[...]
The A record for ha[...].TLD points to 85.[...]
image

Now we can see that the domain is resolved but the subdomain prioritized.
When you now say, you can connect to e.g. 1.1.1.1 but not to example.com the problem should be with the record.
Things to ensure:

  • example.com actually points to 1.1.1.1 (nslookup example.com)
  • If the server is not on the default port you need
    • a SRV record OR
    • still specify the port even with a domain (example.com:9999)
3 Likes

Just set up an SRV RR and call it a day.

Go to the control panel of your domain registrar and setup “DNS record A” to make it redirect traffic to the ip adress of your server on which you have TS3 server.