Home | History | Annotate | Download | only in examples
      1 # CHANGES
      2 # -------
      3 # v0.3a2- fixed bug in "if" operator. Thanks kad (a] dgtu.donetsk.ua.
      4 # v0.3a-  added TIME parameter. Example:
      5 #         TIME=00:00-19:00;64Kbit/6Kbit
      6 #         So, between 00:00 and 19:00 RATE will be 64Kbit.
      7 #         Just start "cbq.init timecheck" periodically from cron (every 10
      8 #         minutes for example).
      9 #         !!! Anyway you MUST start "cbq.init start" for CBQ initialize.
     10 # v0.2 -  Some cosmetique changes. Now it more compatible with
     11 #         old bash version. Thanks to Stanislav V. Voronyi
     12 #         <stas (a] cnti.uanet.kharkov.ua>.
     13 # v0.1 -  First public release
     14 # 
     15 # README
     16 # ------
     17 # 
     18 # First of all - this is just a SIMPLE EXAMPLE of CBQ power.
     19 # Don't ask me "why" and "how" :)
     20 # 
     21 # This is an example of using CBQ (Class Based Queueing) and policy-based
     22 # filter for building smart ethernet shapers. All CBQ parameters are
     23 # correct only for ETHERNET (eth0,1,2..) linux interfaces. It works for
     24 # ARCNET too (just set bandwidth parameter to 2Mbit). It was tested
     25 # on 2.1.125-2.1.129 linux kernels (KSI linux, Nostromo version) and 
     26 # ip-route utility by A.Kuznetsov (iproute2-ss981101 version). 
     27 # You can download ip-route from ftp://ftp.inr.ac.ru/ip-routing or
     28 # get iproute2*.rpm (compiled with glibc) from ftp.ksi-linux.com.
     29 # 
     30 # 
     31 # HOW IT WORKS
     32 # 
     33 # Each shaper must be described by config file in $CBQ_PATH
     34 # (/etc/sysconfig/cbq/) directory - one config file for each CBQ shaper.
     35 # 
     36 # Some words about config file name:
     37 # Each shaper has its personal ID - two byte HEX number. Really ID is 
     38 # CBQ class.
     39 # So, filename looks like:
     40 # 
     41 # cbq-1280.My_first_shaper
     42 # ^^^ ^^^  ^^^^^^^^^^^^^
     43 #  |  |            |______ Shaper name - any word
     44 #  |  |___________________ ID (0000-FFFF), let ID looks like shaper's rate
     45 #  |______________________ Filename must begin from "cbq-" 
     46 # 
     47 # 
     48 # Config file describes shaper parameters and source[destination] 
     49 # address[port].
     50 # For example let's prepare /etc/sysconfig/cbq/cbq-1280.My_first_shaper:
     51 # 
     52 # ----------8<---------------------
     53 # DEVICE=eth0,10Mbit,1Mbit
     54 # RATE=128Kbit
     55 # WEIGHT=10Kbit
     56 # PRIO=5
     57 # RULE=192.168.1.0/24
     58 # ----------8<---------------------
     59 # 
     60 # This is minimal configuration, where:
     61 # DEVICE:  eth0   - device where we do control our traffic
     62 #          10Mbit - REAL ethernet card bandwidth
     63 #          1Mbit  - "weight" of :1 class (parent for all shapers for eth0),
     64 #                   as a rule of thumb weight=batdwidth/10.
     65 #          100Mbit adapter's example: DEVICE=eth0,100Mbit,10Mbit
     66 #          *** If you want to build more than one shaper per device it's
     67 #              enough to describe bandwidth and weight once  - cbq.init
     68 #              is smart :) You can put only 'DEVICE=eth0' into cbq-* 
     69 #              config file for eth0.
     70 # 
     71 # RATE:    Shaper's speed - Kbit,Mbit or bps (bytes per second)
     72 # 
     73 # WEIGHT:  "weight" of shaper (CBQ class). Like for DEVICE - approx. RATE/10
     74 # 
     75 # PRIO:    shaper's priority from 1 to 8 where 1 is the highest one.
     76 #          I do always use "5" for all my shapers.
     77 # 
     78 # RULE:    [source addr][:source port],[dest addr][:dest port]
     79 #          Some examples:
     80 # RULE=10.1.1.0/24:80         - all traffic for network 10.1.1.0 to port 80
     81 #                               will be shaped.
     82 # RULE=10.2.2.5               - shaper works only for IP address 10.2.2.5   
     83 # RULE=:25,10.2.2.128/25:5000 - all traffic from any address and port 25 to
     84 #                               address 10.2.2.128 - 10.2.2.255 and port 5000
     85 #                               will be shaped.
     86 # RULE=10.5.5.5:80,           - shaper active only for traffic from port 80 of
     87 #                               address 10.5.5.5
     88 # Multiple RULE fields per one config file are allowed. For example:
     89 # RULE=10.1.1.2:80
     90 # RULE=10.1.1.2:25
     91 # RULE=10.1.1.2:110
     92 # 
     93 # *** ATTENTION!!!
     94 # All shapers do work only for outgoing traffic!
     95 # So, if you want to build bidirectional shaper you must set it up for
     96 # both ethernet card. For example let's build shaper for our linux box like:
     97 # 
     98 #                     ---------             192.168.1.1
     99 # BACKBONE -----eth0-|  linux  |-eth1------*[our client]
    100 #                     ---------
    101 # 
    102 # Let all traffic from backbone to client will be shaped at 28Kbit and
    103 # traffic from client to backbone - at 128Kbit. We need two config files:
    104 # 
    105 # ---8<-----/etc/sysconfig/cbq/cbq-28.client-out----
    106 # DEVICE=eth1,10Mbit,1Mbit
    107 # RATE=28Kbit
    108 # WEIGHT=2Kbit
    109 # PRIO=5
    110 # RULE=192.168.1.1
    111 # ---8<---------------------------------------------
    112 # 
    113 # ---8<-----/etc/sysconfig/cbq/cbq-128.client-in----
    114 # DEVICE=eth0,10Mbit,1Mbit
    115 # RATE=128Kbit
    116 # WEIGHT=10Kbit
    117 # PRIO=5
    118 # RULE=192.168.1.1,
    119 # ---8<---------------------------------------------
    120 #                 ^pay attention to "," - this is source address!
    121 # 
    122 # Enjoy.
    123