Linux vishal on 15 Apr 2007 08:09 am
how to use squid proxy as transparent mode
in transparent squid ne need to configure browser to perticular port like 8080 and 3128.
in this mode first edit your squid.conf file
by typing in terminal
vim /etc/squid/squid.conf
edit line may be 89 in 2.6 version
http_port 192.168.0.1:3128 transparent
( where 192.168.0.1 is your local interface address )
and set visible_hostname to localhost
and insert below lines under tag
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
acl our_networks src 192.168.0.0/24 192.168.2.0/24
http_access allow our_networks
(use gedit if not familier with vim )
now start squid by typing
/usr/sbin/squid -z
now flush all rules of iptabes for transparent mode
iptables -F
iptables -t nat -F
iptables -t mangle -F
now delete this chanis bye
iptables -X
iptables -t nat -X
iptables -t mangle -X
now time to save iptables so type
service iptables save
service iptables restart
now all rules and chains will clear !
check it by /etc/sysconfig/iptables which has all defaults rules set to accept.
now /etc/rc.d/rc.local
and insert line
echo ” 1 “> /proc/sys/net/ipv4/ip_forward
and then save and close.
now asuming that your internet interface is eth0 then type :
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart
note:- check your service of iptables is set to start during boot up .
or check status of your iptables service
chkconfig –list iptables
if level 5 is on then its ok othewise start service at level 5 or level 2345.