![]() |
|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Hi all,
Before now I've only used IPFW + Dummynet, but decided to use PF and ALTQ for dynamic shaping. But I can't make it use whole bandwidth when there is only one host on, so the link is free, borrow parameter is designed to expand parent bandwidth when it is free, but not in my case current configuration gives host only 50% of bandwidth even when the link is free, here is PF config: Code:
ext_if="rl0" # int_if="rl1" # lan="192.168.10.0/24" # LAN set loginterface $ext_if table <user1_ips> { 192.168.10.2, 192.168.10.5 } #IP addresses of user1 table <user2_ips> { 192.168.10.3 } #IP of user2 scrub in all # IN altq on $int_if cbq bandwidth 100Mb queue { inet_in, default_in } queue inet_in bandwidth 512Kb { user1_in, user2_in } queue user1_in bandwidth 50% cbq(red, borrow) queue user2_in bandwidth 50% cbq(red, borrow) queue default_in bandwidth 99% cbq(default) # OUT altq on $ext_if cbq bandwidth 100Mb queue { inet_out, default_out } queue inet_out bandwidth 256Kb { user1_out, user2_out } queue user1_out bandwidth 50% cbq(red, borrow) queue user2_out bandwidth 50% cbq(red, borrow) queue default_out bandwidth 99% cbq(default) # NAT nat on $ext_if from $lan to !$lan -> $ext_if # Queues # IN pass in on $int_if from <user1_ips> to !$lan queue user1_out no state pass in on $int_if from <user2_ips> to !$lan queue user2_out no state # OUT pass out on $int_if from !$lan to <user1_ips> queue user1_in no state pass out on $int_if from !$lan to <user2_ips> queue user2_in no state Thanks! |
|
|||
![]()
s0xxx thanks for your reply!
seems that I've resolved the bandwidth problem by specifying borrow in paren queue: Code:
# IN altq on $int_if cbq bandwidth 100Mb queue { inet_in, default_in } queue inet_in cbq(borrow) bandwidth 512Kb { user1_in, user2_in } queue user1_in bandwidth 50% cbq(red, borrow) queue user2_in bandwidth 50% cbq(red, borrow) queue default_in bandwidth 99% cbq(default) Quote:
|
|
|||
![]()
Thanks for your advices, but it didn't work so far.
It seems that when I specified borrow in parent queues (inet_in and inet_out) I only allowed them to borrow from "grandparent" queue, which is 100Mb - so it is not 50% anymore, but really is the same as with no shaping at all! I also tried different approaches. See (in attachment) what pfctl -sq -vv looks like when user2 is downloading (commented out user1 for simplicity) On user2 machine wget shows stable 32K/s! Quote:
Code:
# Queues # OUT #pass in on $int_if from <user1_ips> to !$lan queue user1_out no state pass in on $ext_if from <user2_ips> to !$lan queue user2_out no state # IN #pass out on $int_if from !$lan to <user1_ips> queue user1_in no state pass out on $int_if from !$lan to <user2_ips> queue user2_in no state |
|
||||
![]()
First, I am not a pf expert.
![]() Code:
ext_if="rl0" # int_if="rl1" # lan="192.168.10.0/24" set loginterface $ext_if table <user1_ips> { 192.168.10.2, 192.168.10.5 } table <user2_ips> { 192.168.10.3 } scrub in all # NAT nat on $ext_if from $lan to !$lan -> $ext_if # IN altq on $int_if cbq bandwidth 99Mb queue { inet_in, default_in } queue inet_in bandwidth 512Kb { user1_in, user2_in } queue user1_in bandwidth 50% cbq(red, borrow) queue user2_in bandwidth 50% cbq(red, borrow) queue default_in bandwidth 99% cbq(default) # OUT altq on $ext_if cbq bandwidth 99Mb queue { inet_out, default_out } queue inet_out bandwidth 256Kb { user1_out, user2_out } queue user1_out bandwidth 50% cbq(red, borrow) queue user2_out bandwidth 50% cbq(red, borrow) queue default_out bandwidth 99% cbq(default) block in on $ext_if all block out on $ext_if all # TAGGING on users pass in on $int_if from $lan pass in on $int_if from <user1_ips> to any tag USER1 pass in on $int_if from <user2_ips> to any tag USER2 # Queues # IN pass out on $int_if from any to $lan queue default_in pass out on $int_if from any to <user1_ips> queue user1_in pass out on $int_if from any to <user2_ips> queue user2_in # OUT pass out on $ext_if from ($ext_if) to any queue default_out pass out on $ext_if from ($ext_if) to any tagged USER1 queue user1_out pass out on $ext_if from ($ext_if) to any tagged USER2 queue user2_out ![]()
__________________
The best way to learn UNIX is to play with it, and the harder you play, the more you learn. If you play hard enough, you'll break something for sure, and having to fix a badly broken system is arguably the fastest way of all to learn. -Michael Lucas, AbsoluteBSD |
![]() |
Tags |
borrow, cbq, freebsd, pf filter |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Traffic Shaping | LordZ | OpenBSD Security | 6 | 19th January 2009 04:30 PM |
Ajax dynamic table/spreadsheet | robbak | Programming | 1 | 7th June 2008 10:33 PM |
dhcpd problems... dynamic and static leases present | edhunter | FreeBSD General | 7 | 16th May 2008 02:34 PM |