How to Check Active Connections to Your Squid Proxy Server

Monitoring the active connections to your Squid proxy server is crucial for maintaining optimal performance and security. If you need to check these connections, you can use either the netstat or ss command. Here’s a step-by-step guide to help you through the process.

Using the netstat Command

  1. Open your terminal on the server where Squid is running.
  2. Run the following command to list all active connections on the Squid port (usually 3128):
    netstat -na | grep :3128
    This command will display a list of connections, showing the local and remote IP addresses and the connection status.
  3. Filter for established connections to see only the active ones:
    netstat -na | grep :3128 | grep ESTABLISHED
  4. Optional: If you prefer to see the hostnames instead of IP addresses, use:
    netstat -a | grep :3128 | grep ESTABLISHED

Using the ss Command

If the netstat command is not available, the ss command is a modern alternative that provides similar functionality.

  1. Open your terminal on the server where Squid is running.
  2. Run the following command to list all active connections on the Squid port (usually 3128):
    ss -na | grep :3128
    This will display a list of connections, showing the local and remote IP addresses and the connection status.
  3. Filter for established connections to see only the active ones:
    ss -na | grep :3128 | grep ESTAB
  4. Optional: If you want to see the hostnames instead of IP addresses, use:
    ss -a | grep :3128 | grep ESTAB

By following these steps, you can effectively monitor the connections to your Squid proxy server, ensuring that it runs smoothly and securely.

Comments

Scroll to Top