首页 > linux, ubuntu, xen > linux tc 对本机网卡限速

linux tc 对本机网卡限速

2010年1月25日 eric 发表评论 阅读评论

今天由于项目要测试在网络环境不好的情况下,会不会对平台有所影响,要求测试限制服务器流量,我想到了TC,我对TC不是很了解, google了一下,看到了不少文章都是做路由用的,对我来说不是很实用,因为我是对单机测试。先看看TC命令在说,没想到报错,错误如下:
shell$> tc -s qdisc
RTNETLINK answers: Invalid argument
看到这个错误很迷茫,命令是支持的啊,在网上查询了很久,发现是内核不支持,不支持QOS,不支持正常,因为我的内部测试服务器用XEN,虚拟的系统,所以我重新编译DomU内核,添加 QOS,CBQ等

环境:
xen domU : ubuntu-server 8.0.4  IP:192.168.6.101
kernel : linux-2.6.18-xen
xen dom0 : ubuntu-server 8.0.4  IP:192.168.6.209
操作:

DomU $> tc -s qdisc
RTNETLINK answers: Invalid argument

进入父系统:
Dom0 $> cd xen-3.4.2
编译xen DomU 内核
Dom0 $> make linux-2.6-xenU-config CONFIGMODE=menuconfig
选择 Networking  —>
          Networking options  —>
                QoS and/or fair queueing  —>
                      [*] QoS and/or fair queueing
把下面的最好都选上吧 * 是打入内核,M 是以模块方式。我全选择 *
选择好,保存退出

Dom0 $> make linux-2.6-xenU-build        

Dom0 $> cd xen-3.4.2/dist/install/boot

Dom0 $> scp vmlinuz-2.6.18.8-xenU root@192.168.6.101:~

好,然后进入 DomU

DomU $> ls
vmlinuz-2.6.18.8-xenU
覆盖 以前的vmlinuz-2.6.18.8-xenU
DomU $> mv vmlinuz-2.6.18.8-xenU /boot/
DomU $> reboot

重启后,在进入系统,看是否还报错:

DomU $> tc -s qdisc
好没有报错“下来我们对 服务器 1935 端口进行限速,限制为 上传下载都为50Kbit

CBQ 算法:

DomU $> tc qdisc del dev eth0 root
DomU $> tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 cell 8
DomU $> tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate 50Kbit weight 50Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
DomU $> tc class add dev eth0 parent 1:1 classid 1:4 cbq bandwidth 100Mbit rate 50Kbit weight 50Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
DomU $> tc qdisc add dev eth0 parent 1:4 handle 40: sfq
DomU $> tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip sport 1935 0xffff flowid 1:4

好了 连接 1935 试试吧`

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/29.html

  1. 2018年8月24日14:20 | #1

    Garnet is proven to be a fast and clear blast media.

  2. 2018年8月24日15:24 | #2

    In this type of blasting, air and dry ice are used.

  3. 2018年8月25日21:05 | #3

    To realize this, sandblasting gear is used.

  4. 2018年8月26日09:25 | #4

    Garnet is confirmed to be a fast and clear blast media.

  5. 2018年8月26日09:41 | #5

    Garnet is confirmed to be a fast and clear blast media.

  6. 2018年8月27日17:25 | #6

    Garnet is proven to be a quick and clear blast media.

  7. 2018年8月28日13:38 | #7

    In the sort of blasting, air and dry ice are used.

  8. 2018年9月9日15:09 | #8

    best online prices for http://firstones.net/forums/profile/simaulmer online purchase.

  9. 2018年9月20日01:44 | #9

    An impressive share! I have just forwarded this onto
    a colleague who was doing a little homework on this. And he in fact bought me dinner because I stumbled upon it for him…
    lol. So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanx for spending the time to talk about this subject here on your web page.

  10. 2018年10月5日01:13 | #10

    Asking questions are truly fastidious thing if
    you are not understanding anything entirely, however
    this post gives good understanding yet.

  11. 2018年10月5日06:08 | #11

    Do you have a spam issue on this website; I also am a blogger, and I was wanting to
    know your situation; we have developed some nice methods and
    we are looking to trade techniques with others, please shoot me an email if interested.

  12. 2018年10月5日15:36 | #12

    What’s up to all, how is everything, I think every one is getting more from this website, and your views are fastidious for new users.

  13. 2018年10月6日04:38 | #13

    Wonderful post! We are linking to this particularly great article on our website.
    Keep up the great writing.

  14. 2018年10月6日21:26 | #14

    Pretty nice post. I just stumbled upon your weblog and wanted to say
    that I have really enjoyed browsing your blog posts. In any case
    I will be subscribing to your rss feed and I hope you write
    again soon!

  15. 2018年10月7日00:10 | #15

    Greetings I am so grateful I found your webpage, I really found you
    by accident, while I was browsing on Aol for something else, Anyways I am here now and would just like
    to say thanks a lot for a fantastic post and a all round
    enjoyable blog (I also love the theme/design), I don’t have time
    to go through it all at the moment but I have bookmarked it and also added your
    RSS feeds, so when I have time I will be back to read a lot
    more, Please do keep up the fantastic jo.

  16. 2018年10月7日14:47 | #16

    I like it when people get together and share ideas. Great site,
    stick with it!

  17. 2018年10月7日18:01 | #17

    Hello there, just became aware of your blog through Google, and found that
    it’s really informative. I am going to watch out for brussels.
    I’ll appreciate if you continue this in future.

    Many people will be benefited from your writing. Cheers!

  18. 2018年10月9日11:53 | #18

    Hi! I just want to offer you a huge thumbs up for the excellent information you’ve got right here
    on this post. I’ll be returning to your web site for more soon.

  19. 2018年10月10日19:00 | #19

    Hi there would you mind stating which blog platform you’re using?
    I’m going to start my own blog in the near future but I’m having
    a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design seems different then most blogs and I’m looking for something unique.

    P.S Sorry for being off-topic but I had to ask!

  20. 2018年10月11日19:13 | #20

    Amazing things here. I am very happy to see your post. Thank you
    a lot and I’m taking a look ahead to contact you. Will you please drop me a e-mail?

  21. 2018年10月16日20:25 | #21

    Hello! I could have sworn I’ve been to this website before but
    after checking through some of the post I realized it’s
    new to me. Nonetheless, I’m definitely delighted I
    found it and I’ll be book-marking and checking back often!

  22. 2018年10月17日06:01 | #22

    I think this is one of the most important info
    for me. And i am glad reading your article. But should remark on some
    general things, The web site style is wonderful, the articles
    is really excellent : D. Good job, cheers

  23. 2018年10月18日22:28 | #23

    I studied in a number of colleges for acting.

  24. 2018年11月7日13:55 | #24

    I have fun with, lead to I discovered just what I used to be looking for.

    You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day.
    Bye

  25. 2018年11月9日07:29 | #25

    What’s up, just wanted to tell you, I enjoyed this
    article. It was funny. Keep on posting!

  26. 2018年11月10日11:33 | #26

    Hello there! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My site looks weird
    when browsing from my iphone4. I’m trying to find a template or plugin that might be
    able to resolve this issue. If you have any suggestions, please share.
    Thank you!

  27. 2018年11月11日06:17 | #27

    Unquestionably imagine that that you said. Your favourite reason appeared
    to be on the internet the simplest factor to be aware of.

    I say to you, I definitely get annoyed at the same time as other folks think about worries that they just do not know about.
    You managed to hit the nail upon the top and defined
    out the entire thing with no need side-effects , other folks could
    take a signal. Will probably be back to get more. Thank
    you

  28. 2018年11月12日04:59 | #28

    This is very interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of
    your wonderful post. Also, I’ve shared your web site in my
    social networks!

  29. 2018年11月12日23:27 | #29

    Heya just wanted to give you a quick heads up and let you know a few of
    the images aren’t loading correctly. I’m not sure why but I think its
    a linking issue. I’ve tried it in two different internet browsers and both show the same outcome.

  30. 2018年11月15日15:36 | #30
  31. 2018年11月15日23:50 | #31
  32. 2018年11月16日08:27 | #32
  33. 2018年11月17日00:36 | #33

    You have made some decent points there. I checked on the web
    for more information about the issue and found most people will go along with your views on this site.

  34. 2018年11月17日06:02 | #34

    Sling tv coupons and promo codes for november 2018
    Wow! After all I got a website from where I be capable of in fact get
    useful data regarding my study and knowledge. Sling tv coupons and promo codes for november 2018

  35. 2018年11月19日15:40 | #35

    What’s Happening i am new to this, I stumbled upon this I’ve discovered It absolutely useful and it has helped me out loads.
    I am hoping to give a contribution & aid different users like its aided me.
    Good job.

  36. 2018年11月20日06:39 | #36

    Hello, this weekend is pleasant in favor of me, because this
    occasion i am reading this great educational paragraph here at my
    house.

  37. 2018年11月20日21:30 | #37

    Its like you read my mind! You seem to know so much about this,
    like you wrote the book in it or something. I think that you could do with a few pics to drive the message
    home a little bit, but other than that, this is
    magnificent blog. A fantastic read. I’ll certainly be back.

  38. 2018年11月22日16:11 | #38

    Does your website have a contact page? I’m having problems
    locating it but, I’d like to shoot you an e-mail.
    I’ve got some suggestions for your blog you might
    be interested in hearing. Either way, great site and I look forward to
    seeing it develop over time.

  39. 2018年11月25日01:18 | #39

    With investing, your capital is at risk.

  40. 2018年12月1日15:01 | #40
  41. 2018年12月1日20:51 | #41
  42. 2018年12月4日18:26 | #42

    https://installmentloans2018.com/ – oregon payday loans

  43. 2018年12月5日00:01 | #43

    Fantastic blog! Do you have any recommendations for aspiring writers?
    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for
    a paid option? There are so many choices out there that I’m totally confused ..
    Any suggestions? Thanks!

  44. 2018年12月7日08:39 | #44

    [url=https://albendazoletablets.com/]albendazole[/url] [url=https://antabuse250.com/]antabuse[/url] [url=https://tadacip2019.com/]tadacip[/url] [url=https://buyzithromaxonline.com/]zithromax[/url] [url=https://celebrex200.com/]generic celebrex 200mg[/url]

  45. 2018年12月7日14:16 | #45

    Fantastic beat ! I wish to apprentice while you
    amend your site, how could i subscribe for
    a blog website? The account aided me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided
    bright clear idea

  46. 2018年12月9日11:08 | #46
评论分页
1 2 3 4 29
订阅评论
0+9= (必填)