首页 > 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年6月1日00:19 | #1

    Some online drug stores will market authentic medicines yet will certainly when does viagras patent expire swipe your details making extra money as well as market it as newsletter that would certainly result in a chaotic mail box. You can likewise face a bank card scams due to the fact that on the internet pharmacies come to be privy to such info after the financial transaction. Hence, you need to ensure that the Canadian pharmacy online has a reliable info safety plan in place.
    viagrausa com [url=http://toppharmacyusa.com/]viagraplus com[/url]

  2. 2018年6月1日01:56 | #2

    Seeking to repair your storage door opener?

  3. 2018年6月1日02:10 | #3

    These drivers can even change tires on automobiles.

  4. 2018年6月6日05:43 | #4

    Many roadside restore services advertise towing.

  5. 2018年6月6日10:12 | #5

    cialis 20 mg tablet
    [url=http://cialisec.com/]cheap cialis online[/url]
    cialis coupons printable walmart
    buy cheap cialis online
    kroger pharmacy cialis price

  6. 2018年6月6日21:49 | #6

    There are two sorts of spring system openers.

  7. 2018年6月7日01:33 | #7

    Search for the online drug store’s certificate number, phone number is there a generic cialis as well as physical address on the website. Likewise look for the regulative body that takes care of its operations. Most governing bodies have a list of signed up drug stores on their web site. Phone the pharmacy and check whether a pharmacist is readily available to speak with you and also take your order. [url=http://bingpharmacyrx.com/]cheap canadian drugs[/url]
    buy viagra online without prescription

  8. 2018年6月7日03:06 | #8

    Tow truck drivers work long hours every day.

  9. 2018年6月7日11:59 | #9

    Tow truck drivers work lengthy hours every day.

  10. 2018年6月7日13:28 | #10

    Add mulch to the soil so the plants develop nicely.

  11. 2018年6月7日18:35 | #11

    Customers notice the little issues like soiled home windows.

  12. 2018年6月7日20:25 | #12

    Garage doorways assist ensure the security of a home.

  13. 2018年6月11日16:39 | #13

    Course needs will certainly differ from college to institution, generic sildenafil citrate so you will certainly need to do your research. In fact there could be several other demands for different Pharm.D. programs, so I have give a chart that details needed courses at every pharmacy school. For specific program numbers equivalencies, you will certainly have to perform your own search on the Internet or speak to the admission offices at each college of drug store.
    northwestpharmacy com scam [url=http://canadianpharmacyextra.com/]cheap medications online[/url]

  14. 2018年6月21日11:37 | #14

    What Do Talent Agents Look For In Actors?

  15. 2018年6月21日13:02 | #15

    Nicely rounded folks often make good actors.

  16. 2018年6月21日16:56 | #16

    What Do Expertise Agents Look For In Actors?

  17. 2018年6月22日00:59 | #17

    Effectively rounded folks often make good actors.

  18. 2018年6月22日05:39 | #18

    Head turns allow the eyes to comment on a situation.

  19. 2018年6月22日06:40 | #19

    medicine canada onlinefdf
    medical drug canadian pharmacy usa
    prescription drugs pills
    walg [url=http://hansolav.net/blog/ct.ashx?id=0af6301b-e71f-44be-838f-905709eee792&url=https://tinyurl.com/ycuc7s82]medication canada[/url]

  20. 2018年6月22日08:06 | #20

    What Do Expertise Agents Look For In Actors?

  21. 2018年6月22日17:16 | #21

    Most actors invest their time and efforts poorly.

  22. 2018年6月22日17:31 | #22

    Most actors make investments their time and efforts poorly.

  23. 2018年6月22日18:25 | #23

    Properly rounded individuals normally make good actors.

  24. 2018年6月22日18:59 | #24

    Head turns permit the eyes to touch upon a state of affairs.

  25. 2018年6月22日22:39 | #25

    What Do Talent Agents Look For In Actors?

  26. 2018年6月22日23:52 | #26

    Most actors make investments their time and efforts poorly.

  27. 2018年6月23日02:34 | #27

    Most actors invest their time and efforts poorly.

  28. 2018年6月23日04:03 | #28

    Most actors invest their time and efforts poorly.

  29. 2018年6月23日11:32 | #29

    Nicely rounded folks usually make good actors.

  30. 2018年6月23日14:57 | #30

    Head turns permit the eyes to comment on a state of affairs.

  31. 2018年6月23日16:40 | #31

    Properly rounded individuals often make good actors.

  32. 2018年6月23日19:22 | #32

    What Do Expertise Agents Look For In Actors?

  33. 2018年6月24日00:17 | #33

    Head turns enable the eyes to comment on a scenario.

  34. 2018年6月24日16:39 | #34

    What Do Talent Agents Look For In Actors?

  35. 2018年6月24日17:57 | #35

    What Do Talent Agents Look For In Actors?

  36. 2018年6月24日18:57 | #36

    Well rounded individuals often make good actors.

  37. 2018年6月25日06:27 | #37

    Nicely rounded folks usually make good actors.

  38. 2018年6月25日10:25 | #38

    What Do Expertise Brokers Look For In Actors?

  39. 2018年7月5日03:42 | #39

    Post writing is also a excitement, if you be familiar with afterward you can write otherwise it is difficult to
    write.

  40. 2018年7月6日16:29 | #40

    cvs pharmacy simi valley
    It is not essential that a Canadian pharmacy online adheres to [url=http://cvspharmacyexpress.com/#cvs-pharmacy-prescription-return-policy]cvs pharmacy locations[/url] all the top quality standards established by the Canadian regulatory authorities. Of the hundreds of on the internet drug stores cvs pharmacy porter ranch operational in the country, only a few are authentic as well as have the required licenses. As stated prior to the license for marketing drugs is offered by the rural authorities. So the first thing one needs to do is to check whether the drug store is signed up and also has the required licenses. If yes, the license and also registration number must be clearly presented on the Canadian pharmacy online internet site.

  41. 2018年7月14日22:40 | #41

    Nevertheless steam cleansing is a misnomer.

  42. 2018年7月15日13:01 | #42

    The double entry system uses nominal ledger accounts.

  43. 2018年7月16日18:56 | #43

    This makes you expensive carpets recent and clear.

评论分页
订阅评论
4+4= (必填)