Saturday, December 18, 2010

Solving squid's pinger error: IcmpSquid.cc(155) Recv: recv: (111) Connection refused

I've installed latest squid (3.2.0.3) recently from source. I configured it with --with-icmp to enable incoming icmp request. After compiling and installing it, it's time to run it. From the log I noticed that the pinger program produced an error like this:

IcmpSquid.cc(155) Recv: recv: (111) Connection refused

and filtering the log of the word pinger (using grep) :

pinger: Initialising ICMP pinger ...
2010/12/18 10:57:16| pinger: Unable to start ICMP pinger.
2010/12/18 10:57:16| pinger: Unable to start ICMPv6 pinger.
2010/12/18 10:57:16| FATAL: pinger: Unable to open any ICMP sockets.

From the errors above, I knew that they were related to permission problem (connection refused, unable to open socket). It solved when I setuid the pinger program to enable it to open the required socket :

chmod 4755 pinger (run this as root of course)

This pinger program is usually located in the bin directory of squid path e.g /usr/local/squid/bin (this is the default if you compile from source). Please consult your distro if you install it using package manager.

After restarting squid, I could see in the log as below:

pinger: Initialising ICMP pinger ...
2010/12/18 16:58:48| pinger: ICMP socket opened.
2010/12/18 16:58:48| pinger: ICMPv6 socket opened

That I think solved the problem. Have fun.

2 comments:

TiM said...

You mean chmod instead chown

But thanks for the idea and fix :)

zamri said...

Yes. Corrected. Thanks for the heads-up. :)