I followed this answer: Redirect all non-local traffic to a socks proxy
root@xxx:~# cat /proc/sys/net/ipv4/ip_forward
1
root@xxx:~# netstat -tapln | grep :4545 | grep LISTEN
tcp 0 0 127.0.0.1:4545 0.0.0.0:*
The port works fine when I connect the socks5 through curl:
root@xxx:~# curl -x socks5h://127.0.0.1:4545 ifconfig.co
1.2.3.4
When I run enable iptables rules, i see my computer's ip:
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 4545
root@xxx:~# curl ifconfig.co
9.8.7.6
However, 4545th port is a socks5 proxy. It should be working.
I couldn't figure out what is wrong there.
I tried to use FoxyProxy. It works fine. But I want to redirect all traffic through socks5proxy. How can i do it?
P.S.: I don't have any DROP/REJECT rule in iptables. I have only those 3 rules.