Jump to content

This is the support site for Andrews & Arnold Ltd, a UK Internet provider. Information on these pages is generally for our customers but may be useful to others, enjoy!

Router - Linux upload bonding using policy routing: Difference between revisions

no edit summary
(Created page with "I'm using PPP on the Linux box - in my case via a Solos ADSL card, but this will also work using PPPoE. First, for convenience, name your extra routing tables by editing <tt>...")
 
No edit summary
<pre>
#!/bin/bash
# ip-up.d/set-routes
 
ip route replace default dev ${PPP_IFACE} table ${PPP_IFACE}
</pre>
 
<pre>
#!/bin/bash
# ipv6-up.d/set-routes
 
ip -6 route replace default dev ${PPP_IFACE} table ${PPP_IFACE}
</pre>
 
Add a script in <tt>/etc/ppp/ip-down.d</tt> and in <tt>/etc/ppp/ipv6-down.d</tt> to remove the per-interface routes when the PPP link goes down:
<pre>
#!/bin/bash
# ip-down.d/remove-routes
 
ip route flush table ${PPP_IFACE}
</pre>
 
<pre>
#!/bin/bash
# ipv6-down.d/remove-routes
 
ip -6 route flush table ${PPP_IFACE}
</pre>
 
 
Run the following script on boot:
</pre>
 
This uses iproute2's ip command to set up policy routing rules; the first set give you a firewall mark per line. (rules at prio 40000 and 40001). The last block (rules at 50000 and 50001) ensureserves thattwo even if you fail to set firewall marks for upstream line choice, your packets will still get out - it will just be non-optimal.purposes:
# It ensures that packets that are marked for routing via a dead line are passed onto the other line
# It provides a fallback if you forget to add firewall marks in PREROUTING for some packets.
 
Finally, apply firewall marks in PREROUTING to choose your load balancing policy. For example:
18

edits