Configuring selective dynamic load balancing

To configure a selective load balancing policy, specify the match conditions for ingress traffic and the action that indicates whether the traffic should be subject to static or dynamic ECMP load balancing, then apply the policy in the network-instance. You can optionally configure the default system load-balancing behavior that applies to traffic on DLB-enabled interfaces that is not subject to selective load balancing policies.

You can use the info from state command to display statistics for a selective load balancing policy.

Configure a selective load balancing policy

The following example configures a selective dynamic load balancing policy. Traffic matching the policy uses static ECMP load-balancing, not dynamic.

--{ + candidate shared default }--[  ]--
# info with-context network-instance default policy-forwarding
    network-instance default {
        policy-forwarding {
            policy slb1 {
                type selective-load-balancing
                rule 101 {
                    action {
                        load-balance static
                    }
                    match {
                        rdma-opcode 100
                        ipv4 {
                            protocol udp
                            destination-ip {
                                prefix 10.10.10.0/24
                            }
                        }
                        transport {
                            destination-port https
                        }
                    }
                }
            }
        }
    }

Apply the selective dynamic load balancing policy

A selective DLB policy is applied globally on a network-instance, meaning it applies to all subinterfaces within the network-instance in which it is configured. The following example applies a selective DLB policy in a network-instance.

--{ + candidate shared default }--[  ]--
# info with-context network-instance default policy-forwarding global-selective-load-balancing-policy
    network-instance default {
        policy-forwarding {
            global-selective-load-balancing-policy slb1
        }
    }

Configure the default system load-balancing behavior

For traffic matching DLB-enabled prefixes that does not match a selective DLB policy, you can configure the default DLB behavior to be either static or dynamic. The static setting causes traffic matching DLB-enabled prefixes to not use dynamic load balancing for ECMP distribution of packets over outgoing links, while the dynamic setting causes the traffic to use dynamic load balancing; the default is dynamic.

The following example configures the default system load-balancing behavior to be static, so traffic matching DLB-enabled prefixes does not use dynamic load balancing.

--{ +* candidate shared default }--[  ]--
# info with-context system load-balancing
    system {
        load-balancing {
            dynamic {
                default-load-balancing static
            }
        }
    }

Display TCAM resources used by selective DLB policies

Before a selective DLB policy is applied, the reserved and programmed statistics are both 0, and free-static statistic is 254. After a 1-rule policy is applied, the resources are adjusted as shown in the following example:

--{ running }--[  ]--
# info from state platform linecard 1 forwarding-complex 0 tcam resource policy-forwarding-selective-load-balancing
    free-static 252
    reserved 2
    programmed 2

The reserved statistic is the number of TCAM entries allocated to applied selective DLB policies, programmed is how many TCAM entries are installed in hardware, and free-static is the number of remaining TCAM entries.

Display TCAM entries per selective DLB policy rule

The following example displays the number of TCAM entries used by a specific rule in a selective DLB policy.

--{ running }--[  ]--
# info from state network-instance default policy-forwarding policy p1 rule 10
    tcam-entries {
        forwarding-complex "(0,0)" {
            tcam-entries 1
        }
        forwarding-complex "(1,0)" {
            tcam-entries 1
        }
    }

The tcam-entries statistic shows a rule's footprint on each forwarding complex.

Display matched packets and octets per selective DLB rule

The following example displays a count of the matched-packets and matched-octets that matched a specific selective DLB rule.

--{ running }--[  ]--
# info from state network-instance default policy-forwarding policy p1 rule 10 statistics
    matched-packets 9427143
    matched-octets 9389434428