The server traffic is only 1TB, what should I do if I am afraid of being swiped? This article teaches you how to prevent the other party from swiping the traffic!

This article mainly explains how to monitor server traffic and close network requests, which can effectively prevent the trouble of being brushed under certain circumstances.
Date: October 2, 2023
Author: Ren Congcong

A fundamental and effective way to avoid brush flow

Insert image description here
Note: Only select the server configuration with fixed bandwidth and unlimited traffic. Do not choose a billing and metering type server. This type of server is generally very cost-effective, but it is very troublesome for various types of attacks. First, compare the fixed bandwidth type server. The fixed bandwidth itself can filter a large number of requests.

The solution for selecting the billing and metering server

Note: In a Linux environment, you can install bmon to monitor and manage traffic. The specific steps are as follows:

Step 1. Install bmon

sudo apt-get install bmon

Step 2. Execute the following command

0 0 1 * * bash -c 'for i in $(seq 1 30); do bmon --read-bytes --write-bytes --bandwidth --time | grep "$(date -d "${i} days ago" +%b)"; done' | while read line; do if [[ $line == *"sent"* && $line != *"sent"* ]] || [[ $line == *"recv"* && $line != *"recv"* ]]; then echo "流量超过1TB,关闭网络!" && sudo service network-manager stop; break; fi; done

Note: This command is for implementation. The actual traffic usage from 1st to 30th of this month can be changed according to your own needs. The scheduled detection time can also be changed by yourself, or customized and edited into an execution script. It will default after reaching the monitoring peak. Automatically close the gateway to avoid being swiped.

Guess you like

Origin blog.csdn.net/hj960511/article/details/133493023