librelist archives

« back to archive

Redirecting UDP traffic TO and/or FROM specific ports through a SOCKS5 proxy using redsocks

Redirecting UDP traffic TO and/or FROM specific ports through a SOCKS5 proxy using redsocks

From:
Sergei
Date:
2015-05-03 @ 16:27
Hello!
Shadowsocks-android user here.

Shadowsocks uses redsocks under the hood but, for some reason, does not use
it for udp forwarding.

However, TPROXY support seems there

https://github.com/shadowsocks/shadowsocks-android/blob/master/src/main/jni/redsocks/

and android kernel is recent enough to do TPROXY, at least since Android
4.0 I think.

My android is currently 4.2.2
The SOCKS proxy server is Shadowsocks-libev (started with -u option, which
is "UDP support ON")

So, what I want to do:

1.
Force UDP AND TCP traffic that is going to a specific remote port to go
through the proxy
2.
Force UDP AND TCP traffic originating from a specific port range to go
through the proxy

All that on an android device with shadowsocks-android (which includes
redsocks)


So, the questions are

1) what do I need to put in the config and ?

2) what iptables rules do I need ?

Thank you very much for your help!