Mwan3 load balancing kernel commands

I am new to mwan3 and comparing it to a ClearOS solution. I am just above novice level with respect unix networking, but I have developed some scripts that tweak the load balancing in ClearOS. I generally understand the ip routing tables and ip rules created by mwan3. But I do not see any load balancing entries. In ClearOS the balancing is done via nexhop entries in an ip routing table that include the weights. Somethlng like: "nexthop via x.x.x.x dev eth1 weight 200"
I don't see such a table or entries in Openwrt as configured by mwan3.

I looked through the user guide and searched the forum, but I did not see this info.

  • Where is the load balancing managed in Openwrt/mwan3?
  • What OS level network commands or config files drive the load balancing (below mwan3 e.g. the equivalent of nexthop)

I don't need a tutorial - just the terminology/kewords or pointers to the relevant unix documentation.

Thanks much!

If you use weights, then you have failover not load balance.
mwan3 is implementing the load balancing in the iptables mangle

-A mwan3_policy_loadbal -m mark --mark 0x0/0x3f00 -m statistic --mode random --probability 0.50000000000 -m comment --comment "wifi 1 2" -j MARK --set-xmark 0x300/0x3f00
-A mwan3_policy_loadbal -m mark --mark 0x0/0x3f00 -m comment --comment "wwan 1 1" -j MARK --set-xmark 0x100/0x3f00

Thanks much! FYI - in the ClearOS case, the nexthop weights are load balancing. There appears to be more than one way to achieve load balancing in linux

I see, I must have misread your first post and confused metric with weight.
Indeed mwan3 uses the term weight, but only for the load balancing. If you have a policy with 2 members for example and the first member has metric 1 and the second metric 2, then only the first will be used regardless of the weight. Which is a failover scenario, the first member must be considered down to use the second member. If both members have the same metric, then weight is used to calculate the balancing ratio. If both members have metric 1 and weight 1, then it is 50-50%. If member 1 has metric 1 and weight 3 and member 2 has metric 1 and weight 1, then there will be load balancing 75-25%.

Thanks! So just clarify, if:

  • member1 has metric 1 and weight 1
  • member2 has metric 2 and weight 1
  • member3 has metric 2 and weight 3

then:

  • if member1, 2 and 3 are up, all traffic will go to member1
  • if member1 is down, traffic will be split between member2 @25% and member3 @75%.

correct?

Looks about right. I haven't seen before combination of failover with load balancing, but I don't see why it won't work.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.