{"id":9015,"date":"2022-03-25T10:03:49","date_gmt":"2022-03-25T10:03:49","guid":{"rendered":"https:\/\/cpanelplesk.com\/wp62\/?p=9015"},"modified":"2022-03-25T10:03:49","modified_gmt":"2022-03-25T10:03:49","slug":"how-to-check-if-your-linux-server-is-under-ddos-attack","status":"publish","type":"post","link":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/","title":{"rendered":"How to Check if Your Linux Server Is Under DDoS Attack"},"content":{"rendered":"<p><b>What is DDOS:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">DDoS, or Distributed Denial of Service, is a coordinated attack using one or more IP addresses designed to cripple a website by making its server inaccessible. This is done by overloading a server\u2019s resources and using up all available connections, bandwidth, and throughput. Just like when driving, your travel time from point A to point B will be slower if there\u2019s too much traffic. By flooding a server with more connections than it can handle, the server becomes bogged down, making it unable to process legitimate requests. Even hardy servers can\u2019t handle the number of connections a DDoS can bring.<\/span><\/p>\n<p><b>How to Check for DDos:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If you&#8217;re worried that your server is being targeted by a DDoS assault, the first thing you should do is check the load on it. The uptime or top commands, for example, will give you a decent understanding of the server&#8217;s current load.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But what constitutes an acceptable load?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">That, of course, is dependent on your CPU resources and available threads. In most cases, however, the norm is one point per thread.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To begin, use the two commands below to get your server load and uptime.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><span style=\"font-weight: 400;\">grep processor \/proc\/cpuinfo | wc -l<\/span>\r\n\r\n<span style=\"font-weight: 400;\">uptime<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">The load average shows the load across the following time intervals: 1 minute, 5 minutes, and 15 minutes. In this case, a load average of more than 7 would be a cause for concern.<\/span><\/p>\n<p><b>How to Find Out Which IP Addresses Are Connecting to Your Server:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Because most DDoS attacks necessitate connections to your server, you can observe how many and which IP addresses are simultaneously connected to your server. This can be determined using netstat, a tool that displays a variety of information. We&#8217;re simply interested in the exact IPs making connections, the quantity of IPs, and potentially the subnets they&#8217;re connected to in this case.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To get started, type the following into your terminal:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><span style=\"font-weight: 400;\">netstat -ntu|awk '{print $5}'|cut -d: -f1 -s|sort|uniq -c|sort -nk1 -r<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">This command will return a descending list of which IPs are connected to your server and how many connections each one has if typed correctly. Artifact data may appear in the results as non-IP information, which can be ignored.<\/span><\/p>\n<p><b>Mitigating a DDoS Attack:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Blocking individual IPs can be done with a few simple keystrokes after you know which IPs are hitting your server.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To begin, use the command below, replacing &#8220;ipaddress&#8221; with the IP address you want to block.<\/span><\/p>\n<p><b>Reject route add IP address:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Once you&#8217;ve blocked a certain IP on the server, you may use the following command to see if the IP has been blocked successfully:<\/span><\/p>\n<pre>route -n |grep ipaddress<\/pre>\n<p><span style=\"font-weight: 400;\">You may also use iptables to block an IP address on the server by executing the following commands:<\/span><\/p>\n<pre>iptables -A INPUT 1 -s IPADDRESS -j DROP\/REJECT\r\n\r\nservice iptables restart\r\n\r\nservice iptables save<\/pre>\n<p><span style=\"font-weight: 400;\">You&#8217;ll need to stop all httpd connections and restart httpd services after running this series of commands. This can be done by typing in the following:<\/span><\/p>\n<pre>killall -KILL httpd\r\n\r\nservice httpd startssl<\/pre>\n<p><span style=\"font-weight: 400;\">If a high number of connections are being made by more than one unknown IP address, either of these steps can be repeated for all offending IPs.<\/span><\/p>\n<p><b>DDoS Using Multiple IPs:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">DDoS prevention becomes more difficult as attackers use fewer connections spread across a larger number of attacking IPs. While a denial of service attack from a single IP making numerous connections can be easy to diagnose and fix, DDoS prevention becomes more difficult as attackers use fewer connections spread across a larger number of attacking IPs. Even when your server is under DDoS, you will observe fewer individual connections in these circumstances. These types of attacks have become increasingly widespread as the Internet of Things (IoT) has risen in popularity. Malicious actors have constructed botnets of available IPs by hacking into and using &#8220;smart&#8221; devices, appliances, and gadgets with internet connectivity. Botnets are networks of available IPs that may be used in coordinated DDoS attacks against specified targets.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To find IPs from the same \/16 (xxx.xxx.0.0) subnet, use:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><span style=\"font-weight: 400;\">netstat -ntu|awk '{print $5}'|cut -d: -f1 -s |cut -f1,2 -d'.'|sed 's\/$\/.0.0\/'|sort|uniq -c|sort -nk1 -r<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">When entered, this command will display any IP starting with the same two octets: ie. 192.168.xxx.xxx.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To find IPs from the same \/24 (xxx.xxx.xxx.0) subnet, use:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><span style=\"font-weight: 400;\">netstat -ntu|awk '{print $5}'|cut -d: -f1 -s |cut -f1,2,3 -d'.'|sed 's\/$\/.0\/'|sort|uniq -c|sort -nk1 -r<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">When this command is entered, it will display any IP address that begins with the same three octets: for example, 192.168.1.xxx.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is DDOS: DDoS, or Distributed Denial of Service, is a coordinated attack using one or more IP addresses designed to cripple a website by making its server inaccessible. This is done by overloading a server\u2019s resources and using up all available connections, bandwidth, and throughput. Just like when driving, your travel time from point [&#8230;]<\/p>\n<p><a class=\"understrap-read-more-link\" href=\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,22],"tags":[],"class_list":["post-9015","post","type-post","status-publish","format-standard","hentry","category-general","category-security"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk\" \/>\n<meta name=\"twitter:description\" content=\"What is DDOS: DDoS, or Distributed Denial of Service, is a coordinated attack using one or more IP addresses designed to cripple a website by making its server inaccessible. This is done by overloading a server\u2019s resources and using up all available connections, bandwidth, and throughput. Just like when driving, your travel time from point [...]Continue Reading...\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"samama\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\"},\"author\":{\"name\":\"samama\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/b5c17eff2915a029433dfd2d5a6e8465\"},\"headline\":\"How to Check if Your Linux Server Is Under DDoS Attack\",\"datePublished\":\"2022-03-25T10:03:49+00:00\",\"dateModified\":\"2022-03-25T10:03:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\"},\"wordCount\":700,\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"articleSection\":[\"General\",\"Security\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\",\"name\":\"How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk\",\"isPartOf\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\"},\"datePublished\":\"2022-03-25T10:03:49+00:00\",\"dateModified\":\"2022-03-25T10:03:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cpanelplesk.com\/wp62\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Check if Your Linux Server Is Under DDoS Attack\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#website\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/\",\"name\":\"cPanel Plesk\",\"description\":\"Blog on famous hosting control panels\",\"publisher\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13\",\"name\":\"Farooq Omer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"contentUrl\":\"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png\",\"width\":300,\"height\":44,\"caption\":\"Farooq Omer\"},\"logo\":{\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/b5c17eff2915a029433dfd2d5a6e8465\",\"name\":\"samama\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5ad71c1d187b45a3c1a68698160b5f6d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5ad71c1d187b45a3c1a68698160b5f6d?s=96&d=mm&r=g\",\"caption\":\"samama\"},\"url\":\"https:\/\/cpanelplesk.com\/wp62\/author\/samama\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/","twitter_card":"summary_large_image","twitter_title":"How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk","twitter_description":"What is DDOS: DDoS, or Distributed Denial of Service, is a coordinated attack using one or more IP addresses designed to cripple a website by making its server inaccessible. This is done by overloading a server\u2019s resources and using up all available connections, bandwidth, and throughput. Just like when driving, your travel time from point [...]Continue Reading...","twitter_misc":{"Written by":"samama","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#article","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/"},"author":{"name":"samama","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/b5c17eff2915a029433dfd2d5a6e8465"},"headline":"How to Check if Your Linux Server Is Under DDoS Attack","datePublished":"2022-03-25T10:03:49+00:00","dateModified":"2022-03-25T10:03:49+00:00","mainEntityOfPage":{"@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/"},"wordCount":700,"publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"articleSection":["General","Security"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/","url":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/","name":"How to Check if Your Linux Server Is Under DDoS Attack - cPanel Plesk","isPartOf":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#website"},"datePublished":"2022-03-25T10:03:49+00:00","dateModified":"2022-03-25T10:03:49+00:00","breadcrumb":{"@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cpanelplesk.com\/wp62\/how-to-check-if-your-linux-server-is-under-ddos-attack\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cpanelplesk.com\/wp62\/"},{"@type":"ListItem","position":2,"name":"How to Check if Your Linux Server Is Under DDoS Attack"}]},{"@type":"WebSite","@id":"https:\/\/cpanelplesk.com\/wp62\/#website","url":"https:\/\/cpanelplesk.com\/wp62\/","name":"cPanel Plesk","description":"Blog on famous hosting control panels","publisher":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cpanelplesk.com\/wp62\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/c78ae1cf9451a09592fb9697d69c0c13","name":"Farooq Omer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","contentUrl":"https:\/\/cpanelplesk.com\/wp62\/wp-content\/uploads\/2020\/11\/cpanelplesk.png","width":300,"height":44,"caption":"Farooq Omer"},"logo":{"@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/b5c17eff2915a029433dfd2d5a6e8465","name":"samama","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cpanelplesk.com\/wp62\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5ad71c1d187b45a3c1a68698160b5f6d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5ad71c1d187b45a3c1a68698160b5f6d?s=96&d=mm&r=g","caption":"samama"},"url":"https:\/\/cpanelplesk.com\/wp62\/author\/samama\/"}]}},"_links":{"self":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/9015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/comments?post=9015"}],"version-history":[{"count":3,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/9015\/revisions"}],"predecessor-version":[{"id":9024,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/posts\/9015\/revisions\/9024"}],"wp:attachment":[{"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/media?parent=9015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/categories?post=9015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelplesk.com\/wp62\/wp-json\/wp\/v2\/tags?post=9015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}