0

Is there any way to find out the client machines connected to the particular proxy server in redhat linux , i am using redhat linux version 6 and squid configured in it

  • 1
    Did you check in squd logs? – user1700494 Feb 4 '16 at 13:16
2

If the Squid is listening on port, let's say 3128, you can list all connected IP addresses to this port by using command like netstat in the server.

For example:

netstat -na | grep :3128

will display something like below:

tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN
tcp        1      0 10.12.0.1:3128          10.12.3.60:53736        CLOSE_WAIT
tcp        1      0 10.12.0.1:3128          10.12.4.24:60545        CLOSE_WAIT
tcp        1      0 10.12.0.1:3128          10.12.4.13:50484        ESTABLISHED
tcp        1      0 10.12.0.1:3128          10.12.3.55:52669        ESTABLISHED

You can ignore the first line, that displays the default listening of squid service. For the rest of rows, 4th row is the local server ip and 5th row lists the remote endpoint (the clients connecting to proxy). On the 6th column you can see the tcp connection status. The ESTABLISHED signifies a currently active connection.

You can only list the estbalished connection with this:

 netstat -na | grep :3128 | grep ESTABLISHED

You may use the command without the -n option, to display hostname, instead of ip addresses.

netstat -a | grep :3128 | grep ESTABLISHED
  • It is working but i can not resolve the hostname – Alfred Babu Feb 4 '16 at 13:59
  • I tried that but the ip is not resolving to the hostname – Alfred Babu Feb 4 '16 at 14:30
  • Then probably it's a problem related to dns settings. Netstat uses the local dns to resolve the hostnames. Check on that. – Diamant Feb 4 '16 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.