Configuration Guide
Traffic Behavior Configuration Guide
14 min
introduction introduction qos (quality of service) is a technique used to solve problems such as network latency and blocking complex traffic classifier in qos can be achieved through traffic classifier in the modular qos command line interface (mqc), which consists of three elements, namely traffic classifier, traffic behavior and traffic policy the traffic classifier is used to define a set of traffic matching rules for classifying packets; the traffic behavior is used to define the actions to be performed for a certain type of packet; the traffic policy is used to bind the specified traffic classifier to the traffic behavior to control the traffic basic concepts basic concepts flow control flow control the flow control function is based on acl (access control list) and car (committed access rate) policies to limit the speed of specific flows the car policy is the basis for flow control the user can define a car action that defines the speed at which the flow is limited this chapter focuses on the configuration of traffic behaviour and car actions the configuration of acl complex traffic classifier is described specifically in the acl chapter token bucket technology token bucket technology the token bucket technique is a common algorithm used in qos based on the way token buckets process packets, two marking algorithms are defined in the rfc sr tcm (single rate three color marker) and tr tcm (two rate three color marker) where sr tcm denotes single rate two bucket, which is mainly concerned with bursting of packet size; tr tcm denotes two rate two bucket, which is mainly concerned with bursting of packet rate when using the token bucket, the following parameters are configured cir cir means the committed information rate, i e the average rate that is guaranteed to pass pir pir means peak information rate, i e the maximum allowable through rate cbs cbs means committed burst size, i e the amount of committed burst traffic that can pass instantaneously pbs pbs refers to peak burst size, i e the maximum burst of traffic allowed to pass instantaneously cir must be configured when using sr tcm mode, optionally cbs if the user does not configure cbs, the system will automatically set the default value cir must be configured when using tr tcm mode, optionally cbs, pir, pbs if the user does not configure pir, the switch will automatically set 1 2 times cir if the user does not configure cbs, pbs, the system will automatically set the default value traffic behavior configuration traffic behavior configuration traffic behavior default setting traffic behavior default setting the default setting of traffic behavior is shown in the table below table 1 traffic behavior default setting table 1 traffic behavior default setting parameters default value traffic behavior not configured car action not configured configure traffic behavior configure traffic behavior the key to configuring traffic behavior is the car template, which can define a rate limit policy; there are two types of car speed limit bytes, which refers to byte based speed limit mode, and packets, which refers to packet based speed limit mode if not specified, the default is bytes mode when bytes mode is selected, the units of the above cir and cbs parameters are bit/s for example, if the user wants to set a speed limit of 4mbit/s, configure cir=4000000bit/s when packets mode is selected, the units of the above cir and cbs parameters are packet/s for example, if the user wants to set a speed limit of 4m packet/s, configure cir=4000000packet/s the conversion formula corresponding to the unit of bit/s is cir(bps)=cir(pps) 84 8 (default packet length is 84bytes) note 1g = 103 m, 1m = 103 k the conversion factor is calculated uniformly at 1000 table 2 configure traffic behavior table 2 configure traffic behavior purpose commands description enter global configuration view configure terminal create traffic behavior and enter the traffic behavior view, or enter an existing traffic behavior view traffic behavior traffic behavior name create car template car { sr tcm | tr tcm } \[ meter type { bytes | packets }] cir cir \[ cbs cbs ] \[ pir pir ] \[ pbs pbs ] cir is mandatory, pir, cbs, pbs are optional configure interface based traffic behavior configure interface based traffic behavior table 3 configure interface based traffic behavior table 3 configure interface based traffic behavior purpose commands description enter global configuration view configure terminal create traffic behavior and enter the traffic behavior view, or enter an existing traffic behavior view traffic behavior traffic behavior name create car template car { sr tcm | tr tcm } \[ meter type { bytes | packets }] cir cir \[ cbs cbs ] \[ pir pir ] \[ pbs pbs ] cir is mandatory, pir, cbs, pbs are optional exit traffic behavior view exit enter interface configuration view interface ethernet interface name bind traffic behavior traffic behavior traffic behavior name configure acl based complex traffic behavior configure acl based complex traffic behavior table 4 configure acl based complex traffic behavior table 4 configure acl based complex traffic behavior purpose commands description enter global configuration view configure terminal create layer 3 acl table access list table name flow control { ingress | egress } configure rate limit rule for specific flows rule rule id rule options traffic behavior traffic behavior name rule id rule sequence number (range 1–500) rule options match fields display and maintenance display and maintenance the following command allows you to view the configured traffic behavior table 5 traffic behavior display and maintenance table 5 traffic behavior display and maintenance purpose commands description display configured traffic behavior show traffic behavior \[ traffic behavior name ] typical configuration example typical configuration example flow control configuration example flow control configuration example networking requirements as shown in the diagram below, department a and department b are connected to the switch via ethernet 0 and 1 there are a number of hosts under each department that access the network via the switch and the router it is known that all hosts under department a have their ip in the 10 0 0 0/24 network segment and all hosts under department b have their ip in the 20 0 0 0/24 network segment there is only data traffic in the network, so there is no need to prioritize the services, but the network bandwidth is limited and the overall bandwidth limit for access to department a and department b is required to achieve a speed limit for users on different network segments department a bandwidth is limited to 800 mbps, up to a maximum of 1000 mbit/s department b bandwidth is limited to 500mbps, up to a maximum of 800mbit/s topology procedure \#configure each interface ip to enable users to access the network through the switch (skipped) \#configure traffic behavior sonic# configure terminal sonic(config)# traffic behavior test1 sonic(config traffic behavior test1)# car tr tcm cir 800000000 pir 1000000000 sonic(config traffic behavior test1)# ex sonic(config)# traffic behavior test2 sonic(config traffic behavior test2)# car tr tcm cir 500000000 pir 8000000000 sonic(config traffic behavior test2)# ex \#create flow control acl rule sonic(config)# access list flow control table 1 ingress sonic(config flow control acl table 1)# rule 200 source ip 10 0 0 0/24 in ports 0/0 traffic behavior test1 sonic(config flow control acl table 1)# rule 201 source ip 20 0 0 0/24 in ports 0/1 traffic behavior test2 verify the configuration check the created policer and acl rules sonic# show traffic behavior name type mode cir cbs \ test1 bytes tr tcm 800000000 64000 test2 bytes tr tcm 500000000 64000 sonic# show acl rule table rule priority action match \ table 1 rule 201 201 set policer policer|test2 in ports ethernet1 src ip 20 0 0 0/24 table 1 rule 200 200 set policer policer|test1 in ports ethernet0 src ip 10 0 0 0/24 send traffic to verify departments a and b are sending data traffic to the switch using 1500mbps and 1000mbps respectively the rx rate of ethernet0 is about 800mbps and the tx rate of ethernet2 is about 500mbps, and both have some packets dropped, indicating that the speed limit is successful
