PDA

View Full Version : ALTQ--traffic shaper


congavangkiev
May 5th, 2009, 00:53
I use ALTQ for traffic shaper.I can bandwidth limiter speed internet only download or upload client.But i want bandwidth limiter speed internet download and upload same time.

$ext_if = "10.119.16.6"
$int_if = "192.168.3.1"

altq on $ext_if cbq bandwidth 100Mb queue { pc_up1, pc_up2 }
queue pc_up1 bandwidth 2.5Mb cbq (default)
queue pc_up2 bandwidth 0.5Mb cbq (rio)

altq on $int_if cbq bandwidth 100Mb queue { pc_down1,pc_down2 }
queue pc_down1 bandwidth 4.5Mb cbq (default)
queue pc_down2 bandwidth 2Mb cbq (rio)
nat on $ext_if from 192.168.3.5 to any -> 10.119.16.6
pass in on $int_if from 192.168.3.5 to any queue pc_down # down
pass out on $ext_if from 192.168.3.5 to any queue pc_up2 # up
#save
#pfctl -f /etc/pf.conf
result speed test:
download : 2Mb (only 192.168.3.5 )
upload : 2.5Mb ( don't = 0.5 MB)

Say me please!
what can i do?
:(:(

Antti
May 7th, 2009, 22:03
ALTQ can only work with outgoing traffic, so "pass in" won't work with ALTQ.
I think you can specify pass out on ext_if to limit upload, and pass out on int_if to limit download.

DutchDaemon
May 7th, 2009, 23:04
ALTQ will work with pass out and pass in, simply because it is state-aware. In other words: return traffic on the pass in rule (like html pages and images served as a result of an incoming http request) will be handled by the queue named on that pass in rule. This is even more evident on busy bittorrent boxen sending out tons of ACKs ;)

By the same token, ICMP traffic associated with connections (notifications) will be handled by the queue of the rule handling that connection, even when ICMP isn't mentioned anywhere in rules or queue definitions.

So, altq does only work on outgoing traffic (as seen from the kernel), but pass in rules can (and should) be bound to outbound queues as well.

congavangkiev
May 15th, 2009, 01:30
Because I have problem in upload.Download,this right speed.But upload don't right.All computer (192.168.3.0/24) have upload speed = 2.5Mb ,because { cbq default = 2.5Mb } .But i want only 192.168.3.5 have speed = 0.5Mb , i can't