
                              <<DNS Balance>>

 By: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>



[1. What's this]

 DNS Balance is a load-balancing DNS server.
Today's Web server, like "kernel.org", "*bsd.org" and Ring Server Project
(http://www.ring.gr.jp/) are mirrored all over the world. DNS Balance
selects fast server from all over the world for DNS resolver.

 DNS Balance has these functions:

o Dynamic load balancing.
o Answer different IP address between DNS client's IP address.
o Minimun implement. DNS Balance can serv only A record. This may be
  good for security.


[2. What you need]

 DNS Balance requires Ruby (http://www.ruby-lang.org/).
So, you must install it. Some PC-UNIX has binary packages.


[3. What you do]

1. Extract the archive.
2. File "addrdb.rb" is the address database. You must edit this for
   your site.

------------------
$addr_db = {
  "130.12" => {                # => Request from 130.12.*.*
                               #    For example, DNS client's IP is
                               #    "123.45.67.89", search "123.45.67.89",
                               #    "123.45.67", "123.45","123".
    "www.foo.com" => [         # => IP address for "www.foo.com"
                               #    This host name must be lower case character.
      [[1,2,3,4], 0],          # => IP address and badness information.
      [[1,2,3,5], 10000],      #    Badness must be 0-10000. 0 is for fastest
      [[1,2,3,6], 9000],       #    server, and 10000 is for downed server.
      [[1,2,3,7], 9000],
    ],
  },
  "default" => {               # => If theres nothing to match, use "default".
    "www.foo.com" => [
      [[1,2,3,4], 0],
      [[1,2,3,5], 100],
      [[1,2,3,6], 1000],
      [[1,2,3,7], 9000],
    ],
    "localhost" => [
      [[127,0,0,1], 0],
    ],
  },
}
------------------

3. If your addrdb.rb is too complex to maintain, you can use namespace.rb .

------------------
$namespace_db = {
  "127"        => "localnet",     # Write IP address and its alias name.
  "192.168"    => "foo-net",      # If client IP is 123.45.67.89, search
  "130.199"    => "foo-net",      # "123.45.67.89", "123.45.67", "123.45",
  "130.123.12" => "foo-net",      # "123".
}
------------------

   If you use namespace.rb , you can write this way.

------------------
$addr_db = {
  "localnet" => {
    "www.foo.com" => [
      [[1,2,3,6], 2000],
      [[1,2,3,7], 1000],
    ],
  },
  "foo-net" => {
    "www.foo.com" => [
      [[1,2,3,4], 0],
      [[1,2,3,5], 100],
    ],
  },
  "default" => {
    "www.foo.com" => [
      [[1,2,3,4], 0],
      [[1,2,3,5], 10000],
      [[1,2,3,6], 9000],
      [[1,2,3,7], 9000],
    ],
  },
}
------------------

4. Run DNS Balance. You must be root user befor run and change to
   installed directory. Type "ruby dns_balance.rb" for run DNS Balance.

5. If exists a file named "addr", DNS Balance is loads automatically every
   5 minutes. This file contains same database as "addrdb.rb".
   I make some sample script like CSV -> address database converter.
   See "sample" directory

6. If you run DNS Balance with "-l" option, DNS Balance output some log
   information. "-i xxx.xxx.xxx.xxx" to specify listen IP address.
   And "-h" to display some help message.


[4. Copyright]

 See README.dns_balance.

 If you want newer version, see my homepage.
   URL http://www.netlab.is.tsukuba.ac.jp/~yokota/
       http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/dns_balance/

 Any questions and suggestions are welcome.

                  2000/11/29: YOKOTA Hiroshi (yokota@netlab.is.tsukuba.ac.jp)
