Squid Listen on Other Port ( Squid Configure Port Listing with SELinux)

by on April 20, 2009 · 5 comments· LAST UPDATED April 20, 2009

in , ,

My Squid proxy server running on port 3128. Since this is frequently scanned by adversaries looking for proxy servers; I've changed port to 10000 and restart squid. But my squid is not working on port # 10000 it only works on port # 3128? How do I force Squid to listen on uncommon port under CentOS Linux v5.3?

Yes, the default listening port for the Squid service is 3128. You can change it to something else to improve security.

Squid Listen on Uncommon Port

Open squid.conf file, enter:
# vi squid.conf
Use an arbitrary port such as 10000:
http port 10000
Save and close the file. Restart squid:
# service squid restart
Verify port is open:
# netstat -tulpn | grep ':10000'
You also need to update SELinux configuration. Type the following command to add a new SELinux port mapping for the Squid service:
# semanage port -a -t http_cache_port_t -p tcp 10000
semanage is used to configure certain elements of SELinux policy without requiring modification to or recompilation from policy sources. Above command will allow Squid to listen on port 10000.

Configure Squid Authentication

You can improve squid security by configuring authentication.

Squid Iptables

Edit your /etc/sysconfig/iptables file and only allow Squid access from for port # 10000:

-A RH-Firewall-1-INPUT -s -m state --state NEW -p tcp --dport 10000 -j ACCEPT

Finally, restart iptables:
# service iptables restart

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 5 comments… read them below or add one }

1 Arslan Arif April 21, 2009 at 8:45 pm

# vi /etc/ squid/squid.conf
add this line
http_port 10000
squid -k reconfigure


2 jpdurai April 22, 2009 at 7:24 am

how to do in redhat EL4?


3 http://pitchover.wordpress.com April 23, 2009 at 12:02 pm

what about in Gentoo Linux


4 V.Balaviswanathan May 4, 2009 at 11:05 am

How to manage SElinux in Ubuntu 9.04. Please help


5 Ajido-Marujido March 13, 2011 at 7:44 am

make sure you have configured your firewall properly (e.g: iptables) to make the squid works..


Leave a Comment

Tagged as: , , , , , , , , , , , ,

Previous Faq:

Next Faq: