How to check and mitigate DDoS on VPS or Dedicated Server

How to check and mitigate DDoS on VPS or Dedicated Server

You can access your VPS/Dedicated Server root access by putty command, here you can apply following SSH commands.

Download PuTTY

To see what Ips are connecting to server and how many connections exist from each IP:

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

To see how many connections each IP on the server is receiving:

netstat -plan |grep :80 | awk '{print $4}' | cut -d: -f1 | sort | uniq -c | sort -n

Get the count of current Active connections to Apache:

netstat -apn | grep :80 | wc -l

Get Apache status update from command line to see which domain is receiving maximum hits:

lynx http://localhost/whm-server-status

If you notice any particular IP suspicious, you can block that particular IP address on your server by using the following command.

route add ipaddress reject
Ex: route add 169.90.0.56 reject



To make sure if the IP is blocked on the server on not, you can cross check it by entering the following command.

route -n |grep Ipaddress



If you are familiar with iptables rules, you can even block an IP with it by using the following command.

iptables -A INPUT 1 -s IPADRESS -j DROP/REJECT
service iptables restart
service iptables save



Once you enter the above command, make sure you KILL all the httpd connections and restart the httpd service by entering the following command.

killall -KILL httpd
service httpd startssl
  • cpanel, Hosting, domain
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

DNS Management - How To Edit MX Records

DNS Management - How To Edit MX Records A mail exchanger (MX) record is a type of DNS record...

Cpanel Exim How To Clear The Mail Queue

  Cpanel Exim How To Clear The Mail Queue Here’s the proper way to clear the exim mail...

Creating a cPanel User Account

Creating a cPanel User Account To create a new account go toWHM >> Account Functions...

How can I limit access to certain directories on my server by requiring a password using cPanel/WHM?

How can I limit access to certain directories on my server by requiring a password using...

How do I backup my entire site in Cpanel?

How do I backup my entire site in Cpanel? Entire accounts can be backed up by doing the...