Ake's corner

How to setup a bonding VPN connection in Linux [explained]

Well, as I said I'm going to add here some tech oriented articles, so the first one will «partly» discover some omitted parts of this guide

That guide describes how to setup a bonding VPN connection in Linux and it seems to be easy step-by-step instruction, but paragraphs appearing after «here comes the tricky part» are mostly confusing, there is some script which refers another and it gives a little about how was it intended to work.

I suppose you're clever enough to perform previous operations of that manual, so let's start from part where script is introduced. If you're using USB modems you'll probably use wvdial, so after successful connection (this actions also can be tricky enough, but I won't describe it here) you get a /dev/pppN interface. I'll follow logic of original script therefore I'll rename interfaces same way into wwanN (with corresponding 10N routing table). Next, you should execute this bunch of commands for each of interfaces.

# ifconfig [your pppN interface] down
# ip link set [your pppN interface] name [you new wwanN name]
# ifconfig [your new wwanN name] up
# route del default [your new wwanN name]

Then you need to get gateway address for interface - it'll be shown in ifconfig -a as remote addr:

# ip route add default via [that remote/gateway address] dev [your wwanN name] table 10[N] metric 100
# route add default gw [that remote/gateway address] dev [your wwanN name]
.. after starting vtrunkd ..
# route add default gw dev tun1

Also you may execute these commands once without infinite loop if you aren't going to hot-plug modems.