How to Find and Check Number of Connections to a Server

Whenever a client connects to a server via network, a connection is established and opened on the system. On a busy high load server, the number of connections connected to the server can be run into large amount till hundreds if not thousands. Find out and get a list of connections on the server by each node, client or IP address is useful for system scaling planning, and in most cases, detect and determine whether a web server is under DoS or DDoS attack (Distributed Denial of Service), where an IP sends large amount of connections to the server. To check connection numbers on the server, administrators and webmasters can make use of netstat command.

Below is some of the example a typically use command syntax for ‘netstat’ to check and show the number of connections a server has. Users can also use ‘man netstat’ command to get detailed netstat help and manual where there are lots of configurable options and flags to get meaningful lists and results.

netstat -na
Display all active Internet connections to the servers and only established connections are included.

netstat -an | grep :80 | sort

Show only active Internet connections to the server at port 80 and sort the results. Useful in detecting single flood by allowing users to recognize many connections coming from one IP.

netstat -n -p|grep SYN_REC | wc -l
Let users know how many active SYNC_REC are occurring and happening on the server. The number should be pretty low, preferably less than 5. On DoS attack incident or mail bombed, the number can jump to twins. However, the value always depends on system, so a high value may be average in another server.

netstat -n -p | grep SYN_REC | sort -u
List out the all IP addresses involved instead of just count.

netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'
List all the unique IP addresses of the node that are sending SYN_REC connection status.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Use netstat command to calculate and count the number of connections each IP address makes to the server.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
List count of number of connections the IPs are connected to the server using TCP or UDP protocol.

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
Check on ESTABLISHED connections instead of all connections, and displays the connections count for each IP.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
Show and list IP address and its connection count that connect to port 80 on the server. Port 80 is used mainly by HTTP web page request.


4 Responses to “How to Find and Check Number of Connections to a Server”

  1. What is my computer doing? pids, IP addresses, tcp, netstat, and lsof | /Good/Bad/Tech
    June 25th, 2009 13:06
    4

    [...] http://www.mydigitallife.info/2007/12/13/how-to-find-and-check-number-of-connections-to-a-server [...]

  2. How to Find and Check Number of Connections to a Server « Tipsy little box
    November 13th, 2008 18:05
    3

    [...] (sursa: http://www.mydigitallife.info/2007/12/13/how-to-find-and-check-number-of-connections-to-a-server/) [...]

  3. Giochi
    July 3rd, 2008 19:24
    2

    Thank you very much, I have been under attack and thanks to list list of such useful info I am now clean!

  4. kleang
    April 24th, 2008 13:38
    1

    Thank you, really useful for defending attacker :)

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

netstat ddos - server connections - sql server check connections - check connections - ddos check - how to check Number of RPC connections to the server - SQl Server number of connections - check connections to iis - how to check connections to a server - netstat number of connections - netstat count connections - netstat count - check connections netstat - How to check IIS connections - count connections netstat - netstat number of connections per port - sql server verify users connected - check connection to sql server - no of connections counter - check number of connections - how to check connections - all - check server connections - netstat count apache connection - number of connections to the server - cache:rz2KW2XfCPEJ:nnm.ru/blogs/aktuba/suki/ кто ДДосит netstat - ddos netstat - determine number of IIS connections - how to check number on connection on a server - netstat command to check connected users - check sql server connections - check active windows server connections - check connections dos - cheing number of connected users for weblogic - check connections established on windows server - check connected users in 2003 server - check for number of connections in sql server - check webserver connections windows - count connection port 80 netstat - get how many connections open in sqlserver 2005 - how to find number of active connections to web site - how to check port numbers in dos - how to find out # of connections sql server 2005 - how many connections netstat - how to check telnet connections on the server - how to check users connected to the server - iis connection count - isa 2006 find exact number of http connections - list connections to server by alias - netstat show number of connection -