Hi, is this policy enough to LB based on source ports whether TCP/UDP if the source IP address is the same i.e 192.168.0.2 with traffic coming only from a single LAN port?
I would of course enable the LB thereafter, I’m just wanting to know the OS behaviour since I have this configuration/design.
Load-balancing and failover serve distinct purposes and cannot be enabled at the same time. If you seek basic load-balancing to distribute connections across multiple WAN interfaces, typically, no additional policies need to be configured, and the default settings should suffice. However, if you require load-balancing or failover based on specific port numbers, you can create additional rules and policies, where you can specify the protocol (e.g., TCP, UDP, etc) and port number in your configuration. When network traffic aligns with this rule, it will follow the policy you’ve associated with it.
For example, if you create a failover policy where ‘Mob1s1a1’ is the primary interface and ‘Wired WAN’ is the backup, and you apply this policy to a rule, the matched traffic will use the ‘Mob1s1a1’ interface when it’s up and switch to wired WAN if the mobile connection is down. A similar principle applies to load-balancing. If you’ve set up a load-balancing policy with two interfaces, traffic that matches this rule will be distributed between these two interfaces.
For better understanding, I would suggest checking the wiki page here.
Additional information about failover and load-balancing is available here.
Can someone technical answer the actual question?
Could you please clarify with what exactly are you having difficulties?
The load balancing operates on a per-connection basis. For instance, if your PC establishes multiple TCP connections to various web servers, these connections will be balanced across the WAN interfaces defined in your load balancing setup. However, if you’re, let’s say, downloading a file from a server using a single connection, this connection won’t be load balanced, and its speed will be limited by the speed available on the corresponding WAN interface.
The rule you’ve shared shows a default failover rule rather than load balancing. Additionally, it’s configured to apply to all protocols, meaning it will apply to all types of traffic, including TCP, UDP, ICMP, and so on, for failover.
As previously mentioned, by default, all traffic is load balanced according to the interfaces you’ve set up in your load balancing configuration. So if you have enable load-balancing and selected two WAN interfaces, the connections from your PC will be balanced over those interfaces.
If you want to load-balance based on port numbers on Source/Destination IP addresses, then you need to create rules for those port numbers / IP addresses. Each rule needs to have a policy attached, i.e. what interfaces to use for load-balacing. To simply load-balace all traffic, no such rules are needed. You simply select load-balancing and turn on the interfaces that you want to use for load-balancing.
That makes sense I just wanted to ensure if traffic comes from the same source IP that connections are still distributed across both WANs (mobile and wired)
This is the current config
I will enable them once my wired service is brought up of course, does it look correct?
Also, how does the ratio work like 3 would be 60% and 2 would be 40% what’s the calc for 70/30 or 80/20?
I just want to make sure it’s correct.
also, what’s the default behaviour if my wired service is brought up i.e mobile first then wired? when I’ve not enabled the load-balancing yet…how does the routing priority work when you have two default routes 0/0 in the route table
Yes, you can define the ratios in the following manner: For a 70/30 split, use the format 7-3, and for an 80/20 split, use 4-1. If you wish to balance between mobile and wired WAN connections, simply enable “mob1s1a1” and “WAN” for load balancing.
The decision regarding which interface to use for each connection is managed by the internal logic of the failover package, “mwan3”. If you’re interested in understanding the inner workings of this package, you can find detailed information on the openwrt webpage here. This package doesn’t rely on the ‘default routes’ like routing does in simple networks; instead, it employs its own internal logic and algorithms to choose the interface for the connection. However, it aims to distribute connections based on the ratios you’ve specified. So, if you’ve configured a 60/40 split, in practice, it may occasionally vary slightly, resulting in ratios like 58/42 at times.
Thanks, when the wired service comes up does it become live automatically what’s the order if the mob1s1a1 is already in use - i don’t get this part
For the load-balancing, the order does not really matter. The mwan3 service monitors the status of each interface by regularly sending ping requests to assess their internet connectivity. When an interface successfully responds to the pings, the service recognizes it as “UP” and includes it in the load-balancing process. If, on the other hand, the interface fails to respond to the pings, it’s marked as “down,” and the service excludes it from load-balancing.
Even when an interface is labeled as “down,” the mwan3 service continues to periodically send ping requests from it. This is to check if the connection via that interface is re-established. If the connection is re-established and the interface becomes responsive, the device will starts using it for load-balancing again. You can change the interval between pings, as well as ping hosts used to check the connectivity and how many pings need to fail for the interface to be considered down.
Thanks all good info but my question is related to if there is no failover or no load balancing configured, then how the route tables select the mobile or wired (pppoe metric 1) service for the 0/0?
If you refer to the order of the interface in Network → WAN (not failover/load-balancing), then, the interface listed at the top holds the lowest metric and, as a result, takes priority. As you move down the list, the metrics increment. Therefore, the interface at the bottom of the list will have the highest metric, so it will not be used as a default route because it has a higher metric, unless other interfaces are unavailable.
The metric can be confirmed by editing a specific interface and navigating to advanced settings, where you can see the metric. On the same page, the default gateway specifies that this interface can be used as a default route for internet access.
So if you want to used pppoe WAN as your main connection, make sure to drag WAN interface to the top of the list in Network → WAN.
Thanks for all the detailed replies!
This topic was automatically closed after 15 days. New replies are no longer allowed.