- 论坛徽章:
- 0
|
tc filter add dev imq1 parent 1:0 prio 1 handle 10: protocol ip u32 divisor 256
tc filter add dev imq1 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip src 192.168.1.0/24 hashkey mask 0x000000ff at 12 link 10:
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 10:2: match ip src 192.168.1.2/32 flowid 1:2
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 10:3: match ip src 192.168.1.3/32 flowid 1:3
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 10:4: match ip src 192.168.1.4/32 flowid 1:4
tc filter add dev imq0 parent 1:0 prio 1 handle 100: protocol ip u32 divisor 256
tc filter add dev imq0 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 192.168.1.0/24 hashkey mask 0x000000ff at 16 link 100:
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 100:2: match ip dst 192.168.1.2/32 flowid 1:2
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 100:3: match ip dst 192.168.1.3/32 flowid 1:3
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 100:4: match ip dst 192.168.1.4/32 flowid 1:4
tc class add dev imq1 parent 1:1 classid 1:2 htb rate 2kbps ceil 10kbps prio 2
tc class add dev imq1 parent 1:1 classid 1:3 htb rate 2kbps ceil 10kbps prio 2
tc class add dev imq1 parent 1:1 classid 1:4 htb rate 2kbps ceil 10kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:2 htb rate 10kbps ceil 150kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:3 htb rate 10kbps ceil 150kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:4 htb rate 10kbps ceil 150kbps prio 2
tc filter add dev imq1 parent 1:0 prio 1 handle 10: protocol ip u32 divisor 64
tc filter add dev imq1 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip src 192.168.1.0/26 hashkey mask 0x0000003f at 12 link 10:
tc filter add dev imq0 parent 1:0 prio 1 handle 20: protocol ip u32 divisor 64
tc filter add dev imq0 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 192.168.1.0/26 hashkey mask 0x0000003f at 16 link 20:
i=2
j=2
m=2
n=2
while [ $i -le 63 ]
do
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 10:${n}: match ip src 192.168.1.${i}/32 flowid 1:$j
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 20:${n}: match ip dst 192.168.1.${i}/32 flowid 1:$j
tc class add dev imq1 parent 1:1 classid 1:$j htb rate 2kbps ceil 8kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:$j htb rate 8kbps ceil 120kbps prio 2
tc qdisc add dev imq1 parent 1:$j handle $j: sfq perturb 12
tc qdisc add dev imq0 parent 1:$j handle $j: sfq perturb 12
i=`expr $i + 1`
m=`expr $m + 1`
j=$(echo $i|awk '{printf "%x\n",$0}')
n=$(echo $m|awk '{printf "%x\n",$0}')
done
tc filter add dev imq1 parent 1:0 prio 1 handle 11: protocol ip u32 divisor 64
tc filter add dev imq1 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip src 192.168.1.64/26 hashkey mask 0x0000003f at 12 link 11:
tc filter add dev imq0 parent 1:0 prio 1 handle 21: protocol ip u32 divisor 64
tc filter add dev imq0 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 192.168.1.64/26 hashkey mask 0x0000003f at 16 link 21:
i=64
j=40
m=0
n=0
while [ $i -le 127 ]
do
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 11:${n}: match ip src 192.168.1.${i}/32 flowid 1:$j
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 21:${n}: match ip dst 192.168.1.${i}/32 flowid 1:$j
tc class add dev imq1 parent 1:1 classid 1:$j htb rate 2kbps ceil 8kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:$j htb rate 8kbps ceil 120kbps prio 2
tc qdisc add dev imq1 parent 1:$j handle $j: sfq perturb 12
tc qdisc add dev imq0 parent 1:$j handle $j: sfq perturb 12
i=`expr $i + 1`
m=`expr $m + 1`
j=$(echo $i|awk '{printf "%x\n",$0}')
n=$(echo $m|awk '{printf "%x\n",$0}')
done
tc filter add dev imq1 parent 1:0 prio 1 handle 12: protocol ip u32 divisor 64
tc filter add dev imq1 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip src 192.168.1.128/26 hashkey mask 0x0000003f at 12 link 12:
tc filter add dev imq0 parent 1:0 prio 1 handle 22: protocol ip u32 divisor 64
tc filter add dev imq0 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 192.168.1.128/26 hashkey mask 0x0000003f at 16 link 22:
i=128
j=80
m=0
n=0
while [ $i -le 191 ]
do
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 12:${n}: match ip src 192.168.1.${i}/32 flowid 1:$j
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 22:${n}: match ip dst 192.168.1.${i}/32 flowid 1:$j
tc class add dev imq1 parent 1:1 classid 1:$j htb rate 2kbps ceil 8kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:$j htb rate 8kbps ceil 120kbps prio 2
tc qdisc add dev imq1 parent 1:$j handle $j: sfq perturb 12
tc qdisc add dev imq0 parent 1:$j handle $j: sfq perturb 12
i=`expr $i + 1`
m=`expr $m + 1`
j=$(echo $i|awk '{printf "%x\n",$0}')
n=$(echo $m|awk '{printf "%x\n",$0}')
done
tc filter add dev imq1 parent 1:0 prio 1 handle 13: protocol ip u32 divisor 64
tc filter add dev imq1 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip src 192.168.1.192/26 hashkey mask 0x0000003f at 12 link 13:
tc filter add dev imq0 parent 1:0 prio 1 handle 23: protocol ip u32 divisor 64
tc filter add dev imq0 protocol ip parent 1:0 prio 1 u32 ht 800:: match ip dst 192.168.1.192/26 hashkey mask 0x0000003f at 16 link 23:
i=192
j=c0
m=0
n=0
while [ $i -le 254 ]
do
tc filter add dev imq1 parent 1:0 protocol ip prio 2 u32 ht 13:${n}: match ip src 192.168.1.${i}/32 flowid 1:$j
tc filter add dev imq0 parent 1:0 protocol ip prio 2 u32 ht 23:${n}: match ip dst 192.168.1.${i}/32 flowid 1:$j
tc class add dev imq1 parent 1:1 classid 1:$j htb rate 2kbps ceil 8kbps prio 2
tc class add dev imq0 parent 1:1 classid 1:$j htb rate 8kbps ceil 120kbps prio 2
tc qdisc add dev imq1 parent 1:$j handle $j: sfq perturb 12
tc qdisc add dev imq0 parent 1:$j handle $j: sfq perturb 12
i=`expr $i + 1`
m=`expr $m + 1`
j=$(echo $i|awk '{printf "%x\n",$0}')
n=$(echo $m|awk '{printf "%x\n",$0}')
done
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/110758/showart_2160292.html |
|