Netem and TC Flow control

Source: Internet
Author: User

First, Netem and TC:

Netem is a network emulation function module provided by Linux 2.6 and above kernel versions. The function module can be used to simulate complex Internet transmission performance in a well-performing LAN, such as low bandwidth, transmission delay, packet loss and so on. Many distributions of Linux with Linux 2.6 (or more) versions of the kernel feature the kernel, such as Fedora, Ubuntu, Redhat, OpenSuse, CentOS, Debian, and more.

TC is a tool in a Linux system with the full name traffic control (flow controls). TC can be used to control the operating mode of the Netem, that is, if you want to use Netem, you need at least two conditions, one is the kernel Netem function is included, the other is to have TC.

Note: This article describes the flow control can only control the package action, can not control the packet, and it directly to the physical interface, if the physical eth0 control, then the logical network card (such as Eth0:1) will also be affected, conversely, if you do control on the logical network card, the control may be invalid. (Note: Multiple network cards in a virtual machine can be considered as multiple physical network cards in a virtual machine.)
Second, analog delay transmission

# TC Qdisc Add dev eth0 root netem delay 100ms

This command sets the transmission of the eth0 NIC to a delay of 100 milliseconds to send.

In a more realistic case, the delay value will not be so accurate, there will be a certain fluctuation, we can use the following conditions to simulate the delay value with volatility:

# TC Qdisc Add dev eth0 root netem delay 100ms 10ms

This command sets the transmission of the ETH0 network card to a delay of 100ms±10ms (any value between a maximum of $ ms).

The randomness of this fluctuation can also be further enhanced:

# TC Qdisc Add dev eth0 root netem delay 100ms 10ms 30%

This command sets the transmission of the eth0 NIC to 100ms, and approximately 30% of the packets delay the ±10MS send.

Three, analog network packet loss:

# TC Qdisc Add dev eth0 root netem loss 1%

This command sets the transmission of the eth0 NIC to randomly discard 1% of packets.

You can also set the success rate of packet loss:

# TC Qdisc Add dev eth0 root netem loss 1% 30%

This command sets the transmission of the eth0 NIC to randomly discard 1% of packets, with a success rate of 30%.

Four, the simulation package repeat:

# TC Qdisc Add dev eth0 root netem duplicate 1%

This command sets the transmission of the eth0 NIC to randomly generate 1% of duplicate packets.

Five, Analog packet corruption:

# TC Qdisc Add dev eth0 root netem corrupt 0.2%

This command sets the transmission of the eth0 NIC to a randomly generated 0.2% corrupted packet. (kernel version is required at 2.6.16 or more)

Six, Analog packet chaos sequence:

# TC Qdisc Add dev eth0 root netem delay 10ms reorder 25% 50%

This command sets the transmission of the eth0 NIC to: 25% of the packets (50% related) are sent immediately, and the other is delayed by 10 seconds.

In the new version, the following command will also disrupt the order of the packages to some extent:

# TC Qdisc Add dev eth0 root netem delay 100ms 10ms


This article is from the "bad-kbase" blog, make sure to keep this source http://bad51men.blog.51cto.com/3141086/1693458

Netem and 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.