htb-gen is now deprecated and it will not receive any further improvements, nor even maintenance.
3 years ago i've found a company devoted to networking sys-admin and ISPs solucitions named Sequre.
Now I'm proud to announce the successor of htb-gen now re-written from scratch in Ruby on Rails named SequreISP
Sequre ISP? is light years ahead of htb-gen in every single aspect, now it is possible to manage not only bandwidth limits but clients, plans, providers, load balancing, failover, port forwarding, and many, many other features that keep increasing every day.
Sequre ISP? comes as Free Software (AGPLv3) or, if you're interested in our experience and support mounting ISPs, with a commercial license.
So i invite you to go to sequreisp home page and the git-hubrepo.
New htb-gen-0.9beta-1 released, testers needed.
This release should be functional, not-test-at-all so feedback
highly is needed.
To get it up&running edit self-documented config files: htb-gen.conf and htb-gen-rates.conf
-htb-gen: merge with htb-gen0.9-advanced
-command line options updated
-htb-gen.conf: documentation updates and example
-htb-gen-rates.conf: documentation updates and example
-General docs update
02.06.2007 02:24 Htb-gen has evolved a lot since it release in feb/2006, but i have no
time to make a public decent documented and generalized release.
But right now i think that is better to put the stuff here, so others can
enjoy the notorious improvements (and maybe someone wants to help out)
Lets go to the hacks:
I have made 2 flavors of htb-gen (actually these are two real setups each one with different needs)
config files where touched and some documentation update was made in place.
Multiples ifaces support, you can have now mult. LAN and mult. ISPs.
Per host p2p percent of rate assignation
Named ISP/LAN and clients in the web-frontend
htb-init support removed (no one find this usefull)
pfifo_fast for prio class
Compatibility with bash v2
tc batch mode support, now both iptables and tc are batched,
huge speed impact on large setups and yet tc and iptables
command in the source are transparent readables
All features of htb-gen-0.9b
Grained prio/non_prio per host definition, you can setup per client:
prio_protos (as esp,gre,igmp or ie even udp to include all udp traffic)
prio_helpers (netfilter helpers)
Customizable defaults for the variables above
An php-based web front-end:
builded with PEAR Quick Form?
data entry safe-checks
innline graphics per client
There is also a per client graphic development, look at htb-graph script that collects data
triggered by a cron entry(look at cron.d/htb-graph), and put it in /var/lib/rrd/.
Then there is a perl-cig script at /usr/lib/cgi-bin/traffic.pl, that create and display the graphics
images each time you visit the page. The images are stored in /var/lib/rrd/img so apache need
to read and write in this directory.
The graphics are per client and have different color(ligth/dark green) for prio/non_prio traffic. :-)
There is a git repository up-to date with half of the clean-up work done, plz if you want to
contribute sends diffs against the git-repo version. To checkout the repository just do:
htb-gen is meant to be an easy, scalable, yet powerfull, bandwidth
management tool. You can set up/down portions of bandwith for each
host or network, that goes trough your router/firewall.
Prioritary traffic(web, mail, gaming, ftp, voip, streaming) is
preferred over Junk traffic(kazaa, emule, etc). Also dynamic
bandwith borrow and re-assignation is done betwen host thanks to
A web-frontend for config is avaible as well, so remote management
All bash based so it can be used in embedded routers/firewalls
Two backend are aviable:
generates raw tc commands
generates htb-init conf files (util for integration)
The packet clasification is done by iptables
The script has 2 configuration files and both are self documented.
The firstone is htb-gen.conf, among other things there are 4 essential vars
iface_down="eth1" # Server LAN iface iface_up="eth0" # Server INET iface total_rate_down=1024 #Total download bw total_rate_up=512 #Total upload bw
Te secondone is htb-gen-rates.conf, here you can setup the rates for the hosts(or you can use the web-frontend for this)
# down down up up # min max min max #ip (rate) (ceil) (rate) (ceil) 192.168.1.2 0 64 0 32 192.168.1.3 0 128 0 64 192.168.1.4 0 256 0 128 10.0.0.1/30 256 512 128 256 188.8.131.52 256 256 256 256
As you see
-Is extremly easy to maintain a large amount of hosts/networks
-ips from different newtorks are allowed(they have to pass FORWARD anyway)
-newtork syntax is allowed, bw will be assigned to the network
-fixed rate support, i can garantee some bw.
-A 0(zero) in rate means that it will be automagickly calculated based on the
ceil weigth, and the unassigned bandwidth
After this you run 'htb-gen tc_all' (for the tc backend) and your are done!
The bw that you assign for each host is divided like this (this can be
easy addapted if you know a litle bit of iptables):
packets smallest than 100bytes (tcp ACKs, most icmp messages)
all icmp traffic (icmp messages)
all udp traffic (voip, streaming, real time gaiming, etc...)
some tcp ports (seteable in conf file, ie: http,pop3,imap,ssh...)
-Default traffic (junk traffic)
all traffic that do not mach any of the above (ie:emule, torrent,
kazaa, gnutella...and so on)
By thefault the host bandwidth is shared betwen this two kind of traffic, but
the script grants that anytime that i use prio traffic it will climb up to
90%, till that 'prio traffic' ends. This % can be modified if you want, see
the 'rate_dfl_percet' value in conf. Also is posible to save junk bandwith
assigning only a % of host ceil to the dfl traffic, see 'ceil_dfl_percet'.
This will help to have several host sharing bw without almost any complaint.
Where it works
This script is instalable in a Linux Firewall(NAT/Router) (even on embebed
ones) that connects two or more networks.
In general there are two networks: Internet and a LAN(or a set of public IPs)
At any place where is a shared Internet access for multiple users (Small or
medium range ISP and WISP, neighbourhood wireless/wired LAN, university, etc) htb-gen will provide easy, fair and managed bandwidth distribution.