Hullo all. Despite searching both this and the misc@ lists, and porting to misc@ and getting useful responses that I should look at http://www.probsd.net/pf/index.php/Hednod%27s_HFSC_explained and http://calomel.org/pf_hfsc.html (which I did) I am still failing spectacularly to understand how to properly do HFSC.
Having previously posted asking 'How do I do this?' I though perhaps I would get better answers if I tried 'This is what I've tried, what am I doing wrong?'. What I'm trying to do: We have a leased line for hosting our servers. We don't use anywhere near that much, so we resell the spare capacity to other tenants in our building, providing a {A,S}DSL-like service. In our setup, this means that we have pools of 20 clients, who then contend for the bandwidth allocated to that pool. ADSL-alike gets 2Mb down and 256Kb up, SDSL gets 2Mb both ways. At the moment, we are on an old setup, from before I'd heard of HFSC. There is a single pair of rules for each pool, and all clients in that pool get their up- and downstream traffic assigned to those queues. This sucks, because if any one client tries to whore over their connection, they can take up the entire allocation for their pool. Instead, I would like to have it so that each client has their own queue, which is guaranteed their 20th of the bandwidth, and then contends with the other clients in their pool for the remaining 19 20ths. Below is my initial attempt at the queue definitions: # Queueing altq on $ext_if bandwidth 9.7Mb hfsc(linkshare 9.7Mb upperlimit 9.7Mb) queue { adsl_up, sdsl_up, default_up } altq on $int_if bandwidth 9.7Mb hfsc(linkshare 9.7Mb upperlimit 9.7Mb) queue { adsl_dn, sdsl_dn, default_dn } # All numbers set the same, because that's how the Hednod example had. Not sure why. queue adsl_up bandwidth 256Kb hfsc(realtime 128Kb linkshare 256Kb) { adsl_client1_up, adsl_client2_up } queue adsl_dn bandwidth 2048Kb hfsc(realtime 512Kb linkshare 2048Kb) { adsl_client1_dn, adsl_client2_dn } queue sdsl_up bandwidth 2048Kb hfsc(realtime 512Kb linkshare 2048Kb) { sdsl_client1_up, sdsl_client2_up } queue sdsl_dn bandwidth 2048Kb hfsc(realtime 512Kb linkshare 2048Kb) { sdsl_client1_dn, sdsl_client2_dn } # (Not sure if the realtime bit is needed...) # Not sure how to do this bit at all in fact. # Want it so that each pool can take up to 2Mb, but if they're not using it, its available to default. # ADSL # Clients get a guaranteed 1/20th of the bandwidth, and fight with their peers # over the remaining 19/20th. # 256/20=12, 2048/20=102 (rounded to whole Kb) queue adsl_client1_up bandwidth 12Kb hfsc(realtime 12Kb linkshare 256Kb) queue adsl_client1_dn bandwidth 100Kb hfsc(realtime 100Kb linkshare 2048Kb) queue adsl_client2_up bandwidth 12Kb hfsc(realtime 12Kb linkshare 256Kb) queue adsl_client2_dn bandwidth 100Kb hfsc(realtime 100Kb linkshare 2048Kb) # SDSL # Clients get a guaranteed 1/20th of the bandwidth, and fight with their peers # over the remaining 19/20th. # 2048/20=102 (rounded to whole Kb) queue sdsl_client1_up bandwidth 100Kb hfsc(realtime 12Kb linkshare 256Kb) queue sdsl_client1_dn bandwidth 100Kb hfsc(realtime 100Kb linkshare 2048Kb) queue sdsl_client2_up bandwidth 100Kb hfsc(realtime 12Kb linkshare 256Kb) queue sdsl_client2_dn bandwidth 100Kb hfsc(realtime 100Kb linkshare 2048Kb) # Misc # non-DSL stuff gets whatever is left over # Default priority is 7, so make this have a lower priority queue default_up bandwidth 2Mb priority 5 hfsc(default realtime 1Mb linkshare 9Mb) queue default_dn bandwidth 2Mb priority 5 hfsc(default realtime 1Mb linkshare 9Mb) I initially tried with the bandwidth argument set to the 2Mb/256Kb size, thinking that this represented a maximum, but then pf complained that the subqueues added up to more than the parent, so I tried this. However, this way I still get: claudas:~# pfctl -nf /etc/pf.conf pfctl: linkshare sc exceeds parent's sc /etc/pf.conf:36: errors in queue definition pfctl: linkshare sc exceeds parent's sc /etc/pf.conf:37: errors in queue definition pfctl: linkshare sc exceeds parent's sc /etc/pf.conf:46: errors in queue definition pfctl: linkshare sc exceeds parent's sc /etc/pf.conf:51: errors in queue definition pfctl: linkshare sc exceeds parent's sc /etc/pf.conf:52: errors in queue definition claudas:~# uname -a OpenBSD claudas 4.2 GENERIC#1 amd64 claudas:~# I know I have misunderstood how the numbers work, but I just don't know how to make it all fit. For those of you who have made it this far, I thank you. Any ideas? (Si1ent)Dave Wilson