Shell Script Limite Traffic OpenVZ

By | 19/02/2017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
#
# Incoming traffic control
#
DEV=venet0
#
tc qdisc del dev $DEV root
#
tc qdisc add dev $DEV root handle 1: htb default 10
#
tc class add dev $DEV parent 1: classid 1:1 htb rate 100mbps burst 15k
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 2.5mbps ceil 2.5mbps burst 15k
#
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
#
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst #IP_VM# flowid 1:30

#
echo;echo "tc configuration for $DEV:"
tc qdisc show dev $DEV
tc class show dev $DEV
tc filter show dev $DEV
#
# Outgoing traffic control
#
DEV=vmbr0
#
tc qdisc del dev $DEV root
#
tc qdisc add dev $DEV root handle 1: htb default 10
#
tc class add dev $DEV parent 1: classid 1:1 htb rate 100mbps burst 15k
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 2.5mbps ceil 2.5mbps burst 15k
#
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
#
tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip src #IP_VM# flowid 1:30
#
echo;echo "tc configuration for $DEV:"
tc qdisc show dev $DEV
tc class show dev $DEV
tc filter show dev $DEV

ใส่ความเห็น