I am using the command ssh -N -D localhost which works perfectly fine for my web browser, but when I try and tunnel a UDP traffic application it doesn't work.

I thought that socks5 should be able to handle UDP traffic, or is there something else that I need to setup?

  • perhaps SOCKS is application layer specific. So for example, just as AFAIK, it won't support -any- application layer that uses TCP(just some specific app layer protocols). Perhaps then similarly for UDP.
    – barlop
    Sep 1, 2013 at 10:29
  • Ive used sosck5 proxies before that i Purchased to rout this same application in the same way, so I know that socks 5 is capable of doing it, but i am thinking that it takes some addition setup that i don't know about, server side. Sep 2, 2013 at 2:17

1 Answer 1


SOCKS 5 supports UDP. OpenSSH claims to implement SOCKS4 and SOCKS5, but it only implements a subset of the SOCKS5 protocol.

You won't find the specifics of what is, or is not supported in the documentation though, look at the source instead:

    if (s5_req.version != 0x05 ||
        s5_req.command != SSH_SOCKS5_CONNECT ||
        s5_req.reserved != 0x00) {
            debug2("channel %d: only socks5 connect supported", c->self);
            return -1;

(from function channel_decode_socks5() in channels.c, OpenSSH-6.4p1 from November 8, 2013. Update this continues to be the case up to OpenSSH-7.6p1, October 2017 OpenSSH-8.2p1, February 2020.)

SSH_SOCKS5_CONNECT is command opcode 1 which is implicitly a TCP connection. Command opcode 3 is UDP ASSOCIATE for UDP proxying (this is what was added to SOCKS5, SOCKS4 or 4a do not support UDP).

There are commercial and free (e.g. Dante) SOCKS5 proxies available that support UDP.

If you do not need dynamic UDP port forwarding, you can set up a number (choosing the destinations in advance) of UDP forwardings over an SSH connection using one of these methods: UDP traffic through SSH tunnel (I recommend the socat approach, I find it to work the best.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.