Linux TC Flow Control

Source: Internet
Author: User

TC Flow Control Project Background
    • vintage3.0 interface Lookupforupdage Adds a policy when bandwidth traffic TX or RX exceeds 40%,75% randomly returns 304; more than 60%, this interface returns 304
    • In order to control the flow of the test machine, TC is used: Set the network transmission rate; transfer large files: Generate network traffic
Generating large files

dd if=/dev/zero of=test bs=1M count=10000
Generates a 10000M test file with a full 0 file content
File is large, direct transmission with the computer room will take a few minutes
Note: The file transfer needs to be in the same room, can be full of bandwidth, if the cross-room, cannot play full bandwidth, also about more than 10 trillion.

About TC

For the time being, please refer to http://blog.csdn.net/daniel117/article/details/17350243

Flow control target Machine
    • Suppose Eth0 is the server's extranet network interface (you can use Ifconfig to find out the network interface used by the target machine). TC Queue Add Device interface root is the topmost handle, and the tag type uses the 1 class by default

      tc qdisc add dev eth0 root handle 1: htb default 1
      Explanation: Whether it is a queue or a class,filter, there are identifiers, such as the identifier, generally have the parent (father, upper layer), because Qdisc at the top, all the parent, with the root of the word identity, ID 1: to mark; default 1 means that when an IP stream does not meet any of the set filter rules, it is automatically grouped into Class 1

    • Create a class under Qdisc to make eth0 control the speed of the native to the outside network

      tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit ceil 1000mbit
      Explanation: Add classification to root queue 1:0 under eth0 and name 1:1, type HTB, speed 100mbit, maximum to 1000mbit.
      Special Note: nic metering bit, and we usually measure the byte conversion relationship is 8:1, so the rate of 100mbit is 12M, if you want to set the traffic to 25m,rate for 200mbit, as follows
      tc class add dev eth0 parent 1: classid 1:1 htb rate 200mbit ceil 1000mbit
      The traffic controlled here is send (send) that is TX, if you want to control the RX (receive) traffic, you need to set the machine to send traffic, such as to set the receive traffic 25M, then need to set the send traffic machine TC rate 200mbit

Practice
    • Based on the vintage project background, deploy Vintage-server at 10.13.1.135 to start the Vintage-server service
    • Analog TX (send) traffic exceeds 40%, such as 48M

      • Flow control for 10.13.1.135

      tc qdisc add dev eth0 root handle 1: htb default 1
      tc class add dev eth0 parent 1: classid 1:1 htb rate 400mbit ceil 1000mbit

      • 10.13.1.135 Create a large file dd If=/dev/zero of=test bs=1m count=10000
      • In 10.13.1.134 receive large file test,nc -l 1234 >test
      • Send large file test in 10.13.1.135,nc 10.13.1.134 1234
    • You can perform your own test tasks during large file transfers

    • Analog Rx (receive) traffic exceeds 60%, such as 72M

      • Flow control for 10.13.1.134

      tc qdisc add dev eth0 root handle 1: htb default 1
      tc class add dev eth0 parent 1: classid 1:1 htb rate 400mbit ceil 1000mbit

      * 10.13.1.134 Send large files
      * 10.13.1.135 receive large files

Automation tools

Cond

Linux TC Flow Control

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.