Monday, 5 December 2016

squid proxy server configuration in linux

http proxy server configuration using squid and use it as private proxy IPs.

OS : Linux (rhel,centos)
Squid Server : 10.20.36.54
Additional IPs : 10.20.30.2
                          10.20.30.4

In above Case we use only private IPs. so it can work over LAN Only. if you want use http proxy IPs over WAN you need to setup on public IPs.

1. install the required packages.

# yum install squid*

install httpd

#yum install httpd


2. Backup the existing squid.conf and modify it has below.

#cd /etc/squid
#cp squid.conf  squid.conf-bkp
#vi squid.conf

#add this to the auth_param section of squid.conf
#
auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/squid_passwd

#
# Add this to the bottom of the ACL section of squid.conf
#
acl ncsa_users proxy_auth REQUIRED

#
# Add this at the top of the http_access section of squid.conf
#
http_access allow ncsa_users

forwarded_for off


http_port 3128


#  TAG: httpd_suppress_version_string   on|off
#       Suppress Squid version string info in HTTP headers and HTML error pages.
#
#Default:
httpd_suppress_version_string on

acl     ip1     myip    10.20.30.2

acl     ip1     myip    10.20.30.4


tcp_outgoing_address    10.20.30.2  ip1
tcp_outgoing_address    10.20.30.4  ip2

#save and exit the file (wq! )

from above configuration file We used 3128 has port number . you can use any port number in place of that. 

if you have more IPs also you can use same format like below.

acl     ip1     myip  10.20.30.1
.
.
.
acl     ip250  myip  10.20.30.250


tcp_outgoing_address    10.20.30.1  ip1
.
.
.
tcp_outgoing_address    10.20.30.250  ip250


3.  Create user authentication 

# htpasswd  -c /etc/squid/squid_passwd  proxyuser
New password: 

it's prompt for new password. Please enter your password. These credentials used as http proxy authentication 

4. Once all above steps completed. Please restart squid service and add it in chkconfig

# service squid restart
# chkconfig squid on

4. Test the http squid proxy IPs.

Open firefox or any browser and got to option click on advanced tab and click on network after that click on settings.


Provide the Proxy IP and port number, click on ok then it's prompt for username and password. Please provide the logins what ever you are  given.




Squid proxy server installation and configuration completed successfully

No comments:

Post a Comment