我正在尝试使用 netem 模拟网络中的抖动。我使用以下命令:
sudo tc qdisc add dev eno3 root netem delay 200ms 100ms
此命令是 ping 另一个 IP 的输出:
$ ping 10.82.96.254 -c 10
PING 10.82.96.254 (10.82.96.254) 56(84) bytes of data.
64 bytes from 10.82.96.254: icmp_seq=1 ttl=255 time=258 ms
64 bytes from 10.82.96.254: icmp_seq=2 ttl=255 time=233 ms
64 bytes from 10.82.96.254: icmp_seq=3 ttl=255 time=295 ms
64 bytes from 10.82.96.254: icmp_seq=6 ttl=255 time=260 ms
64 bytes from 10.82.96.254: icmp_seq=8 ttl=255 time=212 ms
64 bytes from 10.82.96.254: icmp_seq=4 ttl=255 time=4466 ms
64 bytes from 10.82.96.254: icmp_seq=5 ttl=255 time=4474 ms
64 bytes from 10.82.96.254: icmp_seq=7 ttl=255 time=4459 ms
64 bytes from 10.82.96.254: icmp_seq=9 ttl=255 time=4476 ms
64 bytes from 10.82.96.254: icmp_seq=10 ttl=255 time=4453 ms
--- 10.82.96.254 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9051ms
rtt min/avg/max/mdev = 212.173/2359.059/4476.181/2107.031 ms, pipe 5
通常,使用此命令,我预计往返时间会在 100 到 300 毫秒之间变化,因此这些 4400 毫秒的回复确实让我感到惊讶。如果我只生成时间延迟,一切似乎都正常工作:
$ ping 10.82.96.254 -c 10
PING 10.82.96.254 (10.82.96.254) 56(84) bytes of data.
64 bytes from 10.82.96.254: icmp_seq=1 ttl=255 time=202 ms
64 bytes from 10.82.96.254: icmp_seq=2 ttl=255 time=200 ms
64 bytes from 10.82.96.254: icmp_seq=3 ttl=255 time=200 ms
64 bytes from 10.82.96.254: icmp_seq=4 ttl=255 time=200 ms
64 bytes from 10.82.96.254: icmp_seq=5 ttl=255 time=202 ms
64 bytes from 10.82.96.254: icmp_seq=6 ttl=255 time=201 ms
64 bytes from 10.82.96.254: icmp_seq=7 ttl=255 time=201 ms
64 bytes from 10.82.96.254: icmp_seq=8 ttl=255 time=200 ms
64 bytes from 10.82.96.254: icmp_seq=9 ttl=255 time=200 ms
64 bytes from 10.82.96.254: icmp_seq=10 ttl=255 time=203 ms
--- 10.82.96.254 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9003ms
rtt min/avg/max/mdev = 200.365/201.286/203.059/1.013 ms
我正在运行 Ubuntu 18.04 服务器映像,其中所有软件包都是最新的。我在 16.04 中使用相同的实用程序来生成网络损伤,我认为它在使用相同硬件的先前 Linux 发行版 16.04LTS 上运行良好。
一个小细节是,我在 eno3 和 eno4 之间运行一座桥,并且通过 eno1 访问 Linux 服务器。
答案1
这似乎是 4.15 内核的一个错误。为了解决这个问题,您需要更新到 4.18 或降级 Linux 内核。这是 Launchpad 中对该问题的描述:关联