I would like to know how exactly does Squid does its transparent caching:
What I understand it does is:
When a user in a lan accesses a website, squid receives the request as a server from the browser (client) and as a client request the website from the server the website is hosted on. Then, receives the website as a client from the server and serves the web page to the browser as the a server saving on disk the served page. Now, when another user on the lan request the same page, squid serves it from its cache instead of requesting it again from the internet and as a result saving bandwidth. Is this correct?
I have a transparent cache installed but, I don't think is working that way. I tested by going to lets say www.bestbuy.com
from one pc and then from another going to the same site to see if that page got cached but instead it requested from the actual server the page is hosted in.
I ran iptables -L -vn --line-numbers to see how many packets were forwarded where and I got this:
Squid server running in 192.168.3.100 on eth2 of the router
Lan is in 192.168.2.0/24 on eth1 or router
Internet is on eth0
11 30 1386 ACCEPT tcp -- eth1 eth2 192.168.2.0/24 192.168.3.100 tcp spts:1024:65535 dpt:3128 state NEW
56 31 1395 ACCEPT tcp -- eth2 eth0 192.168.3.0/24 0.0.0.0/0 tcp spts:1024:65535 dpt:80 state NEW
By looking at that I noticed that the same requests are being downloaded from the internet. Please let me know if this is correct or not.