Set up transparent proxy with Squid

Proxy server is as an intermediate for a machine(client) to connect to another machine or network. All outside connections of the client can be done by the proxy server. Proxy server can be used for setting firewall in a network.

Other than just forwarding requests from client, proxy servers can cache some data(web pages,DNS,network lookups) it has already retrieved. Such proxies are called caching proxy. The proxies which does not change the packets other than just forwarding it is called transparent proxy.

Squid is a free and open source web proxy server. Quick steps for setting up a transparent proxy server is given below.
  • Install squid
  • hash@ssl50:~$ sudo apt-get install squid squid-common
  • Configure /etc/squid/squid.conf
  • Squid configurations uses acl. To allow local machines to connect to it you have to add access right to localnet The file contain an acl called localnet representing the local network..
    acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
    acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
    acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
    You may change it or add your own network along with it. You can also see
    # http_access allow localnet
    Uncomment it. If the line is not there just add it.
    Note down the http_port given in config file. Usually it is set to 3128. You may change it. This is the port number to which clients has to connect to for using the proxy server.
  • Restart squid
  • hash@ssl50:~$ /etc/init.d/squid restart
Authentication can be enabled in squid. Timed firewalls can be set using Squid. Squid also permits to add our own scripts for managing things. For more details , visithttp://www.squid-cache.org/


0 comments: