Check IP’s Hitting Server

Let’s say your website is running pretty slow and you think it may be an attack of some sort, you can run the following commands to get a nice and simply output of a source ip address and the # of connections it has to your server.

For linux:

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

For FreeBSD:

netstat -an | grep ‘tcp|udp’ | awk ‘{print $5}’ | cut -d”.” -f1-4 | grep -v “*.*” | sort | uniq -c | sort -n

Related Articles

  • Add IP to CentOS 5/6

    If you recently got a secondary IP block for your server but you do not know how to bind the secondary IP address, please follow the steps below:   First, run...
  • Adding IP’s to Windows Server 2012

    This article will help you add one or more IP’s to windows server 2012.   To start, look on the bottom right of the your display to find a icon...
  • Using MTR

    MTR is a powerful network diagnostic tool that enables administrators to diagnose and isolate networking errors and provide helpful reports of network status to upstream providers. MTR represents an evolution...