Summary of delay commands for simulating packet loss in centos

Source: Internet
Author: User

Summary of delay commands for simulating packet loss in centos
Summary of delay commands for simulating packet loss in linux:


First, run the ifconfig command.



1. Set latency


Latency: sudo tc qdisc add dev eth0 root netem delay 30 ms
Latency in the range (10-50 ms): sudo tc qdisc add dev eth0 root netem delay 30 ms 20 ms
Set the delay to 30 ms, and about 20% packets will delay sending sudo tc qdisc add dev eth0 root netem delay 30 ms 20 ms 20%


Display delay settings: sudo tc qdisc show
Modification delay: sudo tc qdisc change dev eth0 root netem delay 40 ms
Deletion delay: sudo tc qdisc del dev eth0 root netem delay 40 ms




2. Set packet loss


Packet loss: sudo tc qdisc add dev eth0 root netem loss 10%.
10% of data packets are randomly dropped. The success rate is 20%: sudo tc qdisc add dev eth0 root netem loss 10% 20%.
Delete packet loss: sudo tc qdisc del dev eth0 root netem loss 10%


3. Duplicate simulated packages


1% duplicate packets are randomly generated: sudo tc qdisc add dev eth0 root netem duplicate 1%




4. data packet corruption


0.2% corrupted data packets are randomly generated: sudo tc qdisc add dev eth0 root netem packet upt 0.2%


5. unordered data packets


25% of data packets (related to 50%) will be sent immediately, and the other delay is 10 seconds: sudo tc qdisc change dev eth0 root netem delay 10 ms reorder 25% 50%


6. Check the configured network conditions for production


Sudo tc qdisc show dev eth0


7. Delete tc rules


Sudo tc qdisc del dev eth0 root

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.