How to configure Squid on CentOS/RHEL 7/6

How to configure Squid on CentOS/RHEL 7/6

How to configure Squid on CentOS/RHEL 7/6:

Squid is a high-performance HTTP and FTP caching proxy server. It is otherwise called a Web proxy cache. As it stores information from frequently used Web pages and files, it can frequently give your users the information they require without their systems needing to look to the Internet. Proxy servers work as a intermediary between a local network and Internet. Requests from local clients for web services can be taken care of by the proxy server.

From squid web proxy server you can control what ought to be access on your network from web. It could be act as a filter that could filter everything from porn site to advertise, videos etc.

Install Squid:

First we need to install squid using yum command.

# yum install squid -y

Configure Squid:

Add internal network name into the IP networks list where browsing should be allowed. Squid default configuration file is “/etc/squid/squid.conf”.

# vi /etc/squid/squid.conf

In this example, your internal network name is “technical”:

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
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
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl technical src 192.168.78.0/24    # Your internal network

Add technical in the ACL section to list your (internal) IP network from where browsing should be allowed

http_access allow localnet
http_access allow localhost
http_access allow technical

Make sure squid proxy port is uncomment. You can change the proxy port to any available port here.

# Squid normally listens to port 3128
http_port 3128

Start Service:

After configuring squid need to start squid service.

For CentOS 5/6:
# service squid start
For CentOS 7:
# systemctl start squid

Configure Proxy on Client:

Configure at proxy setting at client’s browser as below :
Chrome:

Setting > Change Proxy Settings > Lan Settings > check proxy server > advanced

Firefox:
Tools > Option > Advanced > Network > Settings

See Also:
How to configure Squid on Ubuntu with Authentication
How to configure Squid Proxy on Ubuntu/Debain

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

 
Enjoyed this video?
How to configure Squid on CentOS/RHEL 7/6
"No Thanks. Please Close This Box!"