PragaOrgAr: DevPraga/htb-gen

htb-gen (home/small/medium ISP bandwidth solution)

IMPORTANT NOTICE – READ THIS

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-hub repo.

Or you can just check the on-line demo at http://sequreisp.sequre.com.ar/ (user: admin@sequre.com.ar, pass: 1234)

Regards.

Luciano Ruete, author of htb-gen.

News

11.06.2007 00:17

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

Then run:

#htb-gen all

download from:

htb-gen-0.9b-1.tar.gz Source tarball

or git-[pull|clone] from:

http://www.lugmen.org.ar/~luciano/git-repo/htb-gen/.git

Some changlelog:

-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.

* First flavor (htb-gen natural evolution)

htb-gen-0.9b.tar.gz Source tarball

– 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

– Code simplification

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

* Second flavor (htb-gen advanced)

htb-gen-0.9b-advanced.tar.gz Source tarball

– All features of htb-gen-0.9b

– Grained prio/non_prio per host definition, you can setup per client:

– prio_tcp_ports

– prio_udp_ports

– 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

* Bonus

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:

# git-clone http://www.lugmen.org.ar/~luciano/git-repo/htb-gen/.git

Good luck, and plz mail me any clean-up of this!

Description

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

htb boundaries.

web-frontend for config is avaible as well, so remote management

is possible.

All bash based so it can be used in embedded routers/firewalls

(wired/wireless).

Two backend are aviable:

The packet clasification is done by iptables

Configuration

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

200.80.22.2     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!

Download

htb-gen-0.8.4.tar.gz Source tarball

htb-gen_0.8.4_all.deb Debian package

htb-gen-0.8.4–1.noarch.rpm Aliened RPM package

htb-gen-0.8.4.ebuild Gentoo ebuild (Txs Ariyx!)

Beta version(see News section at top for details)

htb-gen-0.9b-1.tar.gz Source tarball

Archive at http://www.praga.org.ar/dev/htb-gen/packages/

Freshmeat project page

http://www.freshmeat.net/projects/htb-gen/

License

GPLv2 or later

Requirements

-bash

-QoS htb kernel support

-iproute2 tc

-iptables

-htb-init script (optional)

How does it work

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):

-Prio traffic

-Default traffic (junk traffic)

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.

Autors

Luciano Ruete – luciano at praga org ar