1

I’m trying to setup up a TeamSpeak3 server on my home network "net1.mydomain". It uses an IPv4 subnet of 10.0.0.0/8 in LAN; internet access using IPv4 is possible via CGN. This renders IPv4-only-listeners (as is TeamSpeak) unreachable for clients outside of "net1.mydomain".

To circumvent this only downside, I found socat (SOcket CAT; multipurpose relay.) helpful, as I also have access to a machine fwbox.net2.mydomain which has a full IPv4 and IPv6 dual-stack connection.

Let the server run on machine tsbox.net1.mydomain, ports 1234/UDP4 (voice), 1234/TCP4 (query), 1235/TCP (file). After running following commandset I can use the TS3-client to connect to fwbox.net2.mydomain:1234 as if my TS3-server was running there instead.

ldericher@fwbox$ socat TCP4-LISTEN:1234,fork TCP6:tsbox.net1.mydomain:61234 &# queryport
ldericher@fwbox$ socat TCP4-LISTEN:1235,fork TCP6:tsbox.net1.mydomain:61235 &# fileport
ldericher@fwbox$ socat UDP4-LISTEN:1234,fork TCP6:tsbox.net1.mydomain:61236 &# voiceport

ldericher@tsbox$ socat TCP6-LISTEN:61234,fork TCP4:localhost:1234 &# queryport
ldericher@tsbox$ socat TCP6-LISTEN:61235,fork TCP4:localhost:1235 &# fileport
ldericher@tsbox$ socat TCP6-LISTEN:61236,fork UDP4:localhost:1234 &# voiceport

Well, almost.

Due to FIFO-fication of the voice (UDP-)stream, a high percentage of packages gets dropped and the connection is unusable. So ideally, it would just pass on UDP-packets via IPv6 - but using the following commands instead just produces "Permission denied" on tsbox

ldericher@fwbox$ socat UDP4-LISTEN:1234,reuseaddr,fork UDP6:tsbox.net1.mydomain:61234 &# voiceport
ldericher@tsbox$ socat UDP6-LISTEN:61234,reuseaddr,fork UDP4:localhost:1234 &# voiceport

…for which I blame the connectionless nature of UDP. I tried tinkering with the options of socat, to no avail. "UDP-RECVFROM"/"UDP-SENDTO" does not produce errors, yet only seems to to unidirectional forwarding. I read about stone (application TCP/IP repeater) being out there, which might serve as an alternative, yet did not come in handier than socat for me.
Either I completely missed some point about UDP, or it’s just not possible to do UDP forwarding at all, or it’s my toolset.

So is there any way, any tool or any snippet of code which may suit my needs? Maybe even a set of socat options I've not yet come up with?

ADD 03/06/2015

It is possible to forward UDP traffic as I want. Even using socat, there is a way. I successfully tested that using another box, testbox.net1.mydomain:

# File- and Query- portforwards omitted for irrelevance
ldericher@testbox$ socat UDP4-LISTEN:1234,fork UDP4:tsbox:61234 &
ldericher@tsbox$ socat UDP4-LISTEN:61234,fork UDP4:localhost:1234 &

This works without any performance loss, yet it doesn't solve my problem of not being able to use IPv4 from outside.

# File- and Query- portforwards omitted for irrelevance
ldericher@testbox$ socat UDP4-LISTEN:1234,fork UDP6:tsbox:61234 &
ldericher@tsbox$ socat UDP6-LISTEN:61234,fork UDP4:localhost:1234 &

This does not work in the same way as forwarding across fwbox.
So, am I just missing an important point about IPv6?
Is this a bug? In socat? In Linux?!

2 Answers 2

0

You may find this impossible to get working, as the TeamSpeak protocol embeds IP address in the (poorly encrypted) payloads, and as such, forwarding the data to other hosts will likely result in connection failures as either the client, server, or both, completely ignore where the data is coming from and attempt to use the IP addresses they think the data should be coming from.

1
  • Then why does it work with forwarding through UDPv4 only? And why can I reach TeamSpeak servers behind simple NAT DSL routers (dynamic DNS), which obviously don't run on the router's IP?
    – LDericher
    Mar 7, 2015 at 17:46
0

Adding the -T option to socat somehow solves the problem.

-T<timeout>
       Total  inactivity timeout: when socat is already in the transfer
       loop and nothing has happened for  <timeout>  [timeval]  seconds
       (no  data arrived, no interrupt occurred...) then it terminates.
       Useful with protocols like UDP that cannot transfer EOF.

Updated commands:

ldericher@fwbox$ socat TCP4-LISTEN:1234,reuseaddr,fork TCP6:tsbox.net1.mydomain:61234 &# queryport
ldericher@fwbox$ socat TCP4-LISTEN:1235,reuseaddr,fork TCP6:tsbox.net1.mydomain:61235 &# fileport
ldericher@fwbox$ socat -T15 UDP4-LISTEN:1234,reuseaddr,fork UDP6:tsbox.net1.mydomain:61234 &# voiceport

ldericher@tsbox$ socat TCP6-LISTEN:61234,reuseaddr,fork TCP4:localhost:1234 &# queryport
ldericher@tsbox$ socat TCP6-LISTEN:61235,reuseaddr,fork TCP4:localhost:1235 &# fileport
ldericher@tsbox$ socat -T15 UDP6-LISTEN:61234,reuseaddr,fork UDP4:localhost:1234 &# voiceport

I don't fully understand why this works (as there obviously never pass 15 seconds), but I'm happy it does.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .