Demonio que se ejecuta en el sistema local y que tuneliza de forma transparente cualquier conexión TCP y paquetes UDP a través de un servidor proxy remoto SOCKS4, SOCKS5 o HTTP. El archivo de configuración en /etc/redsocks.conf.
# systemctl enable redsocks
# redsocks -t -c /etc/redsocks.conf
1.-
Ejemplo clásico de redirigir todo el tráfico TCP excepto redes locales con iptables:
# iptables -t nat -N REDSOCKS
Ignorar tráfico a redes locales y reservadas para evitar bucles)
# iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
# 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 169.254.0.0/16 -j RETURN
# iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
# iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
# iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
# iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
Redirigir todo el tráfico TCP al puerto de redsocks
# iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345
Aplicar la cadena al tráfico saliente de la propia máquina
# iptables -t nat -A OUTPUT -p tcp -j REDSOCKS
# iptables -t nat -A REDSOCKS -p tcp -m multiport --dports 80,443 -j REDIRECT --to-ports 12345
# iptables-save