我在一台专用服务器(proxmox-ve-2.6.32:3.4-165(运行内核:2.6.32-42-pve))上,使用 95 百分位规则,并且希望确保不破坏它。我有一个 1gbit 链接,我的合同为我提供了 100mbits 的 95 百分位。因此,我希望将我的带宽始终限制为 100mbits。
我尝试使用 wondershaper 但没有成功,需要一些帮助:
#ifconfig
eth0 Link encap:Ethernet HWaddr xxx
inet6 addr: xxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:273688 errors:0 dropped:0 overruns:0 frame:0
TX packets:33946 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:409128994 (390.1 MiB) TX bytes:4016030 (3.8 MiB)
Interrupt:20 Memory:f7f00000-f7f20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:313 errors:0 dropped:0 overruns:0 frame:0
TX packets:313 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:49781 (48.6 KiB) TX bytes:49781 (48.6 KiB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet6 addr: fe80::1/128 Scope:Link
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:351 errors:0 dropped:0 overruns:0 frame:0
TX packets:338 errors:0 dropped:5 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:180727 (176.4 KiB) TX bytes:109667 (107.0 KiB)
vmbr0 Link encap:Ethernet HWaddr xxx
inet addr:xxx Bcast:xxx Mask:255.255.255.248
inet6 addr: xxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:35361 errors:0 dropped:0 overruns:0 frame:0
TX packets:33722 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:392904370 (374.7 MiB) TX bytes:4002892 (3.8 MiB)
没有奇迹塑造者:
wget -O /dev/null http://speedtest.dal01.softlayer.com/downloads/test100.zip
--2015-10-15 10:12:35-- http://speedtest.dal01.softlayer.com/downloads/test100.zip
Resolving speedtest.dal01.softlayer.com (speedtest.dal01.softlayer.com)... 74.86.116.210, 2607:f0d0:1003:31::2
Connecting to speedtest.dal01.softlayer.com (speedtest.dal01.softlayer.com)|74.86.116.210|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104874307 (100M) [application/zip]
Saving to: `/dev/null'
39% [============================================================================> ] 41,468,482 27.3M/s ^C
我配置了 wondershaper:
# wondershaper vmbr0 1000000 1000000
结果...:
wget -O /dev/null http://speedtest.dal01.softlayer.com/downloads/test100.zip
--2015-10-15 10:12:56-- http://speedtest.dal01.softlayer.com/downloads/test100.zip
Resolving speedtest.dal01.softlayer.com (speedtest.dal01.softlayer.com)... 74.86.116.210, 2607:f0d0:1003:31::2
Connecting to speedtest.dal01.softlayer.com (speedtest.dal01.softlayer.com)|74.86.116.210|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104874307 (100M) [application/zip]
Saving to: `/dev/null'
0% [ ] 61,970 18.4K/s eta 87m 39s ^C
(介于 6ko/秒和 18ko/秒之间......)
本次测试后在 wondershaper 上的配置:
#wondershaper vmbr0
qdisc cbq 1: root refcnt 2 rate 10000Kbit (bounded,isolated) prio no-transmit
Sent 546883 bytes 776 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
qdisc sfq 10: parent 1:10 limit 127p quantum 1514b divisor 1024 perturb 10sec
Sent 15781 bytes 123 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 20: parent 1:20 limit 127p quantum 1514b divisor 1024 perturb 10sec
Sent 530850 bytes 647 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b divisor 1024 perturb 10sec
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc ingress ffff: parent ffff:fff1 ----------------
Sent 695844 bytes 1291 pkt (dropped 20, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
class cbq 1: root rate 10000Kbit (bounded,isolated) prio no-transmit
Sent 252 bytes 6 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:1 parent 1: rate 1000Mbit (bounded,isolated) prio 5
Sent 547619 bytes 772 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:10 parent 1:1 leaf 10: rate 1000Mbit prio 1
Sent 16769 bytes 125 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:20 parent 1:1 leaf 20: rate 900000Kbit prio 2
Sent 530850 bytes 647 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
class cbq 1:30 parent 1:1 leaf 30: rate 800000Kbit prio 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
borrowed 0 overactions 0 avgidle 12500 undertime 0
有任何想法吗?
答案1
我还没有找到使用 wondershaper 修复此问题的方法,但找到了使用 ethtool 执行相同操作的另一种方法:
ethtool -s eth0 speed 100 duplex full