Skip to main content

User Manual

Using multiple WAN connections in load balancing mode (configuring from the CLI)

Important

This article shows how to configure routers with KeeneticOS 2.14 - 3.8. Starting with KeeneticOS 3.9, Intelligent Balancing mode has been implemented and a new Multipathing policy has been added to the web interface to optimise the use of multiple Internet connections, speeding up and balancing traffic. For information on how to configure via the web interface, please refer to the 'Multipathing (summing the bandwidth of multiple Internet connections)' article.

Keenetic routers can use multiple WAN connections simultaneously in balancing mode. Any WAN interface — wired, modem, DSL, WISP, PPPoE, etc. — can participate in balancing.

Note

Balancing will be most effective for multithreaded traffic (point-to-multipoint or one-to-many connections), such as torrent traffic, P2P or other protocols that open multiple connections that do not require saving the source address. In this case, the connections will be distributed over different links.

Balancing will not work correctly for point-to-point or one-to-one connections because most hosts will drop packets from the same session if they come from different IP addresses. For example, an HTTPS-enabled website or web service that opens multiple sessions might not work because if some sessions are routed to different ISPs, it will trigger security and errors for the HTTPS protocol.

Below, as an example, we will enable balancing mode for BitTorrent protocol (it is easier to demonstrate the operation of this mode for multithreaded traffic). This method is relevant for models that do not have multipath configuration via the web interface.

  1. First you need to set up a separate 'Internet connection policy' in the web interface. On the 'Connection priorities' page, on the 'Internet connection policies' tab, you need to click '+ Add policy' and specify the name of the new policy, for example, torrent-multipath. Here policy is a set of rules and routing policies applied to hosts' traffic when they access the Internet.

    Important

    Balancing mode does not work in the default policy, only in additional policies.

    In the right column 'Connection' you need to tick the Internet connections (which will be used in the torrent-multipath profile) and save the settings. In our example these will be Backup connection and Main connection.

  2. Here, on the 'Connection priorities' page, click on the 'Policy bindings' tab. The 'Show all objects' option lets you display all devices registered in the local segments and the local network segments configured on the router.

    By holding down the Ctrl key on your keyboard with the mouse, you can select multiple devices at once. Move the desired host(s) to the created torrent-multipath profile.

  3. Prioritizing the Main and Backup connections.

    Important

    The load ratio is determined by the priority value of the ip global interfaces within the connection policy. The priority of the Backup connection must be lower by one than the priority of the Main connection. In our example, priorities 65533 and 65532 are used.

    To make the balancing work, you will need to set the ip global value for Main and Backup via the router's command-line interface (CLI). In our example, the GigabitEthernet0/Vlan4 interface is used for the Backup connection (priority 65533) and the ISP interface is used for the Main connection (priority 65532):

    (config)> interface GigabitEthernet0/Vlan4
    Core::Configurator: Done.
    (config-if)> ip global 65533
    Network::Interface::Ip: "GigabitEthernet0/Vlan4": global priority is 65533.
    (config-if)> exit
    Core::Configurator: Done.
    (config)> system configuration save 
    Core::ConfigurationSaver: Saving configuration.

    GigabitEthernet0/Vlan4 interface for 1 Gbit/s or FastEthernet0/Vlan14 interface for 100 Mbit/s.

    (config)> interface ISP
    Core::Configurator: Done.
    (config-if)> ip global 65532
    Network::Interface::Ip: "ISP": global priority is 65532.
    (config-if)> exit
    Core::Configurator: Done.
    (config)> system configuration save 
    Core::ConfigurationSaver: Saving configuration.
  4. Enable balancing mode for the torrent-multipath policy:

    (config)> ip policy Policy5
    Network::PolicyTable: Policy "Policy5" exists.
    (config-policy)> multipath
    Network::PolicyTable: "Policy5": enable multipath.
    (config-policy)> exit
    Core::Configurator: Done.
    (config)> system configuration save
    Core::ConfigurationSaver: Saving configuration.

    In our example, the torrent-multipath alias corresponds to the policy's name of the Policy5:

    (config)> show ip policy
    
    policy, name = Policy5, description = torrent-multipath: 
    mark: ffffd05
    table: 47
  5. Here, in the command-line interface, check the routing table.

    The numbering of the Internet connection policies (ip policy PolicyX) starts at 42.

    In our example, the ip policy Policy5 is numbered 47:

    (config)> show ip route table 47
    ================================================================================
    Destination          Gateway           Interface                         Metric 
    ================================================================================
    0.0.0.0/0            192.168.209.1     GigabitEthernet0/Vlan4            253      
    0.0.0.0/0            193.0.174.1       ISP                               253 
    10.1.30.0/24         0.0.0.0           Guest                             0
    151.236.14.119/32    192.168.209.1     GigabitEthernet0/Vlan4            0
    172.16.82.0/24       0.0.0.0           Wireguard2                        0
    192.168.3.0/24       0.0.0.0           Bridge2                           0
    192.168.22.0/24      0.0.0.0           Home                              0
    192.168.209.0/24     0.0.0.0           GigabitEthernet0/Vlan4            0
    193.0.174.0/24       0.0.0.0           ISP                               0
    193.0.175.0/25       193.0.174.10      ISP                               0
    193.0.175.22/32      193.0.174.1       ISP                               0
    193.187.91.26/32     192.168.209.1     GigabitEthernet0/Vlan4            0
    194.32.146.82/32     192.168.209.1     GigabitEthernet0/Vlan4            0

    After enabling balancing mode, a default route is added within the Additional policy for the interfaces added to this policy. In other words, if two ISP interfaces are in the table, it means that multipath works.

  6. Check the Download speed on connected interfaces in the web interface on the System Dashboard.

    Channel rate of Main connection and Backup connection up to 100 Mbit/s = 12.5 Mbytes/s.

    Start downloading the file and in the torrent client we see that the download speed is summed up from two Internet channels. In our example we get the speed up to 179.2 Mbit/s = 22.4 Mbytes/s. The download speed is summed from two profiles.

    multipath-torrent-downloading.png

    To disable balancing mode, you will need to run the following commands via the router's CLI:

    (config)> ip policy Policy5
    Network::PolicyTable: Policy "Policy5" exists.
    (config-policy)> no multipath
    Network::PolicyTable: "Policy5": enable multipath.
    (config-policy)> exit
    Core::Configurator: Done.
    (config)> system configuration save
    Core::ConfigurationSaver: Saving configuration...

Tip

If you have 100 Mbit/s and 200 Mbit/s Internet channels, you need to set the first Internet connection to ip global value 10000 and the second Internet connection to ip global value 20000. Then the balancing will work in the ratio of 1:2, and the total speed will increase up to 300 Mbit/s.

Note

The balancing mode also works for the Download Station built into KeeneticOS. You can assign a connection policy for the BitTorrent client with the command torrent policy <connection_policy>