Dual-path routing with Quagga
Well, I guess it took me long enough, but as promised, how I setup dual-path routing with Quagga. But first, thanks and credit to Colin and Jonathan for helping me out with this on IRC; as they had done similar work before, it was a lot easier than blazing the trail myself.
So, what the heck am I talking about? Let’s start off with a little background for those of you unfamiliar with the state of ADSL internet access in South Africa. Aside from the costs paid to the local telecommunications monopoly for the physical service provision, there is also an ISP charge for actually getting onto the internet, which includes charging for bandwidth usage (throughput). Exact pricing varies slightly between ISPs, but is mostly the same across the board, so I’ll quote prices from the ISP I use. To cut a long story short, I pay about R70 (US$9.46) per GB of international transfer (in both directions), but I can get local-only connectivity at a much cheaper rate of around R4.33 (US$0.59) per GB. This clearly makes it economically advantageous to do local transfers over a local-only account.
So, how to do it? My internet gateway, elvandar, is naturally running Debian GNU/Linux, so this can easily be setup. Please note that the following instructions are primarily designed for a Debian system, and your mileage may vary with other distributions.
Configure your PPP connections appropriately.
Make a copy of your existing
/etc/peers/$PROVIDERfile for the second PPP connection; you will want to change the
usernamesetting in the new file, and also remove the
defaultroutesetting, so that the default route will always point at the first PPP connection.. Next, add a
unit 0setting to the first file, and a unit
unit 1setting to the second (assuming you don’t already have these or similar); this ensures that the
ppp1devices (respectively) will always be used, rather than the order of the connections coming up determining how devices are assigned.
For reference, my peer files are called
is, and I have the following stanzas in
/etc/network/interfacesto bring them up:
auto dsl iface dsl inet ppp provider saix auto dsl-is iface dsl-is inet ppp provider is
# aptitude install quagga
My configuration looks like the following:
hostname elvandar ### TENET # UCT-C1 ip route 22.214.171.124/19 ppp1 ### IS # ISNET-03 ip route 126.96.36.199/16 ppp1 ### Verizon # HC1-20050912 ip route 188.8.131.52/20 ppp1 # HETZNER-ZA ip route 184.108.40.206/22 ppp1 ip route 220.127.116.11/21 ppp1 ### Datapro # GIA-BLK6 ip route 18.104.22.168/19 ppp1
Initially I had plans to retrieve a list of local routes from public-route-server.is.co.za and use that, but I discovered that I was tweaking my routing a lot, so I decided to just stick with setting specific routes for hosts that I wanted them for.
Enable the Zebra daemon.
Make sure the configuration changes take effect.
# invoke-rc.d quagga force-reload
And there you have it. Zebra will automatically add the routes as the appropriate interface(s) come up, thus you don’t need to worry about the routes persisting across reconnections etc. (which is a good thing, since currently all ADSL connections are terminated after they have been active for 24 hours… argh!)