This is a BDP test in rhca, which is also a very common simulation of latency and packet loss. I will share it with you now.
We also use the application software to test TCP/UDP comparison. When we test the impact of BDP on TCP/IP, we all need some network latency and packet loss simulation, many commercial software can do this. In fact, the perfect Linux itself can use TC to implement this function. the netem in TC can simulate latency, packet loss, repeated packets, and out-of-order functions.
We recommend that you use TC as the intermediate router to pick up two NICs and enable the routing function for testing.
The most basic use of TC
1234 |
tc qdisc show # Display tc qdisc add dev eth0 root ...... # Join tc qdisc change dev eth0 root ...... # Modify the existing qdisc, note, and add the same record. You can only use change to modify the record. tc qdisc del dev eth0 root # Delete |
Latency simulation in Linux
Set the latency of 3 S:
1 |
tc qdisc add dev eth0 root netem delay 3000ms |
A latency can be added after 3000 Ms. For example, '3000ms 3000 Ms' indicates 200 ms ± 2800 ms, and the latency range is between 3200 and.
The result is as follows:
Packet loss simulation in Linux
If the packet loss rate is set to 50%, iptables can simulate this, but you can run the following command:
1 |
tc qdisc change dev eth0 root netem loss 50% |
If we change the packet loss rate of the following 50% to 50% 80%, the packet loss rate is different from the above latency. This means the packet loss rate is between 50-80%.
Shown below