Setting Transparent Proxy using Squid in Ubuntu

To Setting transparent squid, first we must install squid, to install squid. go to terminal and login as root type :




$ sudo su
$ apt-get install squid

edit squid configuration file in /etc/squid/squid.conf before edit

$ cp /etc/squid/squid.conf /etc/squid/squid.conf_backup
$ gedit /etc/squid/squid.conf

you will show file configuration squid, find :

  • First change HTTP port : http_port : 3128
  • Visible host (For if there was an error Squid can find a valid hostname) : visible_hostname minez-inspirate.blogspot.com
  • Cache manager : cache_mgr minezinspirate@gmail.com
  • Directory cache squid : cache_dir ufs /var/spool/squid 500 16 256
  • Filtering : acl user src 192.168.1.1/255.255.255.255 ex : $ acl group-it src 192.168.1.1-192.168.1.12/255.255.255.255
  • Filtering time : acl-time access time MTWHFA 08:00-16:00 save and exit
$ squid -z

Transparent proxy : give 1 value in file /proc/sys/net/ipv4/ip_forward by type :


$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ iptables -A PREROUTING -t nat -p tcp –dport 80 -j REDIRECT –to-port 3128

and restart squid by tupe :


$ squid -k reconfigure

Finish....!!

No comments:

Post a Comment

Please Comment...!!