New Install of Squid Only Listening on IPv6

Problem

I installed Squid 3.5.20 on a fresh copy of CentOS 7 but the web proxy was not working when I pointed a browser to it.

 

Troubleshooting

 I could telnet locally to port 3128 but when I tried from another device on the network I was unable to connect, despite opening the port on the firewall.

Running a netstat command I was able to see that port 3128 was utilizing ipv6 only:

# netstat -an 


Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp        0     64 10.64.208.100:22        10.64.214.254:51700     ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 :::3128                 :::*                    LISTEN
tcp6       0      0 ::1:25                  :::*                    LISTEN
udp        0      0 0.0.0.0:45496           0.0.0.0:*
udp        0      0 127.0.0.1:323           0.0.0.0:*
udp6       0      0 :::33526                :::*
udp6       0      0 ::1:323                 :::*
raw6       0      0 :::58                   :::*                    7
 

 

Resolution

Edit squid.conf and change the http_port 3128 to http_port 0.0.0.0:3128

 # vi /etc/squid/squid.conf

eg

#http_port 3128
http_port 0.0.0.0:3128