How to check whether a Linux server is under DDOS Attack

Source: Internet
Author: User

How to check whether a Linux server is under DDOS Attack

Address: http://www.phpthinking.com/archives/427

Log on to your server and run the following command as the root user to check whether your server is under DDOS Attack:
Netstat-anp | grep 'tcp \ | udp' | awk '{print $5}' | cut-d:-f1 | sort | uniq-c | sort-n
This command displays the list of the maximum number of IP addresses that have been logged on to the server.

DDOS becomes more complex, because when attackers use fewer connections and more IP addresses to attack servers, you get fewer connections, even if your server is attacked. It is important to check the active connection information of your server and execute the following command:
Netstat-n | grep: 80 | wc-l
The above command will show all the active connections that open your server.

You can also use the following command:
Netstat-n | grep: 80 | grep SYN | wc-l
The results of the valid connection from the First Command will be different, but if it shows that the connection exceeds 500, then there will certainly be a problem.

If the result of the second command is 100 or above, the server may be attacked synchronously.

Once you get a list of IP addresses that attack your server, you can easily block it.

The command below is homogeneous to block IP addresses or any other specific IP addresses:

Route add ipaddress reject

Once you organize access from a specific IP address on the server, you can check that the bean curd blocking is effective.

Run the following command:

Route-n | grep IPaddress

You can also use the following command to block a specified IP address using iptables.

Iptables-a input 1-s IPADRESS-j DROP/REJECT

Service iptables restart

Service iptables save

After the preceding command is executed, stop the httpd connection and restart the httpd service.

Run the following command:

Killall-KILL httpd

Service httpd startssl

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.