Article title: basic implementation and usage of Linux Traffic control. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Generally, the internal network of an enterprise has enough bandwidth to use. However, the Internet access for enterprises is 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. Next, let's take a look at the implementation and usage of Linux traffic control.
Basic implementation of Linux Traffic control
In Linux, the traffic controller (TC) establishes a queue at the output port to implement traffic control. Linux kernel 2.1.105 supports traffic control and needs to be re-compiled during use. The basic implementation of Linux Traffic control can be simply described. We can see how the kernel processes the received packets, generates the sent packets, and sends them to the network.
Basic implementation of Linux Traffic control
After receiving the package, Input De-Multiplexing is used to determine the selection. if the packet is sent to the host, the package is sent to the upper layer for processing; otherwise, you need to forward the received packet to the Forwarding Block. The forwarding block also receives packets generated by the upper layer of the host (such as TCP and UDP. The next hop of the processed package is determined by viewing the route table. Then, arrange the packages to send them to the Output Interface ). Linux traffic control is implemented during sorting.
Basic traffic control framework
As shown in 2, Linux traffic control is implemented by three major components:
◆ Queue rule (Queue Discipline)
◆ Category (Classes)
◆ Filter (Filters)
Therefore, Linux traffic control is mainly divided into three aspects: establishing a queue, establishing a classification, and creating a filter. The basic implementation steps are as follows:
(1) bind a queue to a network physical device (such as the Ethernet card eth0;
(2) create a category on the queue;
(3) Create a routing-based filter for each category.