Guest User

Untitled

a guest
Oct 8th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. DEV=eth0
  4. RATE="rate 40Mbit"
  5. TNETS="192.168.122.0/24"
  6. ALLOT="allot 20000"
  7.  
  8. tc qdisc del dev $DEV root 2>/dev/null
  9.  
  10. tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 rate 1000Mbit \
  11. bandwidth 1000Mbit
  12. tc class add dev $DEV parent 1: classid 1:1 \
  13. est 1sec 8sec cbq allot 10000 mpu 64 \
  14. rate 1000Mbit prio 1 avpkt 1500 bounded
  15.  
  16. # output to test nets : 40 Mbit limit
  17. tc class add dev $DEV parent 1:1 classid 1:11 \
  18. est 1sec 8sec cbq $ALLOT mpu 64 \
  19. $RATE prio 2 avpkt 1400 bounded
  20.  
  21. tc qdisc add dev $DEV parent 1:11 handle 11: \
  22. est 1sec 8sec qfq
  23.  
  24. #tc filter add dev $DEV protocol ip parent 11: handle 3 \
  25. # flow hash keys txhash divisor 8
  26. #tc filter add dev $DEV protocol ip parent 11: handle 3 \
  27. # flow hash keys u32 dport divisor 8
  28. #tc filter add dev $DEV protocol ip parent 11: \
  29. # u32 hashkey mask 0000ffff at 8 divisor 8
  30.  
  31.  
  32. for i in `seq 1 8`
  33. do
  34. classid=11:$(printf %x $i)
  35. tc class add dev $DEV classid $classid qfq
  36. tc qdisc add dev $DEV parent $classid pfifo limit 30
  37. done
  38.  
  39. # use just following simple dport match to test this beast
  40. for i in `seq 1 8`; do
  41. tc filter add dev $DEV protocol ip parent 11: u32 \
  42. match ip dport 123$i 0xffff flowid 11:$i
  43. done
  44.  
  45. for privnet in $TNETS
  46. do
  47. tc filter add dev $DEV parent 1: protocol ip prio 100 u32 \
  48. match ip dst $privnet flowid 1:11
  49. done
  50.  
  51. tc filter add dev $DEV parent 1: protocol ip prio 100 u32 \
  52. match ip protocol 0 0x00 flowid 1:1
Advertisement
Add Comment
Please, Sign In to add comment