Simulating a bad internet connection

后端 未结 4 1032
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 13:42

I\'m developing an embedded device which has access to the internet through LAN. I\'m in the testing phase now, and I would like to test how the device performs when the connect

4条回答
  •  佛祖请我去吃肉
    2021-01-30 14:03

    You may use (almost) any linux distribution from liveCd (like ubuntu, mandriva, others) to run it on any hardware you want, and use the kernel-based tool netem, aka "Network Emulation" with the "iproute2" package tools. It lets you control delays, package loss, corruption, duplication and other possible problems of wide area network.

    There is list of most used simulations, like:

    • Rate control using Token Bucket Filter:

      tc qdisc add dev eth0 root handle 1:0 netem delay 100ms
      tc qdisc add dev eth0 parent 1:1 handle 10: tbf rate 256kbit buffer 1600 limit 3000
      
    • Delay all packets by fixed time: tc qdisc add dev eth0 root netem delay 100ms

    • Package loss: tc qdisc change dev eth0 root netem loss 0.1%

提交回复
热议问题