Previous

Content  

Next


3.4. Edge32-ca-u32

 

Google
The example's script is as follows:

 
#! /bin/sh -x

####################### Ingress side ########################

tc qdisc add dev eth2 handle ffff: ingress

tc filter add dev eth2 parent ffff: protocol ip prio 1 u32 \
match ip tos 0x88 0xfc \
police index 1 rate 1000kbit burst 90k \
continue flowid :1

tc filter add dev eth2 parent ffff: protocol ip prio 2 u32 \
match ip tos 0x88 0xfc \
police index 2 rate 1000kbit burst 30k \
continue flowid :1

tc filter add dev eth2 parent ffff: protocol ip prio 3 u32 \
match ip tos 0x88 0xfc \
police index 3 rate 500kbit burst 90k \
continue flowid :2

tc filter add dev eth2 parent ffff: protocol ip prio 4 u32 \
match ip tos 0x88 0xfc \
police index 4 rate 500kbit burst 30k \
continue flowid :2

tc filter add dev eth2 parent ffff: protocol ip prio 5 u32 \
match ip tos 0x88 0xfc \
police index 5 rate 500kbit burst 90k \
continue flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 6 u32 \
match ip tos 0x88 0xfc \
police index 6 rate 500kbit burst 30k \
drop flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 8 u32 \
match ip tos 0x90 0xfc \
police index 3 rate 500kbit burst 90k \
continue flowid :2
 
   

 

tc filter add dev eth2 parent ffff: protocol ip prio 9 u32 \
match ip tos 0x90 0xfc \
police index 4 rate 500kbit burst 30k \
continue flowid :2

tc filter add dev eth2 parent ffff: protocol ip prio 10 u32 \
match ip tos 0x90 0xfc \
police index 5 rate 500kbit burst 90k \
continue flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 11 u32 \
match ip tos 0x90 0xfc \
police index 6 rate 500kbit burst 30k \
drop flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 13 u32 \
match ip tos 0x98 0xfc \
police index 5 rate 500kbit burst 90k \
continue flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 14 u32 \
match ip tos 0x98 0xfc \
police index 6 rate 500kbit burst 30k \
drop flowid :3

tc filter add dev eth2 parent ffff: protocol ip prio 16 u32 \
match ip src 0/0\
police index 7 rate 1000kbit burst 90k \
drop flowid :4

######################## Egress side ########################

tc qdisc add dev eth1 handle 1:0 root dsmark indices 64

tc class change dev eth1 classid 1:1 dsmark mask 0x3 value 0x88
tc class change dev eth1 classid 1:2 dsmark mask 0x3 value 0x90
tc class change dev eth1 classid 1:3 dsmark mask 0x3 value 0x98
tc class change dev eth1 classid 1:3 dsmark mask 0x3 value 0x0

   
tc filter add dev eth1 parent 1:0 protocol ip prio 1 \
handle 1 tcindex classid 1:1

tc filter add dev eth1 parent 1:0 protocol ip prio 1 \
handle 2 tcindex classid 1:2

tc filter add dev eth1 parent 1:0 protocol ip prio 1 \
handle 3 tcindex classid 1:3

tc filter add dev eth1 parent 1:0 protocol ip prio 1 \
handle 4 tcindex classid 1:4
 

 
This new example is very similar to the previous one. The egress side works exactly the same way. In the ingress side, seven (7) shared meters are used. This time the same meter can be shared between two or more filter elements. For example, the meter number 3 (identified by police index 3) is shared by the filter elements 3 and 8 (prio 3 and prio 8); have a look to the script above.
 
Taking the AF41 entering traffic as example (marked with tos 0x88), in the first combo rule the flows are assigned to class 1 up to a rate of 1000 (CIR1) + 1000 (PIR1) kbps and a bursting of 90 (CBS1) + 30 (EBS1) KB. CIR stands for Commited Information Rate, PIR as Peak Information Rate, CBS as Commited Burst Size and EBS as Extended Burst Size. Then AF41 traffic is passed on with a tcindex value = 1 if it doesn't exceed its CIR1/CBS1 + PIR1/EBS1.
 
If AF41 traffic exceeds the first rule, but not an extra rate/burst of CIR2/CBS1 + PIR2/EBS1, it is passed on with a tcindex value = 2. Here, CIR2 = 500kbps and PIR2 = 500kbps.
 
If AF41 traffic exceeds the second rule, but not an extra rate/burst CIR2/CBS2 + PIR2/EBS2, it is passed on with a tcindex value = 3. Here, CBS2 = 90KB and EBS2 = 30KB.
 
AF41 traffic exceeding above rule is dropped.
 
Same explanation applies to other type of traffic. For AF42 traffic a 2-level combo rule is applied. For AF43 traffic a 1-level combo rule is applied. For the rest of traffic a 1-level single rule is applied to passes this on with a tcindex value = 4, to be finally marked as BE.
 
Okay, it's time to continue with Edge31-cb-tables.
 
   

 


   


Previous

Content  

Next