Advertisement
Guest User

Untitled

a guest
May 2nd, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. #!/bin/sh
  2. # Example script with more complex fq_codel hash configuration
  3. # You can load up the network and see the behavior of the active classes
  4. # via tc -s qdisc show dev eth2 in this case
  5.  
  6. tc qdisc del dev eth2 root
  7.  
  8. # Use small number of flows. Suitable for less than 2Mbits...
  9. # A smaller quantum prioritizes smaller packets over bigger ones, also useful at low bandwidths
  10.  
  11. tc qdisc add dev eth2 handle a root fq_codel flows 16 quantum 300
  12.  
  13. # catch-all filter for protocol types that don't match. We just do this so packets
  14. # aren't dropped on the floor while we add more filters
  15.  
  16. tc filter add dev eth2 parent a: protocol all prio 999 u32 match ip protocol 0 0x00 flowid a:f
  17.  
  18. # match multicast packets and give them their own bin.
  19. # There is no need to segregate ipv6 and ipv4 traffic here, this is just an example
  20.  
  21. tc filter add dev eth2 parent a: protocol ip prio 5 u32 match u8 0x01 0x01 at -14 flowid a:9
  22. tc filter add dev eth2 parent a: protocol ipv6 prio 6 u32 match u8 0x01 0x01 at -14 flowid a:9
  23.  
  24. # What the heck, toss arp into its own bin
  25. tc filter add dev eth2 parent a: protocol arp prio 7 u32 match u8 0x01 0x01 at -14 flowid a:a
  26.  
  27. # Give EF traffic its own bin. Ideally this would be *bins*. Using map, rather than hash?
  28. # Secondly, this doesn't work for some reason. Neither does ff or 3f as a mask
  29. # tested with netperf -Y EF,EF fd01::1 and on ipv4 and with numeric constants too.
  30. # e2? WTF?
  31.  
  32. tc filter add dev eth2 parent a: protocol ip prio 8 u32 match ip tos 0x2e fc flowid a:b
  33. tc filter add dev eth2 parent a: protocol ipv6 prio 9 u32 match ip6 priority 0x2e fc flowid a:b
  34.  
  35. # Stick traffic marked interactive into the EF bin too. Would be better to give them their
  36. # own bins....
  37.  
  38. tc filter add dev eth2 parent a: protocol ip prio 10 u32 match ip tos 0x08 0xfc flowid a:b
  39. tc filter add dev eth2 parent a: protocol ipv6 prio 11 u32 match ip6 priority 0x08 0xfc flowid a:b
  40.  
  41. # Toss CS1 background into its own bin, too. Segregate ipv6 for sake of example
  42. # This DOES work, unlike EF (netperf -Y CS1,CS1 fd01::1)
  43. # But should be bins in a larger configuration
  44.  
  45. tc filter add dev eth2 parent a: protocol ip prio 12 u32 match ip tos 0x20 0xfc flowid a:c
  46. tc filter add dev eth2 parent a: protocol ipv6 prio 13 u32 match ip6 priority 0x20 0xfc flowid a:d
  47.  
  48. # Not entirely clear to me if using the pre-natted ip stuff works always
  49.  
  50. tc filter add dev eth2 parent a: handle 3 protocol ipv6 prio 94 flow hash keys proto-dst,rxhash divisor 8
  51. tc filter add dev eth2 parent a: handle 4 protocol all prio 97 flow hash keys proto-dst,nfct-src divisor 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement