Linux 使用netem进行带宽限制?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10481032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bandwidth throttling using netem?
提问by confused1
I am trying to emulate a network as (bitrate: 200kbps , packetloss: 0.03, delay: 400ms) and I am using netem.
我正在尝试将网络模拟为(比特率:200kbps,丢包率:0.03,延迟:400ms)并且我正在使用 netem。
tc qdisc add dev eth1 root handle 1:0 netem delay 400ms loss 0.03%
tc qdisc add dev eth1 parent 1:1 handle 10: tbf rate 200kbit buffer 1600 limit 3000
When i run this i am getting error stating
当我运行这个时,我收到错误说明
RTNETLINK answers: No such file or directory
Where am I going wrong? how can I do it better?
我哪里错了?我怎样才能做得更好?
采纳答案by confused1
tc qdisc add dev eth1 root handle 1:0 tbf rate 200kbit buffer 1600 limit 3000
tc qdisc add dev eth1 parent 1:0 handle 10: netem delay 400ms loss 0.03%
This worked. Seriously not sure about the difference between this two,
这奏效了。严重不确定这两者之间的区别,
回答by Kamal Kumar
Please refer http://edseek.com/~jasonb/articles/traffic_shaping/classes.html
请参考http://edseek.com/~jasonb/articles/traffic_shaping/classes.html
--> edseek link is dead - try the archive.is page: http://archive.is/o4UTQ
--> edseek 链接已失效 - 尝试 archive.is 页面:http: //archive.is/o4UTQ
--> or perhaps better: http://www.lartc.org
--> 或者更好:http: //www.lartc.org
==:> and yet another good resource: http://myconfigure.blogspot.com/2012/03/traffic-shaping.html
==:> 另一个很好的资源:http: //myconfigure.blogspot.com/2012/03/traffic-shaping.html
Please get the below cmds to set eth as per your requirements.
请获取以下 cmds 以根据您的要求设置 eth。
tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 1: htb default 1
tc class add dev eth1 parent 1: classid 0:1 htb rate 200kbit
tc qdisc add dev eth1 parent 1:1 handle 10: netem delay 400000 5 loss 0.03%
tc qdisc ls dev eth1
tc class ls dev eth1