How to route all local trafic to Squid?

10,147

Solution 1

After many frustrating attemps I could solve my problem with adding following rule:

iptables -t nat -A OUTPUT -p tcp -m owner ! --uid-owner proxy --dport 80 -j REDIRECT --to-port 3128

and by updating squid.conf:

from http_port 3128 to http_port 3128 accel vhost allow-direct

Solution 2

Take a look at this article. However, you shouldn't forward all traffic to squid. You should forward only http and ftp traffic to squid. Just because all traffic isn't proxyable by default.

You should also use the port in forwarding rules which is configured in squid to access such forwarded traffic - as explained here.

You probably should avoid forwarding https traffic to squid, regardless of the ssl_bump feature configured.

Share:
10,147

Related videos on Youtube

eneepo
Author by

eneepo

Updated on September 18, 2022

Comments

  • eneepo
    eneepo over 1 year

    I have a working squid caching server which is accessile through 127.0.0.1:3128. I'm trying to route all my trafic(and if possible all my virtual machines) to 127.0.0.1:3128.

    I'm using vagrant and virtual box and it would be nice if I don't config each virtualbox to use squid(I'm trying to cache packages to save time and bandwidth).

    Thanks