Modify or add following to squid configuration file (/etc/squid/squid.conf):
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on acl lan src 192.168.1.1 192.168.2.0/24
http_access allow localhost
http_access allow lan
Added following rules to forward all http requests (coming to port 80) to the Squid server port 3128 :
[eth0 connected to internet and eth1 connected to local lan]
iptables -t nat -A PREROUTING -i eth1 -p tcp –-dport 80 -j DNAT –to 192.168.1.1:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp –-dport 80 -j REDIRECT –-to-port 3128
3 comments:
hi..
i cant run this command
root@server# iptables -t nat -A PREROUTING -i eth0 -p tcp -dport 80 -j REDIRECT -to-port 3128
it return error
Bad argument `80'
ok, This should help ...
iptables -t nat -A PREROUTING -i eth0 -p tcp –-dport 80 -j REDIRECT –-to-port 3128
Also, if you didnt already enabled the forwarding add this to your /etc/sysctl.conf
net.ipv4.conf.default.forwarding=1
@Nikesh Jauhari : thank you !
Post a Comment