如何用tc(Traffic Control)同时延迟流量和限制带宽?

如何用tc(Traffic Control)同时延迟流量和限制带宽?

我想限制带宽并增加网络接口的延迟来模拟卫星通信。例如 800ms 延迟和 1mb/s。

以下正确限制带宽但不会增加延迟:

 17:16:51 root@Panasonic_FZ-55 ~ # tc qdisc add dev eth0 root tbf rate 1024kbit latency 800ms burst 1540
 17:18:48 root@Panasonic_FZ-55 ~ # ping 10.10.91.58
PING 10.10.91.58 (10.10.91.58): 56 data bytes
64 bytes from 10.10.91.58: seq=0 ttl=64 time=0.938 ms
64 bytes from 10.10.91.58: seq=1 ttl=64 time=3.258 ms
64 bytes from 10.10.91.58: seq=2 ttl=64 time=1.259 ms
64 bytes from 10.10.91.58: seq=3 ttl=64 time=1.407 ms
^C
--- 10.10.91.58 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.938/1.715/3.258 ms
 17:18:56 root@Panasonic_FZ-55 ~ # iperf -c 10.10.91.58
------------------------------------------------------------
Client connecting to 10.10.91.58, TCP port 5001
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 10.10.91.57 port 34790 connected with 10.10.91.58 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.5 sec  1.38 MBytes  1.09 Mbits/sec
 17:19:19 root@Panasonic_FZ-55 ~ #

我的信息来自地点。

答案1

也许是 netem 模拟器:

tc qdisc add dev eth0 root netem delay 800ms rate 1mbit

相关内容