[文章作者:张宴 本文版本:v1.0 最后修改:2008.11.20 转载请注明原文链接:http://blog.zyan.cc/post/380/]
Linux下限制网卡的带宽,可用来模拟服务器带宽耗尽,从而测试服务器在此时的访问效果。
1、安装iproute
2、限制eth0网卡的带宽为50kbit:
3、限制带宽为50kbit后,在百兆局域网中wget下载一个大文件:
下载速度为457K/s,限制效果达到。
4、解除eth0网卡的带宽限制:
5、对比:未作带宽限制情况下,在百兆局域网中wget下载一个大文件:
下载速度为6.16MB/s。
Linux下限制网卡的带宽,可用来模拟服务器带宽耗尽,从而测试服务器在此时的访问效果。
1、安装iproute
yum -y install iproute
2、限制eth0网卡的带宽为50kbit:
/sbin/tc qdisc add dev eth0 root tbf rate 50kbit latency 50ms burst 1000
3、限制带宽为50kbit后,在百兆局域网中wget下载一个大文件:
[root@localhost ~]# wget http://192.168.1.7/test.zip
--19:40:27-- http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23862312 (23M) [application/zip]
Saving to: `test.zip'
37% [=======> ] 8,994,816 457K/s eta 27s
--19:40:27-- http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23862312 (23M) [application/zip]
Saving to: `test.zip'
37% [=======> ] 8,994,816 457K/s eta 27s
下载速度为457K/s,限制效果达到。
4、解除eth0网卡的带宽限制:
/sbin/tc qdisc del dev eth0 root tbf
5、对比:未作带宽限制情况下,在百兆局域网中wget下载一个大文件:
[root@localhost ~]# wget http://192.168.1.7/test.zip
--19:44:33-- http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23862312 (23M) [application/zip]
Saving to: `test.zip'
100%[==========>] 23,862,312 6.14M/s in 3.7s
19:44:36 (6.16 MB/s) - `test.zip' saved [23862312/23862312]
--19:44:33-- http://192.168.1.7/test.zip
Connecting to 192.168.1.7:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23862312 (23M) [application/zip]
Saving to: `test.zip'
100%[==========>] 23,862,312 6.14M/s in 3.7s
19:44:36 (6.16 MB/s) - `test.zip' saved [23862312/23862312]
下载速度为6.16MB/s。
vex
2019-7-1 12:15
This article has suggested to me many new ideas. Hope you can continue to contribute your talents in this area. Thank you for sharing this great article.word games
test
2020-12-12 16:01
good
test
2020-12-12 16:08
good
shz
2022-7-3 18:03
Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily Lead generation
shz
2022-7-3 18:06
I don’t think many of websites provide this type of information. Lead generation
shzz
2022-7-3 18:07
Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers. Lead generation
shz
2022-7-3 18:08
Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. Lead generation
shzz
2022-7-3 18:09
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one Lead generation
shz
2022-7-3 18:11
Three are usually cheap Ralph Lauren available for sale each and every time you wish to buy. Lead generation
shzz
2022-7-3 18:12
Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks. Lead generation
shz
2022-7-3 18:13
This post is very simple to read and appreciate without leaving any details out. Great work! Lead generation
shzz
2022-7-3 18:15
This is really very nice post you shared, i like the post, thanks for sharing.. Lead generation
shz
2022-7-3 18:16
I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done! Lead generation
john
2022-11-7 21:23
. A hacker attempted to open a backdoor into nearly a million WordPress-based sites. Cyber security services
UFABET
2023-5-18 16:15
Amazing content ever! Thank you for sharing! UFABETUFA365UFABET เข้าสู่ระบบยูฟ่าเบท
meeloun
2024-4-7 15:29
对于留学作业代写 http://www.cieae.net/liuxuezuoye 服务的需求逐渐增长。国际留学生面临着语言、文化等多方面的障碍,而一些本地学生也因为专业知识的限制或时间压力而需要外部帮助。留学作业代写服务的兴起迎合了这一需求,为学生提供了更多选择,帮助他们更好地完成学业。
分页: 3/3 1 2 3