Answer the question
In order to leave comments, you need to log in
How to configure redsocks and iptables on Linux so that only native DNS from SOCKS5 is displayed in DNS?
Hello. I ask for help from network specialists. On Windows, there is a Proxifier program with the "Resolve hostnames through proxy" setting. When it is enabled and DNS check on https://browserleaks.com/dns gives out only native DNS from the proxy:
I am trying to configure also on a router with OpenWrt firmware.
redsocks.conf:
base {
log_debug = on;
log_info = on;
log = "syslog:local7";
daemon = on;
redirector = iptables;
}
redsocks {
local_ip = 0.0.0.0; local_port = 12345;
ip = xxx.xxx.xxx.xxx; port = xxxx; - SOCKS5
type = socks5;
}
redudp {
local_ip = 0.0.0.0; local_port = 10053;
ip = xxx.xxx.xxx.xxx; port = xxxx; - SOCKS5
dest_ip = 1.1.1.1; dest_port = 53;
udp_timeout = 30;
udp_timeout_stream = 180;
}
dnstc {
local_ip = 127.0.0.1;
local_port = 5300;
}
iptables -t nat -D REDSOCKS
iptables -t nat -D REDSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -D REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -D REDSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -D REDSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -D REDSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -D REDSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -D REDSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -D REDSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -D REDSOCKS -d 123.8.141.173 -j RETURN
iptables -t nat -D REDSOCKS -p tcp -j REDIRECT --to-ports 12345
iptables -t nat -D PREROUTING -p tcp -j REDSOCKS
iptables -t nat -D PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 10053
iptables -t nat -D OUTPUT -p tcp -j REDSOCKS
iptables -t nat -D OUTPUT -p udp -j REDSOCKS
iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 1111
iptables -t nat -N REDSOCKS
iptables -t nat -N REDSOCKS_FILTER
iptables -t nat -I REDSOCKS_FILTER -o lo -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 0.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 127.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 169.254.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 172.16.0.0/12 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 192.168.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 224.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 240.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -d 123.8.141.173 -j RETURN
iptables -t nat -A REDSOCKS_FILTER -j REDSOCKS
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-port 12345
iptables -t nat -A OUTPUT -p tcp -j REDSOCKS_FILTER
iptables -t nat -A PREROUTING -p tcp -j REDSOCKS_FILTER
Answer the question
In order to leave comments, you need to log in
I'm certainly not an expert, but first you need to install the cloudflared client and add to /etc/redsocks.conf
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question