{"id":251,"date":"2009-01-22T18:05:46","date_gmt":"2009-01-22T10:05:46","guid":{"rendered":"http:\/\/blog.wallaceho.com\/?p=251"},"modified":"2009-01-24T02:31:28","modified_gmt":"2009-01-23T18:31:28","slug":"prevent-dosddos-on-linux","status":"publish","type":"post","link":"https:\/\/blog.wallaceho.com\/?p=251","title":{"rendered":"Prevent DoS\/DDoS On Linux"},"content":{"rendered":"<p>Last month my server have been ddos by someone, so that I have search on the internet and see how can I prevent it. It&#8217;s juz very simple, as u know the linux firewall &#8220;iptable&#8221;. u can wirte a shell script monitoring the netstats and check whether an IP address have how many connections in this peroid. If there are more than X(u can set a variable on it) connections, the ip address will be ban for X minutes by iptables. Moreover, if there is any ip address has been banned, a email will sent to your administrator account, and I have tested by myself, it works! That&#8217;s a great shell script!<\/p>\n<p><a href=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-253\" title=\"1\" src=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/1.jpg\" alt=\"1\" width=\"516\" height=\"414\" srcset=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/1.jpg 516w, https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/1-300x240.jpg 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/a><\/p>\n<p>Checking how many connections does those IP address<\/p>\n<p><a href=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-254\" title=\"2\" src=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/2.jpg\" alt=\"2\" width=\"521\" height=\"196\" srcset=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/2.jpg 521w, https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/2-300x112.jpg 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/a><\/p>\n<p>If there are someone been banned, an email will be received<\/p>\n<p><a href=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-255\" title=\"3\" src=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/3-300x171.jpg\" alt=\"3\" width=\"300\" height=\"171\" srcset=\"https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/3-300x171.jpg 300w, https:\/\/blog.wallaceho.com\/wp-content\/uploads\/2009\/01\/3.jpg 790w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Testing the function:P 123.203.109.188 is my IP address and trying to hack DrKn(Kenny)&#8217;s Server \ud83d\ude1b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last month my server have been ddos by someone, so that I have search on the internet and see how can I prevent it. It&#8217;s juz very simple, as u know the linux firewall &#8220;iptable&#8221;. u can wirte a shell &hellip; <a href=\"https:\/\/blog.wallaceho.com\/?p=251\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=251"}],"version-history":[{"count":9,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/posts\/251\/revisions"}],"predecessor-version":[{"id":264,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=\/wp\/v2\/posts\/251\/revisions\/264"}],"wp:attachment":[{"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.wallaceho.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}