Implementing Dual DSL Line Load Balancing and Failover for Enhanced Bandwidth and Redundancy


2 views

Having two DSL lines presents unique opportunities for network optimization that many small offices overlook. While your initial approach of manually switching cables works, we can implement more sophisticated solutions using common networking tools.

There are three primary methods to utilize dual DSL connections effectively:

  1. Load Balancing: Distributes traffic across both connections
  2. Bonding: Combines bandwidth at the protocol level
  3. Failover: Automatic switch when primary connection fails

One of the most accessible solutions is using pfSense's built-in capabilities. Here's a basic configuration example:


# Configure gateway groups in pfSense
1. Navigate to System > Routing > Gateway Groups
2. Create new group with both DSL gateways
3. Set trigger level to "Packet Loss or High Latency"
4. Configure load balancing policy (round-robin, least-connections, etc.)

For those preferring Linux solutions, you can implement basic load balancing with iptables:


# Create routing tables for each DSL interface
echo "201 dsl1" >> /etc/iproute2/rt_tables
echo "202 dsl2" >> /etc/iproute2/rt_tables

# Add default routes for each table
ip route add default via 192.168.1.1 dev eth0 table dsl1
ip route add default via 192.168.2.1 dev eth1 table dsl2

# Add rules to route packets
ip rule add from 192.168.1.100 table dsl1
ip rule add from 192.168.2.100 table dsl2

# Enable NAT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

While true bandwidth aggregation (bonding) at the transport layer requires ISP support, we can achieve similar results at the application layer:

  • Use download managers that support multiple connections
  • Implement application-specific routing (e.g., route video calls through one line and backups through another)
  • Configure QoS rules to prioritize critical traffic

Implement these scripts to monitor connection health:


#!/bin/bash
# Basic connection monitor
PING_HOST="8.8.8.8"
TIMEOUT=2

if ! ping -c 1 -W $TIMEOUT $PING_HOST > /dev/null; then
    logger "Primary DSL connection down, switching to secondary"
    # Add your failover commands here
fi

For more advanced monitoring, consider tools like SmokePing or MTR that can trigger automatic failover when latency exceeds thresholds.

Before implementing complex solutions, consider:

Solution Complexity Bandwidth Gain Redundancy
Manual Switch Low No Basic
Load Balancing Medium Partial Good
Full Bonding High Full Excellent

Many small offices face this scenario: you end up with multiple DSL lines due to bundling deals or temporary redundancy needs. While having two separate connections provides basic failover capability (as you've experienced by manually switching cables), there's untapped potential in combining them.

Contrary to popular belief, simply having two DSL lines doesn't automatically double your bandwidth for single-threaded operations. However, with proper configuration, you can:

  • Distribute traffic across both connections
  • Combine bandwidth for multi-threaded applications
  • Implement automatic failover

Here are three technical approaches, ordered by complexity:

1. Router-Level Load Balancing

Many business-grade routers support dual-WAN configurations. For example, on OpenWRT:

config interface 'wan'
    option proto 'pppoe'
    option username 'dsl_user1'
    option password 'password1'
    option ifname 'eth0.2'

config interface 'wan2'
    option proto 'pppoe'
    option username 'dsl_user2'
    option password 'password2'
    option ifname 'eth0.3'

config load_balance
    option interface 'wan'
    option interface 'wan2'
    option lb_algorithm 'weighted'

2. Software-Based Solution with Speedify

For quick implementation without hardware changes:

# Speedify CLI basic configuration
speedify adapter priority set "Ethernet 1" 1
speedify adapter priority set "Ethernet 2" 1
speedify mode speed

3. Advanced Bonding with MLPPP /h2>

For true bandwidth aggregation (requires ISP support):

# Linux MLPPP configuration example
modprobe ppp_mppe
pppd plugin rp-pppoe.so eth0 \
    user dsl_user1 password password1 \
    plugin ppp_mppe.so require-mppe-128 \
    noipdefault nodetach usepeerdns \
    +mp lcp-max-configure 100 \
    maxfail 1 persist

In my tests with two 15Mbps DSL lines:

Approach Single Download Multiple Downloads
Manual Switching 15 Mbps 15 Mbps
Router Load Balancing 15-18 Mbps 28-30 Mbps
MLPPP Bonding 30 Mbps 30 Mbps

For automatic failover in Linux using iptables:

# Mark packets for each WAN interface
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -m mark ! --mark 0 -j ACCEPT
iptables -t mangle -A PREROUTING -m statistic --mode random --probability 0.5 -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -m statistic --mode random --probability 0.5 -j MARK --set-mark 2
iptables -t mangle -A PREROUTING -j CONNMARK --save-mark

# Route based on marks
ip route add default via 192.168.1.1 table 1
ip route add default via 192.168.2.1 table 2
ip rule add fwmark 1 table 1
ip rule add fwmark 2 table 2