Tc
如何用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 ~ #
我從這個網站得到了我的資訊。
也許是 netem 模擬器:
tc qdisc add dev eth0 root netem delay 800ms rate 1mbit