Pages

Tuesday, January 11, 2011

Transparent Proxy server

1. Install squid if it is not:
    # apt-get install squid

2. Create a Transparent Proxy squid so (meaning the client does not need to enterproxy settings
    in the Browser / automatic)
    # mcedit /etc/squid/squid.conf

    rules that allow ip Networks 192.168.10.0/29
    acl src 192.168.10.0/29 http_access allow local local

    in mcedit press F7 to search. Search for "http_port 3128"
    http_port 3128
    plus / replaced by:
    3128 http_port transparent

3. Restart the Squid service
     #/etc/init.d/squid restart


4. Forced redirect all Web requests (port 80) to keep it through the port Squid
     (port 3128)
     # iptables-A PREROUTING-p tcp --dport 80-j REDIRECT - to-port 3128-- t nat
      But iptables setting is only temporary, will be lost upon reboot
 
      How to Permanently:
     a. Redirect port 80 to 3128
          # iptables-A PREROUTING-p tcp --dport 80-j REDIRECT - to-port-3128-t nat

      b. Save the file anywhere, eg: / etc / iptables.rules
          # iptables-save> / etc / iptables.rules

        c. Edit / Add on the bottom row / etc / network / interfaces:
            pre-up iptables-restore </etc/iptables.rules post-down iptables-save> /etc/iptables.rules

5. Restart the Squid service
     #/etc/init.d/squid restart

No comments:

Post a Comment