# Tcp Router not working properly for Teamspeak

**URL:** https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650
**Category:** Traefik v2
**Tags:** tcp
**Created:** [May 17, 2023, 4:54pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650 "2023-05-17T16:54:53Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![tryingDocker](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tryingDocker](https://community.traefik.io/u/tryingDocker)
#### Post date: [May 17, 2023, 4:54pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/1 "2023-05-17T16:54:53Z")

</div>

Hi,

I want to run teamspeak behind docker. Teamspeak needs a tcp connection on Port 30033 for file transfers. I can connect to the server fine, and speaking works, but file transfers don't work. Sometimes teamspeak gives me an error, sometimes teamspeak says it's fine but the files are always emtpy (0 bytes). If I don't route this ports over traefik but with

```auto
    ports:
      - "30033:30033"
      - "10011:10011"

```

directly into the teamspeak container it works fine. So the problem is probably somewhere around traefik, but the dashboard says everything is fine. Does anybody have an Idea?

> **Traefik Dashboard**
>
> ![10011](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/9/93d3d5580f61aaab2796a16f14f11a96e47b5604.jpeg)  
> ![30033](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/6/6610ca534bf5be901065d7fb20ed8bb4f3ff2da9.jpeg)

> **Teamspeak docker-compose.yml with Traefik**
>
> ```auto
> version: '3.1'
> services:
> teamspeak:
> image: teamspeak
> restart: unless-stopped
> environment:
> - TS3SERVER_LICENSE=accept
> - TS3SERVER_DB_PLUGIN=ts3db_mariadb
> - TS3SERVER_DB_SQLCREATEPATH=create_mariadb
> - TS3SERVER_DB_HOST=teamspeak_db
> - TS3SERVER_DB_USER=teamspeak
> - TS3SERVER_DB_PASSWORD=$DB_PASSWORD
> - TS3SERVER_DB_NAME=teamspeakdb
> - TS3SERVER_DB_WAITUNTILREADY=30
> labels:
> - "traefik.enable=true"
> # Port 30033
> - "traefik.tcp.routers.teamspeakft.entrypoints=p30033"
> - "traefik.tcp.routers.teamspeakft.rule=HostSNI(`*`)"
> #Port 10011
> - "traefik.tcp.routers.teamspeak.entrypoints=p10011"
> - "traefik.tcp.routers.teamspeak.rule=HostSNI(`*`)"
> # Port 9987
> - "traefik.udp.routers.teamspeakudp.entrypoints=p9987"
> volumes:
> - ./teamspeak:/var/ts3server
> depends_on:
> - teamspeak_db
> networks:
> - traefik
> - default
> 
> teamspeak_db:
> image: mariadb
> restart: unless-stopped
> environment:
> - MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
> - MYSQL_PASSWORD=$DB_PASSWORD
> - MYSQL_DATABASE=teamspeakdb
> - MYSQL_USER=teamspeak
> volumes:
> - ./db:/var/lib/mysql/
> networks:
> traefik:
> name: traefik_network
> external: true
> 
> ```

> **traefik.yml**
>
> ```auto
> log:
> level: DEBUG
> accessLog: {}
> providers:
> docker:
> exposedByDefault: false
> network: traefik_network
> entryPoints:
> web:
> address: ":80"
> http:
> redirections:
> entryPoint:
> to: websecure
> scheme: https
> websecure:
> address: ":443"
> http:
> tls:
> certResolver: letsencrypt
> p30033:
> address: ":30033"
> p9987:
> address: ":9987/udp"
> p10011:
> address: ":10011"
> certificatesResolvers:
> letsencrypt:
> acme:
> storage: /data/acme.json
> email: xxxxx
> httpchallenge:
> entrypoint: web
> api:
> dashboard: true
> insecure: true
> 
> ```

> **traefik docker-compose.yml**
>
> ```auto
> version: "3.3"
> 
> services:
> 
> traefik:
> image: docker.io/traefik:latest
> ports:
> - "80:80"
> - "443:443"
> - "9987:9987/udp"
> - "10011:10011"
> - "30033:30033"
> - "127.0.0.1:8080:8080"
> volumes:
> - "/var/run/docker.sock:/var/run/docker.sock"
> - "./data:/data"
> - "./traefik.yml:/etc/traefik/traefik.yml:ro"
> restart: unless-stopped
> networks:
> default:
> name: traefik_network
> 
> ```

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [May 17, 2023, 5:08pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/2 "2023-05-17T17:08:48Z")

</div>

I would use a dedicated Docker network, see [simple Traefik example](https://github.com/bluepuma77/traefik-best-practice/tree/main/docker-traefik-dashboard-letsencrypt).

What protocol is Teamspeak using? Do you need to enable TLS? What about the UDP port?

---

<div class="post-metadata">

### Author: ![tryingDocker](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tryingDocker](https://community.traefik.io/u/tryingDocker)
#### Post date: [May 19, 2023, 10:59pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/3 "2023-05-19T22:59:15Z")

</div>

> [@bluepuma77](#):
>
> What protocol is Teamspeak using? Do you need to enable TLS? What about the UDP port?

It just says TCP: [https://support.teamspeak.com/hc/en-us/articles/360002712257-Which-ports-does-the-TeamSpeak-3-server-use-](https://support.teamspeak.com/hc/en-us/articles/360002712257-Which-ports-does-the-TeamSpeak-3-server-use-)

The UDP-Port is the one responsible for voice communication.

---

<div class="post-metadata">

### Author: ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)
#### Post date: [May 20, 2023, 6:23am UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/4 "2023-05-20T06:23:27Z")

</div>

For the `teamspeak` service I would add and assign services for each router with the appropriate `loadbalancer.server.port`. (Make sure to use `.tcp.`)

```auto
version: "3"
services:
  my-container:
    # ...
    labels:
      - traefik.http.routers.www-router.rule=Host(`example-a.com`)
      - traefik.http.routers.www-router.service=www-service
      - traefik.http.services.www-service.loadbalancer.server.port=8000
      - traefik.http.routers.admin-router.rule=Host(`example-b.com`)
      - traefik.http.routers.admin-router.service=admin-service
      - traefik.http.services.admin-service.loadbalancer.server.port=9000

```

[Docs](https://doc.traefik.io/traefik/routing/providers/docker/)

---

<div class="post-metadata">

### Author: ![tryingDocker](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tryingDocker](https://community.traefik.io/u/tryingDocker)
#### Post date: [May 20, 2023, 7:24pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/5 "2023-05-20T19:24:20Z")

</div>

Thanks that solves it! Now the filetransfer is working.

And if I read the docs it also becomes clear why:

> By default, Traefik uses the first exposed port of a container.
> 
> Setting the label `traefik.http.services.xxx.loadbalancer.server.port` overrides that behavior.

That is why 9987 works for the voice but the other ports weren't working.

For anybody else having a problem with Teamspeak File Transfers with Dockers and Traefik this docker-compose.yml works with the other configs in the original post.

> **docker-compose.yml**
>
> ```auto
> version: '3.1'
> services:
> teamspeak:
> image: teamspeak
> restart: unless-stopped
> environment:
> - TS3SERVER_LICENSE=accept
> - TS3SERVER_DB_PLUGIN=ts3db_mariadb
> - TS3SERVER_DB_SQLCREATEPATH=create_mariadb
> - TS3SERVER_DB_HOST=teamspeak_db
> - TS3SERVER_DB_USER=teamspeak
> - TS3SERVER_DB_PASSWORD=$DB_PASSWORD
> - TS3SERVER_DB_NAME=teamspeakdb
> - TS3SERVER_DB_WAITUNTILREADY=30
> labels:
> - "traefik.enable=true"
> # Port 30033
> - "traefik.tcp.routers.teamspeakft.entrypoints=p30033"
> - "traefik.tcp.routers.teamspeakft.rule=HostSNI(`*`)"
> - "traefik.tcp.services.teamspeakftlb.loadbalancer.server.port=30033"
> - "traefik.tcp.routers.teamspeakft.service=teamspeakftlb"
> #Port 10011
> - "traefik.tcp.routers.teamspeak.entrypoints=p10011"
> - "traefik.tcp.routers.teamspeak.rule=HostSNI(`*`)"
> - "traefik.tcp.services.teamspeaklb.loadbalancer.server.port=10011"
> - "traefik.tcp.routers.teamspeak.service=teamspeaklb"
> # Port 9987
> - "traefik.udp.routers.teamspeakudp.entrypoints=p9987"
> volumes:
> - ./teamspeak:/var/ts3server
> depends_on:
> - teamspeak_db
> networks:
> - traefik
> - default
> 
> teamspeak_db:
> image: mariadb
> restart: unless-stopped
> environment:
> - MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
> - MYSQL_PASSWORD=$DB_PASSWORD
> - MYSQL_DATABASE=teamspeakdb
> - MYSQL_USER=teamspeak
> volumes:
> - ./db:/var/lib/mysql/
> 
> networks:
> traefik:
> name: traefik_network
> external: true
> 
> ```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)
#### Post date: [May 23, 2023, 7:25pm UTC](https://community.traefik.io/t/tcp-router-not-working-properly-for-teamspeak/18650/6 "2023-05-23T19:25:11Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
