I'm doing proxy setup squid. I set up squid as a forward proxy listening to my public IP where my firefox browser connects to port 3128 of that public IP and I can browse the web without any issues.
Now I need to install OpenVPN client from VPN provider and route all squid traffic through VPN tunnel
To achieve this, first I disable all automatic route entries from OpenVPN clients by using route-noexec
config.
After that, I create a different routing table for VPN and add the VPN as a default gateway for that table.
After this, I can reach out using this gateway with IP rule. like ip rule add from 8.8.8.8 lookup vpn
then ping 8.8.8.8
But I cannot make squid routed through the same VPN table.
what is the best possible way to route squid traffic through this routing table? without using a solution like docker or cgroups ?
If I add a MASQUERADING rule like iptables -t -nat -I POSTROUTING -s 127.0.0.1 -o tun0 -j MASQUERADE
squid traffic does not going through tun0 but still eth0
I need to route all local originated traffic through the VPN routing table while keeping my public-facing proxy intact