Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - There is a lot of server traffic flowing out. What happened?
There is a lot of server traffic flowing out. What happened?
This is not a Trojan horse, it is a matter of setting. The following are traffic control methods. There are two kinds of 1.Linux traffic control processes: 1, queue control is QOS, and the rule control of sending queue at bottleneck. The common ones are SFQ priority 2, flow control, namely bandwidth control and queue shaping. Generally speaking, it is TBF·HTB II. There are two kinds of Linux traffic control algorithms: 1, classless algorithms for branchless leaf-level queues, such as SFQ2, and classification algorithms for multi-branch queues. For example: PRIO TBF HTB III. Specific implementation: 1 Establish a current limit based on SFQ algorithm on the network card # tcqdisc add deveth0root handle1:sfq sfq parameters are disturbed (adjust the algorithm interval again). Quantum basically does not need manual adjustment: handle 1: specifies the algorithm number ... it can be specified by the system without setting .. #tc qdisc sh dev eth0 display algorithm # Tc qd del dev eth0 root delete Note: by default, eht0 supports TOS 2. Establish the current limit # tcqdadddev eth1roothandle1:TBF rate 256kbit burst1000 latency 50ms rate 256kbit burst transmission1 0k maximum delay 50ms # TC-s qdsh Deveth1statistics # TC qd del Deveth1root deleting 3. Establish the prio # TC qdisc add dev eth0 root handle 1: prio # on the network card. This command immediately creates classes: 1: 1, 1:2, 1:3 (three subclasses by default) # tcqdisc add deveth0parent1:1handle10: sfq # tcqdisc add develop 0parent1:2handle20: TBF rate 20kbit buffer/. # TC qdisc add Deveth 0 Parent 1:3 handle 30:SFQ 4。 The traffic of the Web server is controlled at 5 Mbps, the traffic of SMTP is controlled at 3Mbps, and both * * * shall not exceed 6Mbps. Bandwidth # tcqdisc add deveth0root handle1:0cbq bandwidth100 mbit avpkt1000cell 8 # can be borrowed from each other. Tc class add dev eth0parent1:0classid1:kloc-0/cbq bandwidth 100Mbit bit rate 6Mbit weight 0.6Mbit priority 8 allocation 15 14 unit 8 maximum burst 20avpkt/kloc-. And the class 1: 1 is bound. That is to say, the whole bandwidth cannot exceed 6Mbps. # TC class add dev eth0parent1:1classid1:3cbq bandwidth 100Mbit rate 5Mbit weight 0.5Mbit priority 5 allocation 15 1 4cell 8maxburst 20avpkt1000 # TC class add dev eth0parent1:1classid65438 Pay attention to how we adjust the weight parameters according to the bandwidth. Neither of these classes is configured as bounded, but they are both connected to the class 1: 1. And 1: 1 is set to "bounded", then the total bandwidth of the two classes will not exceed 6Mbps. Don't forget, the main figures of subclasses under the same CBQ must be consistent with CBQ's own figures! # tcqdisc add dev eth0parent1:3 handle30: sfq # tcqdisc add dev eth0parent1:4 handle40: sfq by default, both classes have a FIFO queue, but we changed it to sfq queue. Ensure that every data stream is treated fairly. # TC filter adds Deveth 0 Parent 1: 0 protocol IP Prio 1 U32 to match IP Sport 800xffffflowid1:3 # TC filter adds dev eth 0parent 1: 0 protocol IP Prio/ Kloc-0/ U32 matches IP Sport 250xfffff lowid1:46. Filter filtering example # tcfilter add Deveth0 protocol IP parent10: prio1u32match IP dport 220xfffff lowid10:1:Add a filtering rule to the node. Priority 1: All IP packets sent to 22 ports (exact match), Send to channel10:1... # tcfilter add dev eth0 protocol IP parent10: prio1u32match IP sport 800xfffff lowid10:10: Add a filter to the node. Priority 1: All IP packets from port 80 (exact match) are sent to the channel 10:1... # tcfilter add dev eth0 protocol IP parent10: prio2flowid10: 2eth0/kloc. Its priority is 2: any IP packet that does not match the first two sentences, Send to the channel10: 2 .. # TC filter add develop 0parent10: 0 protocol IP prio1u32match IP dst4.3.2.1/32flowid10:/kloc-. A packet with a destination of 4. 3. 2. 1 is sent to the channel 10: 1. Other parameters are as follows: # tcfilter add dev eth0parent10: 0protocol IP prio1u32match IP src1.2.3.4/32flowid10:1 .2.3.4 send the data packet from 1. 2. 3. 4 to the channel10:1# tcfilter add dev eth0 protocol IP parent65433.