semigodking / redsocks

transparent redirector of any TCP/UDP connection to proxy
Apache License 2.0
1.17k stars 247 forks source link

Help, problem with reudp( #181

Open dadbravo opened 2 years ago

dadbravo commented 2 years ago

Hello, tell me please, I can’t figure it out and get reudp to work I do on ANDROID the proxy is working, but I can't turn everything into a reudp

base {
 log_debug = off;
 log_info = off;
 log = stderr;
 daemon = on;
 redirector = iptables;
}
redsocks {
 bind = "0.0.0.0:8123";
 relay = "proxy_server:proxy_port";
 type = socks5;
 login = "login";
 password = "password";
 }
 redudp {
 bind = "127.0.0.1:10053";
 relay = "proxy_server:proxy_port";
 type = socks5;
 login = "login";
 password = "password";
 dest = "217.169.120.78:53";
 udp_timeout = 30;
 }
tcpdns {
        bind = "127.0.0.1:1053";
        tcpdns1 = "217.169.120.78:53";
        tcpdns2 = "217.169.120.78:53" ;
        timeout = 4;
}

iptables


iptables -I OUTPUT -p tcp --dport 53 -d 10.0.0.0/8 -j DROP
iptables -I OUTPUT -p udp --dport 53 -d 10.0.0.0/8 -j DROP 

iptables -t nat -N REDSOCKS
iptables -t nat -I OUTPUT -j REDSOCKS

iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN

# DNAT dns
 /system/bin/iptables -t nat -A REDSOCKS -p tcp --dport 53 -j DNAT --to 127.0.0.1:10053
 /system/bin/iptables -t nat -A REDSOCKS -p udp --dport 53 -j DNAT --to 127.0.0.1:10053

tcpdump

image

If iptables -A OUTPUT -p udp -j ACCEPT

then DNS will go to servers 8.8.8.8 8.8.1.1 I understand that they are registered on the android

dadbravo commented 2 years ago

log redsock2 Screenshot_1

semigodking commented 2 years ago

直觉告诉我,你的socks proxy并不支持udp association.

dadbravo commented 2 years ago

直觉告诉我,你的socks proxy并不支持udp association.

Use 如何使用Android NDK交叉编译redsocks2 ARM

https://github.com/semigodking/redsocks/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Android-NDK%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91redsocks2

Android 7.1.2

I did it like this but it didn't work

UDP透明代理配置示例

Android 7.1.2 is behind NAT

dda08a commented 1 year ago

Intuition tells me that your socks proxy does not support udp association.

Use How to cross compile redsocks2 ARM with Android NDK

https://github.com/semigodking/redsocks/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8Android-NDK%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91redsocks2

Android 7.1.2

I did it like this but it didn't work

Configuration example of UDP transparent proxy

redsock2-build-arm-64.zip

I built it. (For arm and arm64)