Bandwidth or flow rate unit:
Kbps |
Kbyte/sec |
Kilobytes per second |
Mbps |
Mbyte/sec |
Megabytes per second |
Kbit |
Kbits/sec |
|
Mbit |
Mbits/sec |
|
1 , Analog Delay Transfer
# 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.
2 , 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%.
3 , simulated packet duplication
# 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.
4 , simulated package 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)
5 , simulation package chaos sequence
# TC Qdisc Change 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
Using TC to simulate network delay and packet loss under Linux