在freebsd下使用ipfw+dummynet 实现流量控制
两条queue
192.168.1.11->192.168.2.100
192.168.1.21->192.168.2.100
udp packet,weight 设置为1:2
通过ipfw命令添加相关的pipe和queue
命令如下:
ipfw add 18002 queue 4 udp from 192.168.1.11 to any in via eth0
ipfw add 18008 queue 8 udp from 192.168.1.21 to any in via eth0
ipfw pipe 10 config bw 30Mbits/s
ipfw queue 4 config pipe 10 weight 1
ipfw queue 8 config pipe 10 weight 2
ipfw add 18006 queue 5 udp from any to 192.168.1.11 in via eth1
ipfw add 18008 queue 9 udp from any to 192.168.1.21 in via eth1
ipfw pipe 20 config bw 512Kbits/s
ipfw queue 5 config pipe 20 weight 1
ipfw queue 9 config pipe 20 weight 2
添加之后ipfw结果如下:
ipfw show
18002 0 0 queue 4 udp from 192.168.1.11 to any in recv eth0
18004 0 0 queue 5 udp from any to 192.168.1.11 in recv eth1
18006 0 0 queue 8 udp from 192.168.1.21 to any in recv eth0
18008 0 0 queue 9 udp from any to 192.168.1.21 in recv eth1
# ipfw pipe list
00010: 3.000 Mbit/s 0 ms 50 sl. 0 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
00020: 512.000 Kbit/s 0 ms 50 sl. 0 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
q00004: weight 1 pipe 10 50 sl. 1 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot __Source IP/port____ ____Dest. IP/port____ Totpkt/bytes Pkt/Byte Drp
0 udp 192.168.1.11/1693 192.168.2.100/2516 4058 5633298 4 5368 0
q00005: weight 1 pipe 20 50 sl. 1 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 udp 192.168.2.100/2516 192.168.1.11/1693 713 42760 0 0 0
q00008: weight 2 pipe 10 50 sl. 1 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 udp 192.168.1.21/2062 192.168.2.100/2515 7476 10377977 0 0 0
q00009: weight 2 pipe 20 50 sl. 1 queues (1 buckets) droptail
mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 udp 192.168.2.100/2515 192.168.1.21/2062 1315 78880 0 0 0
问题是:
如果将pipe bw设置为3Mbit/s, 那么wfq调度成功,按照1:2分享3M带宽,从上面显示pipe list的流量显示也可以看出来,
pipe bw 设置为30Mbit/s,wfq调度失败,不能实现预期的1:2的bw分配,请问这是什么原因呢?
还请高手指导一下