NAT with transparent proxy

http-proxyiptables

is there a way to redirect all non local http requests that through my computer to use my transparent proxy, so i can log all websites are they visiting?

and if possible all https requests too..

my computer was used as NAT server because we only have 1 real IP..

eth1 = w.x.y.z (real/public IP)
eth0 = a.b.c.d (fake/private IP)

my transparent proxy listen on localhost:3128

all computers in my home connected to eth0 to access the internet..

Best Answer

Assuming that you want only to redirect traffic coming from eth0, not from localhost, and that your transparent proxy is running on your NAT server, you can do this for HTTP traffic with:

iptables -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 3128

As HTTPS uses end-to-end encryption, you cannot log specific requests without modifications on the client side - otherwise man-in-the-middle attacks would be easy.

Related Question