On Thu, 13 Jul 2000, Ian C.Sison wrote:

> A linux packet shaper is definitely the way to go (at least for one who doesn't
> want to shell out the $$$ for a cisco or packeteer).  Unfortunately there's so
> little documentation on the linux advanced router for it to be very useful
> right now.  But i've tried it, and it works!  If you are willing and interested
>  to invest in the time to set up a packet shaping linux server, this is the
> solution for you.  

There's an advanced routing how-to at:
        http://www.linuxdocs.org/Adv-Routing-HOWTO.html

The documentation is fantastic, but it is so recondite and abstruse as to
be of absolutely no value whatsoever (just kidding guys!). Actually, I
could hardly make head nor tail of it (perhaps a real networking guru
could), and so I make use of cbq, which is a script that implements the
commands that you read about in the HOWTO and which you configure with a
readable text file.

Here's an example of a cbq config file. I've included the comments so you 
get a better idea of what it does:

--begin file
# This is an example of using CBQ (Class Based Queueing) and policy-based
# filter for building smart ethernet shapers. All CBQ parameters are
# correct only for ETHERNET (eth0,1,2..) linux interfaces. It works for
# ARCNET too (just set bandwidth parameter to 2Mbit). It was tested
# on 2.1.125-2.1.129 linux kernels (KSI linux, Nostromo version) and 
# ip-route utility by A.Kuznetsov (iproute2-ss981101 version). 
# You can download ip-route from ftp://ftp.inr.ac.ru/ip-routing or
# get iproute2*.rpm (compiled with glibc) from ftp.ksi-linux.com.
# 
# 
# HOW IT WORKS
# 
# Each shaper must be described by config file in $CBQ_PATH
# (/etc/sysconfig/cbq/) directory - one config file for each CBQ shaper.
# 
# Some words about config file name:
# Each shaper has its personal ID - two byte HEX number. Really ID is 
# CBQ class.
# So, filename looks like:
# 
# cbq-1280.My_first_shaper
# ^^^ ^^^  ^^^^^^^^^^^^^
#  |  |            |______ Shaper name - any word
#  |  |___________________ ID (0000-FFFF), let ID looks like shaper's rate
#  |______________________ Filename must begin from "cbq-" 
# 
# 
# Config file describes shaper parameters and source[destination] 
# address[port].
# For example let's prepare /etc/sysconfig/cbq/cbq-1280.My_first_shaper:
# 
# ----------8<---------------------
# DEVICE=eth0,10Mbit,1Mbit
# RATE=128Kbit
# WEIGHT=10Kbit
# PRIO=5
# RULE=192.168.1.0/24
# ----------8<---------------------
# 
# This is minimal configuration, where:
# DEVICE:  eth0   - device where we do control our traffic
#          10Mbit - REAL ethernet card bandwidth
#          1Mbit  - "weight" of :1 class (parent for all shapers for eth0),
#                   as a rule of thumb weight=batdwidth/10.
#          100Mbit adapter's example: DEVICE=eth0,100Mbit,10Mbit
#          *** If you want to build more than one shaper per device it's
#              enough to describe bandwidth and weight once  - cbq.init
#              is smart :) You can put only 'DEVICE=eth0' into cbq-* 
#              config file for eth0.
# 
# RATE:    Shaper's speed - Kbit,Mbit or bps (bytes per second)
# 
# WEIGHT:  "weight" of shaper (CBQ class). Like for DEVICE - approx. RATE/10
# 
# PRIO:    shaper's priority from 1 to 8 where 1 is the highest one.
#          I do always use "5" for all my shapers.
# 
# RULE:    [source addr][:source port],[dest addr][:dest port]
#          Some examples:
# RULE=10.1.1.0/24:80         - all traffic for network 10.1.1.0 to port 80
#                               will be shaped.
# RULE=10.2.2.5               - shaper works only for IP address 10.2.2.5   
# RULE=:25,10.2.2.128/25:5000 - all traffic from any address and port 25 to
#                               address 10.2.2.128 - 10.2.2.255 and port 5000
#                               will be shaped.
# RULE=10.5.5.5:80,           - shaper active only for traffic from port 80 of
#                               address 10.5.5.5
# Multiple RULE fields per one config file are allowed. For example:
# RULE=10.1.1.2:80
# RULE=10.1.1.2:25
# RULE=10.1.1.2:110

---end file 
> But if you're already got a high end cisco, or are used to the GUI, knobs, bells
> and whistles of a commercial packet shaper configurator, then go with that, it
> will save you a lot of grief.
> 

I found the cbq install to be pretty "griefless". It actually comes with
the shapecfg-2.2.12.rpm package of RedHat. You have to install the
iproute2 package too, but it's linked as a dependency, so if you don't
have it you will be prompted for it.

The stock kernels provided by RedHat don't have the advanced routing
kernel modules required by cbq and iproute, so you either roll your own or
find a stock kernel that does. which is what I did. The caldera kernel
image package does contain these kernel modules, so I just installed that
(it's RPM too after all).

Works great! If you ever wanted to shape traffic on your lan (give that
office mate that only looks at porno the whole day only 8 kbps so that he
doesn't hog all the bandwidth!), this is the way to go! You can also shape
traffic going to dialup access servers, routers (for leased line
clients).. the possibilities are endless...

Cito Maramba, M.D.
Asst. Prof, Univ. of the Phil. College of Medicine <[EMAIL PROTECTED]>



-
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to