Application of various functions of Linux traffic control TC Tool

Source: Internet
Author: User

The internal network of an enterprise has enough bandwidth to use. However, the Internet access for enterprises is generally limited. To improve the quality of use of the network and ensure that users use the bandwidth of the entire network according to the business design requirements in the network, you can analyze and optimize the Linux system from the perspective of the traffic control server, it brings convenience and efficiency to Enterprise Services. Now we will introduce the specific use of the traffic control TC. The first is the total usage of TC.


TC command. The kernel supports setting QoS support, QoS and/or fair queueing = y. Usage:
# Tc [OPTIONS] OBJECT {COMMAND | help}


Where
OBJECT :={ qdisc | class | filter}
OPTIONS: = {-s [tatistics] |-d [etails] |-r [aw]}


The following describes the usage of queues, categories, and filters in TC.
1. Queue qdisc in TC) Usage
In queue use, the kernel supports setting QoS support, QoS and/or fair queueing = y. Usage:
 

 
 
  1. #tc qdisc [ add | del | replace | change | get ] dev STRING  
  2. [ handle QHANDLE ] [ root | ingress | parent CLASSID ]  
  3. [ estimator INTERVAL TIME_CONSTANT ]  
  4. [ [ QDISC_KIND ] [ help | OPTIONS ] ]  
  5. #tc qdisc show [ dev STRING ] [ingress]  


Where
 

 
 
  1. QDISC_KIND: = {[p | B] fifo | tbf | prio | cbq | red | etc .}
  2. OPTIONS: =... try tc qdisc add <desired QDISC_KIND> help
  3. In the CBQ queue qdisc cbq), QoS support, QoS and/or fair queueing, CBQ packet scheding, and Rate estimator = y must be set in the kernel. Usage:
  4. ... Cbq bandwidth BPS avpkt BYTES [mpu BYTES]
  5. [Cell BYTES] [ewma LOG]


2. Classification class in TC) Usage
For classification, the kernel supports setting QoS support, QoS and/or fair queueing, and Packet classifier API = y. Usage:
 

 
 
  1. #tc class [ add | del | change | get ] dev STRING  
  2. [ classid CLASSID ] [ root | parent CLASSID ]  
  3. [ [ QDISC_KIND ] [ help | OPTIONS ] ]  
  4. #tc class show [ dev STRING ] [ root | parent CLASSID ] 


Where
 

 
 
  1. QDISC_KIND: = {prio | cbq | etc .}
  2. OPTIONS: =... try tc class add <desired QDISC_KIND> help
  3. & Nbsp; tc cbq class cbq) usage:
  4. <Ccid_nobr>
  5. <Table width = "400" border = "1" cellspacing = "0" cellpadding = "2"
  6. Bordercolorlight = "black" bordercolordark = "# FFFFFF" align = "center">
  7. <Tr>
  8. <Td bgcolor = "e6e6e6" class = "code" style = "font-size: 9pt">
  9. <Pre> <ccid_code>... cbq bandwidth BPS rate BPS maxburst PKTS [avpkt BYTES]
  10. [Minburst PKTS] [bounded] [isolated]
  11. [Allot BYTES] [mpu BYTES] [weight RATE]
  12. [Prio NUMBER] [cell BYTES] [ewma LOG]
  13. [Estimator INTERVAL TIME_CONSTANT]
  14. [Split CLASSID] [defmap MASK/CHANGE]


3. Usage of filters in TC)
When using the filter, the kernel supports setting QoS support, QoS and/or fair queueing, and Packet classifier API = y. Usage:
 

 
 
  1. #tc filter [ add | del | change | get ] dev STRING  
  2. [ pref PRIO ] [ protocol PROTO ]  
  3. [ estimator INTERVAL TIME_CONSTANT ]  
  4. [ root | classid CLASSID ] [ handle FILTERID ]  
  5. [ [ FILTER_TYPE ] [ help | OPTIONS ] ]  
  6. #tc filter show [ dev STRING ] [ root | parent CLASSID ]  


Where
 

 
 
  1. FILTER_TYPE := { rsvp | u32 | fw | route | etc. }  
  2. FILTERID := ... format depends on classifier, see there  
  3. OPTIONS := ... try tc filter add <desired FILTER_KIND> help  


Usage of TC U32 filter u32:
 

 
 
  1. ... U32 [match SELECTOR...] [link HTID] [classid CLASSID]
  2. [Police export e_spec] [offset OFFSET_SPEC]
  3. [Ht HTID] [hashkey HASHKEY_SPEC]
  4. [Sample]
  5. Or u32 divisor


Where
 

 
 
  1. SELECTOR := SAMPLE SAMPLE ...  
  2. SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} } SAMPLE_ARGS  
  3. FILTERID := X:Y:Z  


Usage of tc fw filter fw:
... Fw [classid CLASSID] [police paie_spec]


Where
Export e_spec: =... look at TBF
CLASSID: = X: Y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.