What is load-balancing?
=======================

Load-balancing is the ability to use more than one network interface/modem
at the same time, and sending traffic over both in such a way as to
effectively double the throughput (actually, it will "concatenate" the
number of modems to one).  So, for example, if you have a 28.8k modem, and a
14.4k modem, your throughput will effectively be 28.8+14.4 = 43.2k (YMMV).

What do I need to do load-balancing?
====================================

Obviously, you need more than one modem, and the same amount of phone
lines.  You also need a TCP/IP stack that can handle more than one
interface.  Linux and FreeBSD have no troubles here, but stacks like Trumpet
Winsock I don't believe would work (can you use Trumpet on more than one
modem at once?  Or even run two copies of Trumpet?)

How do I use it?
================

First, you must edit config.h (after typing ./configure) and change the
MAX_INTERFACES #define to the MAX number of interfaces you expect to have at
once.  Also, you MUST edit ppp/ppp.h and change NUM_PPP to the MAX number of
PPP interfaces you expect to use.  If all interfaces will be PPP, then these
2 should be the same.  If you don't intend to use PPP at all, then run
./configure with --disable-ppp.  Once you changed these 2 values, recompile
slirp.

Second, you have to setup slirp's configuration files properly.

Each modem (or "unit") needs to have it's own unit number, and it's own
configuration file called ~/.slirprc-N (where N is it's unit number) for
modem-specific configuration (eg: the baudrate, type (ppp or slip),
asyncmap/escapes if ppp is being used, etc).  You shouldn't have any general
stuff in there like "redir" or "add exec" commands, they go in ~/.slirprc.

Third, you need to configure your interfaces.  This will probably be
different on different OS's, but in general, you should give each interface
the same IP address (the remote address doesn't matter. XXXXX talk about
PPP)

And finally, you need to put "socket" in ~/.slirprc (or run slirp with "-s")
to enable slirp to listen for more unit connections.

Once you have the config files and interfaces ready, you connect all your
modems to the same shell account as the same user.  The first slirp that you
run should be run normally, as "slirp" (this is unit 0).  Then, in each
other connection, you type "slirp -l UNIT" where UNIT corresponds to that
connection's ~/.slirprc-UNIT file.  Do NOT give slirp any other flags
(except if it's unit 0), they will be ignored.  Also, the -l option MUST be
the first option.  If it succeeds, you should get a message like "Connected:
Attached as unit N on device D".  Once you have all the slirp's running, you
can "slattach" or "pppd" each device.

Note that you do not need to run all copies of slirp at once, THEN attach
them.  You can attach and detach modems as you wish.  For example, you could
be running slirp as unit 0 as usual, then when you feel like it, you dial-in
with your second modem and attach it while all the connections are still
active.  They will all continue as normal.

You can also detach each unit as you wish, by typing 5 ones ('1') into the
unit you wish to be disconnected (sending 5 zeroes ('0') will kill ALL the
unit's and all running slirp's).  When all unit's are disconnected, slirp
will sit in the background and wait.  If you do not re-attach a new unit in
10 minutes, slirp will exit. XXXXX options, this is "restart"



There are no limits to how many modems you can attach to one running slirp.
If you have 1200 modems, slirp will slurp them all up! :) I'd like to hear
of peculiarly high number of simultaneous connections anyone has tried :)


Limitations, etc.
=================

1) You MUST use the same MTU/MRU on all interfaces (and hence MTU/MRU should
only be in ~/.slirprc).  This is the only *real* limitation when using
load-balancing.  It is needed because of the way slirp allocates data
(mbufs) and the fact that at the TCP/UDP layer, slirp does not yet know over
which interface it is going to send the data, and so it can't tell how big
the packet is allowed to be. I suppose I *could* lift this restriction, but
I don't wanna :) (I don't think the extra code justifies the *small* gain).
You should also try and keep both MTU and MRU the same.

2) Because SLIP is dumb, you should be careful when attaching a new SLIP
unit.  As soon as you attach the new unit, slirp will start sending data
over it.  Try and slattach it quickly, and keep traffic to a minimum when
attaching.  PPP on the other hand does not suffer from this, since it will
not be active until the 2 ends negotiate all options etc. and mark the 
interface as "up".

3) Do NOT use vj compression any ANY of the interfaces when using more than
one link.  It will not work, period.

4) You can mix SLIP/PPP interfaces in whatever way you wish. eg: have 12
modems using PPP and 15 modems using SLIP (you should be so lucky :)


Tuning the connection
=====================

The ONLY thing slirp uses to determine the ratio of data which should go to
each unit, is the "baudrate" as given to it via ~/.slirprc-N.  The baudrate
should be the maximum theoretical throughput on that modem, and, more
importantly, each unit should be given a baudrate which is reflective of
it's performance relative to the other units.  ie: the ratio of any 2
"baudrate"'s on any 2 units should be the same as the ratio of the 2 modem's
speed. eg: if you have 2 modems that are the same speed, the "baudrate"
should also be the same.  Or, if one modem is twice as fast as the other,
then the baudrate should also be twice as fast as the other, etc.

During the initial tests, one tester was able to get 6.3-6.6K/sec using two
28.8k modems.

Good luck!


Dan ...
