Transparent Proxy with Squid
squid 5.0.6 Debian 2.7 kernel 2.6.26-
2-amd64
eth1 connected to the internet (192.168.1.0/24)
eth0 connected to LAN (192.168.2.0/24)
Transparent Proxy
should redirect all traffic on port 3128 proxy
to do this using the
following iptables rule iptables-t nat-A PREROUTING-i eth0-p tcp - dport 80-j REDIRECT - to-port 3128
to make permanent the rule I created the following file with the
command vim vim / etc / network / if-up.d / iptables
inside and must place the following lines
# / bin / sh # -----------
- ------------
NAT iptables-t nat-A POSTROUTING-o eth1-j MASQUERADE #
------------ ----- Transparent Proxy -------
iptables-t nat-A PREROUTING-i eth0-p tcp - dport 80-j REDIRECT - to-port 3128
now need to activate forwarding with the command vim and then I opened the following
file vim / etc / sysctl.conf
now find the line with:
net.ipv4.ip_forward
decomenntatela if it is commented out and set it to 1 = 1
net.ipv4.ip_forward
hours open :
vim / etc / squid / squid.conf
find the line with http_port and replace it with: 3128
http_port transparent
Enable your internal network
now enter or change the line
acl localnet src 192.168.2.0/24
where 192.168.2.0 should be replaced with the values \u200b\u200bof your internal network
and edit or insert the following line: http_access allow localnet
0 comments:
Post a Comment