diff options
Diffstat (limited to 'docs/load-balancing.rst')
-rw-r--r-- | docs/load-balancing.rst | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/docs/load-balancing.rst b/docs/load-balancing.rst index fe0084bf..abf399ea 100644 --- a/docs/load-balancing.rst +++ b/docs/load-balancing.rst @@ -15,7 +15,7 @@ In a minimal, configuration the following must be provided: lets assume we have two dhcp WAN interfaces and one LAN (eth2) -.. code-block:: sh +.. code-block:: console set load-balancing wan interface-health eth0 nexthop 'dhcp' set load-balancing wan interface-health eth1 nexthop 'dhcp' @@ -32,7 +32,7 @@ If a packet doesn't match any rule it is sent by using the system routing table. Create a load balancing rule, rule can be a number between 1 and 9999: -.. code-block:: sh +.. code-block:: console vyos@vyos# set load-balancing wan rule 1 Possible completions: @@ -53,7 +53,7 @@ Interface weight Let's expand the example from above and add a weight to the interfaces. The bandwidth from eth0 is larger than eth1. Per default outbound traffic is distributed randomly across available interfaces. Weights can be assigned to interfaces to influence the balancing. -.. code-block:: sh +.. code-block:: console set load-balancing wan rule 1 interface eth0 weight 2 set load-balancing wan rule 1 interface eth1 weight 1 @@ -66,7 +66,7 @@ Rate limit A packet rate limit can be set for a rule to apply the rule to traffic above or below a specified threshold. To configure the rate limiting use: -.. code-block:: sh +.. code-block:: console set load-balancing wan rule <rule> limit <parameter> @@ -85,7 +85,7 @@ This has the advantage that packets always arrive in order if links with differe Packet-based balancing can lead to a better balance across interfaces when out of order packets are no issue. Per-packet-based balancing can be set for a balancing rule with: -.. code-block:: sh +.. code-block:: console set load-balancing wan rule <rule> per-packet-balancing @@ -94,7 +94,7 @@ Exclude traffic To exclude traffic from load balancing, traffic matching an exclude rule is not balanced but routed through the system routing table instead: -.. code-block:: sh +.. code-block:: console set load-balancing wan rule <rule> exclude @@ -105,7 +105,7 @@ Health checks The health of interfaces and paths assigned to the load balancer is periodically checked by sending ICMP packets (ping) to remote destinations, a TTL test or the execution of a user defined script. If an interface fails the health check it is removed from the load balancer's pool of interfaces. To enable health checking for an interface: -.. code-block:: sh +.. code-block:: console vyos@vyos# set load-balancing wan interface-health <interface> Possible completions: @@ -116,14 +116,14 @@ If an interface fails the health check it is removed from the load balancer's po Specify nexthop on the path to destination, ``ipv4-address`` can be set to ``dhcp`` -.. code-block:: sh +.. code-block:: console set load-balancing wan interface-health <interface> nexthop <ipv4-address> Set the number of health check failures before an interface is marked as unavailable, range for number is 1 to 10, default 1. Or set the number of successful health checks before an interface is added back to the interface pool, range for number is 1 to 10, default 1. -.. code-block:: sh +.. code-block:: console set load-balancing wan interface-health <interface> failure-count <number> set load-balancing wan interface-health <interface> success-count <number> @@ -131,7 +131,7 @@ Or set the number of successful health checks before an interface is added back Each health check is configured in its own test, tests are numbered and processed in numeric order. For multi target health checking multiple tests can be defined: -.. code-block:: sh +.. code-block:: console vyos@vyos# set load-balancing wan interface-health eth1 test 0 Possible completions: @@ -153,7 +153,7 @@ Source NAT rules Per default, interfaces used in a load balancing pool replace the source IP of each outgoing packet with its own address to ensure that replies arrive on the same interface. This works through automatically generated source NAT (SNAT) rules, these rules are only applied to balanced traffic. In cases where this behaviour is not desired, the automatic generation of SNAT rules can be disabled: -.. code-block:: sh +.. code-block:: console set load-balancing wan disable-source-nat @@ -163,7 +163,7 @@ Sticky Connections Upon reception of an incoming packet, when a response is sent, it might be desired to ensure that it leaves from the same interface as the inbound one. This can be achieved by enabling sticky connections in the load balancing: -.. code-block:: sh +.. code-block:: console set load-balancing wan sticky-connections inbound @@ -176,13 +176,13 @@ The primary interface is selected based on its weight and health, others become Secondary interfaces to take over a failed primary interface are chosen from the load balancer's interface pool, depending on their weight and health. Interface roles can also be selected based on rule order by including interfaces in balancing rules and ordering those rules accordingly. To put the load balancer in failover mode, create a failover rule: -.. code-block:: sh +.. code-block:: console set load-balancing wan rule <number> failover Because existing sessions do not automatically fail over to a new path, the session table can be flushed on each connection state change: -.. code-block:: sh +.. code-block:: console set load-balancing wan flush-connections @@ -195,7 +195,7 @@ Script execution A script can be run when an interface state change occurs. Scripts are run from /config/scripts, for a different location specify the full path: -.. code-block:: sh +.. code-block:: console set load-balancing wan hook script-name @@ -219,7 +219,7 @@ A character at the start of each line depicts the state of the test * ``-`` failed * a blank indicates that no test has been carried out -.. code-block:: sh +.. code-block:: console vyos@vyos:~$ show wan-load-balance Interface: eth0 @@ -240,7 +240,7 @@ A character at the start of each line depicts the state of the test Show connection data of load balanced traffic: -.. code-block:: sh +.. code-block:: console vyos@vyos:~$ show wan-load-balance connection conntrack v1.4.2 (conntrack-tools): 3 flow entries have been shown. @@ -252,6 +252,6 @@ Show connection data of load balanced traffic: Restart ******* -.. code-block:: sh +.. code-block:: console restart wan-load-balance |