
The most up to date version of this document can be found at:
http://www3.sympatico.ca/jdrexler/Multi-pppoed-HOWTO.html

Multi-pppoed-HOWTO
==================

This mini-HOWTO explains how to use several PPPoE connections at the same
time, using Jamal Hadi Salim's pppoed program from
http://www.davin.ottawa.on.ca/pppoe/

You need at least version 0.3b1 for more than one connection.

Its maintainer is Josef Drexler, who can be reached at
jdrexler@julian.uwo.ca



Why multiple PPP connections?
-----------------------------

They go through the same ADSL modem, so what's the benefit of having several
connections? They share the same bandwidth anyway?

For example, I've signed up for Sympatico HSE, but also have the option to
connect to my university by authenticating to a special domain, instead of
sympatico.ca. Without two concurrent connections, I'd have to switch back
and forth between Sympatico and my university account.

By having Sympatico on ppp0 and my uni on ppp1 I can use the best of both
worlds.



How does it work?
-----------------

You need to follow these steps to get several (currently limited at 16) ppp
connections:

1) Installation

Install and compile pppoed. It's available here:
http://www.davin.ottawa.on.ca/pppoe/

Install the kernel patches, compile the kernel and reboot with the new
kernel.

Read the "INSTALL" file from the pppoed distribution for more information on
patching the kernel.


2) Create the special pppox devices
Use these commands, as root:
mknod /dev/pppox0 c 4 128
mknod /dev/pppox1 c 4 129
mknod /dev/pppox2 c 4 130

and so on, for up to 16 pppox devices. You only need to create those that
you will use, for example only pppox0 and pppox1 for two concurrent
connections.


3) Setup pppd, set up /etc/ppp/options
This is also explained in the INSTALL file from the pppoed distribution. One
small difference: do *not* include the "name b1xxxxx@sympatico" line, this
goes in a different file (see below).

This is the file I used:
# /etc/ppp/options

hide-password
#persist
lock
local
nocrtscts
sync
noauth
noaccomp
mtu 1484
mru 1484
noipdefault
noipx
novj
novjccomp

# ---<End of File>---

For more information on these options please see the pppd man page.

Then create /etc/ppp/options.pppox0 and put the username in there. This file
is read for connections through /dev/pppox0 only, for example you could put
your Sympatico account there, and have pppd add a default route for this
setup:
# /etc/ppp/options.pppox0

name "b1xxxxxx@sympatico.ca"
defaultroute
#debug

# ---<End of File>---


Do the same for /etc/ppp/options.pppox1, but give the other account. Note
that you can only have one default route, so put "nodefaultroute" in all
other /etc/ppp/options.pppox* files.

You could of course put the information from /etc/ppp/options in the
/etc/ppp/options.pppox* files instead, but then if you may have to change
something, you'd have to change both files. It's just a matter of
convenience. /etc/ppp/options is read for all connections, and the values
given in /etc/ppp/options.pppox* override those from the general options
file.

Don't forget to add both accounts to /etc/ppp/pap-secrets:
#/etc/ppp/pap-secrets
#
#login@hostname * password
"b1xxxxxx@sympatico.ca" * "yourpasswordhere"
"login@otherdomain.ca" * "yourotherpasswordhere"

# ---<End of File>---


4) Adapt /etc/ppp/if-up
Since you can only have one default route, you have to setup /etc/ppp/if-up
to set the routes to the other accounts manually. The safest way is to check
$2, which is one of the /dev/pppox* devices. This is the file I use:
#!/bin/bash
export INTERFACE=$1;
export TTYDEVICE=$2;
export SPEED=$3;
export LOCALIP=$4;
export REMOTEIP=$5;
export IPPARAM=$6;

if [ "$TTYDEVICE" = "/dev/pppox0" ]; then
#Sympatico

#Update the dynamic DNS information
/root/bin/jlclient.pl;

elif [ "$TTYDEVICE" = "/dev/pppox1" ]; then
#Not Sympatico

#add a route to the other network
/sbin/route add -net othernetwork/prefix dev $INTERFACE;
fi

# ---<End of File>---

Enter the network and prefix corresponding to that connection, for example
"129.100.0.0/16".

There is no need to change /etc/ppp/ip-down to remove the extra routing
information, those will automatically be removed when the interface goes
down.


5) Run the pppoed programs

You need to tell pppoed which of the /dev/pppox devices it is supposed to
use. To run two pppd processes, using /etc/ppp/options and
/etc/ppp/options.pppox*, do this:

pppoed -L 0 # run pppd for the first account, through /dev/pppox0
pppoed -L 1 # run pppd for the second account, through /dev/pppox1

If your ADSL modem is not connected to eth0, give the appropriate -I option,
for example
pppoed -I eth1 -L 0 # run pppd for the first account, ADSL modem connected
to eth1

If you need any of the other options just add them too.

You may have to wait a short time between starting several pppoed programs,
to make sure one discovery is complete before the next one is started. A few
seconds should be enough.


6) Test it

- see if your interfaces are up and running
"ifconfig ppp0"
"ifconfig ppp1"
Look if the inet addr's are correct, and that the interface is UP and
RUNNING.

If something went wrong, look in /var/log/messages, possibly after turning
on debugging for that interface. Note that there is not necessarily a
connection between the ppp* and /dev/pppox* device, i.e. /dev/pppox0 could
be connected to ppp1. pppd will use the first available ppp interface,
independently of the pppox device used for the connection. To check the
actual connection look in /var/log/messages or log the parameters given to
/etc/ppp/ip-up somewhere.

- see if your routes are correct
"route" (or "route -n" if DNS doesn't work)

You should see two entries for each ppp device, one being the immediate
partner at the other end, and one being the network route. If you configured
it that way, one will be the default route.

If everything is OK, Linux will use your Sympatico IP to connect to the
world, or the other IP to connect to that subnet.


7) Doesn't work?

If something doesn't work, here are a few things to try:
- run only one pppoed and see if it works
- turn on the "debug" option for pppd, and check the log files for errors
- check all options file and the ip-up script for typos
- make sure you compiled the kernel, and are running the right kernel with
the patches


8) It works?

Well then, have fun!
