欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

使用 linux 模拟广域网延迟 - Emulating wide area network delays with Linux

程序员文章站 2023-11-19 15:01:22
NetEm (already enabled in the Linux kernel) provides Network Emulation functionality for testing protocols by emulating the properties of wide area ne ......

netem (already enabled in the linux kernel) provides network emulation functionality for testing protocols by emulating the properties of wide area networks. 

to simulate an additional latency of 80 ms, just type sudo tc qdisc add dev eth0 root netem delay 80ms 
it just adds a fixed amount of delay to all packets going out of the local ethernet. 

to stop the additional latency, just type sudo tc qdisc change dev eth0 root netem delay 0ms 

lines to add to the file /etc/rc.local before exit 0, to add 40ms of latency :

# add +40ms latency tc qdisc add dev eth0 root netem delay 40ms

note: if your network interface is not eth0, replace eth0 with the name of your network interface

 

在调研 iperf 的时候,偶然看到。对项目很有帮助,原文链接:https://iperf.fr/iperf-servers.php#netem