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
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.
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