I have set up a HFSC repository on github. Feel free to pull, and if you have any improvements, send pull requests.
Since I started to use the internet telephony, the Quality of Service (QoS) started to be important. When my girlfriend opened a web page, the sound was going choppy. So what I want to is:
- Have a responsive remote terminal sessions over SSH
- Stable VoIP telephony
- Fast web browsing, but not hurting SSH nor VoIP
- Low-priority traffic for p2p applications, that uses all the bandwidth that isn’t being used for other services
That’s pretty much to want from a 256/128 ADSL line. However, doesn’t seem impossible.
Let’s try to write down classes of network traffic that I want to distinguish.
- Interactive: SSH sessions, DNS and small ACK packets for establishing TCP connections. They consume small amount of bandwidth, but they need to be fast.
- VoIP: Talking over the Internet can consume a lot of bandwidth, but it needs priority over browsing and the rest.
- Web browsing:Web generates short bursts of traffic. They need priority over p2p connections, but should wait for VoIP traffic.
- General traffic: All traffic that isn’t categorized otherwise. It has lower priority than browsing.
- P2P: It has the lowest priority of all, but can borrow bandwidth from all other classes, when they’re idle.
HFSC stands for Hierarchical Fair Service Queue. The curve means that you don’t define static bounds for bandwidth allocation for a class. Instead, you specify the early bandwidth allocation, then time and then late allocation.
In HTB, you could specify the minimum guaranteed and maximum usable bandwidth for a traffic class. The order of borrowing of the bandwidth was specified with the prio argument. There’s no prio in HFSC, in favor of time specs.
I must say, that HFSC isn’t documented very well in terms of usage with Linux (and iptables). I spend about three days browsing the web and putting together pieces of information about traffic shaping and HFSC. Finally, I’ve come up with something similar to the wondershaper.
It’s a shell script which sets up the HFSC traffic shaping and works with my ADSL connection. The configuration part is on the front. The body of the script has comments, telling what is being done.
If you’re ready to try, please download the HFSC traffic shaping shell script, edit the beginning to set your connection’s parameters and enjoy!