How to configure Squid on CentOS/RHEL

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     # RFC1918 possible internal network
acl localnet src  # RFC1918 possible internal network
acl localnet src # 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    # 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 :

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


Tools > Option > Advanced > Network > Settings


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

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.