This took me way too long to figure out. For a usecase that should be very common I couldn’t find any tutorial on how to do this simple thing.
This tutorial assumes you have a Debian box and has a working and active tun0.
Setup 3proxy
3proxy is a tiny (200Kbytes) standalone proxy server packing tons of protocols, including SOCKS. This software is as good as it gets, everything else either bloats the stack to oblivion or doesn’t work (dante-server).
Download 3proxy
curl -L https://github.com/3proxy/3proxy/releases/download/0.9.5/3proxy-0.9.5.x86_64.deb -O
Install 3proxy
apt install ./3proxy-0.9.5.x86_64.deb
Edit 3proxy config
Edit /usr/local/3proxy/conf/3proxy.cfg
nscache 65536
nserver 8.8.8.8
nserver 8.8.4.4
log /logs/log D
config /conf/3proxy.cfg
monitor /conf/3proxy.cfg
rotate 60
counter /count/3proxy.3cf
include /conf/counters
include /conf/bandlimiters
auth none
deny * * 127.0.0.1
allow *
socks -u -p25344 -Dieth0 -Dotun0
flush
Run 3proxy
systemctl enable 3proxy
systemctl restart 3proxy
Test connection
curl -L -ipv4 -x socks5://192.168.1.51:25344 gri.my/ip